Abstract
This paper introduces sBNN, a variational inference framework designed to compress Bayesian Neural Networks (BNNs) using spike-and-slab priors. By deriving a closed-form analytical solution for inclusion probabilities, the authors overcome the traditional non-differentiability of discrete variables in neural network optimization. The method achieves over 98% sparsity on standard benchmarks like MNIST and CIFAR-10 with minimal impact on accuracy, offering a principled approach to architecture pruning and feature selection.
1. Introduction
Modern deep learning models are notoriously over-parameterized. While this redundancy aids in training stability, it results in massive memory footprints, high computational costs, and a susceptibility to overfitting. Bayesian Neural Networks (BNNs) provide a robust framework for uncertainty estimation and regularization, yet achieving true model sparsity within a Bayesian context remains a significant challenge. This paper presents a novel approach to learning network topology alongside weights, enabling efficient model compression without sacrificing predictive power.
2. The Challenge of Bayesian Sparsity
Traditional pruning methods often rely on heuristics, such as removing weights with the smallest magnitudes. BNNs offer a more principled alternative by treating weights as probability distributions. To truly "zero out" a weight in a Bayesian framework, researchers typically employ a "spike-and-slab" prior—a mixture of a very narrow distribution at zero (the spike) and a wider distribution for active values (the slab).
However, discrete variables (e.g., determining whether a weight is zero or not) are incompatible with the "reparameterization trick" used in standard gradient-based training. Most existing BNN pruning methods either use continuous approximations that fail to achieve true sparsity or rely on computationally expensive Markov Chain Monte Carlo (MCMC) sampling.
3. The sBNN Framework
The authors propose a new Variational Inference (VI) objective function that treats the inclusion of every weight and bias as a latent Bernoulli variable ($Z_i$).
3.1 Spike-and-Slab Prior
Every weight is modeled as a mixture of two Gaussians: one with a tiny variance ($\tau_0^2$, the "spike") and one with a larger variance ($\tau_1^2$, the "slab").
3.2 Optimization via Coordinate Descent
The core contribution of the paper is the derivation of a closed-form update for inclusion probabilities ($p_i$). The authors demonstrate that the dependence of the objective function on $p_i$ can be isolated into a non-stochastic penalty term. This allows for a two-step "sBNN" algorithm:
- Gradient Update: Update weight means and variances using standard backpropagation and the reparameterization trick.
- Analytical Update: Update the inclusion probabilities ($p_i$) using the derived closed-form solution.
This approach can be viewed as an "adaptive" version of Dropout. While standard Dropout uses a fixed, global rate, sBNN learns an individual "dropout rate" for every single connection in the network.
4. Key Theoretical Insights
- The Second Moment Criterion: Unlike previous methods (such as Bayes by Backprop) that prune based on the signal-to-noise ratio ($m/\sigma$), sBNN prunes based on the second moment ($m^2 + \sigma^2$). This ensures weights are retained if they are either large on average or possess high uncertainty that suggests potential importance.
- Lindley’s Paradox: The authors identify a "pathological" case where a very large prior variance ($\tau_1$) can force inclusion probabilities to zero regardless of the data. This highlights the critical importance of hyperparameter tuning for the "slab" width to avoid unintended pruning.
5. Experimental Results
The authors evaluated sBNN across regression benchmarks, simulated feature selection tasks, and image classification.
- Extreme Sparsity on MNIST: Using the LeNet-5 architecture, the model achieved 99.2% sparsity while maintaining a test error of only 1.06%.
- Robustness on CIFAR-10: In experiments with VGG-like networks, sBNN maintained an 8.7% error rate even at 98.5% sparsity, significantly outperforming the popular Horseshoe BNN method, which saw error rates spike much earlier under high compression.
- Feature Selection: On simulated data, the algorithm correctly identified active features with approximately 90% accuracy, even when the underlying data-generating process was highly non-linear.
6. Conclusion and Future Work
sBNN provides a scalable and principled method for compressing BNNs. While the method requires tracking two parameters (mean and variance) per weight during training—effectively doubling memory usage compared to non-Bayesian models—the resulting sparse models offer superior generalization and reduced inference costs. The authors suggest that these learned inclusion probabilities could eventually be used to automatically design optimal architectures from scratch, rather than merely pruning existing ones.
Summary updated