Averaging weights, and why that is not absurd
Averaging the weights of two independently trained networks produces noise, because their hidden units are arbitrarily permuted and nothing lines up.
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
The difference between a fine-tune and its base is a task vector, and it behaves surprisingly like a vector.
Adding two task vectors gives a model with both capabilities. Subtracting one removes a behaviour, which is how unlearning by negation is done.
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.
- Trim each task vector to its largest magnitude entries, usually the top 20 percent.
- For each parameter, take the sign that carries the most total magnitude across tasks.
- Average only the entries agreeing with that elected sign.
- 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
- : 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.