atlas

Research map / Large language models / Language, safety and interpretability

Toxicity Detection for Free

NeurIPS 2024 · Large language models › Language, safety and interpretability · approach: Safety alignment of LLMs · 3 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Proposes MULI, a free toxicity detector for prompts that applies sparse logistic regression to the first response token's logits of the target LLM itself, outperforming LlamaGuard and the OpenAI Moderation API at low FPR.

Problem

Toxicity detectors for LLM prompts are costly (extra model call per query) and have low TPR at very low FPR under real-world class imbalance, while aligned LLMs' refusal signals go unused.

Approach

Toxic prompts raise the probability of refusal-starting tokens (e.g., "Sorry", "Cannot", "I") in the LLM's first response-token distribution, even when the model still answers; a lasso-regularized logistic regression over the full first-token log-odds vector turns this into a near-zero-cost detector.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
use MULI instead of LlamaGuardtoxicity detection · ToxicChat testTPR@FPR 0.1%: 5.25 -> 42.54Helped
use MULI instead of OModtoxicity detection · ToxicChat testAUPRC: 63.14 -> 91.29Helped
use MULI instead of LlamaGuardtoxicity detection · LMSYS-Chat-1M testTPR@FPR 0.1%: 7.29 -> 66.85Helped
use MULI instead of OModtoxicity detection · LMSYS-Chat-1M testTPR@FPR 0.01%: 56.95 -> 53.62Hurt
use MULI instead of LlamaGuardtoxicity detection · OpenAI Moderation API EvaluationTPR@FPR 0.1%: 14.56 -> 24.90; 14.56 -> 25.86Helped
use raw logits instead of f* (ablation)MULI · ToxicChat testTPR@FPR 0.1%: 42.54 -> 45.03Helped
use probabilities instead of f* (ablation)MULI · ToxicChat testAUPRC: 91.29 -> 36.50Hurt
use log probabilities instead of f* (ablation)MULI · ToxicChat testAUPRC: 91.29 -> 91.28No clear effect
replace L1 regularization with L2 regularization (ablation)MULI with f* · ToxicChat testAUPRC: 91.29 -> 90.66Hurt
remove sparse regularization (ablation)MULI with f* · ToxicChat testAUPRC: 91.29 -> 89.05Hurt
increase the training set from 10 examples to 5082MULI · ToxicChatAUPRC: 76.92 -> 91.29Helped
use Llama2-13B instead of Llama2-7B as the base modelMULI · ToxicChatTPR@FPR 0.1%: 43.92 -> 46.13Helped

Surprising findings

Limitations

Experimental setup

Datasets: ToxicChat LMSYS-Chat-1M OpenAI Moderation API Evaluation dataset HarmBench

Benchmarks: ToxicChat LMSYS-Chat-1M OpenAI Moderation API Evaluation dataset

Metrics: Acc_opt AUPRC TPR@FPR 10% TPR@FPR 1% TPR@FPR 0.1% TPR@FPR 0.01%

Baselines: LlamaGuard OpenAI Moderation API GPT-4o GPT-4o-mini Logits_Cannot

Builds on: Llama Guard OpenAI Moderation API

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy