CoolFace
Modelpublic

SimoneAstarita/trilingual-no-bio-20251014-t04

sourceHugging Faceapache-2.0updated 1y agoView on Hugging Face
0likes5downloads
Model Card

trilingual-no-bio-20251014-t04

Slur reclamation binary classifier Task: LGBTQ+ reclamation vs non-reclamation use of harmful words on social media text.

Trial timestamp (UTC): 2025-10-14 08:42:49 Data case: en-es-it

Configuration (trial hyperparameters)

Model: Alibaba-NLP/gte-multilingual-base

HyperparameterValue
LANGUAGESen-es-it
LR1e-05
EPOCHS5
MAX_LENGTH256
USE_BIOFalse
USELANGTOKENFalse
GATED_BIOFalse
FOCAL_LOSSTrue
FOCAL_GAMMA1.5
USE_SAMPLERFalse
R_DROPTrue
RKLALPHA0.5
TEXT_NORMALIZETrue

Dev set results (summary)

MetricValue
f1macrodev_0.50.711233095102222
f1weighteddev_0.50.8500897540205824
accuracydev0.50.8418708240534521
f1macrodevbestglobal0.7368729488982654
f1weighteddevbestglobal0.879740048469433
accuracydevbest_global0.888641425389755
f1macrodevbestby_lang0.7063440156965337
f1weighteddevbestby_lang0.8512922401499736
accuracydevbestbylang0.8463251670378619
default_threshold0.5
bestthresholdglobal0.6
thresholdsbylang{"en": 0.4, "it": 0.6, "es": 0.55}

Thresholds

  • —Default: 0.5
  • —Best global: 0.6
  • —Best by language: { "en": 0.4, "it": 0.6, "es": 0.55 }

Detailed evaluation

Classification report @ 0.5

text
              precision    recall  f1-score   support

 no-recl (0)     0.9290    0.8831    0.9055       385
    recl (1)     0.4578    0.5938    0.5170        64

    accuracy                         0.8419       449
   macro avg     0.6934    0.7384    0.7112       449
weighted avg     0.8618    0.8419    0.8501       449

Classification report @ best global threshold (t=0.60)

text
              precision    recall  f1-score   support

 no-recl (0)     0.9136    0.9610    0.9367       385
    recl (1)     0.6591    0.4531    0.5370        64

    accuracy                         0.8886       449
   macro avg     0.7863    0.7071    0.7369       449
weighted avg     0.8773    0.8886    0.8797       449

Classification report @ best per-language thresholds

text
              precision    recall  f1-score   support

 no-recl (0)     0.9225    0.8961    0.9091       385
    recl (1)     0.4667    0.5469    0.5036        64

    accuracy                         0.8463       449
   macro avg     0.6946    0.7215    0.7063       449
weighted avg     0.8575    0.8463    0.8513       449

Per-language metrics (at best-by-lang)

langnaccf1_macrof1_weightedprec_macrorec_macroprec_weightedrec_weighted
en1540.79220.49670.81720.50150.50250.84600.7922
it1630.90800.83600.90330.87710.80740.90420.9080
es1320.83330.71990.84410.69850.75800.86170.8333

Data

  • —Train/Dev: private multilingual splits with ~15% stratified Dev (by (lang,label)).
  • —Source: merged EN/IT/ES data with bios retained (ignored if unused by model).

Usage

python
from transformers import AutoTokenizer, AutoModelForSequenceClassification, AutoConfig
import torch, numpy as np

repo = "SimoneAstarita/trilingual-no-bio-20251014-t04"
tok = AutoTokenizer.from_pretrained(repo)
cfg = AutoConfig.from_pretrained(repo)
model = AutoModelForSequenceClassification.from_pretrained(repo)

texts = ["example text ..."]
langs = ["en"]

mode = "best_global"  # or "0.5", "by_lang"

enc = tok(texts, truncation=True, padding=True, max_length=256, return_tensors="pt")
with torch.no_grad():
    logits = model(**enc).logits
probs = torch.softmax(logits, dim=-1)[:, 1].cpu().numpy()

if mode == "0.5":
    th = 0.5
    preds = (probs >= th).astype(int)
elif mode == "best_global":
    th = getattr(cfg, "best_threshold_global", 0.5)
    preds = (probs >= th).astype(int)
elif mode == "by_lang":
    th_by_lang = getattr(cfg, "thresholds_by_lang", {})
    preds = np.zeros_like(probs, dtype=int)
    for lg in np.unique(langs):
        t = th_by_lang.get(lg, getattr(cfg, "best_threshold_global", 0.5))
        preds[np.array(langs) == lg] = (probs[np.array(langs) == lg] >= t).astype(int)
print(list(zip(texts, preds, probs)))

Additional files

reports.json: all metrics (macro/weighted/accuracy) for @0.5, @bestglobal, and @bestbylang. config.json: stores thresholds: defaultthreshold, bestthresholdglobal, thresholdsbylang. postprocessing.json: duplicate threshold info for external tools.