用强化学习自动生成强攻击,突破大模型防御
RL Is a Hammer and LLMs Are Nails: A Simple Reinforcement Learning Recipe for Strong Prompt Injection
- 用强化学习从零训练攻击模型,无需初始数据
- 对GPT-4o攻击成功率98%,对带防御的GPT-5达72%
- 可绕过多种检测器,适合安全研究与红队测试
提示注入严重威胁大语言模型代理的可靠性与安全性。现有防御如Instruction Hierarchy和SecAlign在应对静态攻击时表现良好,但需更强攻击(如自动化红队)来全面评估其鲁棒性。为此,我们提出RL-Hammer——一种通过强化学习自动学习执行强提示注入和越狱的简单训练方案,无需预热数据,可完全从零训练。为实现对工业级模型的有效通用攻击,我们引入一系列实用技术。该方法在未防御的GPT-4o上实现98%的攻击成功率,在采用Instruction Hierarchy防御的GPT-5上仍达到72%。我们还探讨了攻击多样性难题,指出攻击模型常会‘奖励黑客’以欺骗多样性目标。此外,RL-Hammer可绕过多种提示注入检测器。我们希望本工作推动自动化红队发展,并促使更严谨的防御机制出现。代码已开源:https://github.com/facebookresearch/rl-injector。
原文摘要 · Abstract (English)
Prompt injection poses a serious threat to the reliability and safety of LLM agents. Recent defenses against prompt injection, such as Instruction Hierarchy and SecAlign, have shown notable robustness against static attacks. However, to more thoroughly evaluate the robustness of these defenses, it is arguably necessary to employ strong attacks such as automated red-teaming. To this end, we introduce RL-Hammer, a simple recipe for training attacker models that automatically learn to perform strong prompt injections and jailbreaks via reinforcement learning. RL-Hammer requires no warm-up data and can be trained entirely from scratch. To achieve high ASRs against industrial-level models with defenses, we propose a set of practical techniques that enable highly effective, universal attacks. Using this pipeline, RL-Hammer reaches a 98% ASR against GPT-4o and a $72\%$ ASR against GPT-5 with the Instruction Hierarchy defense. We further discuss the challenge of achieving high diversity in attacks, highlighting how attacker models tend to reward-hack diversity objectives. Finally, we show that RL-Hammer can evade multiple prompt injection detectors. We hope our work advances automatic red-teaming and motivates the development of stronger, more principled defenses. Code is available at https://github.com/facebookresearch/rl-injector.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。