CoolFace
Modelpublic

SimoneAstarita/trilingual-no-bio-20251014-t01

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

trilingual-no-bio-20251014-t01

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:19:46 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
RKLALPHA1.0
TEXT_NORMALIZETrue

Dev set results (summary)

MetricValue
f1macrodev_0.50.6992930670966142
f1weighteddev_0.50.8352727836218509
accuracydev0.50.8195991091314031
f1macrodevbestglobal0.7380178377927815
f1weighteddevbestglobal0.8735890357147564
accuracydevbest_global0.8752783964365256
f1macrodevbestby_lang0.7174485125858123
f1weighteddevbestby_lang0.8573654650813146
accuracydevbestbylang0.8530066815144766
default_threshold0.5
bestthresholdglobal0.65
thresholdsbylang{"en": 0.45000000000000007, "it": 0.65, "es": 0.7000000000000001}

Thresholds

  • —Default: 0.5
  • —Best global: 0.65
  • —Best by language: { "en": 0.45000000000000007, "it": 0.65, "es": 0.7000000000000001 }

Detailed evaluation

Classification report @ 0.5

text
              precision    recall  f1-score   support

 no-recl (0)     0.9368    0.8468    0.8895       385
    recl (1)     0.4158    0.6562    0.5091        64

    accuracy                         0.8196       449
   macro avg     0.6763    0.7515    0.6993       449
weighted avg     0.8625    0.8196    0.8353       449

Classification report @ best global threshold (t=0.65)

text
              precision    recall  f1-score   support

 no-recl (0)     0.9229    0.9325    0.9276       385
    recl (1)     0.5667    0.5312    0.5484        64

    accuracy                         0.8753       449
   macro avg     0.7448    0.7319    0.7380       449
weighted avg     0.8721    0.8753    0.8736       449

Classification report @ best per-language thresholds

text
              precision    recall  f1-score   support

 no-recl (0)     0.9253    0.9013    0.9132       385
    recl (1)     0.4865    0.5625    0.5217        64

    accuracy                         0.8530       449
   macro avg     0.7059    0.7319    0.7174       449
weighted avg     0.8628    0.8530    0.8574       449

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

langnaccf1_macrof1_weightedprec_macrorec_macroprec_weightedrec_weighted
en1540.79870.52390.82450.52400.54090.85570.7987
it1630.90180.84070.90180.84070.84070.90180.9018
es1320.85610.71420.85450.71890.70980.85310.8561

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-t01"
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.