Under Review · Model Merging

When Does
Refinement Pay?

A budgeted functional view of model consolidation. Closed-form merging and end-to-end refinement are not rival algorithms but approximations to one functional objective, chosen by how faithfully you can afford to preserve expert behavior under a data, compute, and memory budget.

Zhiren Gong, Tiantong Wang, Zeng Zihao, Yiyang Duan, Ming Xiao, Chau Yuen, Wei Yang Bryan Lim

College of Computing and Data Science, Nanyang Technological University

A cheap closed-form merge wins under tight data / compute / memory; end-to-end refinement (E2E-Merge) pays once resources are ample and the closed-form gap is large — up to +9.5 at 20 experts. And a label-free residual read from the merged model predicts the gain in advance, getting 92.9% of refine-or-stop calls right.

Paper · coming soon Code · coming soon ▶ Tutorial
The framework: one task-indexed functional objective, a functional-fidelity spectrum of operating points, and budgeted operating-point selection
Figure. The framework. One task-indexed functional objective; a fidelity spectrum from parameter-space metrics to end-to-end refinement; and a budget that selects the operating point.

4 points

One spectrum: closed-form → Gauss-Newton → block-wise → end-to-end

N = 128

Data crossover: refinement overtakes the closed-form merge here

+4.20

E2E over RegMean++ at 1024 examples/task (ViT-B/32)

92.9%

Label-free refine-or-stop decision accuracy (70 subsets)

up to +9.5

E2E edge at the full-budget endpoint (ViT-L/14, 20 tasks)

Abstract

Model consolidation combines task-specific experts into one deployable model. We frame method choice as deciding how faithfully to preserve expert behavior within a resource budget. Inexpensive mergers solve tractable surrogates, while refinement spends data and computation to match expert behavior more directly.

A task-indexed functional objective separates the realized gap left by a low-cost merge from refinement's finite-data and optimization errors. Local quadratic analysis gives exact excess-loss formulas for metric mismatch, restricted updates, and omitted cross-layer coupling, and combining these gaps yields a condition for the budget-dependent transition to higher-fidelity refinement.

Across six data budgets with five paired ViT-B/32 runs each, RegMean++ leads at 32–64 examples per task, whereas representation distillation leads from 128 onward and reaches a 4.20-point advantage at 1024. Across all 70 four-task subsets, a label-free residual predicts how much refinement will help and achieves 92.9% leave-one-task-out decision accuracy at a 2.5-point utility threshold. Gauss–Newton and block-wise refinement supply intermediate compute and memory tradeoffs, and a three-seed Flan-T5 sweep shows a complementary regime in which closed form wins at all four data budgets.

One Objective · A Spectrum of Approximations

Merging and distillation are not two camps but operating points on one functional-fidelity spectrum. Each rung restores more of the deployed function — target metric, update scope, cross-layer geometry, nonlinear trajectory — at a higher cost in data, compute, and memory.

Two computational endpoints: closed-form merging versus end-to-end refinement, with a budget-dependent choice between them
Figure. The two endpoints. Closed-form merging solves a cheap surrogate; end-to-end refinement queries the frozen experts and matches their representations on unlabeled task inputs. Which one wins is budget-dependent.

Closed-form endpoint — cheapest

Collect a few statistics and solve once. RegMean / RegMean++ regress per-layer activations in closed form — a statistics pass plus sequential solves, 26 s at N = 256. Negligible optimization error, but a fixed structural gap: it only approximates the objective.

Current-point quadratic — intermediate

GN-Merge relinearizes the objective at the current merge and solves a damped Gauss–Newton system matrix-free, restoring current-point cross-layer coupling. Six steps from RegMean++ lift accuracy 84.3 → 86.9 without a full training trajectory.

Block-wise — memory-controlled

Train consecutive block groups from the input side while freezing and caching the prefix. Group size is an explicit memory–fidelity dial: on ViT-B/32 it spans 85.3%@3.7 GiB → 89.8%@5.4 GiB, and even one block beats the closed-form reference.

