arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2404.02151cs.CRcs.AIcs.LGstat.ML

用简单自适应攻击突破领先的安全对齐大型语言模型

Jailbreaking Leading Safety-Aligned LLMs with Simple Adaptive Attacks

EPFL(洛桑联邦理工学院)

Maksym Andriushchenko, Francesco Croce, Nicolas Flammarion

AI总结:

该研究表明最新安全对齐大型语言模型易受简单自适应越狱攻击,通过利用对数概率的随机搜索等方法对多种模型实现100%攻击成功率,揭示适应性对攻击的关键作用并提供可复现代码。

摘要:

我们发现,即使是最新的安全对齐大型语言模型(LLMs)也无法抵御简单的自适应越狱攻击。首先,我们展示了如何利用对数概率(logprobs)访问权限成功实施越狱:我们先设计一个对抗性提示模板(有时会针对目标LLM进行调整),然后对后缀应用随机搜索以最大化目标对数概率(例如“Sure”令牌的对数概率),可能会进行多次重启。通过这种方式,根据GPT-4作为评判者的结果,我们在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以及针对GCG攻击进行对抗训练的R2D2上实现了100%的攻击成功率。我们还展示了如何通过迁移攻击或预填充攻击对不暴露对数概率的所有Claude模型实施越狱,成功率同样为100%。此外,我们展示了如何对受限令牌集应用随机搜索来查找中毒模型中的木马字符串——这一任务与越狱有许多相似之处,正是该算法使我们在SaTML'24木马检测竞赛中获得第一名。这些攻击背后的共同主题是适应性至关重要:不同模型易受不同提示模板的攻击(例如R2D2对上下文学习提示非常敏感),一些模型基于其API存在独特漏洞(例如Claude的预填充),在某些情况下,基于先验知识限制令牌搜索空间至关重要。为了可复现性,我们在JailbreakBench格式中提供了代码、日志和越狱工件,地址为https://github.com/tml-epfl/llm-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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