← selected work

Mill Screen: A System One Model for Toxicity

System One model for multilingual toxicity: one pass, six typed probabilities, 7 languages. Out-ranks Detoxify (AUC 0.992 vs 0.969).

2025 - Sep 2026Machine Learning Engineerwith Nauman Pathan
Mill Screen: A System One Model for Toxicity

Overview

Mill reads a comment once and returns six independent probabilities: toxic, severe toxic, obscene, threat, insult and identity hate. It covers English, Russian, Turkish, Spanish, French, Italian and Portuguese in one model. It is a System One model: a fast, single-pass decision you call as a function inside a moderation pipeline, not a chat model you prompt.

What comes out

Every label gets its own probability and its own decision threshold, tuned on the validation split. The labels do not compete, so one comment can carry several of them, or none.

Spanish

“Eres un completo idiota y nadie te quiere.”

Toxic
98.7 percent; threshold 47.2 percent; fires
Severe toxic
7.0 percent; threshold 47.2 percent; does not fire
Obscene
84.1 percent; threshold 52.8 percent; fires
Threat
2.7 percent; threshold 52.8 percent; does not fire
Insult
99.3 percent; threshold 56.4 percent; fires
Identity hate
5.0 percent; threshold 56.4 percent; does not fire
Probability, % · tick marks the threshold
A Spanish insult. Toxic, obscene and insult cross their thresholds.
English

“I know where you live and I will find you.”

Toxic
17.7 percent; threshold 47.2 percent; does not fire
Severe toxic
1.7 percent; threshold 47.2 percent; does not fire
Obscene
0.7 percent; threshold 52.8 percent; does not fire
Threat
58.8 percent; threshold 52.8 percent; fires
Insult
0.3 percent; threshold 56.4 percent; does not fire
Identity hate
2.5 percent; threshold 56.4 percent; does not fire
Probability, % · tick marks the threshold
An English threat with no insult or swearing fires threat alone.

How it works

XLM-RoBERTa-large (565M parameters) encodes the comment. One extra attention block on top adds a per-language bias to the attention scores, then a small head on the [CLS] position gives six logits, each through its own sigmoid.

Block diagram of Mill: tokenizer, the XLM-RoBERTa-large encoder with a frozen embedding and 24 trained layers, then a head where q, k and v projections give content scores, a language bias is added, and the CLS row goes through a classifier and six sigmoids
One forward pass. The red branch is the only place the language id enters.

It trained on a 360k-comment corpus derived from Jigsaw, with Mistral-7B generating extra examples for the rare threat and identity-hate labels, and a weighted focal loss to lift those classes.

Against public models

On its 35,658-comment held-out test split, Mill ranks toxic comments better than every public multilingual model, in every language. Each baseline was scored as published, on the same rows, on the one label they all share.

Accuracy and speed on the same test split
ModelRanking mistakes per 100 pairs · fewer is betterThroughput comments/s · higher is faster
Detoxify multilingual278M parametersMistakes / 100 pairs3.1AUC 0.969Comments / second2,424
textdetox XLM-R large560M parametersMistakes / 100 pairs6.7AUC 0.933Comments / second896
citizenlab mDistilBERT135M parametersMistakes / 100 pairs14.9AUC 0.851Comments / second3,700
Toxic label, all 7 languages, 35,658 held-out comments. Ranking mistakes = 100 × (1 − AUC). Speed measured on one Quadro RTX 6000, fp16, batch 64, max length 512, tokenisation included.

The margin is widest outside English (Russian: 0.992 against 0.922), and on English it ties Detoxify's original toxic-bert. The price is speed: Mill runs at 871 comments a second, 11.8 ms each, the same class as other XLM-R-large models and about a third of Detoxify's throughput.

Across all six labels on the same split: macro AUC 0.985, macro F1 0.88, exact match 88%.

Known bias

Short, benign sentences that name an identity group are over-flagged as toxic, a pattern inherited from training data where those terms appear mostly in abusive contexts. It is measured with templated probe sentences across all seven languages and disclosed on the model card, with a costed mitigation: roughly 600 counter-examples and one retrain.

Use it

The weights, thresholds and loading code are on Hugging Face.

import json, torch
from huggingface_hub import hf_hub_download
from transformers import AutoModel, AutoTokenizer
 
REPO = "Deeptanshuu/mill-screen"
LABELS = ["toxic", "severe_toxic", "obscene", "threat", "insult", "identity_hate"]
 
model = AutoModel.from_pretrained(REPO, trust_remote_code=True).eval()
tokenizer = AutoTokenizer.from_pretrained(REPO)
thresholds = json.load(open(hf_hub_download(REPO, "thresholds.json")))["thresholds"]
 
text = "Eres un completo idiota y nadie te quiere."
inputs = tokenizer(text, truncation=True, max_length=512, return_tensors="pt")
with torch.no_grad():
    probs = model(**inputs, lang_ids=torch.tensor([3]))["probabilities"][0]
 
for label, p in zip(LABELS, probs.tolist()):
    print(f"{label:14} {p:.2f}  {'yes' if p >= thresholds[label] else 'no'}")

Stack

ml
PyTorchTransformersXLM-RoBERTaMistral-7BONNX Runtime
frontend
StreamlitGradio
tooling
TensorBoarduvDocker
deployment
Hugging FaceCollege GPU Server