arXiv:2505.09820cs.LGcs.CL2025-05中稿 · International Join…被引 4

用指数梯度法优化语言模型攻击,更高效地破解安全限制。

Adversarial Attack on Large Language Models using Exponentiated Gradient Descent

  • 基于指数梯度与Bregman投影,在概率单纯形内直接优化独热编码。
  • 在5个开源模型上成功率超3种现有方法,且计算效率更高。
  • 适合研究模型安全、对抗攻击或红队测试的开发者使用。

随着大语言模型(LLMs)广泛应用,系统性理解其行为对提升安全性至关重要。尽管多数模型通过人类反馈强化学习(RLHF)对齐,仍易受越狱攻击。现有方法或在离散词元空间搜索,或优化连续嵌入空间,但前者效率低,后者需投影生成离散词元,可能降低效果。为此,我们提出一种内在优化方法:利用指数梯度下降结合Bregman投影,确保优化后的独热编码始终位于概率单纯形内。理论证明该方法收敛,并实现高效算法,成功越狱多个主流LLM。在四个公开数据集上的实验表明,该方法在5个开源模型上表现优于三种先进越狱技术,成功率更高且效率更优。代码已开源:https://github.com/sbamit/Exponentiated-Gradient-Descent-LLM-Attack。

原文摘要 · Abstract (English)

As Large Language Models (LLMs) are widely used, understanding them systematically is key to improving their safety and realizing their full potential. Although many models are aligned using techniques such as reinforcement learning from human feedback (RLHF), they are still vulnerable to jailbreaking attacks. Some of the existing adversarial attack methods search for discrete tokens that may jailbreak a target model while others try to optimize the continuous space represented by the tokens of the model's vocabulary. While techniques based on the discrete space may prove to be inefficient, optimization of continuous token embeddings requires projections to produce discrete tokens, which might render them ineffective. To fully utilize the constraints and the structures of the space, we develop an intrinsic optimization technique using exponentiated gradient descent with the Bregman projection method to ensure that the optimized one-hot encoding always stays within the probability simplex. We prove the convergence of the technique and implement an efficient algorithm that is effective in jailbreaking several widely used LLMs. We demonstrate the efficacy of the proposed technique using five open-source LLMs on four openly available datasets. The results show that the technique achieves a higher success rate with great efficiency compared to three other state-of-the-art jailbreaking techniques. The source code for our implementation is available at: https://github.com/sbamit/Exponentiated-Gradient-Descent-LLM-Attack

对抗攻击大模型安全优化算法

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。