Soft Weight-Sharing for Neural Network Compression

Karen Ullrich, Edward Meeds, Max Welling

Introduction

Deep learning has a "size" problem. While massive models with billions of parameters achieve incredible accuracy, they are often too memory-intensive and energy-hungry to run on mobile or edge devices. To fix this, researchers rely on network compression.

Previously, the gold standard (such as the pipeline by Han et al.) involved a complex, multi-stage process: first pruning (deleting) unimportant weights, then quantizing (grouping) the remaining ones, and finally applying Huffman coding. The authors of this paper argue that this piecemeal approach is restrictive. Instead, they introduce a unified, principled approach grounded in the Minimum Description Length (MDL) principle. By reviving the concept of "soft weight-sharing," they achieve simultaneous pruning and quantization in a single retraining step, reaching state-of-the-art compression rates (up to 162x) with minimal loss in accuracy.

The Soft Weight-Sharing Method

The core innovation is treating the weight distribution as a Gaussian Mixture Model (GMM) rather than forcing weights into hard categories post-training.

  1. The Prior: The authors define a prior probability for the weights consisting of several Gaussian "clusters."
  2. Integrated Pruning: One of these clusters is fixed at zero. By encouraging weights to belong to this "zero-component," the model naturally prunes itself during training.
  3. Integrated Quantization: The other clusters have learnable means and variances. As the network retrains, weights naturally gravitate toward these cluster centers.
  4. Variational Learning: The training objective balances two goals: minimizing the standard prediction error and minimizing the "complexity cost" (the KL divergence between the weights and the GMM prior).
Initial vs. final weight distributions demonstrating simultaneous pruning (large peak at zero) and quantization (horizontal bands).

After retraining, weights are assigned to the mean of their most likely cluster. Redundant clusters are merged, and the final sparse model is stored using efficient formats like Compressed Sparse Column (CSC).

Key Insights

  • Compression as Inference: The paper elegantly connects compression to Bayesian inference, showing that "good compression" is essentially the same as finding a "good prior" for your weights.
  • Self-Organizing Quantization: Unlike k-means quantization, which requires picking the number of clusters beforehand, this method allows clusters to merge or collapse if they aren't needed. The network effectively "learns" its own optimal quantization levels.
  • Simplicity Wins: By replacing a multi-stage pipeline with a single retraining procedure, the method becomes more flexible and theoretically sound without sacrificing performance.

Results and Performance

The authors evaluated their method on standard benchmarks (MNIST and CIFAR) to ensure comparability with previous state-of-the-art techniques. The results demonstrate that soft weight-sharing is highly effective, often outperforming more complex multi-step pipelines.

Compression rate versus accuracy loss, comparing the proposed soft weight-sharing method against previous state-of-the-art pipelines.
  • LeNet-5-Caffe (MNIST): Achieved a massive 162x compression rate, significantly higher than the previous state-of-the-art (108x), with an error increase of only 0.09%.
  • LeNet-300-100 (MNIST): Reached a 64x compression rate (compared to 56x in previous work) while maintaining nearly identical accuracy.
  • ResNet (CIFAR): Achieved a 45x compression rate, proving the method scales to more modern, deeper architectures.

Limitations and Future Work

While highly effective on LeNet and ResNet, the authors note that for very large networks like VGG (138M parameters), the algorithm is currently too slow to be practical, though they propose a sampling-based gradient estimation to address this. Additionally, the learning rates for the mixture components (means, variances, and mixing proportions) are sensitive and require careful tuning. Future directions include moving beyond simple point-estimates to more complex distributions and exploring "structural pruning," where entire neurons or convolutional filters are removed rather than individual weights.

Summary updated

BibTeX
@inproceedings{ullrich2017soft,
  author = {Karen Ullrich and Edward Meeds and Max Welling},
  title = {{Soft Weight-Sharing for Neural Network Compression}},
  booktitle = {International Conference on Learning Representations},
  year = {2017},
}
Figure