用零阶优化提升大模型安全对齐的抗干扰能力
Aligned but Fragile: Enhancing LLM Safety Robustness via Zeroth-Order Optimization

- 先用常规方法对齐安全,再通过零阶优化微调增强鲁棒性
- 仅需少量迭代即可显著提升对抗参数噪声等扰动的稳定性
- 可定位关键层并精准更新,效率高适合实际部署
大语言模型的安全对齐旨在降低有害行为,同时保持通用能力。然而,近期研究发现对齐效果易受干扰:如参数噪声、激活噪声或量化等轻量级后处理操作,就可能削弱预期的安全行为。现有方法多聚焦于数据筛选、目标函数调整及关键参数识别,而忽视了优化器本身的作用。本文首次从优化器视角研究安全对齐的鲁棒性,提出利用零阶优化在扰动下评估对齐效果,从而提供面向鲁棒性的信号。我们设计混合框架:先进行标准的一阶安全对齐,再以零阶优化进行微调。理论与实证均表明,仅需少数零阶步骤即可显著提升鲁棒性且不损害原有安全对齐效果。进一步通过扰动评估挖掘层间鲁棒性敏感度,实现对关键层的聚焦更新,大幅降低训练开销。
原文摘要 · Abstract (English)
Safety alignment for large language models (LLMs) aims to reduce harmful or unsafe behavior while preserving general utility. However, recent findings reveal that alignment effects can be fragile: lightweight post-alignment manipulations, such as parameter noise, activation noise, or quantization, can easily weaken the intended safety behavior. Prior efforts to improve robustness have primarily focused on data curation, modified alignment objectives, and safety-critical parameter identification, leaving the role of the optimizer itself largely unexplored. In this paper, we are the first to study the robustness of safety alignment from the perspective of the base optimizer. This optimizer-centric view naturally points to zeroth-order optimization, which provides a robustness-oriented signal by evaluating safety alignment under perturbations. Based on this insight, we propose a hybrid framework that first performs standard first-order safety alignment and then applies zeroth-order refinement to improve robustness. Both theoretically and empirically, we show that only a few zeroth-order refinement steps can enhance robustness while preserving safety alignment. We further improve the efficiency of zeroth-order refinement by exploiting its inherent perturbation-based evaluations to estimate layer-wise robustness sensitivity, enabling the refinement process to concentrate updates on robustness-critical layers with modest training overhead.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。