lightning-uq-box
The lightning-uq-box is a PyTorch library that provides various Uncertainty Quantification (UQ) techniques for modern neural network architectures.
We hope to provide the starting point for a collaborative open source effort to make it easier for practitioners to include UQ in their workflows and remove possible barriers of entry. Additionally, we hope this can be a pathway to more easily compare methods across UQ frameworks and potentially enhance the development of new UQ methods for neural networks.
The project is currently under active development, but we nevertheless hope for early feedback, feature requests, or contributions. Please check the Contribution Guide for further information.
The goal of this library is threefold:
- Provide implementations for a variety of Uncertainty Quantification methods for Modern Deep Neural Networks that work with a range of neural network architectures and have different theoretical underpinnings
- Make it easy to compare UQ methods on a given dataset
- Focus on reproducibility of experiments with minimum boiler plate code and standardized evaluation protocols
To this end, each UQ-Method is essentially just a Lightning Module which can be used with a Lightning Data Module and a Trainer to execute training, evaluation and inference for your desired task. The library also utilizes the Lightning Command Line Interface (CLI) for better reproducibility of experiments and setting up experiments at scale.
Theory Guide
For a comprehensive document that provides more mathematical details for each method and generally forms the basis of our implementations, please see the Theory Guide. As a living document, we plan to update it as the library encompasses more methods. If you have any questions, or find typos or errors, feel free to open an issue.
Installation
The recommended way to install the latest released version is via pip,
pip install lightning-uq-box
For the latest development version you can run,
pip install git+https://github.com/lightning-uq-box/lightning-uq-box.git
The package is also available for installation via conda or spack. You can find instructions in the documention
UQ-Methods
In the tables that follow below, you can see what UQ-Method/Task combination is currently supported by the Lightning-UQ-Box via these indicators:
- ✅ supported
- ❌ not designed for this task
- ⏳ in progress
The implemented methods are of course not exhaustive, as the number of new methods keeps increasing. For an overview of methods that we are tracking or are planning to support, take a look at this issue.
Classification of UQ-Methods
The following sections aims to give an overview of different UQ-Methods by grouping them according to some commonalities. We agree that there could be other groupings as well and welcome suggestions to improve this overview. We also follow this grouping for the API documentation in the hopes to make navigation easier.
Single Forward Pass Methods
| UQ-Method | Regression | Classification | Segmentation | Pixel Wise Regression |
|---|---|---|---|---|
| Quantile Regression (QR) | ✅ | ❌ | ❌ | ✅ |
| Deep Evidential (DE) | ✅ | ⏳ | ⏳ | ✅ |
| Mean Variance Estimation (MVE) | ✅ | ❌ | ❌ | ✅ |
| ZigZag | ✅ | ✅ | ❌ | ❌ |
| Mixture Density Networks | ✅ | ❌ | ❌ | ⏳ |
Approximate Bayesian Methods
| UQ-Method | Regression | Classification | Segmentation | Pixel Wise Regression |
|---|---|---|---|---|
| Bayesian Neural Network VI ELBO (BNN_VI_ELBO) | ✅ | ✅ | ✅ | ⏳ |
| Bayesian Neural Network VI (BNN_VI) | ✅ | ⏳ | ⏳ | ⏳ |
| Deep Kernel Learning (DKL) | ✅ | ✅ | ❌ | ❌ |
| Deterministic Uncertainty Estimation (DUE) | ✅ | ✅ | ❌ | ❌ |
| Laplace Approximation (Laplace) | ✅ | ✅ | ❌ | ❌ |
| Monte Carlo Dropout (MC-Dropout) | ✅ | ✅ | ✅ | ✅ |
| Stochastic Gradient Langevin Dynamics (SGLD) | ✅ | ✅ | ⏳ | ⏳ |
| Spectral Normalized Gaussian Process (SNGP) | ✅ | ✅ | ❌ | ❌ |
| Stochastic Weight Averaging Gaussian (SWAG) | ✅ | ✅ | ✅ | ✅ |
| Variational Bayesian Last Layer (VBLL) | ✅ | ✅ | ❌ | ❌ |
| Deep Ensemble | ✅ | ✅ | ✅ | ✅ |
| Masked Ensemble | ✅ | ✅ | ⏳ | ⏳ |
| Epistemic Neural Network (Epinet) | ✅ | ✅ | ⏳ | ⏳ |
| Density Uncertainty Layer | ✅ | ✅ | ❌ | ❌ |
Generative Models
| UQ-Method | Regression | Classification | Segmentation | Pixel Wise Regression |
|---|---|---|---|---|
| Classification And Regression Diffusion (CARD) | ✅ | ✅ | ❌ | ❌ |
| Probabilistic UNet | ❌ | ❌ | ✅ | ❌ |
| Variational Auto-Encoder (VAE) | ❌ | ❌ | ❌ | ✅ |
| Vector Quantized VAE (VQ-VAE) | ❌ | ❌ | ❌ | ✅ |
Post-Hoc methods
| UQ-Method | Regression | Classification | Segmentation | Pixel Wise Regression |
|---|---|---|---|---|
| Test Time Augmentation (TTA) | ✅ | ✅ | ⏳ | ⏳ |
| Temperature Scaling | ❌ | ✅ | ⏳ | ❌ |
| Conformal Quantile Regression (Conformal QR) | ✅ | ❌ | ❌ | ⏳ |
| Regularized Adaptive Prediction Sets (RAPS) | ❌ | ✅ | ❌ | ❌ |
| Image to Image Conformal | ❌ | ❌ | ❌ | ✅ |
| Adaptive Thresholding (AT) | ❌ | ❌ | ✅ | ❌ |
| COAT | ❌ | ❌ | ✅ | ❌ |
Tutorials
We try to provide many different tutorials so that users can get a better understanding of implemented methods and get a feel for how they apply to different problems. Head over to the tutorials page to get started. These tutorials can also be launched in google colab if you navigate to the rocket icon at the top of a tutorial page.
Documentation
We aim to provide an extensive documentation on all included UQ-methods that provide some theoretical background, as well as tutorials that illustrate these methods on toy datasets.
Citation
If you use this software in your work, please cite our paper:
@article{JMLR:v26:24-2110,
author = {Nils Lehmann and Nina Maria Gottschling and Jakob Gawlikowski and Adam J. Stewart and Stefan Depeweg and Eric Nalisnick},
title = {Lightning UQ Box: Uncertainty Quantification for Neural Networks},
journal = {Journal of Machine Learning Research},
year = {2025},
volume = {26},
number = {54},
pages = {1--7},
url = {http://jmlr.org/papers/v26/24-2110.html}
}
Metadata
Release files for lightning-uq-box 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lightning_uq_box-0.4.0.tar.gz | 177.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lightning_uq_box-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 421.9 kB
Release files / lightning_uq_box-0.4.0.tar.gz
| Download URL | lightning_uq_box-0.4.0.tar.gz |
|---|---|
| Size | 177.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4029effa2cd8e2aa61d521b65bd4e75ca5b7a8fa23be5b383806fbf8130f3075
|
|
BLAKE2b-256 checksum How to use checksums |
333c99dc20d1549edf41f61601df9a66c292273674d9b0423ab7312b70f4aad2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.
Transparency logRelease files / lightning_uq_box-0.4.0-py3-none-any.whl
| Download URL | lightning_uq_box-0.4.0-py3-none-any.whl |
|---|---|
| Size | 244.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a581b9b05ac093c218b4af2953efcd39a639b002d0f68127a64df970c146257f
|
|
BLAKE2b-256 checksum How to use checksums |
e93e7bf575a7e49dc73bef535f0ef712537848195f63a419dae0000d21022366
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.
Transparency log