arXiv:2603.07445cs.CLcs.LG2026-03KDD被引 4

通过约束安全词元信心,微调时保持大模型安全对齐。

Few Tokens, Big Leverage: Preserving Safety Alignment by Constraining Safety Tokens during Fine-tuning

  • 仅约束少量安全相关词元的输出置信度,保留其他词元自由调整。
  • 在无害数据上微调也能避免拒绝行为退化,保持对有害请求的拒绝率。
  • 适合需安全对齐又不牺牲任务性能的场景,如医疗、金融对话系统。

大型语言模型(LLMs)常需微调以适配下游任务,但微调可能引发安全对齐漂移,即使训练数据全为无害内容。已有研究发现,引入极小比例的有害数据即可显著削弱模型拒绝行为,使其响应有害请求。现有防御方法多依赖全局干预,如限制参数更新或注入额外安全数据,往往损害模型通用性与任务表现。为此,我们提出一种名为基于约束词元保护安全对齐(PACT)的微调框架。该方法基于实证观察:安全对齐行为体现在模型对少数安全相关词元的输出置信度上。微调过程中,我们强制模型在每一步生成中匹配参考模型对安全词元的信心水平,同时不限制非安全词元,以保障任务适应能力。此针对性约束有效防止对齐漂移,且无需全局限制,避免性能损失。代码已开源于 {https://github.com/Glresearch1/PACT}。

原文摘要 · Abstract (English)

Large language models (LLMs) often require fine-tuning (FT) to perform well on downstream tasks, but FT can induce safety-alignment drift even when the training dataset contains only benign data. Prior work shows that introducing a small fraction of harmful data can substantially compromise LLM refusal behavior, causing LLMs to comply with harmful requests. Existing defense methods often rely on model-wide interventions, such as restricting which parameters are updated or injecting additional safety data, which can limit generality and degrade downstream task performance. To address these limitations, we propose a fine-tuning framework called Preserving Safety Alignment via Constrained Tokens (PACT), which stabilizes the model's confidence on safety tokens. Our approach is motivated by the empirical observation that safety-aligned behavior is reflected in the model's token-level output confidence and is often concentrated on a small subset of safety-related tokens. During downstream fine-tuning, we regularize the fine-tuned model to match the aligned reference model's confidence on safety-related tokens at each response step, while leaving non-safety tokens largely unconstrained to allow effective task adaptation. This targeted constraint prevents alignment drift without imposing global restrictions that typically trade off with model utility. Our code is available at {https://github.com/Glresearch1/PACT}.

安全对齐微调词元约束大模型

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