arXiv:2506.07022cs.LGcs.AI2025-06被引 49

让大模型在拒绝恶意指令时不影响正常使用,提升安全与性能的平衡。

AlphaSteer: Learning Refusal Steering with Principled Null-Space Constraint

  • 通过零空间约束学习无害数据的零向量,保持模型通用能力。
  • 利用线性回归构建恶意数据的拒绝方向向量,显著提升防御效果。
  • 理论严谨且实证有效,适合关注模型安全性的研究者与开发者。

随着大语言模型在真实场景中的广泛应用,确保其对恶意提示(尤其是越狱攻击)的拒绝能力对安全可靠使用至关重要。近期,激活转向作为一种有效方法,通过在推理过程中向模型内部激活添加拒绝方向向量,诱导模型产生拒绝行为。然而,盲目应用激活转向会带来安全与效用之间的权衡,因为同一转向向量可能引发对良性提示的过度拒绝,导致性能下降。尽管已有工作如向量校准和条件转向尝试缓解该问题,但其缺乏理论基础,限制了鲁棒性和有效性。为此,我们提出一种理论严谨且实验有效的激活转向方法 AlphaSteer。具体而言,将激活转向视为一个可学习过程,包含两个原则性目标:效用保持与安全性增强。为保持效用,它通过零空间约束学习一个近似零的转向向量作用于良性数据;为增强安全,借助线性回归学习恶意数据的拒绝方向向量。在多个越狱攻击和效用基准上的实验表明,AlphaSteer 在不损害通用能力的前提下显著提升了大模型的安全性。代码已公开于 https://github.com/AlphaLab-USTC/AlphaSteer。

原文摘要 · Abstract (English)

As LLMs are increasingly deployed in real-world applications, ensuring their ability to refuse malicious prompts, especially jailbreak attacks, is essential for safe and reliable use. Recently, activation steering has emerged as an effective approach for enhancing LLM safety by adding a refusal direction vector to internal activations of LLMs during inference, which will further induce the refusal behaviors of LLMs. However, indiscriminately applying activation steering fundamentally suffers from the trade-off between safety and utility, since the same steering vector can also lead to over-refusal and degraded performance on benign prompts. Although prior efforts, such as vector calibration and conditional steering, have attempted to mitigate this trade-off, their lack of theoretical grounding limits their robustness and effectiveness. To better address the trade-off between safety and utility, we present a theoretically grounded and empirically effective activation steering method called AlphaSteer. Specifically, it considers activation steering as a learnable process with two principled learning objectives: utility preservation and safety enhancement. For utility preservation, it learns to construct a nearly zero vector for steering benign data, with the null-space constraints. For safety enhancement, it learns to construct a refusal direction vector for steering malicious data, with the help of linear regression. Experiments across multiple jailbreak attacks and utility benchmarks demonstrate the effectiveness of AlphaSteer, which significantly improves the safety of LLMs without compromising general capabilities. Our codes are available at https://github.com/AlphaLab-USTC/AlphaSteer.

大模型安全激活转向拒绝机制

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