Training Bayesian Neural Networks with Sparse Subspace Variational Inference

Junbo Li, Zichen Miao, Qiang Qiu, Ruqi Zhang

Abstract

Bayesian Neural Networks (BNNs) provide a robust framework for uncertainty quantification in deep learning, yet their adoption is hindered by the significant "Bayesian tax"—the high computational and memory overhead required for training. We introduce Sparse Subspace Variational Inference (SSVI), the first fully sparse BNN framework that maintains high sparsity from the first iteration of training through to inference. SSVI utilizes an alternating optimization strategy to refine a low-dimensional sparse subspace and its parameters, guided by a novel uncertainty-aware Signal-to-Noise Ratio (SNR) criterion. Our results demonstrate that SSVI achieves up to a 20x reduction in training FLOPs while matching the accuracy and robustness of dense models, outperforming current state-of-the-art sparse BNN techniques.

Introduction

In safety-critical domains such as autonomous driving and medical diagnosis, knowing "what a model doesn't know" is as vital as the prediction itself. BNNs address this by learning a distribution over weights rather than point estimates. However, the computational cost of training these distributions is often prohibitive. Existing "Sparse BNNs" typically follow a "dense-to-sparse" trajectory, incurring full training costs before pruning. SSVI challenges this paradigm by asking if a BNN can be sparse from the outset without sacrificing performance.

Methodology: Sparse Subspace Variational Inference

SSVI confines the model to a low-dimensional sparse subspace from the beginning of training. The framework employs an alternating optimization strategy:

  1. Parameter Optimization ($\phi$): For a fixed set of active weights, the means and variances are updated using standard Variational Inference.
  2. Subspace Refinement ($\gamma$): The model periodically re-evaluates the importance of weights using a removal-and-addition strategy.
  3. Removal: Weights are pruned based on the SNR of $|\theta|$. Unlike magnitude pruning, this criterion considers both the mean and the variance (uncertainty), penalizing weights with high relative uncertainty.
  4. Addition: New weights are introduced into the subspace based on gradient magnitudes, allowing the model to explore and adapt its structure.

To maintain efficiency, the authors adapt the Local Reparameterization Trick (LRT), ensuring that sampling from weight distributions does not become a bottleneck for sparse operations.

Experimental Evaluation

The researchers evaluated SSVI using ResNet-18 on several benchmarks:

  • Accuracy & Sparsity: CIFAR-10 and CIFAR-100.
  • Uncertainty Quantification: SVHN was used as an Out-of-Distribution (OOD) dataset.
  • Robustness: CIFAR-10-C and CIFAR-100-C (corrupted versions) tested performance under distribution shift.

Key Results and Discussion

SSVI demonstrates a superior trade-off between computational efficiency and predictive performance. As shown in Figure 1, SSVI occupies the optimal top-left region of the accuracy-vs-FLOPs frontier.

Accuracy vs. Training FLOPs on CIFAR-10 and CIFAR-100. SSVI (star) achieves higher accuracy with significantly fewer training FLOPs than competing methods.

Efficiency and Performance

SSVI achieves a 10-20x reduction in model size and up to a 20x reduction in training FLOPs compared to dense BNNs. On CIFAR-100, SSVI reaches 75.81% accuracy at 90% sparsity, significantly outperforming previous methods like mBNN and AEB.

Detailed performance comparison of SSVI against state-of-the-art sparse BNN methods across CIFAR-10 and CIFAR-100 datasets.

Robustness and Uncertainty

Crucially, the high sparsity of SSVI does not compromise Bayesian benefits. It consistently outperforms baselines in OOD detection and maintains higher accuracy under data corruption. Furthermore, the sparse subspace constraint appears to act as a regularizer, making SSVI more robust to hyperparameter choices than standard dense Variational Inference.

Conclusion

SSVI proves that the "dense tax" of BNN training is optional. By maintaining sparsity throughout the entire lifecycle, it lowers the barrier for deploying reliable, uncertainty-aware models. Future work will focus on refining the subspace selection schedule and scaling the framework to larger architectures like Transformers.

Summary updated

BibTeX
@inproceedings{li2024training,
  author = {Junbo Li and Zichen Miao and Qiang Qiu and Ruqi Zhang},
  title = {{Training Bayesian Neural Networks with Sparse Subspace Variational Inference}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=TskzCtpMEO},
}
Figure