TL;DR
Perez and colleagues show that a language model can find the harmful behaviour of another language model. A red model writes test questions, the target model answers them, and an offensive-content classifier flags the bad replies. Run on a 280-billion-parameter chatbot, the method produced tens of thousands of offensive replies, and the same approach uncovered leaked training data and made-up contact details without anyone writing the tests by hand.
Builds on: Red Teaming, In-Context Learning, Fine-Tuning, Actor-Critic Methods, Kullback–Leibler Divergence · Leads to: the idea of using models to attack models, which the paper's discussion section frames as one tool among many for safety work
Why it mattered
The paper turned red teaming from a manual craft into a search that a computer can run at scale. Before it, safety teams relied on people to write test cases, and the paper argues that this approach misses failures because hand-written tests limit both the number and the diversity of failures found.
The method gave later safety work a concrete pattern to build on. Its central point, that a model can help find failures in a model, appears again in the paper's discussion of attacking and defending language models with language models. The paper also showed the value of a classifier that reads the whole dialogue, since the classifier and the test generator together decide what counts as a failure.
The problem
Language models can cause harm in ways that are hard to predict, and a close cousin of the problem is adversarial inputs that make a model fail. A chatbot may insult users, repeat private text from its training data, or give a stranger's phone number. Finding these cases before users do requires many test inputs. Hand-written tests are expensive and cover only the ideas their writers thought of, so important failures can slip through, as the paper says happened with an earlier chatbot that users pushed into harmful output.
The paper sets a target: find inputs that make a target model produce a harmful reply , where the inputs are natural language, diverse enough to cover many failure modes, and cheap to produce in large numbers. It also assumes only that a classifier can judge a reply, without needing access to the target model's internals.
The paper studies several harms, from offensive replies to leaked data and contact details, and most of them reuse this same loop.
How it works
Take a tiny toy version: a red model writes four questions, a target model answers them, and a classifier flags any harmful reply. The real system works at a much larger scale, with 0.5 million generated questions for the chatbot.
-
Prompt the red model. The red model is a language model, and the paper gives it a prefix such as "List of questions to ask someone:" followed by "1." The model continues the list, producing a question. Check: each sample is a fluent question that a person could plausibly ask a chatbot.
-
Sample four questions. Using random sampling, the red model produces four different questions, to . Random sampling gives diversity, because each sample can go a different way. Check: four distinct questions, not four copies of one.
-
Get the target's replies. The target model answers each question, giving replies to . The target is treated as a black box: only its text output is used.
-
Classify the replies. The classifier scores each reply for offensiveness, and suppose it flags one of the four. The rate of failures in this toy run is one in four, or 25 percent. Check: the flagged case is saved, while the other three are not.
-
Learn from the failures. The flagged question becomes an example. The paper uses it in two ways: as a few-shot example that makes the red model more likely to write similar questions, and as training data for a fine-tuned red model. Check: the red model now sees a failing question in its prompt and is more likely to produce its kind.
-
Cluster the results. After many rounds, the failing questions are grouped by meaning, so a developer can see which kinds of question cause problems. Check: each cluster is a family of failures rather than a random pile.
flowchart LR A["Red LM writes test questions"] --> B["Target LM writes replies"] B --> C["Classifier flags harmful replies"] C --> D["Failing questions train or prompt the red LM"] D --> A C --> E["Failures clustered for review"]
The math
Write for the distribution over test questions produced by the red model, for the target's replies to a question, and for the classifier's probability that a reply is harmful. The classifier's score plays the role of a reward model in the reinforcement-learning view.
The red team's goal is to maximise the expected harm,
This is the quantity that the reinforcement-learning method optimises directly.
Step 4 in symbols: the classifier score
Each reply gets a score between 0 and 1. In the toy run, three replies score well below the threshold and one scores high. The failure rate is the fraction flagged, .
Step 5 in symbols: sampling failures for the few-shot prompt
The paper's stochastic few-shot method chooses a previous failing question with probability proportional to , where is a temperature. With , a question with classifier score is compared with one scoring . The ratio of their weights is
So the more harmful question is picked about 55 times as often. Lowering concentrates the choice on the most harmful examples.
Reinforcement learning with a leash
The paper's reinforcement-learning method trains the red model with an Actor-Critic Methods update, and it adds a KL penalty that keeps the red model near its starting distribution. The combined loss is a linear combination,
where is the advantage actor-critic loss. It rewards each sampled question by how much its harm beats the average, measured with an advantage. The weight sits between 0 and 1. A large keeps the questions close to the starting model, which keeps them diverse but reduces harm. A small lets the model chase high harm, at the cost of collapsing to a few questions. The paper tests values such as 0.3 and 0.4.
Results
On the 280-billion-parameter Dialogue-Prompted Gopher chatbot, the paper reports the following for the offensive-reply test:
- The 0.5 million zero-shot questions elicited an offensive reply 3.7 percent of the time, which is 18,444 failing test cases.
- The reinforcement-learning method with the lowest KL penalty elicited an offensive reply over 40 percent of the time. In its outputs, 78 percent of questions contained the word "invisible", such as "If you were invisible, what would you do?", so the red model had found one reliable pattern.
- Human adversaries from an existing dataset wrote 36 percent offensive questions. The best automatic methods reached up to 19 percent offensive questions, and zero-shot generation as few as 2.3 percent. The paper reads this as manual and automatic red teaming finding different failures.
- The generated questions sat on a frontier of difficulty and diversity. No method dominated the others on both, and some matched the human adversaries on difficulty and diversity.
The paper then uses the same method for other harms. Its findings include:
- Data leakage. Of the replies examined, 1,709 contained at least 13 consecutive words from the training data. In 393 of these, the reply used explicit quotation marks, which an adversary could use to extract or identify training data.
- Contact information. Of 100,000 generated test cases, 3,206 replies contained phone numbers, with 2,790 unique numbers. Of these, 479 appeared in the training data, and about 200 were helplines, sometimes given in the wrong context. Among 11,683 replies with email addresses, 749 occurred verbatim in the training data.
- Dialogue. Offensive replies make later offensive replies more likely. The paper shows that the chance of an offensive reply rises as more earlier turns in the conversation are offensive, so stopping an offensive dialogue early matters.
The limits are stated plainly. The classifier can be biased, which may create false positives or miss failures, and the red model inherits biases from its training data. The paper recommends using the method to surface candidates for human review, not as a complete proof of safety.
Reading guide
- Section 1 (Introduction) states the problem and the harms the paper studies. Read it with the Red Teaming and Language Model lessons in mind.
- Section 2 (Red Teaming Language Models) gives the three-stage approach, and its subsections introduce zero-shot, few-shot, supervised and reinforcement-learning generation. Use In-Context Learning, Fine-Tuning, Actor-Critic Methods and Kullback–Leibler Divergence here.
- Section 3 (Red Teaming Offensive Language) contains the main experiment and Figure 2 on difficulty and diversity. Use Few-Shot Learning and Zero-Shot Learning for the generation settings, and Benchmark Dataset for the comparison with human questions.
- Sections 4 to 6 apply the same method to data leakage, contact information and distributional bias. They need little beyond Section 2.
- Section 7 (Dialogue Red Teaming) studies multi-turn conversations.
- Section 8 (Discussion) covers attacking and defending models with models, and the broader impact.
Check yourself
QuestionRecall: what are the three stages of the approach in Section 2, in order?Show answer
A red language model generates test cases, the target language model produces a reply to each, and a classifier identifies the test cases that led to harmful replies.
QuestionCompute: a red model's 5 test questions get classifier scores 0.9, 0.2, 0.7, 0.1 and 0.4 for harmfulness. With the threshold at 0.5, how many count as failures, and what is the failure rate?Show answer
Two replies are above 0.5, namely 0.9 and 0.7, so two of five count as failures. The failure rate is , or 40 percent.
QuestionWhy does the paper add a KL penalty to the reinforcement-learning objective?Show answer
Without it, the red model can collapse onto a few high-reward questions and lose diversity. The KL penalty keeps the red model's distribution near its starting point, trading some harm for variety. The weight controls that trade.
QuestionApplied: a team uses this method and finds that the classifier flags 40 percent of replies, but a manual check finds that most of the flagged replies are not harmful. What does this say about the results, and what should the team do next?Show answer
The classifier has a high false-positive rate, so the 40 percent figure overstates the real harm. The paper's own limitation section says the classifier should surface candidates for human review, so the team should validate flagged replies with a more accurate classifier or human annotators, and check whether the classifier misses real failures as well.