What is model merging?
Model merging is a technique that combines the weights of two or more models with the same architecture, usually fine-tuned from the same base model, into a single model using arithmetic methods without extra training, bringing their capabilities together.
Unlike ensemble learning, which keeps models separate and combines their outputs at inference so several models run per request, model merging folds weights into one model, keeping inference cost at that of a single model.
- Topic
- Machine learning, models and training
- Also known as
- Weight merging, model soup
How model merging works
- The models are checked to share the same architecture and compatible weight layout.
- The simplest method averages their weights.
- Task arithmetic computes each fine-tuned model's difference from the base as a task vector, adding weighted vectors to the base.
- Some methods prune small changes and resolve changes with conflicting signs to reduce interference between tasks.
In more detail
SLERP, DARE and evolutionary merge recipes
Beyond simple averaging, task arithmetic and TIES-Merging, widely used production techniques include SLERP (Spherical Linear Interpolation), DARE (randomly dropping delta weights and rescaling before merging) and evolutionary recipe search to automatically tune layer-wise merge ratios across benchmarks.
The risk of eroding safety alignment
Merging fine-tuned models can inadvertently weaken safety guardrails and refusal behaviour inherited from the base model, even when neither source model was trained on unsafe data. Post-merge safety red-teaming is therefore as important as task-accuracy evaluation.
The linear mode connectivity limit
Weight-space merging assumes models share the same initialisation basin (linear mode connectivity); attempting to merge models trained from divergent bases or different tokenisers generally collapses performance unless permutation alignment is used.
Commonly confused terms
| Term | How it differs |
|---|---|
| Knowledge distillation | Knowledge distillation trains a student model on outputs or representations from one or more teacher models using data and GPU gradient updates, whereas model merging performs training-free arithmetic directly on weight tensors. |
| MoE upcycling | Mixture-of-Experts (MoE) upcycling combines dense checkpoints as routed expert sub-networks within a larger sparse architecture and usually requires further training, whereas weight merging produces a single dense checkpoint of identical size. |
Why model merging matters for on-premises AI
Model merging is cheap because it needs no GPU retraining; it can run in-house on weight files. Combining models fine-tuned separately for different tasks into one can simplify serving infrastructure and the model inventory. It has risks: tasks can interfere, so the merged model may do worse than its sources on some tasks; each task is therefore evaluated separately. Source model licences may also apply to the merged model, so they are checked.
A logistics company merges two models fine-tuned from the same open-weight base, one classifying shipment emails and one summarising delivery notes, using task arithmetic; the merged model is tested on both tasks and logged in the model registry with its source versions.
Common questions
How does model merging differ from ensemble learning?
Ensemble learning keeps models separate while combining outputs. Model merging folds weights into one model, so only one model runs at inference.
Can any models be merged?
No. They need the same architecture and compatible weight layout; usually they are expected to derive from the same base model.
Related terms
Sources
- Wortsman et al., Model soups: averaging weights of multiple fine-tuned models improves accuracy without increasing inference time, 2022
- Ilharco et al., Editing Models with Task Arithmetic, 2022
- Yadav et al., TIES-Merging: Resolving Interference When Merging Models, 2023
In the glossary: Glossary, M to Q