Scaling Up Bayesian Neural Networks with Neural Networks

Zahra Moslemi, Yang Meng, Shiwei Lan, Babak Shahbaba · DOI

TL;DR

The authors introduce Fast Bayesian Neural Networks (FBNN), a framework that uses a small "emulator" neural network to mimic the behavior of a larger Bayesian model. By replacing expensive likelihood evaluations with this fast surrogate, FBNN achieves up to a 60x speedup in posterior sampling while maintaining high accuracy and reliable uncertainty quantification.

What Problem Does This Paper Address?

Deep Neural Networks (DNNs) are powerful but notoriously overconfident; they can give wrong answers with 99% certainty. Bayesian Neural Networks (BNNs) solve this by treating weights as distributions rather than fixed points, providing a principled way to measure "what the model doesn't know."

However, BNNs face a massive "speed vs. quality" trade-off:

  1. MCMC (Markov Chain Monte Carlo): The gold standard for accuracy, but it is painfully slow because it requires thousands of passes through the entire dataset and the entire network.
  2. Variational Inference (VI): Much faster, but it often "cheats" by oversimplifying the distribution, leading to underestimated uncertainty.

As models get larger (high-dimensional parameter spaces), standard MCMC methods become computationally prohibitive. The authors aim to break this bottleneck.

Methods

The researchers propose a Calibration-Emulation-Sampling (CES) strategy:

  1. Calibration: They run a few initial iterations of Stochastic Gradient Hamiltonian Monte Carlo (SGHMC). This isn't meant to get the final answer, but rather to collect a small "representative" set of pairs: model parameters and their corresponding likelihoods.
  2. Emulation: They train a small, separate DNN (the emulator) to learn the mapping between parameters and the posterior probability. Essentially, the emulator learns to predict "how likely are these weights?" without needing to look at the original training data ever again.
  3. Sampling: They use the Preconditioned Crank-Nicolson (pCN) algorithm to generate the final posterior samples. Because pCN is "dimension-independent," its efficiency doesn't collapse as the number of parameters grows. Crucially, pCN queries the emulator instead of the original expensive model, making each step nearly instantaneous.

Datasets

The authors evaluated FBNN across 11 diverse datasets covering both regression and classification:

  • Regression: Boston Housing, Wine Quality, Alzheimer’s (NACC), Year Prediction MSD, and a large-scale simulation (5 million observations).
  • Classification: MNIST (handwritten digits), Adult (census data), SVHN (street view house numbers), celebA (face attributes), and Alzheimer’s.

Key Insights and Ideas

  • Cutting out the Middleman: The core "aha" moment is that you don't need to evaluate a 100,000-parameter model on 1,000,000 data points at every MCMC step. If you can train a surrogate (the emulator) to approximate the likelihood function, you can bypass the data entirely during the sampling phase.
  • The Power of pCN: While SGHMC is great for finding the "right neighborhood" (calibration), the authors show that pCN is superior for precisely mapping out the "shape" of that neighborhood (sampling) in high dimensions.
  • Smoothness as a Shortcut: The method works because the posterior distribution in BNNs tends to be relatively "smooth." This regularity allows a small neural network to act as a highly effective surrogate for a much more complex process.

Key Results

  • Massive Speedups: FBNN consistently outperformed standard BNN-SGHMC in efficiency. For example, on the celebA dataset, FBNN achieved a 61.84x speedup in terms of Effective Sample Size (ESS) per second.
  • Maintained Accuracy: In almost all cases, FBNN matched or exceeded the predictive accuracy of standard DNNs and Ensemble methods. On MNIST, it reached 94% accuracy, matching the top-tier Ensemble-DNN but with much better uncertainty metrics.
  • Better Calibration: Using the Expected Calibration Error (ECE), the authors showed that FBNN provides more "honest" uncertainty than Variational Inference or MC-Dropout, which often struggle with overconfidence.

Limitations and Future Work

  • Architectural Scope: The current study focused on standard feed-forward and convolutional architectures. The authors note that future work should explore more complex structures like Graph Neural Networks or spatiotemporal models.
  • Emulator Optimization: While the current emulators are effective, there is room to automate the search for the "perfect" emulator architecture (e.g., via Neural Architecture Search).
  • Adaptive Sampling: The authors suggest that embedding the sampling algorithm into an even more adaptive framework could further squeeze out performance gains in extremely high-dimensional spaces.

Summary updated

BibTeX
@article{moslemi2024scaling,
  author = {Zahra Moslemi and Yang Meng and Shiwei Lan and Babak Shahbaba},
  title = {{Scaling Up Bayesian Neural Networks with Neural Networks}},
  journal = {Accepted by TMLR},
  year = {2024},
  url = {https://openreview.net/forum?id=cD209UgOX7},
}
Figure