Model Assembly Learning with Heterogeneous Layer Weight Merging

Yi-Kai Zhang, Jin Wang, Xu-Xiang Zhong, De-Chuan Zhan, Han-Jia Ye

TL;DR

Model Assembly Learning (MAL) breaks a major barrier in model merging by allowing the integration of parameters from entirely different neural network architectures without requiring additional training data. By leveraging generalized permutations and zero-padding, MAL successfully aligns and merges layers of varying widths and depths while preserving the models' core capabilities.

What Problem Does This Paper Address?

Model merging has emerged as a powerful way to combine the capabilities of multiple neural networks without the high computational cost of retraining or the risk of catastrophic forgetting. Traditionally, this relies on Linear Mode Connectivity (LMC)—the phenomenon where two models aligned via permutation symmetries can be averaged together without a spike in loss.

However, existing model merging techniques suffer from a strict limitation: they require identical network architectures. In the real world, we have an open-ended "model zoo" filled with diverse architectures optimized for different tasks. Current methods cannot extract and combine knowledge from these heterogeneous models. This paper addresses this gap by asking: Can we merge layer-wise parameters across entirely different network structures?

Methods

The authors introduce Model Assembly Learning (MAL), a paradigm that shifts the focus from global model alignment to layer-wise parameter merging. Instead of enforcing whole-model output invariance, MAL relaxes this to layer output invariance, treating layers as independent subnetworks that can be swapped or combined.

To handle the inevitable shape mismatches between different architectures, MAL introduces a Generalized Permutation framework divided into two scenarios:

  1. Size-Compatible Case: When one layer's weight matrix strictly contains the dimensions of the other (e.g., merging a wider layer into a narrower one), the smaller matrix is padded with zeros to match the larger one. A non-square generalized permutation matrix $P$ is then applied to align the neurons.
  2. Size-Incompatible Case: When the dimensions do not follow a strict order (e.g., one has more rows but fewer columns), a direct one-way transformation fails. MAL solves this by introducing bidirectional permutation, applying matrix $P$ to the target model and matrix $Q$ to the base model. The authors resolve this optimization problem using an alternating optimization strategy, fixing one permutation matrix while solving for the other iteratively.

Datasets

The authors evaluated MAL using a diverse model zoo trained on standard image classification benchmarks:

  • MNIST
  • FashionMNIST
  • CIFAR-10
  • CIFAR-100

They deployed 30 distinct model architectures spanning 5 structural categories (equal width, wide-to-narrow, narrow-to-wide, pyramid-shaped, and inverse-pyramid) with depths ranging from 2 to 6 layers.

Key Insights and Ideas

The paper formalizes its findings into a "Bag of Laws" for MAL:

  • Base Architecture Matters: Merging heterogeneous models works best when at least one of the architectures is already well-suited to the dataset. For instance, simpler architectures perform better as a base on MNIST to avoid overfitting, whereas complex bases excel on CIFAR-10.
  • Zero-Padding is Remarkably Safe: Across different datasets and architectures, zero-padding the dimension mismatches has a minimal negative impact. As long as the permutation matrices correctly align the underlying features, the network retains its capabilities.
  • Respect the Semantic Progression: Selectively merging partial layers works well, but you must respect the network's hierarchy. Merging shallow layers with shallow layers preserves LMC, but attempting to merge deep-layer weights into shallower layers severely degrades performance.

Key Results

The authors demonstrated that MAL successfully maintains LMC during the merging process up to a critical convex combination threshold ($\lambda$).

Loss landscape and heatmaps of heterogeneous model merging

As illustrated in Figure 1, the heatmaps show that even when merging models across different datasets (e.g., CIFAR-100 vs. FashionMNIST) and varying layer widths, the optimized permutation alignment (represented by lighter colors) consistently achieves significantly lower loss compared to naive interpolation. The 1-D loss landscapes (bottom right) confirm that within a certain threshold of the merging factor, the model successfully absorbs target knowledge without destroying its original performance.

Limitations and Future Work

While this paper lays the theoretical and practical groundwork for heterogeneous merging, the experiments were primarily conducted on Multi-Layer Perceptrons (MLPs) and standard dense layers. Although the authors note that the framework mathematically extends to residual connections and attention mechanisms, they have not yet demonstrated MAL on large-scale modern architectures like Transformers or Large Language Models (LLMs).

Future work will focus on scaling MAL to these complex architectures, exploring multi-task scenarios, and testing its efficacy in open-ended LLM merging.

Summary updated

BibTeX
@inproceedings{zhang2025model,
  author = {Yi-Kai Zhang and Jin Wang and Xu-Xiang Zhong and De-Chuan Zhan and Han-Jia Ye},
  title = {{Model Assembly Learning with Heterogeneous Layer Weight Merging}},
  booktitle = {WSL @ ICLR},
  year = {2025},
  url = {https://openreview.net/forum?id=T3tcaDgdaW},
}
Figure