Understanding Model Merging: A Unified Generalization Framework for Heterogeneous Experts

Qinglun Li, Anke Tang, Miao Zhang, Mengzhu Wang, Quanjun Yin, Li Shen · DOI

Abstract

Model merging efficiently aggregates capabilities from multiple fine-tuned models into a single one, operating purely in parameter space without original data or expensive re-computation. Despite empirical successes, a unified theory for its effectiveness under heterogeneous finetuning hyperparameters (e.g., varying learning rates, batch sizes) remains missing. Moreover, the lack of hyperparameter transparency in open-source fine-tuned models makes it difficult to predict merged-model performance, leaving practitioners without guidance on how to fine-tune merge-friendly experts. To address those two challenges, we employ $L_2$-Stability theory under heterogeneous hyperparameter environments to analyze the generalization of the merged model $\boldsymbol{x}_{avg}$. This pioneering analysis yields two key contributions: (i) A unified theoretical framework is provided to explain existing merging algorithms, revealing how they optimize specific terms in our bound, thus offering a strong theoretical foundation for empirical observations. (ii) Actionable recommendations are proposed for practitioners to strategically fine-tune expert models, enabling the construction of merge-friendly models within the pretraining-to-finetuning pipeline. Extensive experiments on the ResNet/Vit family across 20/8 visual classification tasks, involving thousands of finetuning models, robustly confirm the impact of different hyperparameters on the generalization of $\boldsymbol{x}_{avg}$ predicted by our theoretical results.

The Challenge of Model Merging

The current AI paradigm relies heavily on "pre-train then fine-tune," leading to a massive ecosystem of specialized models (experts) fine-tuned for specific tasks. Model merging—the process of combining these experts by operating directly on their weights—is a computationally efficient way to aggregate capabilities.

However, model merging is often treated as an "empirical craft" rather than a science. We lack a unified theory to explain why it works, especially when models are trained with heterogeneous hyperparameters like varying learning rates or batch sizes. Furthermore, practitioners often don't know how to fine-tune a model to make it "merge-friendly." This research bridges the gap between empirical success and theoretical understanding.

A Unified Theoretical Framework

The authors employ $L_2$-Stability theory to analyze the generalization of a merged model ($\boldsymbol{x}_{avg}$). Unlike the more common "Uniform Stability" used in learning theory, $L_2$-Stability doesn't require the assumption of bounded gradients, making it far more applicable to the complex loss landscapes of deep learning.

The core of this method is the derivation of a new excess error bound. This mathematical bound decomposes the error of a merged model into two main components:

  1. Model Stability: How sensitive the models are to small changes in their training data.
  2. Gradient Norm (Optimization Error): How well the individual models converged during their local fine-tuning.

By analyzing this bound, the research shows that popular merging algorithms like Task Arithmetic, TIES-Merging, and AdaMerging are actually different strategies for minimizing specific terms within this unified framework. For instance, TIES-Merging (which prunes weights) mathematically reduces "task heterogeneity," a key term in the stability bound.

Comparison of merging algorithms across hyperparameters for CLIP ViT models.

Empirical Validation and Key Results

The researchers conducted an extensive empirical validation involving thousands of fine-tuned models across 20 visual classification tasks using the ResNet family (ResNet-18, 50, 152) and ViT-based models (CLIP). The empirical results almost perfectly matched the trends predicted by the $L_2$-Stability bound.

Impact of hyperparameters on ResNet model merging performance across accuracy and loss metrics.

Key findings include:

  • Learning Rate Sensitivity: The stability penalty is scaled by the square of the learning rate ($\eta_l^2$). High learning rates during fine-tuning often lead to catastrophic results when merging, as predicted by the theory.
  • Data Ratio Impact: Increasing dataset size ($n_i$) is the only hyperparameter that strictly improves merging performance without a trade-off, as it appears in the denominator of the stability term.
  • Batch Size Benefits: Larger batch sizes ($b_i$) generally improved merged performance. While theory suggests a trade-off, the benefit of better gradient estimation from large batches often outweighs the stability risks.
  • The Optimization-Generalization Trade-off: Increasing training steps ($K_i$) helps convergence but makes models more specialized and unstable. This creates an "inverted U-shape" for accuracy: there is an optimal point where a model is trained enough to be useful but not so much that it becomes un-mergeable.

Actionable Recommendations for Practitioners

Based on these insights, the paper provides a "recipe" for creating merge-friendly experts:

  1. Prioritize Data: Use as much data as possible for local fine-tuning to maximize stability.
  2. Moderate Learning Rates: Avoid excessively high learning rates that can cause model collapse during merging.
  3. Optimize Training Duration: Stop fine-tuning once the optimization error is sufficiently low but before the model becomes overly specialized (unstable).
  4. Leverage Large Batches: Use larger batch sizes to improve gradient estimation and overall merged model accuracy.

Conclusion and Future Work

While this framework provides a robust foundation for vision tasks, future work should explore non-smooth loss landscapes and extend these experiments to Large Language Models (LLMs) at scale. Additionally, these theoretical bounds could pave the way for AutoML approaches that automatically determine optimal merging coefficients, removing the need for manual trial and error.

Summary updated

BibTeX
@misc{li2026understanding,
  author = {Qinglun Li and Anke Tang and Miao Zhang and Mengzhu Wang and Quanjun Yin and Li Shen},
  title = {{Understanding Model Merging: A Unified Generalization Framework for Heterogeneous Experts}},
  year = {2026},
  eprint = {2601.21690},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2601.21690},
}
Figure