MergeNet: Knowledge Migration across Heterogeneous Models, Tasks, and Modalities

Kunxi Li, Tianyu Zhan, Kairui Fu, Shengyu Zhang, Kun Kuang, Jiwei Li, Zhou Zhao, Fan Wu, Fei Wu

TL;DR

MergeNet is a novel framework that enables knowledge transfer between AI models even when they have completely different architectures, perform different tasks, or process different modalities (like images vs. text). By treating model parameters as the primary carriers of knowledge and using a specialized "parameter adapter," it outperforms traditional methods like knowledge distillation in complex, heterogeneous scenarios.

What Problem Does This Paper Address?

Transferring knowledge from a large, powerful "teacher" model to a smaller "student" model is a standard way to deploy efficient AI on edge devices. However, existing methods have strict limitations:

  • Backbone Sharing requires the models to have similar architectures.
  • Knowledge Distillation (KD) relies on matching output "logits" or intermediate feature maps, which is difficult when models are designed for different tasks or modalities.

When you try to bridge models that are fundamentally different—say, transferring visual patterns from a ResNet to a language-processing BERT—traditional methods often falter. Direct parameter sharing between such different structures can actually hurt performance because the knowledge representations are incompatible. MergeNet aims to bridge this "parameter space gap" to allow for truly universal knowledge migration.

Figure 1: (a)-(c): Compare knowledge distillation, backbone sharing, and our proposed MergeNet. The orange arrows represent the flow of knowledge. (d): The parameter sharing method is ineffective for heterogeneous knowledge transfer, and in fact, may lead to a loss of accuracy due to the incom- patibility of knowledge.

Methods

The authors propose that parameters themselves are the natural carriers of knowledge. To facilitate transfer, they introduce three key components:

  1. Parameter Re-Encoding: To make the massive parameter matrices of deep networks manageable, MergeNet uses low-rank decomposition (similar to the concept behind LoRA). It breaks down large weight matrices into smaller, low-rank matrices that still capture the essential "knowledge" of the original weights.
  2. Low-rank Parametric Knowledge Adapter (LPKA): This is the heart of the system. It uses an attention mechanism to query the source model's parameters and map relevant information into the target model's parameter space. Instead of just copying values, it learns how to adapt the source knowledge to fit the target's structure.
  3. Interleaved Training Scheme: Knowledge transfer doesn't happen all at once. The training process alternates between "self-learning" (where the model learns from its own data) and "knowledge transfer" phases (where the adapter fuses parameters). This happens every $T_{cycle}$ steps to ensure the model consolidates its own learning while absorbing external knowledge.
Figure 2: Overview of MergeNet. MergeNet takes parameters from different models as inputs and generates parameters that integrate knowledge from these models, where more knowledge transfer layers indicate a greater amount of knowledge trans- ferred. It is important to note that the descriptions in (b) and (c) are based on the knowledge transfer from larger model to smaller model, but the process from smaller model to larger model is completely symmetrical.

Datasets

The researchers evaluated MergeNet across a wide variety of benchmarks to prove its versatility:

  • Cross-Structural: CIFAR-100 (Image classification using ResNet50 and MobileNetV2).
  • Cross-Modal: VQA v2.0 (Visual Question Answering) and MSCOCO (Image-Text Retrieval) using the X-VLM model.
  • Cross-Task: IMDb (Sentiment classification) and SQuAD v2.0 (Question Answering) using BERT and DistilBERT.

Key Insights and Ideas

  • Parameters as Knowledge: The most significant shift here is moving away from "what the model predicts" (logits) to "what the model is made of" (parameters) as the medium for transfer.
  • Overcoming Incompatibility: The authors found that direct parameter sharing is often detrimental. The "Adapter" acts as a translator, ensuring that knowledge from a vision model doesn't "confuse" a language model but instead provides useful structural priors.
  • Mutual Learning: MergeNet supports bidirectional transfer. In their experiments, transferring knowledge from a smaller model back to a larger one (reverse distillation) also yielded performance gains.
  • Layer Sensitivity: Knowledge transfer is most effective between deeper layers. These layers hold high-level semantic information that is more "portable" across different tasks than the low-level features found in early layers.

Key Results

MergeNet consistently outperformed vanilla models and state-of-the-art distillation techniques:

  • Cross-Structural: On CIFAR-100, MergeNet improved MobileNetV2's Top-1 accuracy by 2.64% over the vanilla version, significantly beating standard KD methods (which only managed ~0.45% to 1.6% improvements).
  • Cross-Modal: In Visual Question Answering, MergeNet achieved an overall score of 46.51, compared to the vanilla 45.78, by migrating knowledge between visual and textual encoders.
  • Cross-Task: Transferring knowledge from a classification task to a question-answering task resulted in a 1.72% increase in Exact Match (EM) score on SQuAD v2.0.
  • Ablation Study: The authors showed that the choice of $T_{cycle}$ is critical. For MobileNetV2, the best results came from a cycle of 4, representing a 6.42% increase over training without the interleaved self-learning phase.
Figure 3: Ablation with respect to Tcycle.

Limitations and Future Work

While MergeNet is powerful, the paper notes a few areas for further exploration:

  • Knowledge Complexity: The authors observed that "overly advanced" knowledge from very deep layers can sometimes disrupt a smaller model's existing knowledge structure if the gap is too wide.
  • Computational Overhead: Although the adapter is removed during inference (resulting in zero extra cost at runtime), training the adapter alongside two models adds complexity to the training pipeline.
  • Future Directions: The authors suggest that MergeNet could provide new insights into how different types of models represent information, potentially leading to even more efficient "universal" adapters.

Summary updated

BibTeX
@inproceedings{li2025mergenet,
  author = {Kunxi Li and Tianyu Zhan and Kairui Fu and Shengyu Zhang and Kun Kuang and Jiwei Li and Zhou Zhao and Fan Wu and Fei Wu},
  title = {{MergeNet: Knowledge Migration across Heterogeneous Models, Tasks, and Modalities}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i5.32510},
}
Figure