NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Posterior Refinement Improves Sample Efficiency in Bayesian Neural Networks

Agustinus Kristiadi, Runa Eschenhagen, Philipp Hennig

Bayesian Neural Networks (BNNs) are the "gold standard" for knowing what a model doesn't know. By treating weights as distributions rather than fixed points, they provide principled uncertainty quantification. However, there’s a catch: calculating the final prediction requires integrating over all possible weights—a process that is usually slow, computationally expensive, or inaccurate.

In this NeurIPS 2022 paper, researchers from the University of Tübingen propose a clever post hoc fix: Posterior Refinement. By using Normalizing Flows to warp simple Gaussian approximations into more complex shapes, they achieve high-quality predictions with a fraction of the usual computational cost.

TL;DR

The authors show that the accuracy of a BNN’s prediction depends more on the quality of the weight distribution than the number of samples used to calculate it. By refining a simple Gaussian posterior with Normalizing Flows, they create a method that is nearly as accurate as the "gold standard" Hamiltonian Monte Carlo (HMC) but significantly faster and easier to implement.

What Problem Does This Paper Address?

To get a prediction from a BNN, you have to perform Bayesian model averaging. This involves an integral: you average the network's output over the entire distribution of possible weights.

Because this integral is mathematically intractable (impossible to solve exactly), practitioners usually use Monte Carlo (MC) integration: they draw $S$ samples from the weight distribution and average them.

  1. The Efficiency Gap: Most BNNs use only 10–30 samples to save time. However, the authors show that for crude distributions like the Laplace Approximation (LA), you might need 10,000+ samples to get an accurate result.
  2. The Approximation Gap: Simple Gaussian approximations are often "underconfident" or "overconfident" because they can't capture the complex, skewed shapes of real neural network landscapes.
  3. The Analytic Trap: Alternatives like "linearization" (treating the NN as a linear model) or "probit approximations" are faster but introduce their own biases, leading to poor uncertainty estimates.
Comparison of MC Standard Error and Calibration showing HMC requires far fewer samples than Laplace Approximation.

Methods

The authors propose a post hoc refinement technique. Instead of training a complex BNN from scratch, you start with a pre-trained model and a simple Gaussian approximation (like the Laplace Approximation).

  1. Normalizing Flows (NF): They apply a series of invertible transformations (Normalizing Flows) to the initial Gaussian distribution. This "warps" the simple bell curve into a more complex, non-Gaussian shape that better fits the true posterior.
  2. ELBO Optimization: They optimize the parameters of the flow by maximizing the Evidence Lower Bound (ELBO), a standard objective in variational inference.
  3. Last-Layer Focus: While the method can work on any BNN, it is particularly effective when applied only to the last layer of the network. This keeps the number of parameters manageable (hundreds or thousands instead of millions) while still providing excellent uncertainty estimates.

Datasets

The researchers validated their approach on standard image classification benchmarks:

  • Fashion-MNIST (using LeNet-5)
  • CIFAR-10 and CIFAR-100 (using WideResNet-16-4)
  • Out-of-Distribution (OOD) Tasks: They tested the models on "unseen" data to see if they could correctly identify their own ignorance.
  • Toy Examples: A 2D logistic regression problem was used to visualize how the refined distribution matches the true posterior shape.

Key Insights and Ideas

  • Quality Over Quantity: A high-quality posterior (like one generated by HMC) performs better with only 10 samples than a crude posterior (like Laplace) does with 10,000 samples. This suggests we should spend our "compute budget" on better distributions, not more samples.
  • Refinement is Faster than Scratch: Starting the Normalizing Flow from a pre-computed Gaussian approximation converges much faster and requires "shorter" (simpler) flows than starting from a standard normal distribution $\mathcal{N}(0, I)$.
  • The "Bias" of Analytic Methods: The paper reveals that popular shortcuts like the Multi-class Probit Approximation (MPA) are actually biased. They often look like they perform well only because their inherent overconfidence happens to cancel out the underconfidence of the underlying Laplace approximation.

Key Results

  • Competitive with Gold Standards: On CIFAR-10, the "Refined Laplace" (LA-Refine) achieved a Negative Log-Likelihood (NLL) of 0.158, identical to the much more expensive full-batch Hamiltonian Monte Carlo.
  • Superior Calibration: In terms of Expected Calibration Error (ECE), the refined method significantly outperformed vanilla Laplace and was competitive with state-of-the-art all-layer BNN baselines.
  • OOD Detection: The refined last-layer BNNs were better at detecting out-of-distribution data than many "all-layer" methods, proving that you don't need to be Bayesian about every single weight to get good results.
  • Low Overhead: Refining a last-layer distribution takes only a few seconds on a standard consumer GPU (e.g., ~3.4 seconds per epoch on an RTX 2080Ti).

Limitations and Future Work

  • Dimensionality: Normalizing Flows are bijectors; they must maintain the same number of dimensions. Applying this to "all-layer" BNNs with millions of parameters remains computationally prohibitive.
  • Loss of Gaussianity: Once you refine a distribution, it is no longer Gaussian. This means you lose some "convenient" properties, such as the ability to easily perform continual learning or certain types of model selection.
  • Future Directions: The authors suggest exploring refinement in lower-dimensional "subspaces" or "pruned" parameter spaces to bring the benefits of refinement to full-scale, all-layer neural networks.

Summary updated

BibTeX
@inproceedings{kristiadi2022posterior,
  author = {Agustinus Kristiadi and Runa Eschenhagen and Philipp Hennig},
  title = {{Posterior Refinement Improves Sample Efficiency in Bayesian Neural Networks}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=HNTEULhs5W},
}
Figure