Merging fine-tunes of one model
Fine-tuning moves every weight of a pretrained model a little. When several models are fine-tuned from the same base for different tasks, their differences from the base can be added back into one model, with no further training. Ilharco et al. called such a difference a task vector:
The second formula is task arithmetic; with it is the plain average of the fine-tunes, the "model soup" of Wortsman et al. TIES-Merging (Yadav et al.) changes how the task vectors are combined, entry by entry, to reduce the interference between them.
This page merges two released fine-tunes of Qwen2.5-0.5B: Qwen2.5-0.5B-Instruct and Qwen2.5-Coder-0.5B-Instruct. Merging only makes sense when every entry lines up, so the recorder first checks that the three checkpoints share one architecture (290 tensors, 494,032,768 weights) and byte-identical tokenizer files.
Two very different task vectors
The Task vectors panel draws both differences for layer 12's v_proj, a 128 × 896 matrix, each on its own colour scale. Coder's is 15 times as long as Instruct's here ( 4.62 against 0.308), and across the model the median ratio over the 290 tensors is 15.5. In the embeddings it is 221 against 20. The Qwen2.5-Coder report describes why: the Coder models were trained on 5.5 trillion further tokens, mostly code, before their instruction tuning. The two task vectors are also nearly unrelated: their cosine on this matrix is 0.21.
The TIES paper merges models fine-tuned the same way on different tasks, whose task vectors are alike in size. This pair is far from that, and the rest of the page shows what the method does with it.
Trim, elect, average
TIES makes three changes to task arithmetic, applied to each tensor on its own.
- Trim. Each task vector keeps only its entries of largest magnitude; the rest are reset to 0. The paper argues most small changes are redundant and only add noise when summed. The Trim to the top k% panel shows both trimmed matrices; the toolbar switches between the recorded densities.
- Elect a sign. For every entry, : the sign with more total mass wins. The Elect a sign panel colours the winner wherever either model kept the entry, and the bar below it counts the cases.
- Disjoint mean. Each entry becomes the mean of only the trimmed values whose sign is ; zeros and the other sign are left out of both the sum and the count.
The Disjoint mean table walks through one real entry of each case. The page redoes all three steps in the browser at each density, and the result equals the matrix the full merge produced, bit for bit.
What happens to Coder's change
With such lopsided task vectors, Coder decides almost every election, and the disjoint mean then works against it. Where both models keep an entry with the same sign, the mean of a large and a small change is about half the large one. At 20% the merged task vector of the shown matrix is 76% of Coder's length and points like Coder's (cosine 0.80) far more than like Instruct's (0.15). Over the whole model at 20%, the two models both keep 4.7% of entries and disagree in sign on 1.44%, the entries the election drops.
Every tensor at k% maps the same quantities for all 290 tensors. At 100%, with nothing trimmed, the two disagree on 44% of all entries and the median tensor keeps 77% of Coder's length.
What the merges keep and lose
Every model is scored greedily on 40 GSM8K rows (Instruct's task) and 40 HumanEval problems (Coder's), the code run against each problem's tests in a sandbox. The base model solves 5 and 22, Instruct 15 and 25, Coder 11 and 29. Scores lists every merge; ref. NLL is the mean negative log-likelihood of the reference solutions.
Task arithmetic with , which here amounts to adding Instruct's small task vector to Coder, keeps both skills: 16 and 30. Against Instruct on GSM8K it keeps 10 problems, loses 5 and gains 6; against Coder on HumanEval it keeps 26, loses 3 and gains 4, as What … keeps and loses shows problem by problem.
Every TIES merge breaks. At 10% and 20% the replies are punctuation, and the reference NLL is 12.5 and 9.7 nats per token on GSM8K; at 50% it solves 3 and 0, at 100% 0 and 1. The plain average () fails too, with 0 and 0: halving Coder's change is what hurts, whichever way it happens. The Replies cards show each model's answer to the selected problem.
Checks and what followed
The merge on this page is checked against mergekit, a widely used merging toolkit, on every real tensor: 1,057,695 of the 494 million entries differ, all of them ties in magnitude at a trim threshold, where mergekit's unstable sort and this code's stable one keep different entries. The drawer's code also matches mergekit's and peft's TIES on a small model.
TIES followed task arithmetic (2023) and model soups (2022). DARE (the DARE tab) replaced the magnitude trim with random dropping and rescaling, and SLERP (the SLERP tab) interpolates two models directly instead of adding task vectors.
Papers
- TIES-Merging: Resolving Interference When Merging Models Introduces TIES: trim each task vector to its largest entries, elect a sign per entry, and average only the entries that agree.
- Editing Models with Task Arithmetic Defines task vectors and merges models by adding them to the base, the baseline the page compares TIES with.
- Model soups: averaging weights of multiple fine-tuned models improves accuracy without increasing inference time Averages the weights of fine-tunes of one pretrained model, the plain average the page also scores.
- Arcee's MergeKit: A Toolkit for Merging Large Language Models The merging toolkit whose ties method the page's code is checked against, tensor by tensor.
- Qwen2.5-Coder Technical Report Qwen2.5-Coder-0.5B-Instruct, one of the two merged fine-tunes: Qwen2.5 trained on further on code before instruction tuning.
- Qwen2.5 Technical Report Qwen2.5-0.5B, the base, and Qwen2.5-0.5B-Instruct, the other merged fine-tune.