alto-tfgbv-all
A multilingual binary TFGBV classifier for Arabic, Swahili, French fine-tuned on afro-xlmr-large-76L with a three-output sigmoid head (gendered_content, simple_hate, tfgbv); the TFGBV label is the third output ≥ 0.5.
Training data: Bench-train + ALTO-train combined, 10 epochs, three sigmoid heads trained jointly from
meedan/alto config all (export 20260924), using the unredacted
doxxing text for the items that are redacted in the public dataset.
Training
- Epochs: 10
- LR: 5e-06
- Batch: 32
- Max_length: 128
- Seed: 42
- 10% linear warmup
- class-weighted BCE per head (pos_weight = n_neg/n_pos of each label), head losses summed
- Training items: {"alto": 1693, "bench": 7512}
TFGBV-class F1 on the ALTO gold test split, per language, this checkpoint vs. the zero-shot baselines of the ALTO paper (same items, same labels):
| model | TFGBV F1 (ar, n=117) | TFGBV F1 (fr, n=180) | TFGBV F1 (sw, n=127) |
|---|---|---|---|
| AfroXLMR-L-76L (M) (this model) | 0.772 | 0.700 | 0.672 |
| OSS-SG-120B | 0.764 | 0.624 | 0.526 |
| OSS-SG-20B | 0.761 | 0.652 | 0.600 |
| LFTW | 0.710 | 0.589 | 0.463 |
| P-API | 0.745 | 0.600 | — |
P-API (Perspective) does not support Swahili.
Usage
The weights are a plain safetensors state dict for the MultiLabelClassifier module below (shared encoder, one
Linear(hidden, 3) head). The three sigmoid outputs are, in order, gendered_content, simple_hate and tfgbv;
the TFGBV label is tfgbv_prob >= 0.5 (the first two heads are auxiliary signals, not part of the decision).
import torch, torch.nn as nn
from huggingface_hub import hf_hub_download
from safetensors.torch import load_file
from transformers import AutoModel, AutoTokenizer
BASE, REPO = "Davlan/afro-xlmr-large-76L", "meedan/alto-tfgbv-xlmr-large-3L"
LABELS = ["gendered_content", "simple_hate", "tfgbv"]
class MultiLabelClassifier(nn.Module):
def __init__(self, model_id, n_labels=3):
super().__init__()
self.backbone = AutoModel.from_pretrained(model_id)
self.dropout = nn.Dropout(0.1)
self.head = nn.Linear(self.backbone.config.hidden_size, n_labels)
def forward(self, input_ids, attention_mask):
out = self.backbone(input_ids=input_ids, attention_mask=attention_mask)
pooled = out.pooler_output if getattr(out, "pooler_output", None) is not None else out.last_hidden_state[:, 0]
return self.head(self.dropout(pooled))
tok = AutoTokenizer.from_pretrained(BASE)
model = MultiLabelClassifier(BASE).eval()
model.load_state_dict(load_file(hf_hub_download(REPO, "model.safetensors")))
@torch.no_grad()
def predict(texts, max_length=128):
enc = tok(texts, truncation=True, padding="max_length", max_length=max_length, return_tensors="pt")
probs = torch.sigmoid(model(enc["input_ids"], enc["attention_mask"]))
return [dict(zip(LABELS, p.tolist())) | {"tfgbv_label": int(p[2] >= 0.5)} for p in probs]
Model tree for meedan/alto-tfgbv-xlmr-large-3L
Base model
Davlan/afro-xlmr-large-76L