TL;DR
This paper reveals that Task Arithmetic—the popular method of merging models by simply adding their weight updates—is mathematically equivalent to one-shot Federated Learning. By bridging these two fields, the authors use Federated Learning theory to identify why merging often fails (data and training heterogeneity) and adapt robust aggregation algorithms to significantly boost the performance of merged models.
What Problem Does This Paper Address?
In the era of massive foundation models, "model merging" has become a hot topic. Instead of expensive multi-task training, researchers often take a pre-trained model (like CLIP or Llama), fine-tune it on several different tasks independently, and then try to "stitch" those capabilities together.
The simplest way to do this is Task Arithmetic: you subtract the pre-trained weights from the fine-tuned weights to get a "task vector," then add these vectors back to the base model. While this works surprisingly well, it’s largely empirical. We don't have a solid theoretical grasp of why it succeeds or why it sometimes produces a "broken" model that fails at all tasks. This paper sets out to provide that missing theoretical foundation.
Methods
The authors’ core contribution is a mathematical bridge. They prove that Task Arithmetic is essentially one-shot Federated Averaging (FedAvg)—a distributed learning algorithm where multiple devices train locally for one round and send their updates to a central server.
By framing model merging as a Federated Learning (FL) problem, they can import years of FL theory to analyze two major hurdles:
- Data Heterogeneity: When the datasets for different tasks are very different, the "optimal" direction for one task might conflict with another.
- Training Heterogeneity: In practice, different tasks are often fine-tuned with different learning rates or for different numbers of steps. This creates "objective inconsistency," where the merged model gravitates toward the task that was trained "harder" rather than a fair balance.
To fix these issues, they adapt four established FL algorithms for model merging:
- FedNova: Normalizes task vectors to account for different training iterations/learning rates.
- FedGMA: Uses a "gradient mask" to resolve sign conflicts (when one task wants a weight to go up and another wants it to go down).
- Median & CCLIP: Robust aggregation methods that treat extreme task vectors as outliers to prevent a single task from dominating the merge.
Datasets
The authors validated their approach across two distinct domains:
- Computer Vision: They used CLIP-ViT-B-32 as the base model and merged task vectors from eight diverse datasets: Cars, DTD (textures), EuroSAT (satellite), GTSRB (traffic signs), MNIST, RESISC45, SUN397, and SVHN (house numbers).
- Large Language Models (LLMs): They merged Llama-2-13B variants fine-tuned for three tasks:
- Instruction Following: Evaluated on AlpacaEval.
- Mathematical Reasoning: Evaluated on GSM8K and MATH.
- Code Generation: Evaluated on HumanEval and MBPP.
Key Insights and Ideas
- The "Silent Killer" is Training Heterogeneity: The paper finds that in practical scenarios, the way we train models (different hyperparams) hurts merging more than the differences in the data itself. If one task is trained with a high learning rate, its task vector norm explodes, effectively "drowning out" other tasks during a simple sum.
- Homogeneity is a Free Lunch: The authors show that if you simply ensure all tasks are fine-tuned with the exact same hyperparameters, the performance of a standard Task Arithmetic merge jumps by up to 30%.
- Robustness Matters: Algorithms like CCLIP and Median are highly effective because they naturally dampen the influence of "outlier" task vectors created by aggressive fine-tuning.
- PEFT Discrepancy: When merging LLMs, they noticed that models trained with Parameter-Efficient Fine-Tuning (like QLoRA) have much smaller task vector norms than fully fine-tuned models. This makes merging "hybrid" models (some PEFT, some full) particularly challenging.
Key Results
- CLIP Merging: In experiments simulating "messy" real-world conditions (heterogeneous training), the adapted FL algorithms outperformed standard Task Arithmetic in the vast majority of cases. CCLIP improved results in 91.5% of the 247 experimental configurations tested.
- LLM Merging: For Llama-2, the robust methods (FedGMA and CCLIP) often outperformed standard arithmetic when merging two tasks. However, they found that when merging three tasks with very different tuning methods (e.g., merging a QLoRA coding model with a fully fine-tuned math model), standard Task Arithmetic was sometimes more stable, highlighting a limit to current aggregation tricks.
Limitations and Future Work
- The Scale Gap: Recent studies suggest that as models get extremely large (like PaLM-2), the differences between merging methods start to shrink. The authors note that their framework doesn't yet explain why massive scale seems to mitigate heterogeneity.
- Universal Heterogeneity: There is still no "universal" definition of data heterogeneity in FL, which makes it hard to develop a one-size-fits-all theory for all types of model merging.
- PEFT vs. Full Fine-Tuning: The norm discrepancy between PEFT and full fine-tuning remains an open challenge. The authors suggest that future work should focus on robust aggregation methods specifically designed for these "hybrid" merges.
Summary updated