End-to-end endpoint — highest fidelity

E2E-Merge drops the layer-local surrogate and optimizes the task-indexed representation objective directly — task-arithmetic init, experts frozen, stop-gradient targets, all student weights updated. It samples the objective exactly, but pays finite-data and optimization error.

Same goal, different budget

Every point returns one shared encoder — no learned router, no task-specific module, and the same per-example inference cost. They chase the same functional target; they just spend a different budget to get there. So the useful question is not which merger is best, but which level of functional fidelity is worth its cost.

The Unifying Objective

On each task's inputs, reproduce its expert

For merged encoder g_θ and experts g_{θₐ}:

F(θ)  =  Σa   πa   Ex∼Da   ‖ gθ(x) − gθa(x) ‖²

Closed-form approximates F

  • RegMean is the exact optimizer of an expert-centered, layer-wise, first-order surrogate of F once its downstream metric becomes a shared scaled identity.
  • Dropping the off-diagonal blocks costs an exact quadratic excess ½‖E Δ_D‖²_{H⁻¹} — a fixed structural gap.
  • Restricting updates to a subspace loses the H-energy of the full solution outside it.

Refinement samples F

  • E2E-Merge minimizes F directly by gradient descent, from a task-arithmetic init, teachers frozen.
  • Under smoothness + a Polyak–Łojasiewicz condition, error contracts geometrically — with a computable break-even budget.
  • It beats the closed-form reference once 2εₙ + δ_K < Δ_CF: data error plus optimization error below the realized merge gap.

Representation matching supervises the full shared space; logit / KL matching only controls the directions each task's text-prototype head can see — a separate design axis from closed-form-vs-iterative.

The Budget Frontier · Three Slices

Data budget

Closed-form wins at 32–64 examples/task; refinement overtakes at 128 and widens through 1024.

+0.68 → +2.14 → +3.42 → +4.20 (128→1024)

Compute budget

At N = 256, E2E clears RegMean++ at the first 500-step point (56 s); gains taper after 2k.

84.2 (26 s) → 86.5 (8k, 533 s)

Memory budget

Block-wise spans 85.3%@3.7GiB → 89.8%@5.4GiB → 90.2%@~8GiB (full).

even one block beats RegMean++

Data-budget crossover — ViT-B/32, average accuracy (%), five paired subsets per point

Distinct examples / task32641282565121024
RegMean++ (closed-form)82.583.584.084.484.384.5
E2E-Merge (refinement)78.782.384.686.487.788.6

The ordering reverses at 128 examples and holds in every one of the five paired subsets from there on — below it, the cheap merge is simply the better bet.

Data, compute, and memory budget frontiers on ViT-B/32
Figure. Three one-dimensional slices of the frontier — data, compute, and memory — from the same ViT-B/32 measurements. Left-panel error bars are over five paired subsets.
Block-wise accuracy-memory trade-off on ViT-B/32 and ViT-L/14
Figure. The memory dial in full. Jointly optimizing more blocks trades peak memory (GiB, annotated) for accuracy — on ViT-B/32 (12 blocks) and ViT-L/14 (24 blocks) — and even one block clears the closed-form reference.

A Label-Free Signal for Refinement

The regime condition becomes an actionable rule: before spending any end-to-end budget, measure the closed-form model's remaining functional discrepancy. The merged model's own held-out squared residual — no labels, no test data — predicts how much refinement will actually help.

Residual predicts future E2E gain; signal survives task adjustment; generalizes to held-out tasks; transfers across backbones and task counts
Figure. Across all 70 four-task subsets of the ViT-B/32 pool, the label-free residual tracks the eventual E2E gain (ρ = 0.96), survives additive task adjustment (ρ = 0.63), generalizes to held-out tasks at the lowest RMSE, and transfers across nine backbone / task-count settings (ρ = 0.99).

