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

Abstract

MergeNet is a novel framework designed to facilitate "knowledge migration" between neural networks that share no commonalities in architecture, task, or modality. Traditional methods like Knowledge Distillation (KD) are often limited by the requirement for identical tasks or data types. MergeNet overcomes these barriers by treating model parameters as the fundamental carriers of knowledge. Using a Low-rank Parametric Knowledge Adapter (LPKA) and an interleaved training scheme, MergeNet maps knowledge across heterogeneous parameter spaces. Our evaluation across vision, natural language processing, and multimodal tasks shows that MergeNet not only outperforms existing distillation techniques but also enables cross-modal learning, such as transferring visual concepts to language models, with zero inference overhead.

Introduction

The deployment of AI models often involves a significant mismatch between high-capacity "teacher" models and resource-constrained "student" models. Conventional techniques like Knowledge Distillation (KD) primarily focus on matching output distributions, which necessitates that both models operate on the same task and data modality. Similarly, backbone sharing or transfer learning requires architectural similarities. These constraints limit the ability to leverage knowledge from diverse, specialized models.

MergeNet addresses this gap by proposing that knowledge is intrinsically stored within model weights. By shifting the focus from what a model predicts to the knowledge embedded in its parameters, MergeNet enables transfer between heterogeneous models—for instance, allowing a vision model to inform a language model.

Comparison of Knowledge Distillation, Backbone Sharing, and MergeNet paradigms.

Methodology

The core of MergeNet lies in its ability to bridge disparate parameter spaces through several key technical components:

  1. Parameter Re-Encoding: To handle the high dimensionality of neural network weights, MergeNet employs a low-rank decomposition strategy inspired by LoRA. Large weight matrices $W$ are decomposed into smaller matrices ($W = BA$), creating a manageable "knowledge package."
  2. Low-rank Parametric Knowledge Adapter (LPKA): This component acts as the translation layer. It utilizes an attention mechanism to query source parameters and identify relevant features for the target model, subsequently fusing this information into the target's weights.
  3. Interleaved Training Scheme: Knowledge transfer is integrated into the training process via a cycle $T_{cycle}$. The model alternates between standard "self-learning" via gradient descent and "knowledge transfer" updates. This prevents the migration process from destabilizing the model's internal representations.
  4. Zero Inference Overhead: The adapter is strictly a training-time construct. Once training is complete, the adapter is discarded, leaving the target model with its original architecture but enhanced performance.
Detailed architecture of MergeNet, including the Knowledge Transfer Layer, LPKA, and the training cycle.

Experimental Evaluation

MergeNet was evaluated across a wide range of benchmarks to demonstrate its versatility:

  • Vision: CIFAR-100 using ResNet50 and MobileNetV2.
  • Multimodal: VQA v2.0 and MSCOCO (Image-Text Retrieval).
  • NLP: SQuAD v2.0 and IMDb.

Key Results

  • Cross-Structure Performance: On CIFAR-100, MergeNet improved MobileNetV2’s accuracy by 1.02%, outperforming modern KD variants like NKD and DKD.
  • Cross-Modality Gains: In a setup where an image classifier (MobileNetV2) and a language model (BERT) learned from each other, BERT’s F1 score on SQuAD increased by 1.09%, while MobileNetV2’s accuracy rose by 1.69%.
  • Resource Efficiency: MergeNet achieved superior results to KD while utilizing less than half the active parameters during the training phase.

Discussion and Insights

A significant insight from this work is that parameters can serve as a "universal language." The successful transfer of knowledge from visual encoders to textual encoders suggests that high-level semantic concepts in weights may transcend specific data modalities. Furthermore, the study highlights the "failure of direct sharing," where forcing heterogeneous models to share weights without an adapter typically degrades performance. MergeNet also facilitates "mutual learning," where even smaller models can provide useful focal points to improve larger models.

Conclusion and Future Work

MergeNet represents a significant step toward universal knowledge transfer. While current limitations include sensitivity to the $T_{cycle}$ hyperparameter and the need for manual layer pairing, the framework opens new avenues for cross-modal and cross-task model enhancement. Future research will explore automated layer discovery and the application of MergeNet to large-scale language models.

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