Introduction
A released language model is routinely fine-tuned into several specialists, one per domain: instruction following, mathematics, coding, multilingual understanding and safety. Each specialist differs from its parent by a task vector [1]. The merging question is how to fold these updates back into one model of the parent's architecture, without joint training, routing or added modules, so that each domain keeps as much of its specialist's ability as possible while the parent's general knowledge survives.
The field's answers fall into two groups. Weight-space rules act on the task vectors alone: a uniform average [2], a scaled sum [1], sign- and magnitude-based conflict resolution [3], random drop-and-rescale [4], consensus masks [5], sparse localisation [6], data-free merging guided by the task vectors themselves [7], merging cast as projective gradient descent [8], and merging of reinforcement-trained agentic models [9]. Data-based rules use a small calibration set: Fisher weighting [10], regression on layer inputs [11, 12], learned merge coefficients [13] and distillation from several teachers [14]. Our task adds the checkpoint lineage: every node carries its parent and its last training stage, so a specialist's update can be taken relative to its own parent, and when the parent is a post-trained model its own post-training update is visible, the object that work on chat vectors and on paired base and post-trained models reasons about [15, 16], as does work that separates instruction-following knowledge from task-specific knowledge layer by layer [17].
The difficulty is a puzzle that the task arithmetic family lives with. In our development probes the specialists' task vectors were almost orthogonal (cosine between 0.00 and 0.08), yet adding all of them at full scale collapsed the model, while a uniform scale of about 0.3 gave the best validation likelihood and still closed only part of the gap to the specialists. Orthogonal updates should not interfere, so the question is where they do. Our answer, and the basis of the method, is that they interfere only on a few input directions that every domain excites. There each specialist wrote its own domain-agnostic response prior, and the sum counts those priors several times over. Everywhere else the updates are separable and should be kept in full, so scaling everything down dilutes what is unique to each specialist in order to repair what is shared.
Method
We call the method EGSR, evidence-gated summation with functional refinement. It has two passes: a closed-form merge per linear map, and a short end-to-end refinement of that merge. All task vectors are taken relative to each specialist's own parent in the lineage, gains and biases are averaged, and the token embeddings and output head are the target's.
The closed form: activation evidence against a full-sum prior
For a linear map with weight in the target, let be specialist 's update of that weight and their sum. We collect , the second moment of the map's input when specialist 's own weights run on its own domain's calibration text. The merged update minimises
whose solution is
The first term is the regression-mean objective of RegMean [11]: along input directions that a domain strongly excites, the specialist that excites them decides the output, and along directions that every domain excites the specialists' maps are averaged by their evidence. The second term is where we depart from it. The prior is not the parent's weights and not an average of the specialists but the full sum , so that along directions where the calibration data carries little evidence, which is most of the input space, every specialist's update is kept at full scale. The strength is measured in units of the mean input energy. Linear maps that read the same tensor share one statistic, and for inputs wider than 4608 we keep only the diagonal of , a per-unit version of the same formula.
nm = k[:-len(".weight")] if k.endswith(".weight") else None
g = group_of.get(nm)
m = None
if tv.dim() != 3:
m = tv.mean(0) # gains / biases act on every input: shared by construction
elif g in use and tv.shape[2] == G[(g, 0)].shape[-1]:
try:
S = tv.sum(0)
Gs = [G[(g, i)] for i in range(n)]
if Gs[0].dim() == 1: # wide input (MLP neurons): privileged basis, per-unit evidence
den = sum(Gs)
rho = C * den.mean()
m = (sum(tv[i] * Gs[i].unsqueeze(0) for i in range(n)) + rho * S) / (den + rho).unsqueeze(0)
else:
if g not in chol:
if len(chol) >= 4:
chol.clear()
tot = sum(x.double() for x in Gs)
rho = C * torch.diagonal(tot).mean()
tot.diagonal().add_(rho)
chol[g] = (torch.linalg.cholesky(tot), rho)
Lc, rho = chol[g]
num = rho * S.double()
for i in range(n):
num += tv[i].double() @ Gs[i].double()
m = torch.cholesky_solve(num.t(), Lc).t().float()
if not bool(torch.isfinite(m).all()):
m = None
except Exception:
m = NoneThe statistics come from one pass over each specialist. Before its domain's texts are run, the specialist's weights are copied into the model, and the same forward pass stores that specialist's top-32 next-token distribution on the response positions, which become the teacher targets of the second pass. Each text is used in the specialists' training format and, when it differs, in the target's own chat format.
for i, e in enumerate(experts):
w = lineage.nodes[e].weights
with torch.no_grad():
for k in keys:
if k in msd:
msd[k].copy_(w.get(k, device=dev, dtype=msd[k].dtype))
state["i"] = i
d = lineage.nodes[e].domain
exs = ctx.calibration_examples(d)
pool[i] = []
absorb(items_of(exs[:NCAL]), pool[i], None)
if len(pool[i]) < MINPOOL: # too few responses fit the window: look at further, shorter examples
absorb(items_of(exs[NCAL:5 * NCAL]), pool[i], MINPOOL)
vpool[i] = []
try:
held = ctx.validation_examples(d)[:NVAL]
except Exception:
held = []
state["on"] = False # held-out texts do not enter the statistics
absorb(items_of(held), vpool[i], None)
state["on"] = TrueThe prior's strength comes from the lineage
How far the full-sum prior should be trusted depends on two properties of the lineage, and we read both from it rather than tuning per model. First, when the target is post-trained (its root is a separate pre-trained base, or its last stage is supervised fine-tuning, preference optimisation or reinforcement learning), the parent already holds abilities that the summed updates perturb, so the evidence is trusted further down the spectrum: for a post-trained target against for a pre-trained one. Second, the prior presumes that the summed update is a small perturbation of the parent's weights. We therefore measure
over up to 48 non-embedding weight matrices sampled with a fixed seed, and shrink the prior quadratically once that ratio exceeds a trust radius :
experts = [e for e in lineage.labels(role="expert") if e != T]
n = len(experts)
if n == 0:
return {k: P[k].clone() for k in keys}
tok = ctx.tokenizer
post_trained = (lineage.base != T) or (lineage.nodes[T].stage in ("sft", "preference", "rl"))
C = C_POST if post_trained else C_PRE
def refw(e):
p = lineage.parent(e)
return lineage.nodes[p if p is not None else T].weights
def skip(k):
return "embed" in k or "lm_head" in k
def linears(model):
return {nm: m for nm, m in model.named_modules()
if isinstance(m, torch.nn.Linear) and (nm + ".weight") in P and not skip(nm + ".weight")}
def offsets(mask):
return (mask > 0).float().argmax(dim=1)
# trust region of the full-sum prior: it presumes that the summed update is a small perturbation of the parent,
# so its strength decays with the square of the update's size relative to the weights it is added to
rel = []
cand = [k for k in keys if not skip(k)]
for k in random.Random(0).sample(cand, min(48, len(cand))):
base = P.get(k, device=dev, dtype=torch.float32)
if base.dim() != 2:
continue
S = torch.zeros_like(base)
for e in experts:
S += lineage.nodes[e].weights.get(k, device=dev, dtype=torch.float32) - refw(e).get(k, device=dev, dtype=torch.float32)
r = float(S.norm() / base.norm().clamp(min=1e-20))
if math.isfinite(r):
rel.append(r)
del base, S
if rel:
rel.sort()
C = C * min(1.0, (R0 / max(rel[len(rel) // 2], 1e-9)) ** 2)A data-free fallback with the same structure
If any specialist's domain has no calibration data, or the statistics pass fails, the merge uses a data-free version of the same decomposition. With the top right-singular vectors of on its smaller side, being one sixteenth of that dimension, the update is
that is, the full sum everywhere except the dominant shared subspace of the mean update, where the updates are averaged instead of summed.
if m is None:
try:
# data-free: full sum, with the dominant (shared) subspace of the mean update averaged instead of summed
tr = tv.shape[1] < tv.shape[2]
t = (tv.transpose(1, 2) if tr else tv).double()
S = t.sum(0)
ev, V = torch.linalg.eigh(S.t() @ S)
Vk = V[:, -max(1, int(S.shape[1] * KF)):]
m = S - (1.0 - 1.0 / n) * (S @ Vk) @ Vk.t()
m = (m.t() if tr else m).float()
if not bool(torch.isfinite(m).all()):
m = tv.mean(0)
except Exception:
m = tv.mean(0)
out[k] = (base + m).to("cpu", dtype=P[k].dtype)Functional refinement by the specialists themselves
The closed form resolves conflicts map by map; what remains is resolved end to end. Starting from the closed-form model, we train the linear maps that fit in the free GPU memory, widest inputs first, with Adam at a learning rate of for at most 200 steps on fp32 master weights. Each step draws two texts per specialist from that specialist's teacher pool, and the loss is the cross-entropy of the merged model against the specialist's renormalised top-32 distribution at the response positions, averaged over positions:
Each specialist is thus the teacher only on its own domain, which is the multi-teacher distillation view of merging [14] applied as a correction to a merge that is already close.
steps = min(STEPS, max(1, (EPOCHS * min(len(pool[i]) for i in range(n))) // per))
for step in range(steps):
if time.time() - t_start > T_STOP:
break
batch = []
for i in range(n):
batch += rng.sample(pool[i], per)
with torch.autocast(dev.type, dtype=torch.bfloat16):
logits, mask = ctx.forward(model, [b[0] for b in batch], max_length=MAXLEN, grad=True)
off = offsets(mask)
loss, cnt = 0.0, 0
for j, (f, pl, end, ix, pv) in enumerate(batch):
o = int(off[j])
lp = torch.log_softmax(logits[j, o + pl - 1:o + end].float(), -1)
if lp.shape[0] != ix.shape[0]:
continue
loss = loss - (pv.float() * lp.gather(-1, ix.long())).sum()
cnt += lp.shape[0]
if cnt == 0:
continue
loss = loss / cnt
if not bool(torch.isfinite(loss)):
return {}
opt.zero_grad(set_to_none=True)
loss.backward()
opt.step()
trace.append(float(loss))
del logits, mask, loss
q = len(trace) // 4
if q < 1 or sum(trace[-q:]) > 1.2 * sum(trace[:q]):
return {} # no progress on the teachers' targets: keep the closed form
after = heldout()
if before is not None and after is not None and not after < before:
return {} # no gain on held-out validation text: keep the closed formThe refinement is guarded so that it can only replace the closed form when it demonstrably helps. It is rejected if the summed loss of the last quarter of the steps exceeds 1.2 times that of the first quarter, and rejected if the teachers' cross-entropy on held-out validation texts, which no step sees, does not strictly decrease (when it can be measured before and after). If nothing fits in memory, it retries with one text per specialist and then with half the memory share. No attempt starts after 2100 seconds of merge time and no step is taken after 2700 seconds; an error in one attempt moves on to the lighter one, and if no attempt completes, the closed-form merge is returned unchanged.
Results
| Method | ① | ② | ③ | ④ | ||||
|---|---|---|---|---|---|---|---|---|
| Normalised performance ↑ | TriviaQA retention ↑ | Normalised performance ↑ | TriviaQA retention ↑ | Normalised performance ↑ | TriviaQA retention ↑ | Normalised performance ↑ | TriviaQA retention ↑ | |
| Claude Fable 5.2 | 93.83 | 0.377 | 93.47 | 0.373 | 88.00 | 0.422 | 101.9 | 0.231 |
| Unmerged parent model | 55.29 | 0.506 | 83.67 | 0.203 | 50.55 | 0.508 | 96.12 | 0.335 |
| Instruction specialist alone | 71.48 | 0.475 | 87.18 | 0.325 | 69.88 | 0.386 | 91.83 | 0.172 |
| Math specialist alone | 69.03 | 0.463 | 89.38 | 0.238 | 69.67 | 0.340 | 92.20 | 0.152 |
| Coding specialist alone | 66.89 | 0.487 | 84.44 | 0.356 | 63.83 | 0.495 | 93.28 | 0.290 |
| Multilingual specialist alone | 52.43 | 0.385 | 71.39 | 0.341 | 50.23 | 0.456 | 94.79 | 0.267 |
| Safety specialist alone | 67.25 | 0.424 | 81.82 | 0.318 | 62.62 | 0.392 | 88.06 | 0.211 |
| Weight average | 68.06 | 0.490 | 88.49 | 0.346 | 61.65 | 0.473 | 99.12 | 0.254 |
| Task arithmetic | 76.90 | 0.353 | 82.34 | 0.279 | 73.62 | 0.311 | 91.63 | 0.151 |
| TIES | 73.09 | 0.423 | 85.74 | 0.310 | 67.22 | 0.415 | 96.92 | 0.200 |
| DARE | 74.41 | 0.353 | 81.24 | 0.273 | 74.85 | 0.296 | 89.67 | 0.154 |
| Consensus TA | 75.68 | 0.398 | 84.40 | 0.304 | 73.60 | 0.352 | 93.91 | 0.165 |
| Localize-and-Stitch | 74.74 | 0.386 | 86.04 | 0.279 | 63.66 | 0.368 | 93.32 | 0.188 |
| RegMean | 76.96 | 0.461 | 90.13 | 0.346 | 71.03 | 0.459 | 101.6 | 0.233 |
| Fisher merging | 60.71 | 0.451 | 86.60 | 0.334 | 71.73 | 0.464 | 100.4 | 0.209 |
| RegMean++ | 76.14 | 0.468 | 89.80 | 0.337 | 70.34 | 0.468 | 102.2 | 0.250 |
| WUDI | 74.13 | 0.413 | 84.38 | 0.321 | 78.74 | 0.428 | 100.5 | 0.223 |
| DOGE-TA | 75.09 | 0.419 | 87.95 | 0.329 | 71.04 | 0.397 | 99.10 | 0.189 |
| AdaMerging | 73.38 | 0.382 | 77.61 | 0.186 | 73.15 | 0.382 | 98.78 | 0.162 |
| RAM | 74.24 | 0.455 | 86.77 | 0.323 | 69.47 | 0.433 | 98.69 | 0.210 |
| Localize-and-Stitch, tuned | 74.99 | 0.387 | 85.81 | 0.280 | 63.74 | 0.368 | 93.09 | 0.187 |
- ① Gemma-2-2B base pool (parent + 5 specialists)
- ② Gemma-2-2B-it pool (parent + 5 specialists)
- ③ Llama-3.2-3B base pool (parent + 5 specialists)
- ④ Llama-3.2-3B-Instruct pool (parent + 5 specialists)
On normalised multi-task performance EGSR is clear of every published baseline on three of the settings: 93.83 on Gemma2-2B against 76.96 for the strongest baseline there, RegMean [11]; 93.47 on Gemma2-2B-it against 90.13 (RegMean [11]); and 88.00 on L3.2-3B against 78.74 (WUDI-Merging [7]). The margin is largest on Gemma2-2B and smallest on Gemma2-2B-it. On L3.2-3B-Inst EGSR reaches 101.89, second to RegMean++ at 102.20 and just above RegMean at 101.62. That setting leaves little room to separate methods: the parent alone reaches 96.12.
Retention of the parent's general knowledge tells a different story. On Gemma2-2B-it our retention of 0.373 is the highest in the table, above 0.356 for Coding spec. and above the parent's own 0.203. On the other three settings it is below the parent's: on Gemma2-2B it is 0.377 against the parent's 0.506, and only task arithmetic (0.353) and DARE (0.353) retain less; on L3.2-3B it is 0.422 against 0.508, in the middle of the baselines; and on L3.2-3B-Inst it is 0.231 against 0.335, a hair below RegMean's 0.233. Keeping every specialist's update at full scale buys domain performance and, on most settings, costs general knowledge, which is the trade-off a full-sum prior predicts.
How we got here
The method was narrowed in four steps, each measured on development lineages we assembled from public checkpoints and scored with our own benchmark harness, normalised to the native specialists. These are our development measurements, not the task's evaluation, and repeat runs of one configuration differed by about .
Locating the conflict. Likelihood probes on validation text came first. Task arithmetic at scale 1.0 collapsed every domain; pairs of task vectors at full scale were tolerable; the damage was super-additive, which pointed to one shared high-curvature direction rather than to pairwise overlap. Removing the over-counted low-rank part of the mean update, , removed the collapse with every task vector at full scale, best at equal to one sixteenth of the rank, while truncating each task vector to low rank on its own did not. Two other estimates of the shared component, a per-direction coherence limit on the sum and a cross-covariance estimate of the common mode, were tried in the same probes and not adopted. The surviving data-free rule (v1, now our fallback) scored 0.751 and 0.942 on two development lineages but only 0.647 on a third.
From a data-free rule to the closed form. The insight that made the rule data-based was that the mean-subspace correction works because the conflict sits on shared, always-active input directions, which is exactly what input statistics measure. The closed form (v2) combines RegMean's evidence with the full-sum prior. Sweeping the prior's strength showed the lineage dependence that the final rule encodes: on a lineage with a pre-trained parent the score rose from 0.752 at to 0.856 at , while on one with a post-trained parent it peaked at 0.947 at and fell to 0.935 at . Fisher-weighted and response-only statistics brought no meaningful gain, and choosing on validation data proved unreliable, which is why comes from the lineage instead.
Adding the refinement. Distilling from the specialists for 100 steps (v3) moved the weights very little (a change of norm about 0.4 against task vectors of norm about 8) but raised one pre-trained-parent lineage from 0.856 for the closed form alone to 1.024, against 0.751 for RegMean and 0.683 for task arithmetic at scale 0.4 on our harness, with safety in particular rising from 0.371 to 0.748. Sweeps then fixed the schedule: 200 steps instead of 100 helped on most development lineages, by up to about 0.02, 400 brought no clear further gain, and 100 steps at twice the learning rate matched 200 steps on one lineage and were slightly worse on another. The closed form matters as the starting point: refining from task arithmetic instead scored 0.934 and 0.872 on two lineages where the full method scored 1.037 and 0.946. Sixteen calibration examples per domain still gave 0.931 to 1.007, and weighting the loss per example rather than per position traded instruction following and mathematics for safety without a net gain. The held-out acceptance test, the teacher-pool top-up and the memory headroom were added at that point.
The trust region. On lineages whose specialists' updates are large relative to the parent, the prior strengths tuned on the other lineages were too strong: a ten times weaker prior raised one such lineage from 0.871 to 0.928. The ratio separates the regimes, with medians of 0.025 and 0.033 on the earlier lineages against 0.166 on that one, and the quadratic factor with reproduces the strengths that had been validated on each lineage. A last check with made no significant difference, so the installed value stayed at 0.05.
Limitations
- Retention is paid for domain performance. On three of the settings our retention of the parent's general knowledge falls below the parent's, and on Gemma2-2B below every baseline except task arithmetic and DARE. The full-sum prior keeps each specialist's update at full scale along low-evidence directions, and nothing in the objective protects knowledge outside the five calibration domains.
- L3.2-3B-Inst is not won. There we are second to RegMean++ on normalised performance, and the parent alone is already close to the top of the table.
- The constants are fitted, not derived. and and were chosen on our own development lineages. On one of them a trust radius of 0.03 scored 0.907 against 0.886 at 0.05, so the large-update regime is probably not at its optimum.
- A small specialist is drowned by large ones. In our final diagnostics one of the two weakest regimes was instruction following on lineages where that specialist's update is several times smaller in norm than the mathematics, coding and safety updates and lies disproportionately in the shared input directions, where the closed form can only average. We proposed, but did not test, weighting each specialist's evidence by its relative rather than absolute error. Work on conditioning task vectors for robust merging [19] was logged as a lead for this but not read.
- Partial calibration falls back entirely. If any one specialist's domain lacks calibration data, the whole merge takes the data-free path rather than using the data that exists.
- The refinement depends on the machine. Which maps are trained depends on the free GPU memory at merge time, and the wall-clock guards can cut the refinement short, so the same inputs can give a different merge on a busier or slower device. The progress test is loose: it accepts a loss that rises by up to a fifth, leaving the held-out test as the real guard.
References
- Gabriel Ilharco, Marco Tulio Ribeiro, Mitchell Wortsman et al. (2023). Editing Models with Task Arithmetic. ICLR.
- Mitchell Wortsman, Gabriel Ilharco, Samir Yitzhak Gadre et al. (2022). Model soups: averaging weights of multiple fine-tuned models improves accuracy without increasing inference time. ICML.
- Prateek Yadav, Derek Tam, Leshem Choshen et al. (2023). TIES-Merging: Resolving Interference When Merging Models. NeurIPS.
- Le Yu, Bowen Yu, Haiyang Yu et al. (2024). Language Models are Super Mario: Absorbing Abilities from Homologous Models as a Free Lunch. ICML.
- Ke Wang, Nikolaos Dimitriadis, Guillermo Ortiz-Jimenez et al. (2024). Localizing Task Information for Improved Model Merging and Compression. ICML.
- Yifei He, Yuzheng Hu, Yong Lin et al. (2024). Localize-and-Stitch: Efficient Model Merging via Sparse Task Arithmetic. TMLR.
- Runxi Cheng, Feng Xiong, Yongxian Wei et al. (2025). Whoever Started the Interference Should End It: Guiding Data-Free Model Merging via Task Vectors. ICML.
- Yongxian Wei, Anke Tang, Li Shen et al. (2025). Modeling Multi-Task Model Merging as Adaptive Projective Gradient Descent. ICML.
- Xiangchi Yuan, Dachuan Shi, Chunhui Zhang et al. (2026). Behavior Knowledge Merge in Reinforced Agentic Models.
- Michael Matena, Colin Raffel (2022). Merging Models with Fisher-Weighted Averaging. NeurIPS.
- Xisen Jin, Xiang Ren, Daniel Preotiuc-Pietro et al. (2023). Dataless Knowledge Fusion by Merging Weights of Language Models. ICLR.
- The-Hai Nguyen, Dang Huu-Tien, Takeshi Suzuki et al. (2025). RegMean++: Enhancing Effectiveness and Generalization of Regression Mean for Model Merging. TMLR.
- Enneng Yang, Zhenyi Wang, Li Shen et al. (2024). AdaMerging: Adaptive Model Merging for Multi-Task Learning. ICLR.
- Seyed Arshan Dalili, Mehrdad Mahdavi (2025). Model Merging via Multi-Teacher Knowledge Distillation.
- Shih-Cheng Huang, Pin-Zu Li, Yu-Chi Hsu et al. (2024). Chat Vector: A Simple Approach to Equip LLMs with Instruction Following and Model Alignment in New Languages. ACL.
- Taiqiang Wu, Runming Yang, Jiayi Li et al. (2025). Shadow-FT: Tuning Instruct Model via Training on Paired Base Model.
- Yan-Lun Chen, Yi-Ru Wei, Chia-Yi Hsu et al. (2025). Layer-Aware Task Arithmetic: Disentangling Task-Specific and Instruction-Following Knowledge. ACL.
- Yifei He, Siqi Zeng, Yuzheng Hu et al. (2025). MergeBench: A Benchmark for Merging Domain-Specialized LLMs. NeurIPS.
- Kotaro Yoshida, Yuji Naraki, Takafumi Horie et al. (2026). DisTaC: Conditioning Task Vectors via Distillation for Robust Model Merging. ICLR.