LLM Engineering

model merging

Suppose you have several models fine-tuned from one shared base — one good at code, one at math, one at a certain language. Training a single model with all those skills usually means gathering all the data and retraining. Model merging offers a startlingly cheap shortcut: combine the finished checkpoints directly in weight space, averaging or adding their parameters, and obtain a single model that inherits multiple capabilities without any gradient step at all.

The clean abstraction is the task vector: subtract the base weights from a fine-tuned checkpoint and you get the direction that adaptation moved in. These vectors can be added to compose skills, scaled to dial strength, or even negated to unlearn a behavior. Naive averaging suffers when task vectors interfere, so methods like TIES-merging trim small components, resolve sign conflicts by majority vote, and merge only agreeing parameters; DARE randomly drops and rescales deltas to reduce redundancy; and SLERP interpolates along the hypersphere between two models. Merging works because independent fine-tunes of a shared base tend to stay in a connected, low-loss region.

The appeal is obvious — no training data, no GPUs beyond a forward pass, instant capability composition — which has made merged checkpoints ubiquitous on model hubs. The caveats are equally real: merging only combines models descended from the same base, conflicting task vectors can cancel rather than add, and the result is empirical, so a merged model needs evaluation rather than faith.

\theta_{\mathrm{merged}} = \theta_0 + \sum_{i} \lambda_i\,\tau_i,\qquad \tau_i = \theta_i - \theta_0

Task vectors τ_i (fine-tuned minus base) are scaled by λ_i and added back onto the shared base θ0.

Model merging is not ensembling: an ensemble keeps several models and combines their outputs at inference, while merging collapses them into one set of weights that runs at single-model cost.

Also called
weight mergingtask arithmetic模型合併