Learning Scalable Model Soup on a Single GPU: An Efficient Subspace Training Strategy

Tao Li, Weisen Jiang, Fanghui Liu, Xiaolin Huang, James T. Kwok

TL;DR

This paper introduces MEHL-Soup (Memory Efficient Hyperplane Learned Soup), a highly efficient strategy for blending multiple fine-tuned models into a single, superior model on a single GPU. By framing model weight averaging as a hyperplane optimization problem and utilizing block coordinate gradient descent, the authors reduce memory consumption by over $13\times$ and accelerate training by $9.5\times$ compared to standard learned model soups, all while delivering state-of-the-art accuracy.

What Problem Does This Paper Address?

When deploying deep learning models, a common pipeline is to take a large pre-trained model and fine-tune it multiple times using different hyperparameter configurations (e.g., varying learning rates or data augmentations). Instead of picking just one winning model or deploying an expensive ensemble of all of them, practitioners use "model soups"—averaging the weights of these fine-tuned models together in parameter space. This boosts accuracy and robustness without adding any computational overhead during inference.

There are two main ways to make a model soup:

  1. Greedy Soup: Sequentially adds models to the average only if they improve validation accuracy. It's simple but sub-optimal because it weights all chosen models equally.
  2. Learned Soup: Learns optimal mixing coefficients for each model via gradient descent.

While Learned Soup performs better, it is a massive resource hog. It requires loading all fine-tuned models into memory simultaneously and building a colossal computational graph across them. For large architectures like Vision Transformers (ViTs), this can demand over 200 GB of RAM, forcing practitioners to run optimization slowly on CPUs or abandon the method entirely. This paper tackles this scalability bottleneck.

Methods

The authors propose MEHL-Soup and its layer-wise extension, MEHL-Soup+, using three core innovations:

  • Hyperplane Optimization (Weight Extrapolation): Traditional learned soups use a softmax function to restrict mixing coefficients between 0 and 1 (interpolation within a convex hull). MEHL-Soup relaxes this constraint to a hyperplane, allowing coefficients to fall outside this range (extrapolation).
  • Weight Decentralization: Instead of optimizing raw weights ($\theta_k$), the objective optimizes the difference between each model and the uniform average model ($\theta_k - \bar{\theta}$). This simple shift drastically reduces correlation between the models, stabilizing and improving the optimization process.
  • Block Coordinate Gradient Descent (BCGD): To solve the memory crisis, the authors apply BCGD. Instead of loading all $K$ models at once, the algorithm randomly selects and updates a small mini-batch ($b$) of models at each iteration. Furthermore, the gradient derivation is mathematically restructured so that a computational graph is only built on the single, combined "soup" model rather than all individual models.

Datasets

The method was validated using publicly available suites of fine-tuned models across several standard computer vision benchmarks:

  • ImageNet (evaluated using CLIP ViT-B/32 and CLIP ViT-L/14)
  • CIFAR-10 (evaluated using CLIP ViT-L/14)
  • CIFAR-100 (evaluated using CLIP ViT-L/14 and ResNet-101)

Key Insights and Ideas

  • Extrapolation Wins over Interpolation: Constraining mixing coefficients to sum to 1 via softmax limits the expressiveness of the soup. Allowing weights to go negative or exceed 1 (hyperplane optimization) unlocks significantly better generalization.
  • Stochasticity as a Feature: Using mini-batches of models via BCGD doesn't just save memory; the introduced stochastic noise actually acts as a regularizer, helping the final model soup generalize better to unseen test data.
  • Lower Sensitivity to Top Performers: Greedy soup relies heavily on a stellar, top-performing individual model to initialize its sequence. MEHL-Soup+ is highly robust; even if you remove the top-performing models from the pool, it still computes coefficients that yield high test accuracy.
  • Upstream Compute Savings: Because MEHL-Soup+ performs layer-wise weighted averaging so effectively, it requires far fewer fine-tuned models to reach peak accuracy compared to Greedy Soup. This means researchers can drastically cut down on the initial, expensive hyperparameter grid-search phase.

Key Results

The experiments demonstrated massive efficiency gains alongside accuracy improvements on a standard server equipped with a single NVIDIA RTX 4090 GPU:

  • Memory Reduction: For a suite of 72 ViT-B/32 models on ImageNet, the layer-wise baseline (Learned-Soup+) required 253 GB of memory (forcing it onto CPU). MEHL-Soup+ slashed this to just 19 GB (a $13\times$ reduction), fitting comfortably on a single GPU.
  • Speedup: MEHL-Soup+ completed soup construction in 808 seconds, compared to 7701 seconds for Learned-Soup+, representing a $9.5\times$ speedup.
  • Accuracy Gains: On ImageNet, MEHL-Soup+ achieved 81.62% top-1 accuracy, outperforming the best individual model (80.38%), Greedy-Soup (81.03%), and Learned-Soup+ (81.39%).
  • Breaking the Scale Barrier: On the larger ViT-L/14 architecture, standard Learned-Soup crashed due to Out-Of-Memory (OOM) errors even on CPU. MEHL-Soup+ ran seamlessly on a single GPU, outperforming Greedy-Soup across ImageNet, CIFAR-10, and CIFAR-100.

Limitations and Future Work

  • Convergence Trade-off: The authors note a theoretical trade-off introduced by the block coordinate approach: smaller model batch sizes ($b$) drastically reduce memory footprint but can slow down the theoretical convergence rate, requiring a careful balance.
  • Future Directions: The authors express interest in expanding this framework to unify the initial model fine-tuning stage and the subsequent model averaging stage into a single, continuous, and systematic training pipeline.

Summary updated

BibTeX
@inproceedings{li2024learning,
  author = {Tao Li and Weisen Jiang and Fanghui Liu and Xiaolin Huang and James T. Kwok},
  title = {{Learning Scalable Model Soup on a Single GPU: An Efficient Subspace Training Strategy}},
  booktitle = {European Conference on Computer Vision},
  year = {2024},
  doi = {10.1007/978-3-031-73650-6\_20},
}
Figure