ICM-Fusion: In-Context Meta-Optimized LoRA Fusion for Multi-Task Adaptation

Yihua Shao, Xiaofeng Lin, Xinwei Long, Siyu Chen, Minxi Yan, Yang Liu, Ziyang Yan, Ao Ma, Hao Tang, Jingcai Guo

TL;DR

ICM-Fusion introduces a novel framework that combines meta-learning and in-context learning within a Fusion Variational Autoencoder (F-VAE) to seamlessly merge multiple task-specific LoRA adapters. By dynamically balancing task vectors in a unified latent space, it eliminates parameter conflicts and catastrophic forgetting without requiring access to the original training datasets.

What Problem Does This Paper Address?

Low-Rank Adaptation (LoRA) has become the gold standard for efficiently tuning large language and vision models for specific downstream tasks. However, a major challenge arises when we want a single model to perform multiple tasks simultaneously by combining different specialized LoRA adapters.

Existing fusion methods typically rely on direct parameter-space manipulations, such as weight averaging or Singular Value Decomposition (SVD). These approaches often damage LoRA's intrinsic structure, leading to inter-weight conflicts and "catastrophic domain forgetting." While alternative strategies like Mixture-of-Experts (MoE) or incremental learning mitigate forgetting, they struggle with data scarcity in few-shot scenarios and fail to generalize to out-of-domain tasks. ICM-Fusion aims to bridge this gap by enabling robust, multi-task LoRA fusion that preserves individual task capabilities even when data is scarce.

Methods

The ICM-Fusion framework operates in three main steps, combining task vector arithmetic with a generative latent space model:

  1. Task Vector Extraction: For each specialized task, the system computes a "task vector" ($\Delta v_{T_i}$), which is the element-wise difference between the final-layer output tokens of the fine-tuned LoRA model and the frozen, pre-trained base model. This vector compactly captures the specific knowledge required for that task.
  2. Latent Space Encoding via F-VAE: Instead of merging weights directly in the high-dimensional parameter space, ICM-Fusion uses a self-designed Fusion VAE (F-VAE). The encoder takes the flattened LoRA parameters concatenated with their corresponding task vectors and maps them into a aligned, low-dimensional latent space.
  3. In-Context Meta-Learning: At inference time, the framework applies meta-learning principles to optimize these latent representations. An inner loop refines the parameter estimates through gradient-based adaptation steps, while an outer loop optimizes the VAE parameters using a meta-loss function. This dual-loop optimization allows the model to dynamically navigate and balance competing optimization directions across different domains.
Figure 2: Overview of the In-Context Meta Fusion LoRA framework. Step 1: LoRA adapters are trained on a diverse set of tasks using masked language modeling (MLM), resulting in task-specific LoRA weights. Step 2: For each task, a task vector is obtained by computing the parameter difference between the fine-tuned and pre-trained LoRA adapters, providing a compact representation of task-specific knowledge. Step 3: The Fusion VAE leverages in-context learning and meta-learning, taking multiple task vectors and LoRA parameters as input to model latent task relationships. For each parameter dimension, the input θadapt refers to the value of that specific dimensions relevant to the task in the flattened LoRA parameters; the VAE then adjusts θadapt to generat e the task-specialized parameter θft suitable for the target task. The encoder-decoder structure enables efficient parameter fusion and adaptation.

Datasets

The authors evaluated ICM-Fusion across both computer vision and natural language processing benchmarks:

  • Computer Vision: Object detection was evaluated using the VOC 2012 dataset on the Florence2 architecture. Multimodal visual question answering was tested using the ScienceQA dataset on LLaVA-v1.5.
  • Language Modeling: Pure language tasks were evaluated using The Pile dataset (specifically subsets like ArXiv, Books, Ubuntu, Wikipedia, and Gutenberg) on the Llama3 architecture.

