Red teaming – Mangrove

GlossaryGuardrails and control

Red teaming

Definition: Red teaming is testing a system by acting as its adversary, deliberately trying to make it fail, leak data or be misused, so the weaknesses can be fixed.

In computer security, the glossary of the US National Institute of Standards and Technology (NIST) defines a red team as “a group of people authorized and organized to emulate a potential adversary’s attack or exploitation capabilities” against an organization’s security, and calls the defenders the blue team (NIST glossary). For a language model, red teamers write inputs meant to make the model produce harmful output or break the rules its developer set. A jailbreak, a separate entry, is one such input. For an agent, red teaming also covers indirect prompt injection, the form of prompt injection (also a separate entry) in which instructions hidden in content the agent reads try to steer its actions. For example, a red team testing a trading agent may plant an instruction in a news article the agent reads, telling it to buy a thinly traded token, and then check whether an order request reaches the trading tool.

Two 2022 studies measured what red teaming finds in language models. Perez et al. (7 February 2022), at DeepMind and New York University, used one language model to write test questions for a 280-billion-parameter chatbot and counted the share of its replies that a program trained to detect offensive content flagged. Half a million generated questions drew offensive replies 3.7% of the time, and in one setting a question writer trained with reinforcement learning to find failures drew them more than 40% of the time. Ganguli et al. (23 August 2022), at Anthropic, had people attack assistants of three sizes, from 2.7 to 52 billion parameters, and released 38,961 of the attacks. Scored by a model trained on which replies the attackers found less harmful, assistants trained with reinforcement learning from human feedback (RLHF) became harder to attack as they grew. Assistants that sampled 16 replies and showed only those a model ranked least harmful were the hardest to attack at every size, and the authors noted that their replies tended to be harmless by being evasive.

The UK Ministry of Defence’s Red Teaming Handbook (third edition, June 2021) defines a red team more broadly, as one formed to subject an organization’s plans, programs, ideas and assumptions “to rigorous analysis and challenge”, and calls a team that adopts an adversary’s viewpoint a red cell, which can also “role play the adversary in any wargaming exercises”.