NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Generalized Variational Inference in Function Spaces: Gaussian Measures meet Bayesian Deep Learning

Veit D. Wild, Robert Hu, Dino Sejdinovic

Introduction

Bayesian Deep Learning (BDL) traditionally attempts to find a distribution over neural network weights. However, this approach is notoriously difficult: weights are high-dimensional, the posterior is often multi-modal, and translating prior knowledge about a function (such as smoothness) into a prior over weights is highly unintuitive.

An elegant alternative is function space inference, where reasoning is applied directly to the output of the model. Unfortunately, standard variational inference in function space relies on the Kullback-Leibler (KL) divergence. In infinite-dimensional spaces, the KL divergence between two measures is often infinite unless they are virtually identical, rendering the optimization objective mathematically pathological and practically useless.

To resolve this, the authors introduce Gaussian Wasserstein Inference (GWI), a novel framework that performs Bayesian inference directly in the space of functions. By replacing the standard KL divergence with the Wasserstein distance, GWI avoids these infinite-dimensional pathologies, successfully combining the predictive power of deep learning with the robust uncertainty quantification of Gaussian Processes.

Methodology: Gaussian Wasserstein Inference

The core contribution of the paper is Generalized Variational Inference in Function Spaces (GVI-FS). The key innovation is swapping the KL divergence for the 2-Wasserstein distance ($W_2$).

  1. Wasserstein over KL: Unlike the KL divergence, the $W_2$ distance is well-defined and tractable for Gaussian measures on Hilbert spaces (such as the space of square-integrable functions). It provides a "smoother" geometry for optimization that does not break down in infinite dimensions.
  2. Tractable Objective: The authors derive a closed-form approximation for the $W_2$ distance between a Gaussian prior and a Gaussian variational posterior. This approximation utilizes the eigenvalues of kernel matrices, making the objective computationally feasible.
  3. GWI-net: To adapt this framework for deep learning, the authors parameterize the mean of their variational distribution using a Deep Neural Network (DNN). This creates a powerful hybrid model: the DNN handles the complex, non-linear mapping for high predictive performance, while a sparse Gaussian Process-like structure manages the uncertainty quantification.

Key Insights and Principled Uncertainty

Instead of attempting to make the entire neural network Bayesian—a computationally daunting task—GWI uses the DNN strictly as the mean function of a Gaussian measure. This allows the model to capture the high-performance non-linearities of deep learning while inheriting principled uncertainty.

Crucially, the model's uncertainty (variance) naturally grows in regions where there is no training data. This is a critical feature for safety-critical applications, addressing a major shortcoming of standard deterministic neural networks which often make overconfident predictions on unfamiliar data.

Figure 1: GWI-net on toy regression tasks. The blue shaded area represents the posterior predictive uncertainty, which correctly expands in regions lacking data.

Empirical Performance

The authors evaluated GWI-net across several standard benchmarks, demonstrating strong results across diverse tasks:

  • State-of-the-Art Regression: On 9 UCI regression benchmarks (e.g., Boston, Concrete, Naval), GWI-net achieved the best "Mean Rank" (2.06) compared to a wide array of competitors, including Bayes-by-Backprop, Variational Dropout, and other function-space methods like FVI.
  • Superior Image Classification: On the Fashion MNIST dataset, GWI-net achieved 93.25% accuracy, outperforming other Bayesian methods such as FVI (91.60%) and KFAC-Laplace (84.42%).
  • Robust Out-of-Distribution (OOD) Detection: The model showed strong performance in identifying out-of-distribution data. On the Fashion MNIST vs. MNIST task, it achieved an impressive OOD-AUC of 0.959, proving the model effectively "knows what it doesn't know."

Limitations and Future Work

While GWI represents a significant step forward for function-space inference, the authors note a few limitations:

  • Numerical Stability: The method relies on the SVGP (Stochastic Variational Gaussian Process) kernel, which involves inverting kernel matrices. This can lead to numerical instabilities and requires careful initialization.
  • Spectral Decay Assumption: The tractable approximation of the Wasserstein distance assumes that the composition of the prior and variational kernels has a rapidly decaying spectrum. While this holds true for the kernels used in the experiments, it may not generalize to all kernel choices.
  • Unimodal Posterior: Because the framework models the posterior as a Gaussian measure, it is inherently unimodal. It cannot capture complex, multi-modal functional posteriors that might arise in certain deep learning scenarios.
  • Computational Overhead: Although more tractable than exact Gaussian Processes, GWI still requires calculating eigenvalues and kernel matrices, making it computationally more expensive than a standard deterministic neural network.

Summary updated

BibTeX
@inproceedings{wild2022generalized,
  author = {Veit D. Wild and Robert Hu and Dino Sejdinovic},
  title = {{Generalized Variational Inference in Function Spaces: Gaussian Measures meet Bayesian Deep Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=O3Qg5OZrx-c},
}
Figure