Abstract
Large Language Models (LLMs) have demonstrated impressive capabilities, but their high computational costs pose challenges for customization. Model merging offers a cost-effective alternative, yet existing methods suffer from interference among parameters, leading to performance degradation. In this work, we propose Optimal Brain Iterative Merging (OBIM), a novel method designed to mitigate both intra-model and inter-model interference. OBIM consists of two key components: (1) A saliency measurement mechanism that evaluates parameter importance based on loss changes induced by individual weight alterations, reducing intra-model interference by preserving only high-saliency parameters. (2) A mutually exclusive iterative merging framework, which incrementally integrates models using a binary mask to avoid direct parameter averaging, thereby mitigating inter-model interference. We validate OBIM through experiments on both Supervised Fine-Tuned (SFT) models and post-pretrained checkpoints. The results show that OBIM significantly outperforms existing merging techniques. Overall, OBIM provides an effective and practical solution for enhancing LLM merging.
Introduction
Model merging has emerged as a "budget-friendly" strategy for creating multi-talented LLMs. Instead of the prohibitive expense of multi-task training, researchers can fuse specialized "expert" models (e.g., for math or code) into a single architecture. However, traditional merging techniques frequently suffer from two types of performance-degrading interference:
- Intra-model interference: LLMs are typically over-parameterized, containing redundant weights that act as noise during merging.
- Inter-model interference: Direct weight averaging often results in parameter values that are suboptimal for all constituent tasks. Even sophisticated methods like TIES struggle when weights lack clear sign conflicts, often defaulting to simple averaging that degrades performance.
The OBIM Framework
To address these challenges, we introduce Optimal Brain Iterative Merging (OBIM), which utilizes two core components to preserve specialized knowledge while minimizing noise.
Optimal Brain Merging (OBM)
Inspired by "Optimal Brain Damage" pruning, OBM identifies salient parameters by measuring the impact of weight removal on layer outputs. Unlike magnitude-based approaches, OBM uses a second-order derivative approximation (the Hessian matrix via MSE) on a small validation set. This allows the identification of "quiet" but vital weights that are essential for task performance.
Mutually Exclusive Iterative Merging (IM)
To prevent models from competing for the same parameter slots, IM integrates models sequentially. For each model, the most salient available parameters are selected and "locked" using a binary mask. This ensures that each parameter index is dedicated to a single model's specialized knowledge, bypassing the pitfalls of weight averaging. A rotation strategy is employed at each layer to ensure a fair distribution of influence across the entire network.
Experimental Evaluation
We evaluated OBIM across two primary scenarios:
- SFT Models: Merging Llama-2-13B variants: WizardLM (instructions), WizardMath (math), and Code Alpaca (code).
- Post-pretrained Models: Merging Qwen2-7B checkpoints further trained on a 200B+ token multilingual dataset (English, Chinese, and Japanese).
- Benchmarks: Performance was measured using AlpacaEval, MMLU, GSM8K, MATH, HumanEval, MBPP, C-Eval, and JP-LMEH.
Results and Discussion
OBIM consistently outperformed state-of-the-art merging techniques like TIES, DARE, and PCB.
Key Findings:
- Superior Math and General Performance: On SFT tasks, OBIM achieved a 45.23 average score, surpassing the next best method (PCB) by nearly 2 points. It improved GSM8K performance by 5.15% over the original math expert.
- Multilingual Recovery: In Qwen2 experiments, OBIM was the only method to simultaneously improve English and Japanese performance while maintaining strong Chinese scores.
- Robustness to Scaling: OBIM remained stable as the number of merged models increased (up to 6), whereas methods like DARE experienced significant performance degradation.
Conclusion
OBIM demonstrates that saliency-based selection is superior to weight magnitude for identifying important parameters. By treating merging as a resource allocation problem rather than an averaging task, OBIM preserves the specialized distributions of expert models. While OBIM requires a validation set for saliency computation and is currently limited to models sharing the same base architecture, it provides a practical and effective solution for high-performance LLM merging.
Summary updated