[论文解读] Jailbreaking Leading Safety-Aligned LLMs with Simple Adaptive Attacks
该论文表明,安全对齐的大型语言模型对利用提示、对数概率的随机搜索、自我迁移和预填充等简单自适应越狱攻击高度易受攻击,在许多模型上实现几乎完美的越狱成功率。它提供了自适应攻击构建的代码和实用指南。
We show that even the most recent safety-aligned LLMs are not robust to simple adaptive jailbreaking attacks. First, we demonstrate how to successfully leverage access to logprobs for jailbreaking: we initially design an adversarial prompt template (sometimes adapted to the target LLM), and then we apply random search on a suffix to maximize a target logprob (e.g., of the token "Sure"), potentially with multiple restarts. In this way, we achieve 100% attack success rate -- according to GPT-4 as a judge -- on Vicuna-13B, Mistral-7B, Phi-3-Mini, Nemotron-4-340B, Llama-2-Chat-7B/13B/70B, Llama-3-Instruct-8B, Gemma-7B, GPT-3.5, GPT-4o, and R2D2 from HarmBench that was adversarially trained against the GCG attack. We also show how to jailbreak all Claude models -- that do not expose logprobs -- via either a transfer or prefilling attack with a 100% success rate. In addition, we show how to use random search on a restricted set of tokens for finding trojan strings in poisoned models -- a task that shares many similarities with jailbreaking -- which is the algorithm that brought us the first place in the SaTML'24 Trojan Detection Competition. The common theme behind these attacks is that adaptivity is crucial: different models are vulnerable to different prompting templates (e.g., R2D2 is very sensitive to in-context learning prompts), some models have unique vulnerabilities based on their APIs (e.g., prefilling for Claude), and in some settings, it is crucial to restrict the token search space based on prior knowledge (e.g., for trojan detection). For reproducibility purposes, we provide the code, logs, and jailbreak artifacts in the JailbreakBench format at https://github.com/tml-epfl/llm-adaptive-attacks.
研究动机与目标
- 展示领先的安全对齐LLM对自适应越狱策略的脆弱性。
- 开发通用提示模板并结合简单优化(随机搜索)以最大化越狱成功率。
- 展示模型特定的脆弱性以及越狱在不同模型和API之间的可迁移性。
- 提供实用建议和开源工具,用于评估和压力测试LLM的安全性。
提出的方法
- 设计面向不同模型族的通用对抗性提示模板。
- 在受限的标记后缀上应用随机搜索,以最大化目标对数概率(例如 ‘Sure’)。
- 通过在相关、较难的提示中重复使用对抗后缀实现自我迁移。
- 对 Claude 模型使用预填充攻击以绕过对 logprob 的访问限制。
- 对于 Claude,从 GPT-4 后缀和多次重新启动中进行迁移;对于 R2D2,使用带随机搜索的上下文提示。
- 在作者的GitHub仓库提供代码、提示和攻击日志。
实验结果
研究问题
- RQ1当可获得 logprobs 或预填充时,安全对齐的 LLM 是否能够通过自适应提示和简单优化实现可靠越狱?
- RQ2越狱在模型族和规模之间的可迁移性有多大,以及存在哪些模型特定的脆弱性?
- RQ3提示、随机搜索、自我迁移和预填充的组合是否能在领先模型上实现近100%的越狱成功率?
- RQ4评估前沿 LLM 的安全性与鲁棒性的实际意义是什么?
- RQ5有哪些开源工具可以复现并扩展这些自适应攻击?
主要发现
- 利用通用模板加上随机搜索和迁移,在包括 GPT-3.5/4、Llama-2-Chat 变体、Gemma、R2D2、Claude 家族等在内的多种模型上实现近100%的自适应攻击成功率。
- 仅提示模板在某些模型上就能获得非常高的成功率(例如 GPT-3.5 Turbo 的 100%),而增加随机搜索和自我迁移后在其他模型上效果更显著(例如 GPT-4 Turbo 的 96%)。
- Llama-2-Chat 和 Gemma 需要自我迁移才能达到完全成功;R2D2 依赖带随机搜索的上下文提示;Claude 模型通过预填充或基于迁移的越狱实现高成功率,即使没有 logprobs。
- GPT-3.5 Turbo 对提示高度脆弱;GPT-4 Turbo 显示出更强的抗性,但通过提示+RS+self-transfer(96%)被克服。
- Claude 模型对静态提示显示出强鲁棒性,但对来自 GPT-4 的迁移和预填充易受影响(在若干情形下 ASR 为 100%)。
- 特洛伊检测竞赛结果表明,对标记池的 RS 可以媲美或接近在后门发现中的真正特洛伊。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。