AutoDefense: Multi-Agent LLM Defense against Jailbreak Attacks

Yifan Zeng, Yiran Wu, Xiao Zhang, Huazheng Wang, Qingyun Wu
3/2/2024
cs.LGcs.CLcs.CR

Official code: XHMY/AutoDefense (68 stars, MIT, last commit 2026-01-15).

Abstract

Despite extensive pre-training in moral alignment to prevent generating harmful information, large language models (LLMs) remain vulnerable to jailbreak attacks. In this paper, we propose AutoDefense, a multi-agent defense framework that filters harmful responses from LLMs. With the response-filtering mechanism, our framework is robust against different jailbreak attack prompts, and can be used to defend different victim models. AutoDefense assigns different roles to LLM agents and employs them to complete the defense task collaboratively. The division in tasks enhances the overall instruction-following of LLMs and enables the integration of other defense components as tools. With AutoDefense, small open-source LMs can serve as agents and defend larger models against jailbreak attacks. Our experiments show that AutoDefense can effectively defense against different jailbreak attacks, while maintaining the performance at normal user request. For example, we reduce the attack success rate on GPT-3.5 from 55.74% to 7.95% using LLaMA-2-13b with a 3-agent system. Our code and data are publicly available at https://github.com/XHMY/AutoDefense.

View on arXivView PDF

Code Implementations(1)

XHMY/AutoDefenseOfficial100%
MIT

AutoDefense: Multi-Agent LLM Defense against Jailbreak Attacks

6820PythonFeb 28, 20249 months agoMIT

Similar Papers

Cite this paper

@article{zeng2024autodefense,
  title  = {AutoDefense: Multi-Agent LLM Defense against Jailbreak Attacks},
  author = {Yifan Zeng and Yiran Wu and Xiao Zhang and Huazheng Wang and Qingyun Wu},
  year   = {2024},
  eprint = {2403.04783},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2403.04783v2}
}

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/2403.04783.svg)](https://codeofpaper.com/paper/2403.04783)

Discussion