CoolFace
Modelpublic

SimoneAstarita/october-finetuning-more-variables-sweep-20251012-200025-t05

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

october-finetuning-more-variables-sweep-20251012-200025-t05

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

Trial timestamp (UTC): 2025-10-12 20:00:25 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_SAMPLERTrue
R_DROPTrue
RKLALPHA1.0
TEXT_NORMALIZETrue

Dev set results (summary)

MetricValue
f1macrodev_0.50.675386567516525
f1weighteddev_0.50.8082213964091853
accuracydev0.50.7817371937639198
f1macrodevbestglobal0.7315184893784421
f1weighteddevbestglobal0.8708804774663164
accuracydevbest_global0.8730512249443207
f1macrodevbestby_lang0.7218964421599621
f1weighteddevbestby_lang0.8449980403391838
accuracydevbestbylang0.8285077951002228
default_threshold0.5
bestthresholdglobal0.8
thresholdsbylang{"en": 0.45000000000000007, "it": 0.45000000000000007, "es": 0.8}

Thresholds

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

Detailed evaluation

Classification report @ 0.5

text
              precision    recall  f1-score   support

 no-recl (0)     0.9470    0.7896    0.8612       385
    recl (1)     0.3672    0.7344    0.4896        64

    accuracy                         0.7817       449
   macro avg     0.6571    0.7620    0.6754       449
weighted avg     0.8644    0.7817    0.8082       449

Classification report @ best global threshold (t=0.80)

text
              precision    recall  f1-score   support

 no-recl (0)     0.9205    0.9325    0.9265       385
    recl (1)     0.5593    0.5156    0.5366        64

    accuracy                         0.8731       449
   macro avg     0.7399    0.7240    0.7315       449
weighted avg     0.8690    0.8731    0.8709       449

Classification report @ best per-language thresholds

text
              precision    recall  f1-score   support

 no-recl (0)     0.9503    0.8442    0.8941       385
    recl (1)     0.4393    0.7344    0.5497        64

    accuracy                         0.8285       449
   macro avg     0.6948    0.7893    0.7219       449
weighted avg     0.8774    0.8285    0.8450       449

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

langnaccf1_macrof1_weightedprec_macrorec_macroprec_weightedrec_weighted
en1540.77920.54920.81690.54810.60010.86960.7792
it1630.84660.79470.85870.76670.86830.89480.8466
es1320.86360.76310.87070.74090.79640.88200.8636

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/october-finetuning-more-variables-sweep-20251012-200025-t05"
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.