aleximmer/Laplace
Laplace approximations for Deep Learning.
What it solves
Standard neural networks give a single prediction without a measure of confidence. This library lets you turn a trained network into a Bayesian model, which provides uncertainty estimates, helps with model selection, and supports continual learning.
How it works
It uses the Laplace approximation, a mathematical shortcut. After you train a model, you fit this approximation to your training data (for example, using a diagonal Hessian over all parameters). You can then tune the "prior precision" (a hyperparameter) using methods like grid search, and finally make predictions using different approximation techniques (like "probit" for classification). It works on the whole network, a subnetwork, or just the last layer, and supports both weight-space and function-space versions. It offers different computational backends (Curvlinops, ASDL, BackPACK) to calculate the required curvature.
Who it’s for
Deep learning researchers and practitioners who have a pre-trained PyTorch model and want to add uncertainty quantification, perform model selection, or explore continual learning. The README explicitly warns that it requires experimentation with its options, so it's aimed at users willing to tune parameters.
Highlights
- Applies Laplace approximations to entire networks, subnetworks, or just the last layer.
- Supports posterior approximations, marginal-likelihood estimation, and various posterior predictive computations.
- Includes both weight-space and function-space Laplace approximations.
- Provides multiple computational backends (Curvlinops, ASDL, BackPACK) for flexibility.
- Comes with a companion paper ("Laplace Redux") and public code to reproduce experiments.
- Easy installation via
pip install laplace-torch.
Related
- Project
- Project
- Project
- Project
- Project