Training-free Heterogeneous Model Merging

Zhengqi Xu, Han Zheng, Jie Song, Li Sun, Mingli SongarXiv 2025 · DOI

Introduction

Model merging has emerged as a powerful paradigm for reusing pre-trained models, enabling the combination of specialized "expert" models into a single versatile "generalist" without the prohibitive computational costs of retraining. However, traditional merging techniques like Weight Averaging or Git Re-Basin are restricted to homogeneous architectures. Merging models with different depths or widths (e.g., a ResNet-50 and a ResNet-26) typically requires a costly retraining phase, which undermines the efficiency of the merge.

This paper introduces a novel framework that enables training-free merging of heterogeneous neural networks. By leveraging Layer Alignment to address depth discrepancies and Elastic Neuron Zipping for width mismatches, the authors demonstrate that heterogeneous models can be unified into a single multi-task model with performance comparable to traditional homogeneous merges.

Methods

The proposed framework addresses two primary architectural mismatches: depth and width.

Layer Alignment for Depth Discrepancies

To align models of varying depths, the deeper model is partitioned into segments, where each segment corresponds to a single layer in the shallower model. The authors propose two strategies for this alignment:

  1. Segment-wise Model Alignment (SMA): Matches the output of a segment in the deep model to the output of a layer in the shallow model.
  2. Layer-wise Model Alignment (LMA): A more granular approach that maximizes similarity between all intermediate layers within a segment and the target layer in the shallow model.
Comparison of SMA and LMA strategies for aligning models with different depths.

LMA ensures that the "representational shift" occurs at synchronized stages across both models, maintaining internal logic consistency during the merge.

Elastic Neuron Zipping for Width Discrepancies

When models have different layer widths (e.g., 512 vs. 256 neurons), a simple 1-to-1 mapping is impossible. Elastic Neuron Zipping calculates the similarity between all pairs of neurons across the two models and iteratively "zips" (merges) the most similar pairs until the target width is reached.

The Elastic Neuron Zipping process, which merges neurons based on representational similarity to handle width mismatches.

This approach effectively projects weights from different dimensionalities into a shared space based on functional similarity, allowing for a seamless integration of layers with disparate widths.

Results

The framework was evaluated on Computer Vision (CIFAR-10/100, ImageNet) and NLP (GLUE benchmark) datasets using ResNet, VGG, and BERT architectures.

  • Performance Parity: On CIFAR-100, merging a ResNet-26 and a ResNet-50 achieved a joint accuracy of ~56%, matching the performance of merging two identical ResNet-50s (~55.5%).
  • Scalability: On ImageNet, the "HeteroZ-LMA" approach reached a joint accuracy of 32.66%, significantly outperforming single-task baselines in multi-task settings.
  • NLP Robustness: BERT models merged via this method exhibited lower "loss barriers" compared to vanilla weight averaging, indicating more stable and effective weight-space alignment.

Discussion and Conclusion

The success of this method relies on the inherent redundancy in deep models, where adjacent layers often share similar representations. This redundancy allows multiple layers to be compressed or aligned into a single layer of a shallower model without catastrophic information loss. The authors found that LMA is generally superior to SMA because it synchronizes the entire representational path rather than just the endpoints.

While this work successfully bridges depth and width gaps within model families (e.g., ResNet to ResNet), merging fundamentally different architectures, such as a Vision Transformer (ViT) and a CNN, remains a challenge. Future work aims to extend this training-free approach toward "Knowledge Amalgamation," harvesting specialized knowledge from a diverse ecosystem of heterogeneous pre-trained models into a single unified architecture.

Summary updated

BibTeX
@misc{xu2025training,
  author = {Zhengqi Xu and Han Zheng and Jie Song and Li Sun and Mingli Song},
  title = {{Training-free Heterogeneous Model Merging}},
  year = {2025},
  eprint = {2501.00061},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2501.00061},
}
Figure