ZipIt! Merging Models from Different Tasks without Training

George Stoica, Daniel Bolya, Jakob Brandt Bjorner, Pratik Ramesh, Taylor Hearn, Judy Hoffman

TL;DR

ZipIt! is a novel method that merges two neural networks trained on completely different tasks into a single multi-task model—without a single step of additional training. By allowing features to merge both within and across models and supporting "partial zipping" to create multi-head architectures, it achieves a massive 20-60% performance improvement over previous state-of-the-art merging techniques.

The Challenge of Disjoint Tasks

In deep learning, models are typically highly specialized. Combining the capabilities of a dog breed classifier and a bird species identifier usually requires "multi-task learning"—training a new model from scratch on both datasets. This is computationally expensive and prone to "catastrophic forgetting."

Existing "model merging" techniques, such as Git Re-Basin, attempt to solve this by aligning the weights of two models and averaging them. However, these methods assume a strict one-to-one mapping of features between models. While effective for models trained on the same data, this approach fails when tasks are disjoint. Forcing incompatible features to merge results in a broken model with near-random accuracy.

Comparison of prior model merging approaches and the proposed ZipIt! method for disjoint tasks.

The ZipIt! Approach

The authors introduce ZipIt!, which departs from the standard "align and average" approach through two key innovations:

  1. Merging Within and Across: Prior methods only look for a one-to-one match between Model A and Model B. ZipIt! recognizes that features within a single model might be redundant or better suited to merge with each other. It uses a greedy matching algorithm based on activation correlations to "zip" together any combination of correlated features, whether they belong to the same model or different ones.
  2. Partial Zipping: As information flows deeper into a network, features become more specialized. ZipIt! allows practitioners to stop the merging process at a specific layer. The layers before the stop point are merged into a shared backbone, while the remaining layers stay separate, naturally forming a "multi-head" model that preserves task-specific expertise.
  3. Zip Propagation: To handle complex modern architectures (like ResNets with skip connections), the authors developed a graph-based algorithm that propagates these merge and unmerge operations throughout the entire network structure.

Key Insights and Results

The researchers evaluated ZipIt! across several challenging scenarios, including disjoint splits of CIFAR and ImageNet, as well as merging models trained on entirely different datasets (e.g., Stanford Dogs and NABirds).

  • Massive Accuracy Gains: On a disjoint CIFAR-10 split, ZipIt! outperformed previous methods by 32.9% in joint accuracy. On the much harder ImageNet task, where prior work achieved only ~3% accuracy, ZipIt! reached over 60%.
  • Finding Shared Basins: ZipIt! successfully navigates the loss landscape to find a shared low-loss basin for both tasks, a feat where previous permutation methods fail.
Loss landscapes for Task A and Task B demonstrating that ZipIt! finds a shared low-loss basin, unlike prior methods.
  • The Specialization Gradient: Features in early layers (like edge detectors) are generally universal and easy to merge. Deeper layers are more specialized. Partial zipping leverages this, trading a small amount of model size for a significant boost in accuracy.
  • Scale Helps: ZipIt! performs significantly better as models get wider. Larger models possess more feature redundancy, providing more room for the zipping process to find high-quality matches.
  • Efficiency: The greedy matching algorithm is highly efficient, capable of zipping a ResNet-20 model in about one second.

Limitations and Future Work

While ZipIt! represents a major leap forward, it does have limitations:

  • Architecture Matching: Currently, ZipIt! requires both models to share the same architecture (e.g., two ResNet-50s).
  • Linearity Approximation: The method applies linear merge operations to features that have passed through non-linearities (like ReLU). Better handling of these non-linear spaces could further improve results.
  • Lossy Process: Merging remains a "lossy" operation. While it avoids retraining, it rarely perfectly matches the performance of a model trained on all tasks simultaneously. Future work may explore lightweight tuning to recover this lost performance.

Summary updated

BibTeX
@inproceedings{stoica2024zipit,
  author = {George Stoica and Daniel Bolya and Jakob Brandt Bjorner and Pratik Ramesh and Taylor Hearn and Judy Hoffman},
  title = {{ZipIt! Merging Models from Different Tasks without Training}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=LEYUkvdUhq},
}
Figure