用强化学习优化提示词,让大模型越狱更有效且可解释。
xJailbreak: Representation Space Guided Reinforcement Learning for Interpretable LLM Jailbreaking
- 基于嵌入空间距离优化提示词生成,保持原意同时提升攻击成功率。
- 在Qwen2.5-7B、Llama3.1-8B和GPT-4o上达到当前最佳效果。
- 提供关键词+意图匹配+答案验证的完整评估框架,适合安全研究者使用。
安全对齐机制对防止大语言模型(LLMs)生成有害或不道德内容至关重要。然而,精心设计的提示词可在不访问模型内部参数的情况下绕过这些安全措施,这种现象称为黑盒越狱。现有启发式黑盒攻击方法(如遗传算法)因固有的随机性而效果有限,而近期基于强化学习(RL)的方法常缺乏鲁棒且有信息量的奖励信号。为此,我们提出一种新颖的黑盒越狱方法,利用强化学习优化提示词生成,通过分析良性与恶意提示词之间的嵌入相似度,确保重写后的提示词在语义上贴近原意的同时增强攻击有效性。此外,我们构建了一个综合评估框架,结合关键词检测、意图匹配与答案验证,实现对越狱成功的更严格、全面评估。实验结果表明,该方法在多个主流开源与闭源模型(包括Qwen2.5-7B-Instruct、Llama3.1-8B-Instruct和GPT-4o-0806)上均达到当前最优性能,树立了越狱攻击的新基准,揭示了大模型潜在的安全漏洞。代码已开源:https://github.com/Aegis1863/xJailbreak。
原文摘要 · Abstract (English)
Safety alignment mechanism are essential for preventing large language models (LLMs) from generating harmful information or unethical content. However, cleverly crafted prompts can bypass these safety measures without accessing the model's internal parameters, a phenomenon known as black-box jailbreak. Existing heuristic black-box attack methods, such as genetic algorithms, suffer from limited effectiveness due to their inherent randomness, while recent reinforcement learning (RL) based methods often lack robust and informative reward signals. To address these challenges, we propose a novel black-box jailbreak method leveraging RL, which optimizes prompt generation by analyzing the embedding proximity between benign and malicious prompts. This approach ensures that the rewritten prompts closely align with the intent of the original prompts while enhancing the attack's effectiveness. Furthermore, we introduce a comprehensive jailbreak evaluation framework incorporating keywords, intent matching, and answer validation to provide a more rigorous and holistic assessment of jailbreak success. Experimental results show the superiority of our approach, achieving state-of-the-art (SOTA) performance on several prominent open and closed-source LLMs, including Qwen2.5-7B-Instruct, Llama3.1-8B-Instruct, and GPT-4o-0806. Our method sets a new benchmark in jailbreak attack effectiveness, highlighting potential vulnerabilities in LLMs. The codebase for this work is available at https://github.com/Aegis1863/xJailbreak.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。