Model Ensembling Methods
Simultaneous finetuning trains one model on a combined dataset of all tasks, and it usually needs more data and training because learning many skills at once is harder.
One Model Asked to Do Many Jobs
A single finetuned model is often expected to handle more than one job. A team may want the same model to answer customer questions, summarize documents, and classify support tickets. Each of these is a task, and each task asks the model to learn something specific. The question this article answers is how to bring several tasks into one model, and what goes wrong along the way.
The source material describes three main routes. The first is finetuning on all tasks at once. The second is finetuning on tasks one after another. The third is finetuning on tasks separately and then merging the results. Each route trades cost, data requirements, and the risk of losing earlier learning in a different way. The sections below follow those three routes in turn, then compare merging with a related idea called ensembling.
Simultaneous Finetuning on a Combined Dataset
Simultaneous finetuning trains one model on a combined dataset of all tasks, so that the model learns every skill in the same training run.
The method is straightforward to describe but demanding in practice. Learning several skills at the same time is generally harder than learning one, so the approach typically needs more data and more training than a single-task finetune. The cost lies less in the procedure itself and more in assembling a dataset large enough to cover every task well.
Simultaneous finetuning is the only one of the three routes that sees all tasks in the same training run. That property makes it attractive when the data for every task is available at the start. It is also the reason its cost grows as more tasks are added to the mix, because every new task enlarges the dataset and the training needed to cover all of them together.
Sequential Finetuning and Its Hidden Flaw
Sequential finetuning trains tasks one after another. The appeal rests on an assumption: that it is easier for a model to learn one task at a time than to learn all of them together. Each stage gets a focused dataset, and the team does not need to assemble every task's data before training can begin.
The assumption has a flaw. Neural networks are prone to catastrophic forgetting, a tendency documented in the research literature. A model can lose the ability to perform an old task once it has been trained on a new one, and the result can be a sharp drop in performance on earlier tasks. Sequential finetuning therefore gives you a clean training schedule, but it does not protect what the model learned first.
Tracing One Model Through Two Stages
To see the trouble concretely, follow one model through a two-stage sequence. The example below is an illustrative case constructed for teaching; it is not drawn from the source. Suppose the model is first finetuned on a task that classifies movie reviews as positive or negative. At that point it handles the review task well.
Movie review classifier, then a name extractor
A model is finetuned first on review classification (task A), then on extracting people's names from news articles (task B). What happens to task A after the second stage?
- 1Stage 1: finetune on task A
The weights are updated so that the model classifies movie reviews as positive or negative. Task A performance is good.
- 2Stage 2: finetune on task B, starting from stage 1 weights
Training continues from the weights left by task A. The run is set up in the usual way, and nothing signals that the review skill still matters.
- 3Check task B
The model answers name-extraction questions well, because the second run improved exactly that skill.
- 4Check task A
The review classification may have slipped. The update that improved task B overwrote parameters that had supported task A.
The model is good at task B, but its task A performance has dropped. The later task did not merely fail to help the earlier one; it erased part of it.
Why the Second Update Overwrites the First
What do you think happens?
After the model is trained on task B, what do you expect to happen to its task A performance?
Reveal answer
It drops sharply, because the task B updates overwrite the weights that supported task A.
Neural networks are prone to catastrophic forgetting. Nothing in the second training run tells the model to keep the first skill, so earlier performance can fall sharply.
This is the core of catastrophic forgetting. The problem is not that the second task is hard or that the model runs out of room. The update made for task B is applied to the same parameters that task A relied on, and it changes them without regard for what they were doing before.
Model Merging: Train Apart, Combine Later
Model merging takes a different route. The key difference from the first two routes is that no task is trained on top of another task's finetuned weights in a chain. Each task gets its own finetuning run, starting from the same model. Because each run focuses on one task, the model can learn that task better than it would when sharing its capacity with others. Afterward, the separate models are combined by mixing their parameters together.
Because the merge happens after finetuning rather than during it, the sequential forgetting problem does not arise. No task's training run ever overwrites another's, since the runs never see each other's updates. The output is a single model that performs multiple tasks.
Why Merging Helps On-Device Deployment
The source gives a practical motive for merging. It is appealing when models must be deployed to devices such as phones, laptops, cars, smartwatches, and warehouse robots. On-device deployment is often difficult because the device has limited memory, and keeping a separate model for each task on the device quickly exhausts that space.
Merging addresses this directly. Rather than squeezing several models onto a device, the separate models are combined into one model that handles multiple tasks while requiring much less memory. Shipping one merged model instead of several finetuned models means one set of parameters to store and load.
The source names two further reasons that deployment on the device matters. Some data cannot leave the device, often for privacy reasons. Some devices also have limited or unreliable internet access. On-device deployment can additionally lower inference costs, since computation offloaded to user devices does not have to be paid for in data centers.
Model merging can also serve as a way to carry out federated learning, in which multiple devices train the same model on separate data. Suppose model X is deployed to several devices. Each copy of X keeps learning from the data on its own device. After a while there are several copies of X, each trained on different data. Those copies can then be merged into one new base model that contains the learning of all the constituent models. No single device had to share its raw data; each contributed through its own trained copy.
Merging Versus Ensembling
The idea of combining models to get better performance predates merging. The source traces it to model ensemble methods, and it quotes a definition of ensembling as combining multiple learning algorithms to obtain better predictive performance than could be obtained from any of the constituent learning algorithms alone.
The two ideas differ in where they combine models. Merging typically mixes the parameters of the constituent models together, so the result is a single model. Ensembling typically combines only the outputs, and it keeps each constituent model intact. In an ensemble, given a query, several models each produce an answer, and a final answer is then produced from those answers, for example by a simple majority vote or by another trainable machine learning module.
The source notes a trade-off. Ensembling can generally improve performance, but it has a higher inference cost because each request requires several inference calls. Merging avoids that per-request cost because the result is one model. The source also observes that many models near the top of the Hugging Face Open LLM Leaderboard are merged models, in the same way that model ensembles once dominated leaderboards.
Mistakes Learners Make With These Routes
Common mistake Assuming sequential finetuning keeps earlier skills because each stage trains well
What it looks likeA model trained on review classification and then on name extraction is assumed to still classify reviews well.
Why it failsNeural networks are prone to catastrophic forgetting, so the second update can overwrite parameters that supported the first task.
Do this insteadMeasure performance on earlier tasks after every stage, not only on the newest one.
Common mistake Thinking merging and ensembling both produce one model
Why it failsMerging mixes parameters into a single model, while ensembling keeps each constituent model intact and combines their outputs.
Do this insteadAsk at which point the combination happens: at the weights before deployment, or at the predictions during inference.
Common mistake Expecting ensembling to be free at deployment time
Why it failsEach request in an ensemble requires several inference calls, which raises inference cost.
Do this insteadCount the models that must run per request before choosing ensembling for a device or service.
Common mistake Assuming simultaneous finetuning is cheap because it avoids forgetting; it usually needs more data and training because learning several skills at once is harder
Choosing a Route for a Given Situation
| Route | When the combined training happens | Data needed | Models or runs needed | Main risk |
|---|---|---|---|---|
| Simultaneous finetuning | One run over all tasks together | A combined dataset covering every task | One model, one run | Learning many skills at once is harder and needs more data and training |
| Sequential finetuning | Tasks are trained one after another, each starting from the previous weights | A focused dataset per stage | One model, several runs in order | Catastrophic forgetting of earlier tasks |
| Model merging | Each task is finetuned separately from the same base, then parameters are mixed | A focused dataset per task | Several finetuning runs, then one merged model | The merge must combine the separate models into one useful model |
Three routes to preparing one model for several tasks
A small team has a phone app that must answer questions, summarize notes, and classify messages on the device, where memory is tight and some user data must stay on the phone. They have a separate finetuned model for each task. Which route is the best fit, and what would they need to check afterward?
Hints
- Consider where the models would run and how much memory several separate models would take on the device.
- Think about whether merging avoids sequential forgetting, and whether earlier tasks still need to be measured after the combination.
Key Takeaways
- Simultaneous finetuning trains one model on a combined dataset of all tasks in one run, and it usually needs more data and training because learning many skills at once is harder.
- Sequential finetuning trains tasks one after another, but neural networks are prone to catastrophic forgetting, so performance on earlier tasks can drop sharply.
- Model merging finetunes separate copies of a model on different tasks, then mixes their parameters into one model, avoiding sequential forgetting and reducing memory needs for on-device deployment.
- Merging combines models at the weights before deployment and yields one model, while ensembling combines the outputs of intact models at inference time, which generally improves performance but raises inference cost.