arXiv:2510.18081cs.LGcs.AI2025-10被引 2

让大模型在任意生成深度都保持安全拒绝能力。

Any-Depth Alignment: Unlocking Innate Safety Alignment of LLMs to Any-Depth

  • 通过重引入对齐关键令牌,实现推理时的安全防护。
  • 对抗性前缀攻击下拒绝率接近100%,攻击成功率低于3%。
  • 无需修改模型参数,适用于各类开源大模型。

大型语言模型(LLMs)表现出强但浅层的安全对齐:当有害请求在助手回复起始处即可识别时,模型会直接拒绝;然而一旦有害内容已开始生成(如通过对抗攻击或有害前缀攻击),这种保护机制即失效。这引发一个根本问题:能否将模型固有的浅层对齐能力拓展至任意生成深度?为此,我们提出任意深度对齐(Any-Depth Alignment, ADA),一种高效、开销极小的推理时防御方法。基于观察发现,对齐信息集中于助手头令牌,这些令牌蕴含模型强大的对齐先验。通过在生成中途重新引入这些令牌,ADA 能促使模型重新评估危害性并恢复拒绝行为。在 Llama、Gemma、Mistral、Qwen、DeepSeek 及 gpt-oss 等多种开源模型上,ADA 实现了鲁棒的安全性能,无需修改基座模型参数。其对数十至数千令牌的挑战性对抗前缀攻击拒绝率达近100%,显著降低主流对抗提示攻击(如 GCG、AutoDAN、PAIR、TAP)的成功率至3%以下。同时,对良性任务保持良好可用性,仅产生轻微过度拒绝。即使在后续指令微调(良性或对抗性)后,该韧性仍得以维持。

原文摘要 · Abstract (English)

Large Language Models (LLMs) exhibit strong but shallow alignment: they directly refuse harmful queries when a refusal is expected at the very start of an assistant turn, yet this protection collapses once a harmful continuation is underway (either through the adversarial attacks or via harmful assistant-prefill attacks). This raises a fundamental question: Can the innate shallow alignment in LLMs be unlocked to ensure safety at arbitrary generation depths? To achieve this goal, we propose Any-Depth Alignment (ADA), an effective inference-time defense with negligible overhead. ADA is built based on our observation that alignment is concentrated in the assistant header tokens through repeated use in shallow-refusal training, and these tokens possess the model's strong alignment priors. By reintroducing these tokens mid-stream, ADA induces the model to reassess harmfulness and recover refusals at any point in generation. Across diverse open-source model families (Llama, Gemma, Mistral, Qwen, DeepSeek, and gpt-oss), ADA achieves robust safety performance without requiring any changes to the base model's parameters. It secures a near-100% refusal rate against challenging adversarial prefill attacks ranging from dozens to thousands of tokens. Furthermore, ADA reduces the average success rate of prominent adversarial prompt attacks (such as GCG, AutoDAN, PAIR, and TAP) to below 3%. This is all accomplished while preserving utility on benign tasks with minimal over-refusal. ADA maintains this resilience even after the base model undergoes subsequent instruction tuning (benign or adversarial).

大模型安全对抗攻击对齐机制

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