arXiv:2503.03710cs.CLcs.CR2025-03ICML被引 44

通过双目标优化提升大模型拒答能力,增强对抗越狱攻击的鲁棒性。

Improving LLM Safety Alignment with Dual-Objective Optimization

  • 将DPO分解为拒答强化与有害知识消解两个目标,分离优化
  • 在多种越狱攻击下拒答率显著提升,包括多轮和分布外场景
  • 引入奖励加权机制聚焦关键拒答词元,防御更精准

现有大语言模型训练阶段的安全对齐方法仍易受越狱攻击影响。广泛使用的直接偏好优化(DPO)在实验和理论上均存在缺陷,其损失函数对拒答学习不理想。通过梯度分析,我们识别出这些问题,并提出一种改进的安全对齐方法,将DPO目标解耦为:(1) 增强拒答训练,即使产生部分不安全输出也坚持拒答;(2) 针对性地消除有害知识。该方法显著提升了模型在各类越狱攻击下的鲁棒性,涵盖预填充、后缀及多轮攻击,覆盖分布内与分布外场景。此外,我们引入基于奖励的词元级加权机制,强化关键拒答词元的学习,进一步提升对抗性攻击的防御能力。研究还发现,越狱鲁棒性与训练过程中拒答和有害词元的分布变化及内部表征相关,为未来研究提供新方向。代码已开源:https://github.com/wicai24/DOOR-Alignment

原文摘要 · Abstract (English)

Existing training-time safety alignment techniques for large language models (LLMs) remain vulnerable to jailbreak attacks. Direct preference optimization (DPO), a widely deployed alignment method, exhibits limitations in both experimental and theoretical contexts as its loss function proves suboptimal for refusal learning. Through gradient-based analysis, we identify these shortcomings and propose an improved safety alignment that disentangles DPO objectives into two components: (1) robust refusal training, which encourages refusal even when partial unsafe generations are produced, and (2) targeted unlearning of harmful knowledge. This approach significantly increases LLM robustness against a wide range of jailbreak attacks, including prefilling, suffix, and multi-turn attacks across both in-distribution and out-of-distribution scenarios. Furthermore, we introduce a method to emphasize critical refusal tokens by incorporating a reward-based token-level weighting mechanism for refusal learning, which further improves the robustness against adversarial exploits. Our research also suggests that robustness to jailbreak attacks is correlated with token distribution shifts in the training process and internal representations of refusal and harmful tokens, offering valuable directions for future research in LLM safety alignment. The code is available at https://github.com/wicai24/DOOR-Alignment

大模型安全拒绝生成越狱攻击对齐优化

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