Combining fine-tuned checkpoints
hard 6 minFine-tuning moves a checkpoint away from a shared base.
Video lesson · Chapter 1 of 4
The changes cancel at ten
Theory
Read or listen first. About 2 min.
What it is
Fine-tuning moves a checkpoint away from a shared base. Merging combines weights or the differences from that base using an explicit rule. Linear averages, spherical interpolation, sign-aware merging and sparsified deltas behave differently when source updates conflict.
Why it exists
Check architecture, tokenizer and training lineage before interpreting any arithmetic. Record the recipe and evaluate each source task, because a model that retains an average score can still erase one specialized capability.
When two adapters disagree on a weight
Inside this chapter
Chapter sources- What is Model Merging?
- Model merging combines compatible checkpoints in weight space. A shared base and aligned parameter shapes make task deltas meaningful. Check tokenizer, architecture and fine-tuning history before combining weights. Evaluate each source task afterward because two useful updates can interfere when added together.
Two checkpoints fine-tuned from the same base usually stay in the same region of weight space, so their differences from the base (task vectors) can be added without retraining. That only makes sense when every tensor lines up: same architecture, same shapes, same tokenizer and the same base revision. Merging checkpoints from different bases produces numbers that average fine but mean nothing. Always re-run each source task afterwards, because one delta can overwrite another.
Example. From base 10, checkpoints 12 and 13 have task deltas +2 and +3. Equal weighting of the deltas produces 12.5.
Another example. A support adapter and a billing adapter, both from the same base revision, are merged into one checkpoint so the gateway serves one model instead of two. The merge is accepted only if both task suites stay within an agreed margin of their source models.
Merge the deltas, not the raw checkpoints
One coordinate shown. The same rule runs over every aligned parameter. - SLERP Algorithm
- Spherical linear interpolation follows an arc between normalized parameter directions. The interpolation coefficient selects a point on that arc. Near-parallel vectors need numerically stable handling. A smooth path in weight space does not imply smooth improvements in downstream accuracy.
A straight-line average of two directions cuts across the inside of the circle, so the result is shorter than either input. SLERP walks around the arc instead and keeps the norm, which some practitioners find preserves behaviour better when blending two checkpoints. When the two vectors are almost parallel, sin Omega is close to zero and the formula becomes unstable, so implementations fall back to linear interpolation. SLERP blends exactly two sources; it is not a general many-model merge.
Example. Between orthogonal unit vectors (1,0) and (0,1), the halfway spherical direction is approximately (0.707,0.707), still of length one.
Interpolating along the arc
For (1,0) and (0,1), Omega is 90 degrees and t = 0.5 gives sin 45 degrees for both weights, about (0.707, 0.707) with length 1. A straight average gives (0.5, 0.5) with length 0.707. - TIES Merging
- TIES addresses conflicting fine-tuning updates by trimming small changes, selecting a sign and merging aligned contributions. Work with differences from the common base. When two tasks push one parameter in opposing directions, ordinary averaging can cancel both signals without exposing the disagreement.
TIES stands for trim, elect sign and merge. Trimming keeps only the largest-magnitude entries of each task vector, because small entries are mostly fine-tuning noise. Sign election picks, per parameter, the direction with the larger total mass. Only deltas that agree with that sign are averaged, so a conflicting update is dropped at that coordinate instead of cancelling the others. It reduces interference but cannot make two genuinely conflicting tasks both win at once.
Example. Imagine retained task deltas of +2, +1 and −0.5 at one coordinate. A positive sign election keeps the aligned positive contributions for the merge.
TIES at one coordinate - 1Task deltas+2, +1, -0.5 and a tiny +0.01
- 2Trim small changes+0.01 dropped as noise
- 3Elect a signsum +2.5, so positive wins
- 4Merge agreeing valuesmean of +2 and +1 = +1.5
- 5Add to basebase + scale x 1.5
The -0.5 is set aside rather than allowed to dilute the agreeing updates.
- DARE Merging
- DARE drops some entries of a task delta and rescales the survivors before combination. The expectation can be preserved while a particular sample still changes behavior. Keep the random seed, drop probability and evaluation results with the merged checkpoint so the experiment is reproducible.
DARE (drop and rescale) randomly zeroes a fraction p of each task vector's entries and multiplies the survivors by 1 over (1 - p). The expected delta stays the same, while the sparser vectors overlap less, which makes them easier to combine with others. Because a different random mask gives a different model, record the seed and drop rate with the merged checkpoint, and evaluate more than one seed before trusting the recipe.
Example. At drop probability one half, a retained delta of 2 is rescaled to 4. Across independent drop draws its expected contribution remains 2.
Another example. Merging three adapters at drop rate 0.9 keeps one entry in ten, each scaled by 10. Two seeds giving worst-task scores several points apart is a sign the recipe is fragile.
Drop and rescale a delta of 2 at p = 0.5
Draw Kept? Value after rescale Probability Survives yes 2 / (1 - 0.5) = 4 0.5 Dropped no 0 0.5 Expected value 0.5 x 4 + 0.5 x 0 = 2 On average the contribution is unchanged, but any single merge sees either 4 or 0 at this coordinate. - Mergekit Lab
- A mergekit configuration records compatible source checkpoints, the merge recipe and parameters. First run a baseline on each original model. Compare the merged checkpoint on every required task, including the weakest one, and preserve licenses and provenance with the exported artifact.
A merge tool turns a recipe file into a new checkpoint, so the recipe is the experiment record. Treat it like code: version it, pin exact source revisions, and store it beside the output with the evaluation results. Score each source model first, then score the merge on every task, paying most attention to the worst one, because a better mean can hide one task that collapsed. Licences of every source travel with the merged weights.
Example. Change only one merge coefficient and keep base revision, task deltas and held-out tasks fixed. Compare worst-task accuracy as well as the mean.
Textmerge_method: tiesbase_model: org/base-7bmodels: - model: org/support-tuned parameters: density: 0.5 weight: 0.5 - model: org/billing-tuned parameters: density: 0.5 weight: 0.5dtype: bfloat16An illustrative mergekit YAML recipe with placeholder names. Change one value per experiment and keep the file with the exported checkpoint.
How it works
Step through the idea, or press Play.
Base weight. w = 10
Understand it
Worked example
When two adapters disagree on a weight
- 1
w = 10
Start from the same base checkpoint. A tuned weight of 12 means a +2 task delta; a tuned weight of 8 means a −2 delta.
- 2
+2 and −2
An equal linear average cancels these changes. TIES and DARE use different strategies for conflicts and sparsity, so preserve the recipe and seed.
- 3
Mean returns to 10
For this weight the average equals the base. The complete model must still be evaluated on both tasks because cancellation can occur unevenly across layers.
A weighted task-delta merge
Follow the handoffs
Compatibility gate before any arithmetic
Linear merge across three coordinates
| Coordinate | Base | Delta A | Delta B | Merged at lambda 0.5 |
|---|---|---|---|---|
| w1 | 10 | +2 | -2 | 10 (both cancelled) |
| w2 | 4 | +1 | +1 | 5 (agreement kept) |
| w3 | -3 | 0 | +2 | -2 (half of B) |
Summary
The whole topic in one minute.
Parameter shapes and learned coordinate meanings must be compatible. A vocabulary mismatch can independently invalidate the resulting model.
Check architecture, tokenizer and training lineage before interpreting any arithmetic. Record the recipe and evaluate each source task, because a model that retains an average score can still erase one specialized capability.