Flexible Bayesian Last Layer Models Using Implicit Priors and Diffusion Posterior Sampling

Jian Xu, Zhiqi Lin, Shigui Li, Min Chen, Junmei Yang, Delu Zeng, John W. PaisleySSRN 2024 · DOI

Abstract

Bayesian Last Layer (BLL) models focus solely on uncertainty in the output layer of neural networks, demonstrating comparable performance to more complex Bayesian models. However, the use of Gaussian priors for last layer weights in Bayesian Last Layer (BLL) models limits their expressive capacity when faced with non-Gaussian, outlier-rich, or high-dimensional datasets. To address this shortfall, we introduce a novel approach that combines diffusion techniques and implicit priors for variational learning of Bayesian last layer weights. This method leverages implicit distributions for modeling weight priors in BLL, coupled with diffusion samplers for approximating true posterior predictions, thereby establishing a comprehensive Bayesian prior and posterior estimation strategy. By delivering an explicit and computationally efficient variational lower bound, our method aims to augment the expressive abilities of BLL models, enhancing model accuracy, calibration, and out-of-distribution detection proficiency. Through detailed exploration and experimental validation, We showcase the method's potential for improving predictive accuracy and uncertainty quantification while ensuring computational efficiency.

Introduction

Bayesian Neural Networks (BNNs) represent the gold standard for uncertainty quantification in deep learning, yet their computational complexity often hinders scalability. A practical alternative is the Bayesian Last Layer (BLL) model, which restricts probabilistic treatment to the final layer while maintaining a deterministic backbone. Despite their efficiency, traditional BLLs are constrained by the assumption of Gaussian weight priors. This "Gaussian bottleneck" limits the model's ability to capture complex, non-Gaussian patterns inherent in high-dimensional or outlier-rich datasets.

In this work, we present DVI-IBLL (Diffusion Variational Inference for Implicit BLL), a framework that replaces restrictive Gaussian priors with flexible "implicit priors" learned via neural networks. By integrating generative diffusion models, DVI-IBLL achieves state-of-the-art performance in both predictive accuracy and uncertainty calibration.

Methodology

The DVI-IBLL framework is built upon two core innovations designed to enhance the expressiveness of BLL models without sacrificing tractability:

  1. Implicit Priors: Rather than prescribing a fixed distribution (e.g., Gaussian), we utilize a neural network to generate an implicit prior. This allows the model to learn a weight distribution that is specifically tailored to the complexities of the training data.
  2. Diffusion Posterior Sampling: To manage the mathematical complexity of non-Gaussian priors, we employ diffusion-based sampling. By utilizing Stochastic Differential Equations (SDEs), we can effectively sample from the posterior distribution.

To ensure training efficiency, we derived a novel Variational Lower Bound (ELBO). A key technical contribution is the use of a "reference process trick," which bypasses the need for intractable score function calculations during training, making the diffusion process computationally feasible for standard deep learning architectures.

Experimental Evaluation

We validated DVI-IBLL across several benchmarks to assess its predictive performance and uncertainty quantification:

  • UCI Regression: Six datasets (Boston, Concrete, Energy, Power, Wine, Yacht) were used to evaluate Negative Log-Likelihood (NLL) and Root Mean Square Error (RMSE).
  • Image Classification: CIFAR-10 and CIFAR-100 datasets were tested using a Wide ResNet-28-10 backbone.
  • Out-of-Distribution (OOD) Detection: The SVHN (Street View House Numbers) dataset served as a far-OOD benchmark for models trained on CIFAR datasets.

Results and Discussion

Predictive Accuracy and Calibration

DVI-IBLL demonstrates superior performance in image classification tasks. On the CIFAR-10 benchmark, the model achieved an accuracy of 96.9%, significantly outperforming standard Deep Neural Networks (DNN) and established Bayesian methods like SNGP and VBLL. Furthermore, the model exhibits excellent calibration and robustness in OOD detection.

Performance results on image classification and OOD detection tasks.

In regression tasks, DVI-IBLL achieved the lowest NLL in four out of six UCI datasets, indicating its superior ability to handle non-Gaussian noise compared to traditional Gaussian-prior models.

Computational Efficiency

A critical advantage of DVI-IBLL is its minimal computational overhead. Despite the added flexibility of implicit priors and diffusion sampling, the model only adds approximately 6.9% to the training time of a standard deterministic DNN. This efficiency makes it a viable candidate for real-world applications where both speed and uncertainty quantification are paramount.

Computational efficiency comparison showing run time and percentage overhead above a standard DNN.

Conclusion

DVI-IBLL successfully bridges the gap between the efficiency of BLL models and the expressiveness of full BNNs. By leveraging implicit priors and diffusion-based inference, the framework provides robust uncertainty estimates and high predictive accuracy with negligible computational cost. Future research will explore scaling this diffusion-based approach to multiple layers and optimizing the denoising network architectures for specialized hardware.

Summary updated

BibTeX
@misc{xu2024flexible,
  author = {Jian Xu and Zhiqi Lin and Shigui Li and Min Chen and Junmei Yang and Delu Zeng and John W. Paisley},
  title = {{Flexible Bayesian Last Layer Models Using Implicit Priors and Diffusion Posterior Sampling}},
  year = {2024},
  eprint = {2408.03746},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2408.03746},
  howpublished = {SSRN},
}
Figure