โ† All models

text-classification ยท text ยท WASM ยท ~110 MB

toxic-bert โ€” score a comment for toxicity, privately

A BERT fine-tuned on the Jigsaw toxic-comment data. It reads any text and emits six independent toxicity signals โ€” toxic, severe toxic, obscene, threat, insult, identity hate โ€” each a 0โ€“100% probability. This is defensive content-safety tooling: set a threshold, and triage what to flag. Every score is computed on your device; no comment is ever sent to a server.

At a glance

ModelXenova/toxic-bert (ONNX of unitary/toxic-bert)
Task / pipelinetext-classification ยท multi-label (per-label sigmoid, not softmax)
Labelstoxic ยท severe_toxic ยท obscene ยท threat ยท insult ยท identity_hate
ArchitectureBERT-base (12-layer) fine-tuned on the Jigsaw Toxic Comment Classification corpus
Quantizationq8 (8-bit) ONNX
BackendWebAssembly (runs anywhere; no WebGPU needed)
Download~110 MB, cached after first load
LicenseApache-2.0
Web APIsWebAssembly, Web Workers โ€” all Baseline widely available

Run it

Type or paste a comment; it re-scores automatically a moment after you stop typing. The moderation threshold decides the verdict: if any label lands at or above it, the comment is flagged for review โ€” otherwise it's allowed. The samples below are deliberately hostile so you can see the classifier separate them from the benign one.

See inside โ€” six sigmoids, not one softmax

A sentiment model picks one winner with a softmax (the scores sum to 100%). Toxicity is multi-label: the model's final layer produces six raw logits, and each passes through its own sigmoid independently. So a single comment can be 0.99 toxic and 0.95 insult at once โ€” the columns below don't add up to anything in particular, and that's the point. The table shows each label's raw logit next to its sigmoid probability, so you can see exactly how the threshold turns numbers into a decision.

Score a comment to see the raw numbers.

Why it matters

Moderation is a scale problem: no team can read every comment, DM, or review. A fast, private, offline toxicity score is a first line of defence โ€” it runs the instant someone hits submit, without the text ever leaving the tab, and hands a human queue only what actually needs eyes.

Use cases

Basics

Score a single comment and read all six independent toxicity labels.

Practical

A moderation queue: paste many comments, set a threshold, auto-sort into flag / allow.

Wild

Edge cases โ€” sarcasm, reclaimed slurs, quoted abuse โ€” where the classifier's calibration shows its limits.

Multi-model

A toxicity gate in front of a sentiment model: only clean comments pass through to analysis.

How the API works

The convenience path is one call; because the model is multi-label, ask for every label with topk: null:

import { pipeline } from "@huggingface/transformers";

const classify = await pipeline("text-classification", "Xenova/toxic-bert");
const out = await classify("you are worthless", { topk: null });
// โ†’ [{ label: "toxic", score: 0.98 }, { label: "insult", score: 0.64 }, โ€ฆ]  (independent sigmoids)

This page goes one level deeper for "See inside": instead of the pipeline it runs the tokenizer then the model() in a single forward pass, reads the raw six-value logits tensor, and applies the sigmoid itself โ€” so it can show both the logit and the probability, and apply your threshold. Same weights, same result. All of it runs in a Web Worker so typing never janks.

References