It predicts the gain

Across the full 70-subset enumeration, Spearman ρ = 0.96, and 0.63 after additive task adjustment.

It beats the alternatives

Leave-one-task-out: 0.265-pt RMSE and 92.9% refine-or-stop decisions, vs 73.9% from initial accuracy and 57.5% from task-vector cosine.

It is robust

The signal persists on an independent slice, with as few as 16 examples/task, and across nine backbone / task-count settings at ρ = 0.992.

Triage before you train

The residual turns the qualitative regime condition into an objective-aligned, label-free triage rule: fit the cheap merge, read its functional residual, and only pay for refinement where the residual says it will pay back.

When Each Wins · Why

Use closed-form merging when…

  • data is scarce (≲ a hundred examples/task), or
  • compute / memory is tight, or
  • the local surrogate is already tight (small structural gap).

A counter-example that proves the point: across a three-seed Flan-T5 GLUE sweep, closed-form RegMean wins all 12 paired runs against iterative output distillation (by 0.76–0.94 pt), and both beat task arithmetic (79.0) and TIES (80.2). Different functional readouts favor the cheap regime.

Use end-to-end refinement when…

  • you have enough unlabeled data (≳ 128 examples/task) and offline compute, and
  • the structural gap is large — many experts, or a weaker backbone.

The refinement edge grows with consolidation load — +2.6 → +4.4 → +6.0 from 2 to 6 to 8 experts, and +13.7 at 20 — and is larger on smaller backbones for the same 20 tasks.

High-accuracy endpoints — best closed-form reference vs E2E-Merge (avg accuracy %)

SettingClosed-form refE2E-MergeΔExpert avg.
ViT-B/32 · 8 tasks84.2 (RegMean++)89.9+5.790.4
ViT-B/16 · 8 tasks87.3 (RegMean++)91.9+4.692.4
ViT-L/14 · 8 tasks90.9 (RegMean++)94.2+3.394.3
ViT-L/14 · 20 tasks83.4 (Iso-C)92.9+9.5—

At the high-fidelity endpoint, the merged model essentially matches the individual fine-tuned experts on ViT-L/14 (94.2 ≈ 94.3).

Layer-wise residuals do not determine final error
Figure. Per-layer residuals are nearly tied, yet the final representation error differs sharply (0.93 / 0.60 / 0.20 for Task Arithmetic / RegMean++ / E2E) — and that ordering matches accuracy (67.6 / 84.2 / 90.2).
Refinement gain grows with the number of merged experts
Figure. The refinement advantage over closed-form grows with consolidation load — the number of merged experts.
Per-task refinement gains over the strongest non-iterative baseline across the 20 TALL tasks on ViT-L/14
Figure. Where the 20-task gain comes from. On ViT-L/14, refinement improves 19 of the 20 TALL tasks over the strongest non-iterative baseline — from +0.3 up to +45.5 (EMNIST), with only Pets slightly down.

Per-layer optimality ≠ end-to-end optimality

A closed-form solver can be near-optimal at every layer and still land far from each expert at the output, because small residuals compound through depth. Refinement controls what actually reaches the output — which is exactly what its extra compute buys, and why the gap widens with more experts and weaker backbones. A matched-target control confirms the mechanism: representation supervision adds 1.6–2.2 points over the strongest logit control, while the restricted-coefficient gradient merger AdaMerging reaches only 82.6%.

Honest scope

  • The endpoint comparison measures a regime gap: it changes target, trajectory, solver, and compute at once, by design.
  • CLIP-centric; all experts share a pre-trained init. The Flan-T5 probe uses different functional readouts.
  • Break-even results are conditional local bounds, not AdamW convergence guarantees. The method is label-free but not data-free.

Resources

Paper

Under review. Coming soon.

Code

Reference implementation and reproduction. Coming soon.

Tutorial

A narrated, animated video tour — one objective, the fidelity spectrum, and the budget frontier, built for a general audience.