Imagine you have two fine-tuned large language models: one is an expert at writing Python code, and the other is an expert at composing medical research summaries. If you want a single system capable of doing both, the traditional solution is ensembling. You deploy both models in parallel, pass the input to both, and aggregate their outputs.
While ensembling works well, it comes with a severe penalty: your computational cost, memory footprint, and inference latency scale linearly with the number of models.
What if, instead of combining the outputs of these models, you could directly combine their weights? Merging multiple specialized neural networks into a single set of parameters would deliver the multi-task benefits of an ensemble at the inference cost of a single model.
Historically, averaging the weights of different neural networks resulted in complete failure. However, a powerful realization has changed this: when models share a common pre-trained starting point, their weights can be combined arithmetically to merge their capabilities.
The Geometry of Merging: Linear Mode Connectivity
If you train two neural networks from scratch on the same dataset, they will arrive at completely different local minima in the loss landscape. Because neural networks are highly non-linear and possess vast permutation symmetries, the path between these two minima is obstructed by high-loss barriers. Averaging their weights lands you on a "mountain" of high loss, yielding a model that performs no better than random noise.
The paradigm shifts entirely when models are fine-tuned from the same pre-trained base model. Because they begin at the exact same coordinates in the parameter space, their subsequent fine-tuning trajectories remain within a shared, low-loss basin. This phenomenon is known as Linear Mode Connectivity.
As shown in Diffusion Soup, fine-tuning operates within a locally linear region of the weight space. Because of this local linearity, taking a linear combination of different fine-tuned weight sets does not destroy the underlying representations. Instead, it smoothly interpolates their capabilities.
By optimizing for this connectivity between disparate weight states, as explored in MergeTune, researchers can integrate specialized capabilities into a single set of parameters, bypassing the increased inference latency typically associated with model ensembles.
Models as Code: Task Vectors and Parameter Arithmetic
Because fine-tuned models remain geometrically connected to their base model, we can isolate the exact changes made during training. If we subtract the base model weights ($W_{\text{base}}$) from the fine-tuned weights ($W_{\text{task}}$), we are left with a task vector ($\Delta W$):
$$\Delta W = W_{\text{task}} - W_{\text{base}}$$
This task vector acts as a modular package of knowledge. Rather than treating a neural network as an opaque blob of data, we can treat these vectors as arithmetic objects that can be added, subtracted, or scaled.
In Decouple-Then-Merge, Qianli Ma et al. demonstrate this by computing the parameter-space difference between specialized "expert" diffusion models and a shared base model. By linearly combining these task vectors and adding them back to the base weights, a single architecture gains the benefits of a model ensemble without incurring additional computational or memory overhead during inference. Similarly, Tangent Model Composition for Ensembling and Continual Fine-tuning treats fine-tuning as independent parameter perturbations relative to a common starting point, allowing parallelized updates to be merged seamlessly.
This perspective allows machine learning workflows to mirror modern software engineering practices. Git-Theta: A Git Extension for Collaborative Development of Machine Learning Models tracks changes at the individual parameter-group level, enabling version control features like meaningful diffs and automatic model merging. As argued in Foundation Model Engineering: Engineering Foundation Models Just as Engineering Software, treating models as mergeable code branches allows developers to synthesize knowledge from multiple contributors into a single unified checkpoint without retraining the entire network from scratch.
[ Pre-trained Base Model (W_base) ]
/ \
/ \
Fine-tune on Task A Fine-tune on Task B
/ \
v v
[ Model A (W_A) ] [ Model B (W_B) ]
\ /
\ /
Extract Task Vectors: ΔW_A = W_A - W_base
ΔW_B = W_B - W_base
\ /
v v
[ Merged Model: W_base + α(ΔW_A) + β(ΔW_B) ]
Resolving Parameter Conflicts
While simple linear averaging ($\frac{W_A + W_B}{2}$) works surprisingly well in locally linear regions, it assumes that every parameter is equally important to every task. In reality, a weight that is critical for Task A might undergo a minor, structural adjustment during Task B's training. Naively averaging them can dilute or overwrite crucial features, leading to interference and performance degradation.
To resolve these conflicts, researchers have developed advanced aggregation mechanisms that move beyond simple averaging:
- Information-Geometric Weighting: In Merging Models with Fisher-Weighted Averaging, the authors use the Fisher Information Matrix to measure how sensitive a model's performance is to changes in specific parameters. When merging, weights that are highly critical for a specific task are heavily protected, while less important weights are allowed to adapt to accommodate the other model's knowledge.
- Data-Free Closed-Form Solutions: The RegMean method, introduced in Dataless Knowledge Fusion by Merging Weights of Language Models, computes a closed-form solution based on linear regression. It minimizes the target prediction differences between the merged model and the individual specialists using only the models' internal statistics, providing a privacy-preserving and computationally efficient alternative to multi-task learning.
- Constrained Optimization: When scaling up to merge a large library of models, FW-Merging: Scaling Model Merging with Frank-Wolfe Optimization formulates the blending process as a constrained optimization problem. By leveraging the Frank-Wolfe algorithm, it iteratively selects and mixes the most relevant model parameters under a constant memory overhead, avoiding the linear scaling bottlenecks of traditional multi-task training.
Applications and Extensions
Weight-space merging has unlocked new capabilities across a variety of domains, proving that specialized knowledge can be consolidated post-hoc without joint training.
Multimodal and Hybrid Reasoning
In Multi-Modality Expansion and Retention for LLMs through Parameter Merging and Decoupling, Jianming Li et al. use parameter merging and binary masks to consolidate independent vision, audio, video, and point-cloud models into a single architecture, preserving nearly all original performance without joint fine-tuning.
Similarly, Haotian Luo et al. demonstrate in Ada-R1: Hybrid-CoT via Bi-Level Adaptive Reasoning Optimization that a linear weight merge between a model specialized in long-form chain-of-thought and one fine-tuned for concise responses allows a single parameter set to dynamically support multiple reasoning depths.
Trajectory Averaging and Flat Minima
Weight merging is also highly effective when applied to checkpoints from the same training run. In Improving Consistency-Based Semi-Supervised Learning with Weight Averaging and There Are Many Consistent Explanations of Unlabeled Data: Why You Should Average, Ben Athiwaratkun et al. show that averaging model weights across different training iterations acts as a powerful regularizer.
Instead of settling on a single point along the optimization path, averaging weights along the trajectory steers the model toward broader, "flat minima" in the loss landscape. This captures the predictive diversity of an ensemble within a single, highly stable model footprint.
Distributed and Library-Scale Aggregation
By eliminating the need to share raw training data, weight-space aggregation serves as a foundational tool for decentralized collaboration. Gideon Mann et al. show in Efficient Large-Scale Distributed Training of Conditional Maximum Entropy Models that training independent models on separate data shards and averaging their weight vectors at the end reduces network traffic by orders of magnitude while matching the accuracy of centralized training.
To scale this to massive repositories of pre-trained models, Zoo-Tuning: Adaptive Transfer from A Zoo of Models utilizes parameter-level aggregation to dynamically combine the internal weights of an entire model library, allowing a single target architecture to capture diverse feature representations without a linear increase in inference costs.