← All models

text-classification · text · multilingual · WASM · ~170 MB

Multilingual toxicity — moderate 15 languages, privately

A multilingual BERT (mBERT) fine-tuned for the TextDetox 2025 shared task. It reads text in 15 languages — Arabic, Hindi, Chinese, Japanese, Hebrew, Russian, Ukrainian, German, Spanish, Italian, French, English and more — and returns a single toxic vs. neutral probability. This is defensive content-safety tooling: set a threshold, triage what to review. Every score is computed on your device; no text is ever sent to a server. It is a probability, not a judgment about a person — and, as the model card is candid about, accuracy varies a lot by language.

At a glance

Modelonnx-community/bert-multilingual-toxicity-classifier-ONNX (ONNX of textdetox/bert-multilingual-toxicity-classifier)
Task / pipelinetext-classification · binary, single-label (softmax over two logits, not independent sigmoids)
Labelsneutral (idx 0) · toxic (idx 1) — the two probabilities sum to 1
Languages15 — ar, hi, zh, ja, he, ru, uk, de, es, it, fr, en, am, tt (+ Hinglish)
Architecturebert-base-multilingual-cased (12-layer mBERT) fine-tuned on textdetox/multilingual_toxicity_dataset
Quantizationq8 (8-bit) ONNX — verified non-degenerate (clean toxic/benign separation across en/ar/es/ru/de)
BackendWebAssembly (runs anywhere; no WebGPU needed)
Download~170 MB, cached after first load
LicenseOpenRAIL++ (use-based restrictions — a responsible-AI license)
Web APIsWebAssembly, Web Workers — all Baseline widely available

Run it

Type or paste text in any of the 15 languages; it re-scores automatically a moment after you stop typing. The moderation threshold decides the verdict: if the toxic probability lands at or above it, the text is flagged for review — otherwise it's allowed. The samples pair a benign and a mild hostile line per language so you can watch the classifier separate them.

See inside — two logits, one softmax

The English toxic-bert demo is multi-label: six independent sigmoids that don't add up. This model is the other shape — binary, single-label. The final layer produces two raw logits (neutral, toxic); a single softmax turns them into two probabilities that do sum to 100%. The table shows both, so you can see exactly how the threshold turns numbers into a decision. The multilingual trick is upstream: mBERT shares one WordPiece vocabulary and one embedding space across 104 languages, so the same two-logit head works whether the input is English or Arabic.

Score some text to see the raw numbers.

Why it matters

Communities are rarely monolingual. A moderation queue that only understands English is blind to abuse in every other language its users actually write in. A single small multilingual model — running for free, on-device, the instant someone hits submit — is a first line of defence that scales across borders without a per-call bill and without the text ever leaving the tab.

Use cases

Basics

Score one line in any language and read the two-class toxic/neutral probability.

Practical

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

Wild

Translation-parity probe — the same sentence in several languages, side by side, exposing where the model is weaker.

Multi-model

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

How the API works

The convenience path is one call — the model is single-label, so the pipeline returns the winning class:

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

const classify = await pipeline("text-classification",
  "onnx-community/bert-multilingual-toxicity-classifier-ONNX");
const out = await classify("أنت شخص غبي");   // Arabic
// → [{ label: "toxic", score: 0.98 }]   (idx 0 = neutral, idx 1 = toxic)

This page goes one level deeper for "See inside": instead of the pipeline it runs the tokenizer then model() in a single forward pass, reads the raw two-value logits tensor, and applies the softmax 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