Fast predictive uncertainty for classification with Bayesian deep networks

Marius Hobbhahn, Agustinus Kristiadi, Philipp Hennig

Abstract

In Bayesian Deep Learning, distributions over the output of classification neural networks are often approximated by first constructing a Gaussian distribution over the weights, then sampling from the resulting logit distribution. However, this sampling process is computationally expensive. This paper introduces a "Laplace Bridge" that analytically maps Gaussian logit distributions to Dirichlet output distributions, providing high-quality uncertainty estimates with almost zero computational overhead compared to a standard forward pass.

Introduction: The Overconfidence Problem

Standard deep learning models are notoriously "overconfident." They often assign high-probability predictions even when they are incorrect or encountering out-of-distribution (OOD) data. Bayesian Deep Learning (BDL) addresses this by treating weights as distributions rather than fixed points, allowing the model to quantify its own uncertainty.

However, BDL faces a significant bottleneck: the softmax-Gaussian integral. While the distribution of "logits" (raw scores before the final layer) can be approximated as a Gaussian, passing that Gaussian through a softmax function to obtain a probability distribution has no closed-form solution. Current methods rely on Monte Carlo (MC) integration—averaging hundreds of samples—which is too slow for real-time applications or large-scale datasets like ImageNet.

Methods: The Laplace Bridge

The authors propose reviving and refining the Laplace Bridge (LB) to bypass the sampling bottleneck. The method consists of three core components:

  1. The Analytic Map: Instead of sampling, the LB uses a mathematical transformation to map the parameters of a Gaussian distribution in logit space directly to the parameters of a Dirichlet distribution in the output space. The Dirichlet distribution is the natural conjugate prior to the categorical distribution, making it ideal for representing uncertainty over probabilities.
  2. The Correction (LB-norm): The "vanilla" Laplace Bridge tends to be overconfident far from training data. The authors introduce a rescaling normalization that pulls the distribution back into regions where the approximation remains accurate.
  3. Last-Layer Laplace: To maximize efficiency, the method is applied specifically to the final linear layer, modeling only the most critical uncertainty for classification.
The Laplace Bridge pipeline: Mapping Gaussian logit distributions to Dirichlet output distributions.

Key Insights and Ideas

Efficiency and Speed

The primary advantage of the Laplace Bridge is speed. It allows for uncertainty quantification that is roughly 100x faster than Monte Carlo sampling. In practice, the LB adds only about 4% overhead to a standard neural network forward pass, making Bayesian methods viable for production environments.

The Asymmetry of Basis Transformation

A critical "aha" moment in the research was identifying that the softmax-Gaussian integral becomes highly asymmetric in "sparse" regions far from the data. The proposed rescaling correction in LB-norm is what finally makes the Laplace Bridge viable for deep learning by accounting for this asymmetry.

Visualization of the Laplace Bridge mapping between probability (standard) and logit bases.

Dirichlet Advantages

Because the output is a full Dirichlet distribution, the model provides more than a simple mean prediction. It allows for the analytic computation of marginal distributions (Beta distributions) for specific classes. This enables an Uncertainty-Aware Top-k ranking: instead of a fixed top-5 list, the model returns a variable-length list of labels that overlap in probability. If the model is certain, it returns one label; if confused, it returns all plausible candidates.

Results and Scalability

The authors evaluated the method across standard benchmarks (MNIST, CIFAR-10, CIFAR-100) and large-scale architectures (DenseNet, ResNet-18) on ImageNet.

  • OOD Performance: The normalized Laplace Bridge (LB-norm) performs comparably to, and often better than, 100-sample Monte Carlo integration on OOD detection tasks, as measured by AUROC.
  • Computational Gains: On a ResNet-18/CIFAR-10 setup, MC sampling with 1000 samples took ~4.7 seconds for the test set, while the Laplace Bridge required only 0.013 seconds.
  • ImageNet Success: The uncertainty-aware top-k rule improved ImageNet accuracy from 74.4% to over 85%, while keeping the average list of predicted labels under 3, demonstrating that the model effectively "knows what it doesn't know."

Conclusion

The Laplace Bridge offers a path toward practical Bayesian deep learning. By replacing expensive sampling with an analytic map, it provides robust uncertainty estimates at a fraction of the cost. While the current rescaling correction is somewhat heuristic, the results show that this approach is a powerful tool for building safer, more reliable classification systems.

Summary updated

BibTeX
@inproceedings{hobbhahn2022fast,
  author = {Marius Hobbhahn and Agustinus Kristiadi and Philipp Hennig},
  title = {{Fast predictive uncertainty for classification with Bayesian deep networks}},
  booktitle = {Conference on Uncertainty in Artificial Intelligence},
  year = {2022},
  url = {https://openreview.net/forum?id=jqktbuYWrN2},
}
Figure