FLIRT: Feedback Loop In-context Red Teaming

Ninareh Mehrabi, Palash Goyal, Christophe Dupuy, Qian Hu, Shalini Ghosh, Richard S. Zemel, Kai-Wei Chang, Aram Galstyan, Rahul Gupta

Researchers at Amazon AGI Foundations have introduced FLIRT (Feedback Loop In-context Red Teaming), an automated framework designed to stress-test generative models. Presented at EMNLP 2024, FLIRT leverages a feedback loop and in-context learning (ICL) to discover vulnerabilities in both text-to-image and text-to-text models, significantly outperforming existing automated red-teaming methods.

Introduction

As Large Language Models (LLMs) and text-to-image generators like Stable Diffusion become integrated into consumer products, ensuring they do not produce unsafe, offensive, or harmful content is critical. Traditional "red teaming"—the process of intentionally provoking model failures—is often bottlenecked by human-in-the-loop costs or inefficient automated methods that lack feedback mechanisms. FLIRT addresses these gaps by providing a model-agnostic, black-box approach that iteratively learns from its successful attacks to find diverse and effective adversarial prompts.

Methodology

The FLIRT framework operates as a continuous loop between a Red Language Model (LM) (the attacker) and a Target Model (the system under test).

The FLIRT framework overview, illustrating the feedback loop between the Red LM and the Target Model using various in-context update strategies.

The Attack Loop

  1. Initialization: The Red LM is seeded with a small set of hand-engineered adversarial examples.
  2. Generation: Using ICL, the Red LM generates a new adversarial prompt based on the examples in its context window.
  3. Evaluation: The prompt is sent to the Target Model. The output is then analyzed by automated safety classifiers (e.g., NudeNet for images or ToxiGen for text).
  4. Feedback & Update: If the prompt successfully triggers an unsafe response, it is added to the Red LM’s context window to guide future iterations.

Update Strategies

The researchers explored three primary strategies for managing the Red LM's context:

  • FIFO (First-In-First-Out): Replaces the oldest successful example with the newest one.
  • LIFO (Last-In-First-Out): Replaces the most recent example, helping to preserve the intent of the original human seeds.
  • Scoring: A sophisticated optimization approach that selects examples to maximize attack effectiveness and semantic diversity while maintaining low prompt toxicity to bypass initial text filters.

Experimental Results

FLIRT was evaluated against various versions of Stable Diffusion (including "Safe" variants) and GPT-Neo 2.7B. The results demonstrate a massive performance boost over the previous state-of-the-art, Stochastic Few-Shot (SFS).

Performance comparison of FLIRT strategies against SFS across different safety levels of Stable Diffusion.

Key Findings

  • Effectiveness: Against vanilla Stable Diffusion, FLIRT's Scoring strategy achieved an 85.2% attack success rate, compared to just 33.6% for SFS.
  • Resilience Against Safety Filters: Even when testing "Max Safe" versions of Stable Diffusion, FLIRT maintained a success rate of 41.0% to 46.7%, while SFS dropped to 14.1%. This suggests that many safety filters are thin wrappers over vulnerable model cores.
  • Diversity-Effectiveness Trade-off: By incorporating a diversity objective in the Scoring strategy, the framework can discover a wider range of vulnerabilities rather than repeating a single successful phrasing.
  • Efficiency: Because FLIRT relies on in-context learning rather than fine-tuning or brute-force token searching, it is computationally efficient and easily adaptable to different target models.

Conclusion

FLIRT represents a significant advancement in automated red teaming, demonstrating that feedback loops and in-context learning can effectively "evolve" attacks to bypass safety guardrails. While this poses a dual-use risk, the authors argue that such tools are essential for defenders to identify and patch vulnerabilities before they can be exploited in production environments. Future work includes incorporating human feedback to catch subtle failures and testing the framework on larger multi-modal models.

Summary updated

BibTeX
@inproceedings{mehrabi2024flirt,
  author = {Ninareh Mehrabi and Palash Goyal and Christophe Dupuy and Qian Hu and Shalini Ghosh and Richard S. Zemel and Kai-Wei Chang and Aram Galstyan and Rahul Gupta},
  title = {{FLIRT: Feedback Loop In-context Red Teaming}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.emnlp-main.41},
}
Figure