Key Insights and Ideas

  • Fusing in the Latent Space: The core "aha moment" is that parameter conflicts are much easier to resolve in a structured latent space than in the raw weight space. The VAE acts as a buffer that protects the structural integrity of the LoRA weights.
  • Task Vectors as Guidance Signals: Treating task vectors as differentiable guidance signals allows the model to find a dynamic equilibrium between opposing task requirements.
  • The Representation Bridge: As shown via t-SNE visualization, the sampled points of the fused model lie gracefully between the distinct clusters of individual tasks (e.g., bridging the gap between a "dog" detection task and a "cat" detection task), proving that the model successfully captures features from both domains simultaneously.
t-SNE visualization of task vectors

Key Results

ICM-Fusion consistently outperformed state-of-the-art model merging baselines (such as Model Soup, RegMean, TIES, and DARE-TIES):

  • Object Detection: On the VOC 2012 dataset, ICM-Fusion achieved the highest overall performance with an average MAP50 score of 0.90, compared to the original base LoRA score of 0.89 and baseline fusion methods which hovered between 0.83 and 0.88.
  • Visual Question Answering: On ScienceQA, the framework robustly improved the average post-fusion score to 89.39, demonstrating its adaptability to complex multimodal architectures.
  • Language Modeling: Across subsets of The Pile, ICM-Fusion consistently lowered perplexity (achieving an average PPL of 7.51 vs. the original model's 8.45), indicating a superior ability to retain language capabilities after fusion.
  • Few-Shot Generalization: In long-tail scenarios where only 10% additional data was available for rare classes (like Sofa or Airplane), ICM-Fusion demonstrated the most significant performance gains, proving its high data efficiency.

Limitations and Future Work

While ICM-Fusion excels at few-shot generalization, its performance is still heavily constrained when absolutely no additional data is provided (the 0% data regime) for extreme long-tail classes, where MAP50 scores drop near zero.

For future work, the authors suggest exploring broader applications of this framework, such as zero-shot knowledge sharing across entirely distinct model families and further minimizing the computational overhead required to augment multi-task systems with completely unseen tasks.

Summary updated

Abstract

Enabling multi-task adaptation in pre-trained Low-Rank Adaptation (LoRA) models is crucial for enhancing their generalization capabilities. Most existing pre-trained LoRA fusion methods decompose weight matrices, sharing similar parameters while merging divergent ones. However, this paradigm inevitably induces inter-weight conflicts and leads to catastrophic domain forgetting. While incremental learning enables adaptation to multiple tasks, it struggles to achieve generalization in few-shot scenarios. Consequently, when the weight data follows a long-tailed distribution, it can lead to forgetting in the fused weights. To address this issue, we propose In-Context Meta LoRA Fusion (ICM-Fusion), a novel framework that synergizes meta-learning with in-context adaptation. The key innovation lies in our task vector arithmetic, which dynamically balances conflicting optimization directions across domains through learned manifold projections. ICM-Fusion obtains the optimal task vector orientation for the fused model in the latent space by adjusting the orientation of the task vectors. Subsequently, the fused LoRA is reconstructed by a self-designed Fusion VAE (F-VAE) to realize multi-task LoRA generation. We have conducted extensive experiments on visual and linguistic tasks, and the experimental results demonstrate that ICM-Fusion can be adapted to a wide range of architectural models and applied to various tasks. Compared to the current pre-trained LoRA fusion method, ICM-Fusion fused LoRA can significantly reduce the multi-tasking loss and can even achieve task enhancement in few-shot scenarios.
BibTeX
@inproceedings{shao2026icm,
  author = {Yihua Shao and Xiaofeng Lin and Xinwei Long and Siyu Chen and Minxi Yan and Yang Liu and Ziyang Yan and Ao Ma and Hao Tang and Jingcai Guo},
  title = {{ICM-Fusion: In-Context Meta-Optimized LoRA Fusion for Multi-Task Adaptation}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2026},
  doi = {10.1609/aaai.v40i11.37840},
}
Figure