DistilBERT โ€” multi-label content / policy classification

Fine-tuned distilbert-base-uncased predicting all applicable labels for a comment: toxic, severe_toxic, obscene, threat, insult, identity_hate.

Six independent sigmoid outputs trained with BCEWithLogitsLoss โ€” not softmax โ€” so any combination of labels can fire and the probabilities do not sum to 1.

Metrics (held-out test split, n=23,936)

Macro-F1: 0.6836 ยท micro-F1: 0.7875 ยท macro average precision: 0.7359

label threshold precision recall F1 AP support
toxic 0.55 0.847 0.832 0.839 0.921 2,295
severe_toxic 0.25 0.441 0.697 0.540 0.573 241
obscene 0.65 0.832 0.826 0.829 0.910 1,268
threat 0.20 0.456 0.662 0.540 0.538 71
insult 0.50 0.733 0.787 0.759 0.832 1,181
identity_hate 0.50 0.667 0.535 0.594 0.641 213

Why not accuracy

A model that predicts nothing scores 89.83% exact-match accuracy and 96.33% mean per-label accuracy on this data, at macro-F1 of exactly 0.0. Macro-F1 is the headline for that reason.

Thresholds

The per-label thresholds in the table were calibrated on the validation split and applied unchanged to test. thresholds_transformer.json in this repo holds them. Using them instead of a flat 0.5 is worth +0.021 macro-F1 with no retraining.

Limitations

  • Trained on 2018 English Wikipedia talk-page comments; other domains will degrade.
  • Rare labels are weak: F1 ~0.54 on threat and severe_toxic; identity_hate recall 0.535.
  • threat's threshold rests on only 72 validation positives, so it is a noisy estimate.
  • Inputs truncated at 256 tokens (~6.9% of training comments were longer).
  • A demo, not a moderation system. Do not make consequential decisions about people with it.

Code, full write-up, and a live demo: https://github.com/Srijan-Ratrey/Multilabel-content-classification

Downloads last month
44
Safetensors
Model size
67M params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support