Multi-task Code LLMs: Data Mix or Model Merge?
This paper compares data mixing and model merging strategies for creating efficient multi-task code LLMs, finding that model merging outperforms data mixing at larger scales (7B) by retaining or even surpassing specialized performance, while data mixing is preferred at smaller scales (2B).
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you have a brilliant but small robot assistant that needs to learn two very different skills: writing code (like a programmer) and explaining code (like a teacher). You want this robot to be good at both, but you don't have the budget or time to train two separate robots. You have two main ways to teach it:
- The "Mix-and-Match" Class (Data Mixture): You throw all the programming problems and all the explanation lessons into one big bucket and teach the robot everything at once.
- The "Specialist Swap" (Model Merging): You first train one robot to be a master programmer and another to be a master teacher. Then, you take their brains (their "weights") and carefully blend them together into one super-robot.
This paper asks a simple question: Which method works better? And the answer depends entirely on how big the robot is.
The Big Discovery: Size Matters
The researchers tested this on robots of different sizes (small ones with about 2 billion "brain cells" and larger ones with 7 billion). Here is what they found:
1. The Small Robots (2 Billion Parameters): The "Mix-and-Match" Wins
For the smaller robots, trying to blend two expert brains together was a disaster. It was like trying to mix oil and water; the two skills fought each other, and the robot got confused, forgetting how to do either job well.
- The Analogy: Imagine a small student trying to learn calculus and poetry simultaneously in a single class. If you try to force them to be a "math-poet" by just blending two separate lessons, they might get overwhelmed and learn neither well.
- The Solution: For small robots, it's better to just put all the math and poetry books in one pile and study them together. The "Mix-and-Match" approach (Data Mixture) kept the small robot competent at both tasks without it getting confused.
2. The Big Robots (7 Billion Parameters): The "Specialist Swap" Wins
For the larger robots, the story flipped completely. Blending the brains of two experts worked beautifully. In fact, the merged robot was sometimes better than the individual experts.
- The Analogy: Imagine a genius professor who is already a master of math and a master of literature. If you take their "math brain" and "literature brain" and combine them, they don't get confused. Instead, they find a way to use their vast knowledge to solve problems in a way neither specialist could do alone.
- The Result: The large merged robot retained 96% of the performance of the specialized experts. In some cases, the merged robot even scored higher on coding tests than the robot trained specifically for coding!
Why Does This Happen? (The "Brain Scan")
The researchers didn't just look at the test scores; they looked inside the robots' brains to see how they changed during training.
- Small Robots: When small robots tried to learn two things at once, their brains changed in very similar ways for both tasks. It was like they were using the exact same neurons for math and poetry. When you tried to merge two small robots, those neurons were fighting over who got to do what, causing a "traffic jam" in the brain.
- Big Robots: Large robots have enough "brain space" to use different parts of their brain for math and different parts for poetry. They are like having two separate rooms in a house. When you merge them, the rooms don't collide; they just sit side-by-side, allowing the robot to be a master of both without interference.
The Takeaway
If you are building a small, efficient AI system (perhaps for a device with limited battery or memory), don't try to merge experts. Just train one model on a mix of all the data you need.
However, if you have a larger, more powerful model, go ahead and merge experts. You can train a coding specialist and a summarizing specialist separately, then combine them to get a versatile, high-performing model that saves you the cost of training a massive multi-task model from scratch.
In short:
- Small Model? Mix the data.
- Big Model? Merge the experts.
The paper provides a clear rulebook for developers to choose the right strategy based on the size of their model, ensuring they get the best performance without wasting resources.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.