Merging pre and post-fine-tuned LLMs creates safer models without safety data overhead.
This paper proposes, a simple two-step approach preserves safety in fine-tuned LLMs by merging weights of pre- and post-fine-tuned models, maintaining performance without extra safety data.
-----
https://arxiv.org/abs/2412.19512
π Original Problem:
Fine-tuning LLMs on downstream tasks often degrades their safety alignment, even with benign datasets. Current solutions require additional safety data, which is impractical and resource-intensive.
-----
π οΈ Solution in this Paper:
β Step 1: Fine-tune base model on downstream tasks using standard supervised fine-tuning
β Step 2: Merge the weights of pre- and post-fine-tuned safety-aligned models using interpolation
β The merging ratio Ξ» determines contribution between base and fine-tuned models
β Linear merging showed strong results compared to complex methods like SLERP and DARE
β Optimal merging ratio found around 0.5~0.6, balancing safety and task performance
-----
π‘ Key Insights:
β Safety can be preserved without additional safety data
β Simple linear merging outperforms complex methods
β Method works across multiple model sizes and families
β Trade-off exists between task performance and safety based on merging ratio
-----
π Results:
β Reduced Attack Success Rate by up to 30% while maintaining task performance
β Effective across 4 downstream tasks: reasoning, medical assistance, code generation, tool usage
β Successfully tested on Llama-3-8B, Llama-3.1-8B, and Gemma-2B models
------
Are you into AI and LLMsβ Join my daily AI newsletter. I will send you 7 emails a week analyzing the highest signal AI developments. ββ
π https://rohanpaul.substack.com/










