Ruby Teaming: Improving Quality Diversity Search with Memory for Automated Red Teaming

Vernon Toh Yan Han, Rishabh Bhardwaj, Soujanya PoriaarXiv 2024 · DOI

TL;DR

This paper introduces Ruby Teaming, an enhancement to automated red teaming for Large Language Models (LLMs). By incorporating a memory of past successful mutations, Ruby Teaming significantly improves the discovery of harmful prompts, leading to higher attack success rates and more diverse vulnerability identification compared to existing methods.

What Problem Does This Paper Address?

As LLMs become more powerful and widely adopted, ensuring their safety and mitigating potential harms is a critical challenge. Red teaming, the process of testing LLMs for vulnerabilities by simulating adversarial attacks, is crucial for this. While manual red teaming is effective, it's costly and time-consuming. Automated red teaming approaches, which use LLMs to generate adversarial prompts (like jailbreaks), offer a scalable solution. However, existing methods like RAINBOW TEAMING, while effective, rely solely on the current set of prompts in their archive. This paper addresses the limitation that these methods might miss opportunities to generate even better prompts by not leveraging the historical context of prompt evolution.

Methods

Ruby Teaming builds upon the RAINBOW TEAMING framework, which uses a Quality-Diversity (QD) search algorithm (MAP-Elites) to automate the discovery of adversarial prompts. The core innovation of Ruby Teaming is the addition of a "memory" dimension to the existing two-dimensional archive (risk category and attack style). This memory stores the history of the k most recent successful mutations and their corresponding feedback from a critique agent.

Here's how a Ruby Teaming iteration works:

  1. Sampling: An adversarial prompt is sampled from the archive, with a bias towards less effective prompts. A risk category and attack style are also sampled.
  2. Mutation: A "mutator" LLM generates a new candidate prompt. This process is guided by the sampled prompt, risk category, attack style, and crucially, the memory of past successful mutations. This memory provides context for generating more harmful prompts. Prompts are filtered if they are too similar to their parent.
  3. Update: The candidate prompt is evaluated against the target LLM. A "judge" LLM determines if the new prompt elicits a more harmful response. If it does, the candidate prompt replaces the existing one in the archive. The memory is updated by adding the new successful prompt and its critique, and removing the oldest entry if the memory is full.

Datasets

The paper uses the Anthropic Harmless dataset for initializing the archive. The target LLM for evaluation is Llama 2-chat 7B. For evaluating the harmfulness of responses, they use Llama Guard 2. The mutator, judge, and critique agents are based on Mistral-7B-Instruct-v0.3.

Key Insights and Ideas

  • Memory as a Third Dimension: The core idea is that the history of prompt mutations, not just the current state of the archive, provides valuable cues for generating more effective adversarial prompts. This "memory" acts as a richer context for the mutator LLM.
  • Improved Prompt Generation: By leveraging this memory, Ruby Teaming can guide the mutator to create prompts that are not only more successful at eliciting harmful responses but also more diverse in their nature.
  • Memory Size is a Hyperparameter: The study investigates the impact of memory size, finding that a moderate size (e.g., 3) is often more effective than very small or very large sizes, suggesting a trade-off in how much historical context is beneficial.

Key Results

  • Higher Attack Success Rate (ASR): Ruby Teaming achieved a peak ASR of 74%, which is a significant 20% improvement over the baseline RAINBOW TEAMING (54% ASR).
  • Enhanced Diversity: Ruby Teaming outperformed RAINBOW TEAMING in terms of prompt diversity, showing a 6% increase in Shannon's Evenness Index (SEI) and a 3% increase in Simpson's Diversity Index (SDI).
  • Category-Specific Improvements: Ruby Teaming achieved perfect ASR (1.0) for "Suicide & Self-Harm" and significantly improved ASR for categories like "Hate" and "Sexual Content" compared to the baseline.
  • Memory Size Impact: The experiments showed that a memory size of 3 was the most effective, achieving a higher ASR than memory sizes of 2 or 4.

Limitations and Future Work

  • Compute Limitations: The experiments were restricted to 7B LLMs due to compute limitations. The authors believe Ruby Teaming would perform equally well, if not better, on larger models and suggest this as future work.
  • Reproducibility: The authors note they were unable to precisely reproduce the results from the original RAINBOW TEAMING paper, attributing this primarily to the use of different mutator agents and target models (they used Llama 2 70B in the original study).
  • Potential for Misuse: The paper acknowledges that the generated prompts could be misused for malicious purposes, emphasizing the importance of responsible AI development.
  • Future Work: The authors suggest exploring the performance of Ruby Teaming on larger LLMs and further investigating the optimal memory size and its interaction with other hyperparameters.

Summary updated

BibTeX
@misc{han2024ruby,
  author = {Vernon Toh Yan Han and Rishabh Bhardwaj and Soujanya Poria},
  title = {{Ruby Teaming: Improving Quality Diversity Search with Memory for Automated Red Teaming}},
  year = {2024},
  eprint = {2406.11654},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2406.11654},
}
Figure