Model merging
Model merging combines the weights of two or more trained models into a single model, aiming to keep their separate strengths without running each one or training again from scratch.
When several models are fine-tuned from the same pre-trained starting point, their weights stay closely related. Model merging exploits this by combining the weights directly, producing one model of the same size. Unlike an ensemble, which runs every model and combines their answers, a merged model costs no more to run than any one of its parents.
The simplest version is averaging. In March 2022 Mitchell Wortsman and colleagues showed that averaging the weights of models fine-tuned with different settings often improved accuracy, and called the results model soups. A soup built from fine-tuned ViT-G models reached 90.94 per cent top-1 accuracy on ImageNet, a new state of the art at the time. In December 2022 Gabriel Ilharco and colleagues introduced task arithmetic: subtract the original weights from a fine-tuned model to get a task vector, then add task vectors together to combine skills, or subtract one to reduce a behaviour.
Simple averaging can go wrong when models pull the same weights in different directions. TIES-Merging, published in June 2023 by Prateek Yadav and colleagues, tackles this by resetting weights that barely changed during fine-tuning, resolving disagreements over whether each weight should go up or down, and merging only the weights that agree. Other work automates the choice of recipe: in March 2024 Takuya Akiba and colleagues used an evolutionary search to merge open models into a Japanese language model with maths reasoning skills.
Merging became popular in the open-model community partly because it needs no further training and can run on modest hardware. The authors of MergeKit, an open-source merging library released in March 2024, said thousands of models had already been merged by the open-source community. Major labs use the idea too: Meta's Llama 3 paper describes averaging models from experiments with different data and settings at each post-training stage, and Ai2 averaged several mid-training runs for OLMo 2.
The limits are practical. The methods above assume models that share an architecture and usually a common pre-trained ancestor, and a merge that scores well on a leaderboard still needs testing on the tasks it is meant for.
It is combining the weights of two or more trained models into one model of the same size, usually models fine-tuned from the same base. The aim is a single model with the combined strengths of its parents, created without further training and without the cost of running several models. An ensemble keeps all the models and runs each one, then combines their predictions, so it costs more to run. Merging combines the weights themselves into one model, so inference costs the same as for a single model. The model soups paper made exactly this comparison. No. The common methods need models with the same architecture, and they work best when the models were fine-tuned from the same pre-trained model, because their weights then line up closely. Merging unrelated models generally does not produce a working result with these techniques. A model soup is a model made by averaging the weights of several versions of a model fine-tuned with different hyperparameters. The term comes from a 2022 paper that found soups often beat the best single model in the batch while costing nothing extra to run.Common questions
What is model merging in AI?
What is the difference between model merging and ensembling?
Can you merge any two AI models?
What is a model soup?
Search for "model merging LLM", "task arithmetic", "TIES merging" or "model soups" to see the main techniques. The most reliable sources are the original papers on arXiv and the documentation of open-source tools such as MergeKit. Treat leaderboard rankings of merged models with care, since merges can be tuned towards particular benchmarks without improving everyday use.Finding more
Working out what this means for your business?
Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.