CoolFace
Modelpublic

YesLab-KSU/folk-relevance-classifier

sourceHugging Facemitupdated 16d agoView on Hugging Face
0likes27downloads
Model Card

Folk Relevance Classifier (v7)

A seed-conditioned cross-encoder that classifies whether a passage is a folk description of a CHC (Cattell-Horn-Carroll) narrow cognitive ability — i.e., whether an ordinary person is naturally describing that ability in everyday language, without knowing the psychological term.


Model description

PropertyValue
Base modelmicrosoft/deberta-v3-base
ArchitectureCross-encoder (sequence classification)
Labelsoff_topic (0) · incidental_mention (1) · folk_description (2)
Input format[CLS] ability anchor [SEP] reddit passage [SEP]
Max length256 tokens

Training details

HyperparameterValue
Training examples7,519
Epochs8
Batch size16
Learning rate2e-5
Weight decay0.01
Warmup ratio0.1
Random seed42
HardwareNVIDIA RTX 3090
FrameworkPyTorch 2.4.1+cu121 · Transformers 4.42.3

Evaluation

MetricValue
Precision0.575
Recall0.450
F10.505
Threshold0.30

Usage

python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

model_id = "Jiho-YesNLP/folk-relevance-classifier"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSequenceClassification.from_pretrained(model_id)
model.eval()

def score(ability_name: str, seeds: list[str], passage: str,
          threshold: float = 0.30) -> dict:
    sep = tokenizer.sep_token or "[SEP]"
    anchor = f" {sep} ".join([ability_name, *seeds])
    inputs = tokenizer(anchor, passage,
                       return_tensors="pt", truncation=True, max_length=256)
    with torch.no_grad():
        probs = torch.softmax(model(**inputs).logits, dim=-1)[0]
    labels = model.config.id2label
    prob_folk = probs[max(labels, key=int)].item()
    return {
        "prob_folk": round(prob_folk, 4),
        "is_folk": prob_folk >= threshold,
        "probs": {labels[i]: round(probs[i].item(), 4) for i in range(len(probs))},
    }

# Example
result = score(
    ability_name="Induction",
    seeds=["finding patterns", "figuring out the rule", "spotting regularities"],
    passage="I'm really good at spotting patterns in data that others miss.",
)
print(result)
# {'prob_folk': 0.812, 'is_folk': True, 'probs': {...}}