arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2507.17075cs.AI
收藏

LoRA是实现推理LLM安全对齐的全部需求

LoRA is All You Need for Safety Alignment of Reasoning LLMs

University of California, Los Angeles(加州大学洛杉矶分校)

Yihao Xue, Baharan Mirzasoleiman

AI总结:

LoRA通过在拒绝数据集上进行有监督微调,有效解决推理LLM的安全对齐问题,同时保持推理性能,适用于多种模型和基准测试。

摘要:

具备推理能力的LLM在解决复杂问题上取得了重大突破,但近期研究表明,获取和部署强大的推理能力可能会引入显著的安全风险。一种常见的缓解方法是在学习推理之后应用一个二次安全对齐阶段;然而,安全对齐往往会降低推理性能——这种现象被称为“安全税”。在本工作中,我们展示了一种简单的策略可以大大绕过这种权衡:在拒绝数据集上应用LoRA进行有监督微调。尽管其简单性,这种配方在安全性和推理性能上都与全模型对齐相当,且结果在多种模型大小和架构、两个安全基准和四个涵盖数学、科学和代码生成的推理基准上均成立。我们进一步分析了LoRA配置,并发现(1)秩1更新足以实现最佳的安全推理权衡,(2)仅对MLP上投影层应用LoRA可以优于更新整个MLP,(3)更新中间层比更新早期或晚期层更有效。最后,我们提供了一种理论分析,帮助理解LoRA何时和为何有效,揭示了在finetuning任务中超出秩预算(使用比所需更大的秩)会以与基础任务的内在维度成反比的速率导致基础任务退化。这表明LoRA在基础任务低秩且基础能力高秩时效果最佳。

英文摘要:

Reasoning-capable LLMs have achieved major breakthroughs in solving complex problems, but recent work shows that acquiring and deploying strong reasoning can introduce significant safety risks. A common mitigation is to apply a secondary safety-alignment phase after reasoning is learned; however, safety alignment often degrades reasoning performance--a phenomenon known as the "Safety Tax". In this work, we show that a simple approach can largely bypass this trade-off: applying LoRA during SFT on refusal datasets. Despite its simplicity, this recipe achieves safety comparable to full-model alignment while preserving reasoning performance close to the original reasoning-tuned model, and the result holds across multiple model sizes and architectures, two safety benchmarks, and four reasoning benchmarks spanning mathematics, science, and code generation. We further ablate LoRA configurations and find that (1) rank-1 updates are sufficient to achieve the best safety-reasoning trade-off, (2) applying LoRA only to the MLP up-projection layers can outperform updating the full MLP, and (3) updating middle layers is more effective than updating early or late layers. Finally, we provide a theoretical analysis that helps understand when and why LoRA works, revealing that overshooting the rank budget (using a larger rank than needed for the finetuning task) induces base-task degradation at a rate inversely proportional to the intrinsic dimensionality of the base task. This suggests LoRA is most effective when the finetuning task is low-rank and the base capability is high-rank.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