Reparameterization invariance in approximate Bayesian inference

Hrittik Roy, Marco Miani, Carl Henrik Ek, Philipp Hennig, Marvin Pförtner, Lukas Tatzel, Søren Hauberg

Overview

Bayesian Neural Networks (BNNs) often struggle to provide reliable uncertainty estimates because standard approximation methods get confused by "reparameterizations"—different parameter weights that produce the exact same function. This paper uses Riemannian geometry to map out these redundant weight spaces and introduces a novel diffusion-based sampling method. By ensuring the model only explores meaningful function changes, this approach effectively solves the severe underfitting problem commonly seen in standard Laplace approximations.

The Challenge: Reparameterization and Underfitting

In Bayesian Deep Learning, the goal is to estimate a full distribution (a posterior) over a neural network's weights to capture uncertainty. A popular and computationally tractable way to do this is the Laplace approximation, which fits a Gaussian distribution around the network's optimized weights.

However, neural networks are highly overparameterized. You can often change the weights without changing the actual function the network computes (for example, scaling up the weights of one layer while proportionally scaling down the next). This phenomenon is known as reparameterization.

Weight space vs. function space for different Laplace approximations

Because standard Laplace approximations operate in the weight space rather than the function space, they fail to recognize when different weights represent the identical underlying function. Consequently, they assign probability mass to "incorrect" degrees of freedom. In practice, this causes standard "Sampled Laplace" to severely underfit the data.

Recently, researchers found that applying an additional approximation—linearizing the neural network (Linearized Laplace)—magically fixes this underfitting. This paper sets out to explain why this linearization hack works and how to achieve the same success in a principled way without needing to linearize the network.

A Geometric Solution: Laplace Diffusion

The authors tackle this problem by analyzing the geometry of the neural network's weight space.

  • Geometric Decomposition: They demonstrate that the weight space can be split into two orthogonal manifolds using the Generalized Gauss-Newton (GGN) matrix. One is the kernel manifold (directions where weight changes do not change the function on the training data), and the other is the non-kernel manifold (directions where the function does change).
  • Explaining Linearized Laplace: They mathematically prove that the Linearized Laplace approximation works because it restricts sampling entirely to the non-kernel manifold, effectively ignoring redundant reparameterizations.
  • Laplace Diffusion (The Novel Approach): Instead of linearizing the network, the authors propose a Riemannian diffusion process. They use a random walk (simulated via the Euler-Maruyama scheme) guided by the GGN matrix as a geometric metric. This forces the sampling process to stay on the non-kernel manifold. As a result, they can sample from the original, non-linear neural network while remaining perfectly invariant to reparameterizations.

Key Insights and Results

The authors evaluated their method across toy datasets (1D regression, 2D classification), standard image benchmarks (MNIST, FashionMNIST, CIFAR-10), and various out-of-distribution (OOD) datasets.

1D regression showing how kernel contributions cause underfitting in standard Laplace
  • The Root of Underfitting: Standard Sampled Laplace underfits because it samples heavily in the "kernel" subspace. It explores weight changes that do nothing on the training data but act wildly and unpredictably on test data, washing out the model's actual learned function.
  • Linearization is a Geometric Filter: The success of Linearized Laplace isn't just a lucky computational trick. The linearization acts as an infinitesimal filter that naturally ignores reparameterization directions, preventing the model from wasting uncertainty on redundant weights.
  • Massive Accuracy Recovery: On MNIST, standard Sampled Laplace gets a dismal 14.6% accuracy due to severe underfitting. The proposed Laplace Diffusion recovers performance, hitting 98.7% accuracy.
  • Superior OOD Detection: Laplace Diffusion significantly outperforms standard Laplace on Out-of-Distribution detection. For example, when trained on MNIST and tested on FMNIST, Laplace Diffusion achieves an AUROC of 0.911, compared to just 0.515 for Sampled Laplace.
  • Beating the State-of-the-Art: The diffusion approach matches or slightly beats Linearized Laplace across calibration (Expected Calibration Error), Negative Log-Likelihood, and accuracy, all while keeping the true non-linear network intact.

Limitations and Future Directions

While theoretically sound and empirically successful, the proposed method has some practical limitations:

  • Computational Cost: Simulating the Riemannian diffusion requires computing the inverse square root of the GGN matrix. Even using efficient iterative methods (like the Lanczos algorithm), this is computationally heavy and increases runtime by a constant factor compared to standard Laplace.
  • Incompatibility with Sparse Approximations: To speed up Laplace approximations, practitioners often use sparse versions of the GGN (like a diagonal approximation). The authors note that doing this destroys the geometric properties that make their method work, as diagonal matrices don't share the same kernel as the true GGN.

Future work will need to focus on developing new computational pipelines and algorithms that can efficiently engage with the full GGN matrix without breaking its vital reparameterization invariance.

Summary updated

BibTeX
@inproceedings{roy2024reparameterization,
  author = {Hrittik Roy and Marco Miani and Carl Henrik Ek and Philipp Hennig and Marvin Pförtner and Lukas Tatzel and Søren Hauberg},
  title = {{Reparameterization invariance in approximate Bayesian inference}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=204YOrDHny},
}
Figure