Sparse Model Soups: A Recipe for Improved Pruning via Model Averaging

Max Zimmer, Christoph Spiegel, Sebastian Pokutta

TL;DR

Sparse Model Soups (SMS) is a novel technique that combines the computational efficiency of model pruning with the performance boosts of "model soups" (averaging the weights of multiple models). By ensuring that multiple retrained sparse models share the exact same connectivity pattern, SMS significantly improves accuracy, robustness, and fairness in compressed neural networks without incurring any extra cost during inference.

What Problem Does This Paper Address?

Deep learning models are notoriously over-parameterized, leading to high memory and computational costs. Pruning—the process of removing redundant weights—is a standard solution to create "sparse" models that are much smaller and faster to run.

Separately, researchers have found that Model Soups (averaging the weights of several models trained with different hyperparameters) can significantly boost a model's ability to generalize to new data. However, combining these two ideas is tricky. If you average two sparse models that have different "holes" (different sets of zeroed-out weights), the resulting averaged model will be less sparse than its parents. This "densification" defeats the entire purpose of pruning.

The authors tackle a fundamental question: How can we leverage the benefits of model averaging while maintaining the strict sparsity requirements of pruned networks?

Methods

The authors introduce Sparse Model Soups (SMS), a framework built on top of Iterative Magnitude Pruning (IMP). The core innovation is a "prune-retrain-average" cycle:

  1. Prune: Take a pretrained model and prune a percentage of its weights based on their magnitude.
  2. Parallel Retrain: Create $m$ copies of this pruned model. Retrain each copy independently using different hyperparameters (e.g., different random seeds for batch ordering, varying weight decay, or different learning rate schedules).
  3. Merge: Because all $m$ copies started from the same pruned parent and share the same "mask" (the set of zeroed-out weights), they remain in the same "loss basin." This allows them to be averaged together—a "soup"—without losing any sparsity.
  4. Repeat: Use this new averaged model as the starting point for the next pruning cycle.
The Sparse Model Soups (SMS) prune-retrain-merge cycle.

The authors primarily use two merging strategies: UniformSoup (simple averaging) and GreedySoup (sequentially adding models only if they improve validation accuracy).

Key Insights and Ideas

  • Connectivity is Key: The "densification" problem is avoided by design. By forcing all models in the soup to share the same sparse mask, the authors ensure the averaged model is exactly as efficient as the individuals.
  • The "Soup Start" Advantage: One of the most surprising findings is that starting a pruning cycle from an averaged model (a "soup") makes the subsequent individual retraining runs better. The averaged model provides a more stable and robust foundation for further compression.
  • Linear Connectivity: The paper confirms that models retrained from the same pruned starting point stay "linearly connected" in the loss landscape. This is why simple weight averaging works so well here, whereas it often fails for models trained from scratch with different initializations.
  • Stability Threshold: There is a limit to this effect. At extreme sparsity levels (e.g., >99%), the models become unstable and diverge into different basins, causing the benefits of averaging to collapse.

Key Results

The researchers evaluated SMS across a wide variety of tasks, including image classification (CIFAR, ImageNet), semantic segmentation, and neural machine translation.

  • Superior Accuracy: SMS consistently outperforms standard IMP. For example, on CIFAR-100 at 98% sparsity, SMS achieved ~73% accuracy, while standard IMP trailed at ~70.7%.
  • Better Robustness: SMS models are significantly more resilient to data corruptions. On ImageNet-C, SMS showed up to a 2.5% increase in out-of-distribution (OOD) accuracy compared to standard pruning.
  • Improved Fairness: Pruning often hurts performance on minority subgroups more than the majority. SMS helps mitigate this "compression-induced unfairness," showing higher recall on challenging subgroups in the Celeb-A dataset.
Soup accuracy vs. best candidate accuracy for ResNet-50 on ImageNet.

Limitations and Future Work

  • Training Cost: While SMS doesn't increase inference time, it does increase training time because you have to retrain $m$ models per phase. However, since these runs are independent, the process is fully parallelizable.
  • Extreme Sparsity: As noted, the method struggles when the network becomes too sparse to maintain a stable loss basin.
  • Fixed Masks: Currently, SMS requires all models in a soup to share the same mask. Future work could explore ways to average models with different sparse connectivities, perhaps by using neuron alignment or permutation techniques.

Summary updated

BibTeX
@inproceedings{zimmer2024sparse,
  author = {Max Zimmer and Christoph Spiegel and Sebastian Pokutta},
  title = {{Sparse Model Soups: A Recipe for Improved Pruning via Model Averaging}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=xx0ITyHp3u},
}
Figure