Model Merging
AI Engineer path · lesson 100 of 124Combine models by mixing their parameters rather than their outputs. Build a task vector, use task arithmetic to add a capability or subtract one, interpolate along a sphere instead of a straight line, and see why TIES keeps only the top 20%.
Key insight
Without further finetuning, model merging can be done without GPUs. That single property is why it became an indie-developer technique rather than a lab one — the expensive part of making a new model was the training run, and merging skips it.
What does this merge method need?
Sort each method by whether it needs a common base model.
Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.
Needs a shared base model
Drop items hereWorks without one
Drop items hereTest your knowledge
Merging differs from ensembling in that merging combines:
The short version
Blending paint rather than hanging two paintings side by side. Ensembling keeps both canvases and asks a judge which to look at; merging mixes the pigments into one tin. The tin is cheaper to carry — and mixing badly gives you brown.
In more depth
Model Merging
Finetuning alters one model; merging combines several, by mixing parameters rather than outputs.
Merging vs ensembling
| Merging | Ensembling | |
|---|---|---|
| What is combined | Parameters | Only outputs |
| Constituent models | Cease to exist | Stay intact |
| Inference cost | One call | Multiple calls per request |
Without further finetuning, merging can be done without GPUs — which is why it became an indie-developer technique. Many models at the top of Hugging Face's Open LLM Leaderboard are merges.
Multi-task finetuning, three ways
Approach 1 — Summing
Merge(A,B) = (W_A·A + W_B·B) / (W_A + W_B). Studied as early as Perrone (1993). Model soups (Wortsman et al., 2022): averaging whole weights improves accuracy without increasing inference time. Rescale first if parameter ranges differ.Approach 2 — Layer stacking (passthrough, frankenmerging)
Typically requires further finetuning.
Approach 3 — Concatenation
Two LoRA adapters of ranks r₁ and r₂ give rank r₁ + r₂. Not recommended — no memory saving versus serving separately.
Interview Questions
References & Further Reading
Love this visualization?
Sign up to track your progress, earn achievements, use the AI assistant, and access your personal learning dashboard.
100% free • No credit card required