Model Fusion via Retrofitting

Phoomraphee Luenam, Andreas Spanopoulos, Amit Sant, Thomas Hofmann, Sotiris Anagnostidis, Sidak Pal Singh

TL;DR

Model fusion aims to merge independently trained neural networks into a single model without costly retraining, but it frequently fails when models are trained on different, non-IID data distributions. This paper introduces a novel, neuron-centric framework that treats fusion as a two-stage representation-matching problem (clustering followed by weight retrofitting) while incorporating neuron saliency scores. The resulting algorithms achieve state-of-the-art zero-shot fusion performance across VGG, ResNet, and Vision Transformer (ViT) architectures, even under extreme data heterogeneity.

What Problem Does This Paper Address?

When we train multiple neural networks independently, they often learn completely different internal representations—even if they share the same architecture and are trained on identical data. This phenomenon, driven by random initialization and permutation invariance, is called representational divergence.

Existing model fusion techniques (like OTFusion or Git Re-Basin) try to align these divergent neurons before averaging their weights. However, they suffer from three major flaws:

  1. Zero-Shot Failure under Non-IID Data: When parent models are trained on heterogeneous or "sharded" data (where different models see entirely different classes, a common scenario in Federated Learning), existing methods collapse to near-random accuracy unless followed by extensive fine-tuning.
  2. Ignoring Neuron Saliency: They treat all neurons as equally important, meaning noisy or irrelevant features can distort the alignment of critical, highly salient features.
  3. Architectural Limitations: Many implementations are hardcoded for specific layer types, making it difficult to generalize across diverse architectures like CNNs and Vision Transformers (ViTs).

This paper tackles these gaps by proposing a principled, architecture-agnostic framework that works exceptionally well in zero-shot (no retraining) settings.

Methods

The authors frame model fusion as a representation-matching problem. Instead of simply averaging weights layer-by-layer in isolation, they decouple the objective function into two distinct, interpretable steps:

  1. Grouping Error (Clustering): Intermediate neurons across all parent models are clustered into target representations (centroids). For equal-sized models with one-to-one matching, this is solved via the Hungarian matching algorithm (Hungarian Fusion / HF). For the general case (varying widths or multiple models), it uses importance-weighted K-means (K-means Fusion / KF).
  2. Approximation Error (Retrofitting): The fused model's weights are optimized to directly approximate these target centroids. For linear layers, this reduces to a closed-form weighted least-squares problem (HF/KF-Linear). For non-linear layers, it is optimized via SGD/Adam (HF/KF-Gradient).

A key innovation is the optional integration of neuron attribution scores (using methods like Conductance or DeepLIFT). This biases the clustering and retrofitting steps to prioritize the preservation of highly salient features over noisy, less important ones.

Figure 1. Overview of our method. Given two MLPs with two hidden layers of size 4, we compute the layer activations, cluster their neurons, and train the first layer of the fused model to match the centroids with the MSE loss. The process is repeated in subsequent levels.

Datasets

The framework was rigorously evaluated across several standard computer vision benchmarks under various data-splitting regimes (Sharded, Non-IID Dirichlet, and Full Dataset):

  • CIFAR-10 & CIFAR-100
  • Tiny-ImageNet
  • ImageNet-1k
  • BloodMNIST: A biomedical dataset containing 17,092 images of blood cells across 8 classes, used to simulate a highly realistic non-IID medical imaging scenario.

Key Insights and Ideas

  • Decoupling is Key: Separating the fusion problem into a discrete clustering step and a continuous function approximation step makes the optimization landscape far more stable and interpretable.
  • Neurons Are Not Created Equal: Incorporating neuron importance scores (especially DeepLIFT) prevents low-importance neurons from corrupting the fused model's intermediate representations. As shown in the paper, accounting for saliency physically shifts the cluster centroids toward features that matter most for predictions.
  • Tracking Representation Evolution: Traditional layer-wise methods fail because they don't account for how the fused model's representations change as you move deeper into the network. Retrofitting fixes this by optimizing the current layer based on the actual outputs of the already fused preceding layers.

Key Results

The proposed framework consistently outperforms prior zero-shot baselines, showing the most dramatic improvements in heterogeneous data settings:

  • Vision Transformer (ViT) Fusion: On a 2-way sharded split of CIFAR-100, HF-Gradient achieved 54.5% zero-shot accuracy, while Transformer OTFusion collapsed entirely to near-random performance (2.3%).
  • BloodMNIST Real-World Simulation: When fusing VGG models trained on disjoint subsets of blood cell classes, KF-Linear achieved 91.0% accuracy, actually outperforming the traditional ensemble baseline (88.4%) while maintaining the inference cost of a single model.
Table 3. Test accuracy comparison for VGGs fused on sharded splits of BloodMNIST. For each algorithm, we show the result with the importance scores that result in the best accuracy.
  • Model Compression: The framework can also be used for zero-shot layer-wise knowledge distillation. Compressing a ResNet-34 to a ResNet-18 using KF-Gradient yielded 70.6% accuracy, compared to just 45.9% using standard Knowledge Distillation under identical data constraints.

Limitations and Future Work

While powerful, the authors note a few limitations:

  • Hyperparameter Sensitivity: The gradient-based variants (HF/KF-Gradient) require careful tuning of optimization parameters like learning rate and weight decay.
  • Data Dependency: The method requires a small "fusion dataset" to compute activations and optimize weights. Performance scales with the size of this dataset, though the authors show that data augmentation can significantly reduce this dependency.
  • Computational Overhead: Because it involves clustering and optimization steps, the framework is slower than lightweight weight-averaging baselines. However, the authors argue this is a favorable trade-off since it eliminates the need for expensive post-fusion fine-tuning.

Future Directions: The authors point toward extending this framework to Large Language Models (LLMs) and automating the selection of hyperparameters and layer partitioning.

Summary updated

BibTeX
@inproceedings{luenam2026model,
  author = {Phoomraphee Luenam and Andreas Spanopoulos and Amit Sant and Thomas Hofmann and Sotiris Anagnostidis and Sidak Pal Singh},
  title = {{Model Fusion via Retrofitting}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=SXOqLX0T6X},
}
Figure