Learning diverse attacks on large language models for robust red-teaming and safety tuning

Seanie Lee, Minsu Kim, Lynn Cherif, David Dobre, Juho Lee +6 more
5/28/2024
cs.CLcs.CRcs.LG

No official code found. Best implementation: GFNOrg/red-teaming (13 stars, MIT, last commit 2025-06-30).

Abstract

Red-teaming, or identifying prompts that elicit harmful responses, is a critical step in ensuring the safe and responsible deployment of large language models (LLMs). Developing effective protection against many modes of attack prompts requires discovering diverse attacks. Automated red-teaming typically uses reinforcement learning to fine-tune an attacker language model to generate prompts that elicit undesirable responses from a target LLM, as measured, for example, by an auxiliary toxicity classifier. We show that even with explicit regularization to favor novelty and diversity, existing approaches suffer from mode collapse or fail to generate effective attacks. As a flexible and probabilistically principled alternative, we propose to use GFlowNet fine-tuning, followed by a secondary smoothing phase, to train the attacker model to generate diverse and effective attack prompts. We find that the attacks generated by our method are effective against a wide range of target LLMs, both with and without safety tuning, and transfer well between target LLMs. Finally, we demonstrate that models safety-tuned using a dataset of red-teaming prompts generated by our method are robust to attacks from other RL-based red-teaming approaches.

View on arXivView PDF

Code Implementations(1)

GFNOrg/red-teamingCommunity100%
MIT

Code for "Learning Diverse Attacks on Large Language Models for Robust Red-Teaming and Safety Tuning", ICLR 2025.

135Python, Jupyter NotebookFeb 21, 20251 years agoMIT

Similar Papers

Cite this paper

@article{lee2024learning,
  title  = {Learning diverse attacks on large language models for robust red-teaming and safety tuning},
  author = {Seanie Lee and Minsu Kim and Lynn Cherif and David Dobre and Juho Lee and Sung Ju Hwang and Kenji Kawaguchi and Gauthier Gidel and Yoshua Bengio and Nikolay Malkin and Moksh Jain},
  year   = {2024},
  eprint = {2405.18540},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2405.18540v2},
  journal = {ICLR 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2405.18540.svg)](https://codeofpaper.com/paper/2405.18540)

Discussion