Improved Bayesian Compression

Marco Federici, Karen Ullrich, Max WellingarXiv 2017 · DOI

Abstract

Compression of Neural Networks (NN) has become a highly studied topic in recent years. The main reason for this is the demand for industrial scale usage of NNs such as deploying them on mobile devices, storing them efficiently, transmitting them via band-limited channels and most importantly doing inference at scale. In this work, we propose to join the Soft-Weight Sharing and Variational Dropout approaches that show strong results to define a new state-of-the-art in terms of model compression.

Introduction

Deep Learning models are notoriously resource-intensive. While their performance is impressive, their massive size poses significant challenges for deployment on mobile devices, storage costs, and transmission over limited bandwidth. Traditionally, researchers have addressed this through two primary strategies: pruning (removing non-contributory weights) and quantization/clustering (representing groups of weights with shared values).

Previously, these techniques were often treated as separate optimization problems. Variational Dropout (VD) excelled at pruning but lacked clustering capabilities, while Soft-Weight Sharing (SWS) was effective for clustering but less so for pruning. This work introduces a unified Bayesian framework that optimizes for both sparsity and quantization simultaneously, achieving superior compression ratios without sacrificing accuracy.

Methodology

The proposed approach utilizes Variational Inference to define a training objective—a Variational Lower Bound—that incorporates a joint distribution over weights and their corresponding cluster centers.

The Hybrid Prior

A key innovation is the use of a hybrid prior. A log-uniform prior encourages weights toward zero (inducing sparsity), while a Gaussian Mixture Model (GMM) prior forces non-zero weights to cluster around specific values. One mixture component is fixed at zero with high probability, acting as a "sink" to facilitate cleaner pruning.

Post-Processing Pipeline

Following training with the specialized objective, the model undergoes a four-step pipeline to finalize compression:

  1. Weight Clustering: Weights are collapsed into the mean of their most likely cluster.
  2. Model Pruning: Rows or columns consisting entirely of zeros are removed.
  3. CSR Encoding: The remaining sparse data is stored using the "Compressed Sparse Row" format.
  4. Huffman Encoding: An optimal coding scheme is applied to minimize the bit-count of the stored values.
The four-step compression pipeline: Clustering, Pruning, CSR Encoding, and Huffman Encoding.

Experimental Setup

The method was evaluated on the MNIST handwritten digit classification task using two standard architectures:

  • LeNet300-100: A fully connected (dense) neural network.
  • LeNet5: A convolutional neural network.

Results and Discussion

The hybrid approach demonstrates that pruning and quantization are orthogonal schemes. Pruning reduces parameter quantity, while quantization reduces the precision required for the remaining parameters. By jointly optimizing these goals, the model "learns" to be compressible during training.

Comparison of compression methods across LeNet architectures, showing the superior performance of the VD+SWS hybrid.

As shown in the results, the VD+SWS hybrid significantly outperforms standalone methods. On LeNet5, the method achieved a 482x reduction in model size while slightly improving accuracy over the baseline. This represents a reduction to less than 0.3% of the original model size.

Conclusion and Future Work

This work establishes a new state-of-the-art for Bayesian neural network compression. While the results on MNIST are promising, future research should focus on:

  • Structured Sparsity: Pruning entire neurons or channels to improve hardware compatibility.
  • Format Optimization: Reducing the overhead introduced by formats like CSR.
  • Scalability: Applying these techniques to larger, modern architectures like ResNets or Transformers to validate their utility in large-scale industrial applications.

Summary updated

BibTeX
@misc{federici2017improved,
  author = {Marco Federici and Karen Ullrich and Max Welling},
  title = {{Improved Bayesian Compression}},
  year = {2017},
  eprint = {1711.06494},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1711.06494},
}
Figure