TL;DR
This paper introduces Orthogonal Model Merging (OrthoMerge), a novel approach to combine multiple finetuned LLMs that preserves the geometric structure of model weights, unlike traditional methods that operate in Euclidean space. OrthoMerge achieves better performance and mitigates catastrophic forgetting by merging models on the orthogonal group manifold, even for models not trained with explicit orthogonal constraints.
What Problem Does This Paper Address?
As Large Language Models (LLMs) become increasingly powerful, finetuning them for specific tasks leads to a proliferation of specialized models. Merging these models into a single, capable one is crucial for efficiency and integration. However, existing methods primarily use linear arithmetic in Euclidean space. This approach can disrupt the inherent geometric properties of the model's weights, such as "hyperspherical energy" (which relates to the angular relationships between neurons), leading to performance degradation and catastrophic forgetting. The paper aims to solve this by proposing a merging strategy that respects and preserves these geometric structures.
Methods
The core of OrthoMerge lies in performing merging operations on the Riemannian manifold of the orthogonal group, which naturally preserves geometric properties.
- For OFT-trained models: Orthogonal Finetuning (OFT) explicitly learns orthogonal transformations. OrthoMerge maps these transformations to the Lie algebra (a related mathematical space), where a magnitude-corrected merging is performed. This ensures that both the direction and intensity of adaptations are accounted for. The result is then mapped back to the orthogonal group.
- For non-OFT models: A novel Orthogonal-Residual Decoupling strategy is introduced. This method decomposes a finetuned model's weights into two parts:
- An orthogonal component: This is extracted by solving an orthogonal Procrustes problem to find the best orthogonal transformation that approximates the task-specific adaptation.
- A residual component: This captures the remaining linear updates. The orthogonal components are merged on the manifold, while the residuals are merged using standard Euclidean methods. The final merged model combines these two components.
Datasets
The paper uses several standard datasets for training and evaluation:
- Training/Finetuning: ScienceQA, CommonsenseQA, Social-IQA, Magicoder-OSS-Instruct, NuminaMath-TIR, and datasets from MergeBench (Instruction-following, Mathematics, Multilingual, Coding, Safety).
- Evaluation: ScienceQA, CommonsenseQA, Social-IQA, MATH500, HumanEval+, M-ARC, AGIEval, and vision-language specific benchmarks like MMSI-Bench, EmbSpatial, MMMU, PathVQA, OCRBench, and CharXiv.
No new benchmarks were introduced.
Key Insights and Ideas
- Geometry Matters: The paper strongly argues that the geometric structure of model weights is crucial for effective merging and preventing catastrophic forgetting. Linear merging in Euclidean space is inherently destructive to this structure.
- Lie Algebra as a Merging Space: Performing merging operations in the Lie algebra associated with the orthogonal group provides an efficient and geometrically sound way to combine orthogonal transformations.
- Decoupling for General Models: The Orthogonal-Residual Decoupling strategy is a significant contribution, enabling the benefits of geometric merging to be applied to models finetuned with standard, non-orthogonal methods.
- Magnitude Correction is Key: Simply averaging orthogonal components can lead to "magnitude collapse" where conflicting updates cancel each other out. OrthoMerge's magnitude-corrected averaging preserves the strength of adaptations.
- Robustness to Task Count: OrthoMerge shows increasing performance gains as more tasks are merged, indicating its scalability and robustness.
Key Results
- Superior Performance: OrthoMerge consistently outperforms standard Euclidean-space merging methods (TA, TIES, DARE, TSV-M) across various benchmarks, including in-domain tasks and out-of-distribution generalization.
- Mitigating Catastrophic Forgetting: OrthoMerge shows improved performance on out-of-distribution tasks and general evaluation benchmarks (like M-ARC and AGIEval), indicating better retention of base model capabilities and reduced forgetting.
- Efficiency: While solving the orthogonal Procrustes problem can be computationally intensive (e.g., 19 minutes per task for SVD), an approximate Newton-Schulz variant significantly speeds this up (to ~1 minute) with comparable performance.
- Vision-Language Models: The Orthogonal-Residual Decoupling strategy also proves effective for merging vision-language models, demonstrating modality-agnostic benefits.
Limitations and Future Work
- Computational Cost: While improved by approximations, the orthogonal component extraction can still be computationally demanding for very large numbers of tasks or extremely high-dimensional models.
- Approximation vs. Exactness: The paper notes that strict orthogonalization might not always be necessary, and approximations can yield comparable or even better results, suggesting a trade-off between geometric rigor and practical performance.
- Future Work: The paper lays the groundwork for more robust and generalizable model merging. Future work could explore more advanced manifold-based merging techniques, investigate the theoretical underpinnings of why geometric preservation is so critical, and apply these methods to even larger and more diverse sets of models and tasks.
Summary updated