Skip to main content
QUICK REVIEW

[Paper Review] Red Teaming Language Models with Language Models

Ethan Perez, Saffron Huang|arXiv (Cornell University)|Feb 7, 2022
Hate Speech and Cyberbullying DetectionComputer Science17 citations
TL;DR

This paper proposes using language models (LMs) to automatically generate red teaming test cases that expose harmful behaviors in target LMs, such as offensive replies, data leakage, and biased language. By leveraging zero-shot, few-shot, supervised, and reinforcement learning methods, the approach uncovers tens of thousands of offensive responses in a 280B-parameter chatbot, demonstrating that LMs can effectively simulate adversarial users and reveal failure modes missed by manual testing.

ABSTRACT

Language Models (LMs) often cannot be deployed because of their potential to harm users in hard-to-predict ways. Prior work identifies harmful behaviors before deployment by using human annotators to hand-write test cases. However, human annotation is expensive, limiting the number and diversity of test cases. In this work, we automatically find cases where a target LM behaves in a harmful way, by generating test cases ("red teaming") using another LM. We evaluate the target LM's replies to generated test questions using a classifier trained to detect offensive content, uncovering tens of thousands of offensive replies in a 280B parameter LM chatbot. We explore several methods, from zero-shot generation to reinforcement learning, for generating test cases with varying levels of diversity and difficulty. Furthermore, we use prompt engineering to control LM-generated test cases to uncover a variety of other harms, automatically finding groups of people that the chatbot discusses in offensive ways, personal and hospital phone numbers generated as the chatbot's own contact info, leakage of private training data in generated text, and harms that occur over the course of a conversation. Overall, LM-based red teaming is one promising tool (among many needed) for finding and fixing diverse, undesirable LM behaviors before impacting users.

Motivation & Objective

  • To address the limitations of manual red teaming, which is costly and prone to critical oversights, by automating the generation of diverse and adversarial test cases for language models.
  • To reduce reliance on human-annotated test cases by using a language model to generate natural language inputs that provoke harmful outputs from target LMs.
  • To identify a broad spectrum of failure modes—such as offensive language, memorized private data, and distributional bias—before deployment.
  • To evaluate the effectiveness of different LM-based prompting and training strategies in generating high-coverage, high-difficulty test cases.

Proposed method

  • Use a language model (the red teaming LM) to generate natural language test inputs (e.g., questions or prompts) that target a separate, larger target language model.
  • Employ a pre-trained offensiveness classifier to automatically detect harmful outputs from the target LM in response to generated inputs.
  • Apply multiple generation strategies: zero-shot prompting, few-shot prompting, supervised fine-tuning, and reinforcement learning to optimize for diversity or adversarial difficulty.
  • Use prompt engineering to condition the red teaming LM on specific targets (e.g., demographic groups, contact information) to uncover targeted biases or data leakage.
  • Generate full dialogues by iteratively prompting the target LM and using the red teaming LM to continue the conversation, enabling detection of behavior degradation over time.
  • Analyze the resulting offensive outputs to identify failure patterns and suggest concrete model improvements, such as prompt edits or data filtering.

Experimental results

Research questions

  • RQ1Can a language model effectively generate diverse and adversarial test cases that trigger harmful behaviors in another language model?
  • RQ2How do different LM-based generation methods (zero-shot, few-shot, RL) compare in terms of test case diversity and difficulty?
  • RQ3To what extent can LM-based red teaming uncover failure modes—such as offensive language, data leakage, and bias—that are missed by manual testing?
  • RQ4Can prompt-based red teaming identify specific groups of people that the target LM discusses in more offensive ways?
  • RQ5How do offensive behaviors propagate and escalate over the course of multi-turn dialogues?

Key findings

  • The LM-based red teaming approach uncovered tens of thousands of offensive replies in a 280B-parameter language model chatbot, significantly expanding coverage beyond manual testing.
  • Generated test cases from the red teaming LM were comparable in diversity and difficulty to manually written test cases from prior work.
  • The method successfully identified offensive replies that included discriminatory jokes, explicit sexual content, and insults, often triggered by subtle or indirect prompts.
  • Prompt-based red teaming revealed that the chatbot sometimes generated real phone numbers (e.g., suicide hotlines, hospital numbers) as its own contact information.
  • The approach uncovered distributional bias, where the chatbot produced more offensive content when prompted about certain demographic groups compared to others.
  • In multi-turn dialogues, offensive responses often escalated over time, with early offensive replies leading to further offensive exchanges, highlighting the need for early detection and termination.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.