Start studying
Module 10 · Fine-Tuning Module contents
Module 10  ·  Card 9 / 15advanced

Model Merging

Two models fine-tuned from the same base can be combined by averaging their weights.

No training and no data are needed, which is why merging spread so quickly.

Task arithmetic treats the change made by fine-tuning as a vector that can be added or subtracted.

Merging works because the fine-tuned models stay in the same region of weight space as their shared base.

Merge models from different bases and you get noise, since the weights mean different things.

Learn in depth ↓
Module 10 · Fine-Tuning · 15 concepts
In depth  /  15 lines

Model Merging, in more detail

Model merging combines several fine-tuned models into one without any further training.

The requirement is that all of them descend from the same base checkpoint.

The simplest method averages the corresponding weights, which is often called model soup.

It sounds like it should not work, and for independently trained networks it does not.

It works here because fine-tuning moves weights only a short distance from the shared starting point.

The fine-tuned models therefore sit in the same broad basin, where the path between them stays low in loss.

Task arithmetic makes the idea explicit by subtracting the base weights from a fine-tuned model.

What remains is a task vector, the change that fine-tuning made and nothing else.

Those vectors can be added to give a model both skills, or subtracted to remove a behaviour.

Fine-tuned models often change overlapping parameters, and naive averaging lets them cancel.

Methods such as TIES trim the small changes and resolve sign conflicts before combining.

DARE drops most of the delta at random and rescales the rest, which is surprisingly effective.

Merging is cheap enough to run on a laptop, which is why open model hubs are full of merges.

It also composes with adapters, since separate LoRA modules can be merged the same way.

The limits are real: capabilities can degrade unpredictably, so a merge needs evaluating like any other model.

Deep dive

What is underneath Model Merging

Averaging weights, and why that is not absurd

θmerged=1n∑i=1nθi\boldsymbol{\theta}_{\mathrm{merged}} = \frac{1}{n} \sum_{i=1}^{n} \boldsymbol{\theta}_i

Averaging the weights of two independently trained networks produces noise, because their hidden units are arbitrarily permuted and nothing lines up.

θi=θbase+Δi\boldsymbol{\theta}_i = \boldsymbol{\theta}_{\mathrm{base}} + \Delta_i

Averaging two fine-tunes of the same base model does work, because both started from the same point and never travelled far enough to leave its basin.

That is the precondition for everything here: a shared ancestor, and updates small enough that the loss surface between them stays low.

Task arithmetic

τi=θi−θbase\boldsymbol{\tau}_i = \boldsymbol{\theta}_i - \boldsymbol{\theta}_{\mathrm{base}}

The difference between a fine-tune and its base is a task vector, and it behaves surprisingly like a vector.

θ′=θbase+∑iλiτi\boldsymbol{\theta}' = \boldsymbol{\theta}_{\mathrm{base}} + \sum_i \lambda_i \boldsymbol{\tau}_i

Adding two task vectors gives a model with both capabilities. Subtracting one removes a behaviour, which is how unlearning by negation is done.

λ≈0.3 to 1.0\lambda \approx 0.3 \text{ to } 1.0

The scaling coefficients matter. Summing several task vectors at full strength overshoots, because their updates overlap in the same parameters.

The interference problem, and TIES

Two task vectors often want to move the same parameter in opposite directions, and averaging them lands on zero, which serves neither task.

  1. Trim each task vector to its largest magnitude entries, usually the top 20 percent.
  2. For each parameter, take the sign that carries the most total magnitude across tasks.
  3. Average only the entries agreeing with that elected sign.
  4. Add the result to the base, scaled by a coefficient.

Most entries of a task vector are near zero and are noise rather than signal, so trimming loses little and removes most of the conflict.

SLERP, for two models

θ(t)=sin⁡((1−t)Ω)sin⁡Ωθ1+sin⁡(tΩ)sin⁡Ωθ2\boldsymbol{\theta}(t) = \frac{\sin\big((1-t)\Omega\big)}{\sin \Omega} \boldsymbol{\theta}_1 + \frac{\sin(t\Omega)}{\sin \Omega} \boldsymbol{\theta}_2
  • Ω\Omega: the angle between the two weight vectors.

Spherical interpolation follows the arc rather than the chord, which preserves the norm of the weights instead of shrinking it towards the midpoint.

Linear interpolation of two normalised directions produces something shorter than both, and in a network that reads as a uniform loss of signal strength.

Why anybody does this

The whole cost is one weighted sum, with no gradients.

Merging needs no training data, no GPU time beyond loading the weights, and no labels. It takes minutes.

A model soup averages many fine-tunes with different hyperparameters.

Averaging several runs that differ only in seed and learning rate reliably beats picking the best single run, at no inference cost, unlike an ensemble.

The limits are real.

Models must share an architecture and a tokeniser, and capabilities that genuinely conflict cannot both survive.

The result has to be evaluated, because nothing about the procedure guarantees it works.

Test yourself

One question on this card. Every option explains itself once you pick, right or wrong.

Question 1
Why can two fine-tuned models be merged by averaging their weights?
Fine-Tuning

15 concepts in this module, then a graded test with every answer explained.

Study this module →
↑↓ move↵ openesc close