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

SafeMERGE: 通过选择性层间模型融合在微调大语言模型中保持安全对齐

SafeMERGE: Preserving Safety Alignment in Fine-Tuned Large Language Models via Selective Layer-Wise Model Merging

Technical University Munich(慕尼黑技术大学);IBM Research(IBM研究院)

Aladin Djuhera, Swanand Ravindra Kadhe, Farhan Ahmed, Syed Zawad, Holger Boche

AI总结:

本文提出SafeMERGE,一种轻量级后微调框架,通过选择性融合层间模型来恢复安全对齐,同时保持下游性能,减少有害输出并提升实用性。

摘要:

微调大语言模型(LLMs)是将通用模型适应专业领域的主要方法。然而,近期研究表明微调会削弱安全对齐,导致LLMs对有害或不道德的提示作出回应。许多方法试图重新对齐安全,但通常引入难以实现的定制算法或影响任务实用性。在本工作中,我们提出SafeMERGE,一种轻量级、后微调框架,能够在模型层偏离安全行为时选择性地融合微调后的安全对齐层。在四个LLMs和多个任务上,SafeMERGE一致减少了有害输出,对实用性的影响微乎其微甚至积极。我们的结果表明,选择性、分层的融合为防止微调过程中无意的安全损失提供了稳健的保障,确立了SafeMERGE作为简单而有效的后微调防御方法。

英文摘要:

Fine-tuning large language models (LLMs) is a common practice to adapt generalist models to specialized domains. However, recent studies show that fine-tuning can erode safety alignment, causing LLMs to respond to harmful or unethical prompts. Many methods to realign safety have been proposed, but often introduce custom algorithms that are difficult to implement or compromise task utility. In this work, we propose SafeMERGE, a lightweight, post-fine-tuning framework that restores safety while maintaining downstream performance. SafeMERGE selectively merges fine-tuned with safety-aligned model layers only when they deviate from safe behavior, measured by a cosine similarity criterion. Across four LLMs and several tasks, SafeMERGE consistently reduces harmful outputs compared to other defenses, with negligible or even positive impact on utility. Our results demonstrate that selective, layer-wise merging offers a robust safeguard against the inadvertent loss of safety during fine-tuning, establishing SafeMERGE as a simple yet effective post-fine-tuning defense.

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

↑