Latent Derivative Bayesian Last Layer Networks

Joe Watson, Jihao Andreas Lin, Pascal Klink, Joni Pajarinen, Jan Peters

Abstract: Bayesian Last Layer (BLL) networks offer a scalable approach to uncertainty quantification by restricting Bayesian inference to the final layer of a neural network. However, these models often suffer from overconfidence in out-of-distribution (OOD) regions due to the collapse of the learned feature space. We introduce Latent Derivative (LD) priors, a novel functional regularization technique that places a prior on the model's Jacobians. By treating Jacobians as latent variables and encouraging feature diversity, the resulting Latent Derivative BLL (LDBLL) achieves robust, Gaussian Process-like uncertainty estimates. Our experiments on active learning and OOD regression demonstrate that LDBLL significantly improves calibration and exploration compared to standard BLL and variational inference baselines.

Introduction

Reliable uncertainty quantification is a prerequisite for deploying deep learning in safety-critical applications such as autonomous robotics and medical diagnostics. While Bayesian Neural Networks (BNNs) provide a principled solution, their computational complexity often limits their practical use. Bayesian Last Layer (BLL) networks provide a popular compromise: they treat the initial layers of a network as a deterministic feature extractor and apply Bayesian inference only to the final linear layer.

Despite their efficiency, BLLs are prone to overconfidence. Because the feature extractor is trained deterministically, it often learns to map unseen, out-of-distribution (OOD) data into the same regions of the feature space as the training data. This "feature collapse" results in predictive distributions that lack meaningful uncertainty in regions where the model has no data.

Methodology

We propose the Latent Derivative BLL (LDBLL) to counteract feature collapse through functional regularization. The key insight is to regularize the model's derivatives (Jacobians) with respect to its inputs.

Graphical model of the LDBLL. The model incorporates latent Jacobians $J_{\phi_j}$ to regularize the feature space diversity across training ($|X|$) and test ($|T|$) points.

As shown in the graphical model above, LDBLL treats the model's Jacobian as a latent variable. We place a functional prior—specifically a Gaussian Process—on these Jacobians. This prior typically encourages the gradients to be diverse or smooth, acting as a maximum entropy regularizer in function space. The training objective combines the standard marginal likelihood with a functional KL divergence (fKL) that penalizes the model if its distribution of derivatives deviates from the prior. By forcing the model to maintain a healthy distribution of possible gradients, LDBLL becomes naturally more cautious in regions where it has not observed data.

Results

The LDBLL was evaluated on a series of challenging "gap" tasks designed to test OOD performance, including robotics dynamics (Cartpole, Sarcos) and atmospheric measurements (CO2). In these scenarios, standard BLLs often exhibit near-zero uncertainty in the gaps between training data clusters. In contrast, LDBLL successfully recovers meaningful uncertainty.

LDBLL predictive distribution on a toy gap task. The model maintains high uncertainty in regions without training data, avoiding the overconfidence typical of standard BLLs.

In active learning experiments on the Cartpole dataset, LDBLL's performance closely tracked that of a full Gaussian Process—the gold standard for uncertainty—and significantly outperformed Mean-Field Variational Inference (MFVI) and standard BLLs. Furthermore, the method demonstrated excellent scalability on the Flight Delay dataset (700,000 points), where it provided robust uncertainty estimates that would be computationally prohibitive for traditional GPs. In Bayesian Optimization tasks, LDBLL's "maximum entropy" nature led to superior exploration, avoiding the local optima that frequently trap standard BLL models.

Conclusion

Latent Derivative priors offer a mathematically tractable and scalable way to improve the uncertainty quantification of Bayesian Last Layer networks. By regularizing the model's Jacobians, LDBLL prevents feature collapse and provides reliable OOD estimates. Future research will focus on automated hyperparameter selection for the LD prior and extending the framework to high-dimensional multivariate regression tasks.

Summary updated

BibTeX
@inproceedings{watson2021latent,
  author = {Joe Watson and Jihao Andreas Lin and Pascal Klink and Joni Pajarinen and Jan Peters},
  title = {{Latent Derivative Bayesian Last Layer Networks}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2021},
}
Figure