Improved uncertainty quantification for neural networks with Bayesian last layer
Felix Fiedler, Sergio Lucia
TL;DR
The paper tackles uncertainty quantification in neural networks by proposing neural networks with a Bayesian last layer (BLL), a tractable compromise between full Bayesian neural networks and traditional methods. It introduces an exact, gradient-friendly reformulation of the log-marginal likelihood that includes the last-layer weights as optimization variables, enabling efficient backpropagation without inverting large matrices. A novel extrapolation-aware mechanism based on an affine-cost interpretation ties predictive uncertainty to the geometry of learned features and introduces an adaptive penalty parameter $\alpha$ to improve extrapolation quality, accompanied by a practical algorithm to tune it. The framework is extended to the multivariate setting with simplified training under reasonable assumptions, and it is compared against Bayes by Backprop and BLR with NN features through simulation, showing superior log-predictive density and controllable extrapolation behavior. Overall, the work provides a scalable, analytically tractable approach to uncertainty quantification with strong extrapolation handling and favorable performance relative to full BNNs.
Abstract
Uncertainty quantification is an important task in machine learning - a task in which standardneural networks (NNs) have traditionally not excelled. This can be a limitation for safety-critical applications, where uncertainty-aware methods like Gaussian processes or Bayesian linear regression are often preferred. Bayesian neural networks are an approach to address this limitation. They assume probability distributions for all parameters and yield distributed predictions. However, training and inference are typically intractable and approximations must be employed. A promising approximation is NNs with Bayesian last layer (BLL). They assume distributed weights only in the linear output layer and yield a normally distributed prediction. To approximate the intractable Bayesian neural network, point estimates of the distributed weights in all but the last layer should be obtained by maximizing the marginal likelihood. This has previously been challenging, as the marginal likelihood is expensive to evaluate in this setting. We present a reformulation of the log-marginal likelihood of a NN with BLL which allows for efficient training using backpropagation. Furthermore, we address the challenge of uncertainty quantification for extrapolation points. We provide a metric to quantify the degree of extrapolation and derive a method to improve the uncertainty quantification for these points. Our methods are derived for the multivariate case and demonstrated in a simulation study. In comparison to Bayesian linear regression with fixed features, and a Bayesian neural network trained with variational inference, our proposed method achieves the highest log-predictive density on test data.
