Model merging via "task arithmetic" is a powerful technique for combining specialized Large Language Models (LLMs) without expensive retraining. However, its effectiveness is often hampered by the global non-linearity of these systems. This paper, "Leveraging Submodule Linearity Enhances Task Arithmetic Performance in LLMs" (ICLR 2025), reveals a critical insight: while the model as a whole is complex and non-linear, its constituent submodules—layers, MLPs, and attention blocks—behave almost linearly. By exploiting this "latent linearity," the authors propose Submodule Linearity Task Arithmetic (SLTA), a training-free method that significantly improves multi-task performance.
The Challenge: Global Non-Linearity
Fine-tuning massive models for every niche task is computationally prohibitive. Task arithmetic offers a shortcut by adding "task vectors" (the difference between fine-tuned and base weights). This approach assumes linearity—that scaling weights leads to a proportional scaling of output features. In practice, LLMs are highly non-linear, causing standard task arithmetic to degrade performance. Previous solutions required "linearized fine-tuning," which reintroduces high training costs. This research asks if the benefits of linearity can be achieved without the cost of retraining.
The Discovery: Latent Submodule Linearity
The researchers introduced a Non-linearity Score to quantify how much a component deviates from linear behavior. Their findings reveal a striking phenomenon: non-linearity is an emergent property of the entire system.
As shown in Figure 1, the non-linearity score for the full model is orders of magnitude higher than that of its submodules. At the level of individual layers or MLP blocks, the relationship between weight changes and output changes is remarkably linear. This discovery suggests that the failures of task arithmetic are not due to the weights themselves, but rather how they are aggregated globally.
Submodule Linearity Task Arithmetic (SLTA)
Based on this insight, the authors developed SLTA, which operates in three key steps:
- Decomposition: The LLM is broken down into submodules (e.g., layers or Attn/MLP blocks).
- Linearity Verification: Submodule linearity is confirmed across tasks and architectures.
- Optimal Weight Calculation: Instead of a single global merging weight, SLTA calculates unique weights for every submodule. They derive a closed-form solution to find these weights by minimizing the distance between the merged submodule's output and the target task's output.
Crucially, SLTA is training-free. It requires only a tiny "calibration" set of approximately 30 samples per task and a few inference passes to solve the weight equations.
Results and Insights
The method was evaluated using Llama-2 and Qwen backbones across diverse tasks including mathematics (GSM8K), coding (Code Alpaca), and translation.
As illustrated in Figure 5, the principle of submodule linearity holds consistently across different task domains and model scales. Key findings include:
- Superior Performance: SLTA consistently outperformed standard Task Arithmetic, Weight Averaging, and DARE. For instance, in a three-task merge on Llama-2-13B, SLTA achieved an average score of 51.05, surpassing the 48.24 achieved by standard task arithmetic.
- Granularity Sweet Spot: Merging at the layer or Attn/MLP level yields the best results. Interestingly, moving to the individual attention head level caused performance to drop, likely because heads have highly specialized, non-overlapping functions that should not be averaged.
- Scalability and Efficiency: The performance gap between SLTA and standard methods grows as more models are merged. Furthermore, the method is highly data-efficient, requiring only 30 samples to calibrate submodule weights effectively.
Conclusion
SLTA demonstrates that we can achieve the benefits of model linearity without the cost of retraining. By shifting the focus from global weight merging to submodule-level optimization, researchers can more effectively combine the capabilities of specialized LLMs. Future work may explore incorporating second-order curvature information or designing "linearity-friendly" activation functions to further push the boundaries of model merging.
Reference: Dai, R., et al. "Leveraging Submodule Linearity Enhances Task Arithmetic Performance in LLMs." Published as a conference paper at ICLR 2025.
Summary updated