Introduction
The proliferation of foundation models has led to a paradigm where a single base model is fine-tuned into numerous task-specific variants. While effective, maintaining a separate model for every task is computationally and financially prohibitive. Model merging has emerged as a promising alternative, allowing researchers to combine multiple specialized models into a single unified architecture without additional training.
However, existing merging techniques—ranging from simple weight averaging to more complex activation-alignment methods like RegMean—share a fundamental flaw: they treat the network's layers as independent entities. This paper argues that this "simultaneous" merging approach ignores the sequential dependencies inherent in deep neural networks, leading to a degradation in performance that scales with model depth.
The Problem: Merging Covariate Shift (MCS)
Deep networks are inherently sequential; the input to any given layer is the output of the preceding one. When layers are merged simultaneously using statistics derived from the original, unmerged models, a distributional mismatch occurs. If the weights of Layer $n$ are altered during the merge, the activations it produces will differ from those seen during the original fine-tuning. Consequently, Layer $n+1$ receives "shifted" inputs that do not match the statistics used to calculate its own merge parameters.
The authors term this phenomenon Merging Covariate Shift (MCS). Much like internal covariate shift during training, these small discrepancies at early layers propagate and compound as they move through the network.
As shown in Figure 4, the MCS value consistently increases as data travels deeper into the network. This "butterfly effect" explains why previous activation-based methods often struggle to maintain performance in deeper architectures like ViT-L or large language models.
The Solution: Chain of Merges (CoM)
To address MCS, the authors introduce Chain of Merges (CoM). Instead of merging all layers at once, CoM adopts a recursive, sequential strategy. The process follows a "merge-then-forward" loop:
- Recursive Dependence: The first layer is merged. A small calibration batch is then passed through this newly merged layer to generate updated activations. These updated activations are then used to compute the optimal merge for the second layer. This process repeats through the entire depth of the network, ensuring that each layer's merge is optimized for the actual inputs it will receive during inference.
- Activation Normalization: To handle the numerical instability often found in high-dimensional Transformer activations, CoM employs feature normalization and utilizes correlation matrices rather than raw Gram matrices.
- Correlation-Based Importance: CoM automatically determines task weights by analyzing feature correlations. Tasks that have deviated significantly from the base model (indicated by a narrow, highly correlated feature subspace) are assigned higher importance to ensure their specialized knowledge is preserved.
Experimental Results
The authors evaluated CoM across a diverse set of benchmarks, including eight vision classification tasks (using CLIP-based ViT-B and ViT-L) and six natural language processing tasks (using Llama 3-8B).
As demonstrated in Table 1 (Figure 6), CoM achieves state-of-the-art results, particularly in scenarios involving Low-Rank Adaptation (LoRA). On the Llama 3-8B model, CoM reached a normalized accuracy of 99.50%, nearly recovering the full performance of individual fine-tuned models and outperforming the next best baseline by over 5 percentage points. In vision tasks, the gains were even more pronounced, with CoM outperforming competitors like CoreTSV by over 15% on ViT-B/32.
Notably, CoM is exceptionally data-efficient. The recursive statistics can be stabilized with as few as 5 examples per task, making the computational overhead of the sequential forward passes negligible compared to the performance gains achieved.
Conclusion
Chain of Merges represents a shift in how we think about model composition. By recognizing and mitigating Merging Covariate Shift through a recursive, activation-aware framework, CoM preserves the integrity of specialized models far more effectively than simultaneous merging methods. As models continue to grow in depth and complexity, accounting for inter-layer dependencies will be essential for successful model surgery and unification.
Summary updated