← Measures

Toxicity Score

An automated classifier's guess at how harmful a piece of text would seem to a reader. Useful for catching the obvious cases, blind to a lot of the subtle ones.

At a glance

Full name Toxicity score, most commonly from Google Jigsaw’s Perspective API
What it measures The predicted probability that a reader would perceive a piece of text as rude, disrespectful or likely to make someone leave a conversation
Formula The output of a trained classifier, a probability between 0 and 1, not a hand-built formula
Typical range 0 to 1, often with an operational cut-off around 0.5 or 0.7 treated as the flag threshold
Used for Content moderation, safety auditing of generative AI outputs, and comment-section moderation
Best used for A fast, automatic first pass at scale, flagging content for closer review
Pair with Human review, and a breakdown by demographic group to check for biased false positives

Toxicity scoring is how most large-scale systems make a first pass at the enormous volume of text they cannot possibly have a human read line by line. It is a trained classifier’s best guess, not a ground truth, and the gap between those two things is the single most important thing to understand about this metric.

What it is and how it’s computed

A classifier, most widely Google Jigsaw’s Perspective API, is trained on large sets of text labelled by human raters for how toxic it seems, and it outputs a probability score for new text. Many implementations break the single toxicity score into subtypes, such as insult, threat, identity attack and profanity, since a single number can hide important differences in what kind of harm is actually present. Systems built around large language models often run every generated output through a classifier like this before it ever reaches a user, specifically to catch the gross failures. The widely used RealToxicityPrompts benchmark, introduced by Gehman and colleagues in 2020, measures how often language models produce toxic completions when given a large, varied set of prompts drawn from the real web, including prompts that are not themselves toxic.

A worked example

A customer support chatbot generates a response to an angry user, and before that response is shown, it passes through a toxicity classifier. If the classifier returns a score of 0.85 against an operational threshold of 0.7, the response gets blocked or rewritten before the user ever sees it. Run across 10,000 generated responses, if 40 get flagged this way, the system reports a 0.4% automated toxicity-flag rate, a number teams track over time to catch regressions after a model update.

Where it matters

Toxicity scoring is standard at scale wherever user-generated or AI-generated content needs a first pass before a human ever sees it: comment moderation on large platforms, safety filtering on chatbot outputs, and red-teaming exercises that measure how easily a model can be provoked into producing harmful content. It is one of the most commonly reported safety metrics in model cards and system cards published alongside new large language models.

Strengths

It operates at a scale no team of human moderators could match, flagging content in milliseconds across millions of pieces of text. It gives a consistent, repeatable signal for tracking whether a system’s safety behaviour is improving or regressing across model versions. And breaking the score into subtypes gives a more actionable signal than a single blended number would.

Limitations, and the things that go wrong

These classifiers carry real, well-documented biases. Sap and colleagues showed in 2019 that widely used toxicity and hate-speech classifiers flagged African American English at substantially higher rates than other dialects for text that human annotators judged equally non-toxic, a bias with obvious and serious consequences if deployed at scale without correction. A single toxicity number also cannot distinguish between a genuine threat, a reclaimed slur used within a community, a quotation of someone else’s harmful words for the purpose of discussing them, and satire, all of which can trigger similar surface-level signals despite being completely different in intent and actual harm. And like any classifier, it can be fooled by adversarial phrasing designed specifically to evade detection while still conveying harmful content to a human reader.

When I would use it, and what to pair it with

I use automated toxicity scoring as a first-pass filter at scale, never as the final word on whether content is actually harmful. I check the classifier’s error rates broken out by demographic group before trusting it in production, specifically looking for the kind of dialect bias documented in the research above. And I route flagged content, along with a random sample of unflagged content, to human review, since that is the only way to catch both the false positives that silence legitimate speech and the false negatives that let genuinely harmful content through.