Skip to main content
QUICK REVIEW

[论文解读] Safety Alignment Should Be Made More Than Just a Few Tokens Deep

Xiangyu Qi, Ashwinee Panda|arXiv (Cornell University)|Jun 10, 2024
Risk and Safety AnalysisDecision Sciences被引用 3
一句话总结

本文识别出‘浅层安全对齐’——即大语言模型的安全性主要依赖于输出的前几个token——作为导致通过对抗后缀、解码攻击和微调实现越狱的核心漏洞。文章提出通过数据增强和约束性微调目标来深化对齐,通过强制在初始token之后仍保持持续的安全性,从而提升对这些攻击的鲁棒性。

ABSTRACT

The safety alignment of current Large Language Models (LLMs) is vulnerable. Relatively simple attacks, or even benign fine-tuning, can jailbreak aligned models. We argue that many of these vulnerabilities are related to a shared underlying issue: safety alignment can take shortcuts, wherein the alignment adapts a model's generative distribution primarily over only its very first few output tokens. We refer to this issue as shallow safety alignment. In this paper, we present case studies to explain why shallow safety alignment can exist and provide evidence that current aligned LLMs are subject to this issue. We also show how these findings help explain multiple recently discovered vulnerabilities in LLMs, including the susceptibility to adversarial suffix attacks, prefilling attacks, decoding parameter attacks, and fine-tuning attacks. Importantly, we discuss how this consolidated notion of shallow safety alignment sheds light on promising research directions for mitigating these vulnerabilities. For instance, we show that deepening the safety alignment beyond just the first few tokens can often meaningfully improve robustness against some common exploits. Finally, we design a regularized finetuning objective that makes the safety alignment more persistent against fine-tuning attacks by constraining updates on initial tokens. Overall, we advocate that future safety alignment should be made more than just a few tokens deep.

研究动机与目标

  • 探究为何当前的大语言模型安全对齐方法尽管经过大量微调和强化学习人类反馈(RLHF),仍容易受到简单攻击的影响。
  • 识别出‘浅层安全对齐’——即对齐效应局限于输出的前几个token——作为这些漏洞的根本原因。
  • 证明许多已知攻击(如对抗后缀、前缀填充、解码参数和微调攻击)均通过操纵初始token来利用这种浅层对齐。
  • 提出方法以将安全对齐扩展至前几个token之后,从而提升鲁棒性。
  • 设计一种约束性微调目标,限制初始token概率的改变,从而增强对基于微调的越狱攻击的抵抗力。

提出的方法

  • 提出一种数据增强策略,包含有害的初始输出响应,随后接以安全的拒绝回应,训练模型从不安全的起始状态中恢复。
  • 提出一种基于偏好建模的正则化微调目标,以对齐模型的策略作为参考,约束初始token概率的更新。
  • 通过缩放后的策略概率对数比的sigmoid函数推导出一个代理目标,利用βt实现类似温度的归一化,以稳定跨序列位置的梯度。
  • 采用Bradley-Terry模型框架定义偏好函数T,偏好那些相对于对齐策略平均值具有更高期望奖励的token。
  • 使用下界代理损失Lθ,实现端到端优化而无需显式值函数学习,确保目标函数可微且可扩展。
  • 将该方法应用于微调场景,显式正则化模型,防止在适应过程中初始几个token的概率分布发生大幅变化。

实验结果

研究问题

  • RQ1为何当前的大语言模型安全对齐方法对诸如对抗后缀和前缀填充等简单攻击仍显脆弱?
  • RQ2对齐模型的安全行为在多大程度上仅由前几个输出token决定?
  • RQ3能否通过深化安全对齐——将影响扩展至前几个token之后——来提升对已知攻击的鲁棒性?
  • RQ4如何通过约束性微调目标减轻基于微调的越狱攻击风险?
  • RQ5初始token分布在此类灾难性对齐失败的发生或防止中起到何种作用?

主要发现

  • 当前的安全对齐主要表现为浅层特性,对齐与未对齐模型之间的主要差异体现在前几个输出token的生成上。
  • 仅通过前缀如‘我无法满足’对未对齐模型进行简单前缀填充,即可使其表现得与完全对齐的模型一样安全,表明浅层对齐的脆弱性。
  • 对抗后缀攻击、解码参数利用和前缀填充攻击均通过操纵初始token分布而成功,证实对齐在前几个token之后并不具备鲁棒性。
  • 微调攻击在有害响应的前几个token上引起最显著的概率分布变化,解释了为何仅需少量微调步骤即可实现越狱。
  • 包含有害到安全过渡的数据增强方法成功深化了对齐,使对齐与未对齐模型在更深层的token位置上产生更大差异,从而提升了鲁棒性。
  • 所提出的约束性微调目标通过正则化初始token概率,显著降低了通过微调攻击实现越狱的风险,提供了一种实用的防御机制。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。