Loading…
Loading…
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.
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 |
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.
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.
threat and severe_toxic; identity_hate recall 0.535.threat's threshold rests on only 72 validation positives, so it is a noisy estimate.Code, full write-up, and a live demo: https://github.com/Srijan-Ratrey/Multilabel-content-classification