Fixed-Mean Gaussian Processes for Post-hoc Bayesian Deep Learning

Luis A. Ortega, Simón Rodríguez Santana, Daniel Hernández-Lobato · DOI

Introduction

Deep Neural Networks (DNNs) have achieved state-of-the-art performance across numerous domains, yet they remain notoriously overconfident in their predictions. In high-stakes applications such as autonomous driving or medical diagnostics, quantifying uncertainty is as critical as predictive accuracy. While Bayesian Neural Networks (BNNs) provide a framework for uncertainty estimation, they often struggle with scalability and can degrade the performance of the underlying model.

This paper introduces Fixed-Mean Gaussian Processes (FMGP), a scalable, architecture-agnostic post-hoc method designed to provide reliable uncertainty estimates for any pre-trained DNN. By fixing the mean of a Gaussian Process to the network's output and optimizing only its variance, FMGP offers a "best of both worlds" solution: it preserves the original model's accuracy while adding high-quality "error bars."

The Scalability Bottleneck in Post-hoc Bayesian Learning

Existing post-hoc methods, such as the Linearized Laplace Approximation (LLA), are popular because they do not require retraining the original model. However, LLA relies on computing the Jacobian—the gradient of every output with respect to every parameter. For modern architectures like ResNet-152 or billion-parameter transformers, this computation is prohibitively expensive in terms of both memory and time.

FMGP addresses this gap by operating in function space rather than parameter space. Instead of finding a distribution over millions of weights, FMGP looks only at the inputs and outputs of the DNN, bypassing the complexity of the network's internal architecture.

Methodology: Fixed-Mean Gaussian Processes

The core innovation of FMGP is treating the pre-trained DNN as the fixed mean of a Gaussian Process. This approach leverages several key technical components:

  1. Universal Kernels: By using kernels like the Radial Basis Function (RBF), the GP can theoretically approximate any continuous function, allowing it to match the DNN's output.
  2. Decoupled Inducing Points: Unlike standard sparse GPs, FMGP uses a small set of "inducing points" (typically 20-100) specifically to learn the predictive variance, while the mean remains anchored to the DNN.
  3. Variational Inference (VI): The use of VI allows for stochastic optimization, making the training cost independent of the total dataset size. This enables FMGP to scale to massive datasets like ImageNet with millions of samples.
  4. Jacobian-Free Optimization: Because FMGP only requires the model's outputs, it never needs to compute a Jacobian, making it significantly faster and more memory-efficient than LLA-based methods.

Key Insights and Results

FMGP's primary advantage is its ability to provide reliable uncertainty without altering the original model's predictions. As shown in the qualitative comparison below, FMGP effectively captures uncertainty in regions where data is sparse, behaving similarly to gold-standard methods like Hamiltonian Monte Carlo (HMC) but at a fraction of the computational cost.

Comparison of FMGP against standard Bayesian and post-hoc methods on a 1D regression task. FMGP provides reliable uncertainty estimates (grey area) while keeping the mean (black line) fixed to the data.

Experimental Performance

The authors evaluated FMGP across regression and classification tasks, including ImageNet:

  • Calibration: FMGP consistently outperformed LLA variants in Negative Log-Likelihood (NLL) and Expected Calibration Error (ECE), particularly on large-scale regression tasks.
  • Efficiency: On ImageNet with a ResNet-152, FMGP's training time was roughly half that of ELLA, and its evaluation time was nearly 3x faster.
  • Robustness: The method demonstrated superior robustness to distribution shifts, such as rotated images, maintaining reliable log-likelihoods where other models became wildly overconfident.

Conclusion and Future Work

Fixed-Mean Gaussian Processes represent a significant step toward making Bayesian deep learning practical for large-scale, real-world models. By decoupling the mean and variance and operating in function space, FMGP provides a scalable, architecture-agnostic path to uncertainty quantification.

While promising, the performance of FMGP depends on the choice of kernel. Future research directions include the development of more sophisticated kernels tailored for complex data types like raw images and addressing the cubic scaling cost associated with increasing the number of inducing points.

Summary updated

BibTeX
@misc{ortega2024fixed,
  author = {Luis A. Ortega and Simón Rodríguez Santana and Daniel Hernández-Lobato},
  title = {{Fixed-Mean Gaussian Processes for Post-hoc Bayesian Deep Learning}},
  year = {2024},
  eprint = {2412.04177},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.04177},
}
Figure