Skip to main content

TorchUncertaintyLogo

pypi tests Docs PRWelcome Ruff Code Coverage Downloads

TorchUncertainty is a package designed to help leverage uncertainty quantification techniques to make deep neural networks more reliable. It aims to be collaborative and to include as many methods as possible — so reach out to add yours!

TorchUncertainty is in active development: expect changes, but reach out and contribute if you are interested in the project! Please raise an issue if you have any bugs or difficulties and join the Discord server.

Our website and documentation are available at torch-uncertainty.github.io. 📚

TorchUncertainty contains the official implementations of multiple papers from major machine-learning and computer-vision conferences and was featured in tutorials at WACV 2024, HAICON 2024 and ECCV 2024.

Torch-Uncertainty was published at NeurIPS D&B 2025. Please consider citing the paper if the framework is helpful for your research.


This package provides a multi-level API, including:

  • easy-to-use ⚡ Lightning uncertainty-aware training & evaluation routines for 4 tasks: classification, probabilistic and pointwise regression, segmentation, and pixelwise regression (e.g., monocular depth estimation);
  • fully automated evaluation of models with proper scores, calibration, selective classification, out-of-distribution detection and distribution-shift metrics — see the Evaluating Models page;
  • layers, models, metrics, & losses ready to drop into your networks;
  • scikit-learn-style post-processing methods such as temperature scaling and conformal prediction;
  • transformations and augmentations, including a set of corruptions used to build "corrupted datasets" hosted on HuggingFace.

Have a look at the Reference page or the API reference for a more exhaustive list of the implemented methods, datasets, metrics, etc.

⚙️ Installation

TorchUncertainty requires Python 3.10 or greater. Install the desired PyTorch version in your environment. Then, install the package from PyPI:

pip install torch-uncertainty

The installation procedure for contributors is different: have a look at the contribution page.

🐳 Docker image for contributors

For contributors running experiments on cloud GPU instances, we provide a pre-built Docker image with all the necessary dependencies and a Dockerfile to build your own custom images. This lets you launch an experiment-ready container with minimal setup. See DOCKER.md for further details.

🐎 Quickstart

We make a quickstart available at torch-uncertainty.github.io/quickstart.

📚 Implemented methods

TorchUncertainty currently supports classification, probabilistic and pointwise regression, segmentation and pixelwise regression (such as monocular depth estimation).

We also provide the following methods:

Uncertainty quantification models

To date, the following deep-learning uncertainty quantification methods have been implemented. Click 📥 on the methods for tutorials:

Augmentation methods

The following data augmentation methods have been implemented:

  • Mixup, MixupIO, RegMixup, and WarpingMixup
  • modernized corruptions to evaluate model performance under distribution shift

Post-processing methods

To date, the following post-processing methods have been implemented:

Metrics

The following metrics have been implemented (see the Evaluating Models page for the full breakdown per task):

  • proper scores: Brier score, Categorical NLL, distribution NLL
  • out-of-distribution detection: AUROC, AUPR, FPR95
  • selective classification with OOD: SCOD-AURC, SCOD-AUGRC, SCOD-CovAt5%Risk, SCOD-RiskAt80%Cov
  • calibration: ECE with improved reliability diagrams, SmoothECE, Adaptive ECE, Classwise ECE, and QuantileCalibrationError for regression
  • selective classification: AURC, AUGRC, CovAt5%Risk, RiskAt80%Cov
  • conformal predictions: CoverageRate, SetSize
  • prediction diversity: Disagreement, Entropy, MutualInformation, VariationRatio
  • multiple pixelwise-regression and segmentation metrics

Official Implementations

It includes the official codes of the following papers:

  • Packed-Ensembles for Efficient Uncertainty Estimation - ICLR 2023 - Tutorial
  • LP-BNN: Encoding the latent posterior of Bayesian Neural Networks for uncertainty quantification - IEEE TPAMI 2023
  • MUAD: Multiple Uncertainties for Autonomous Driving, a benchmark for multiple uncertainty types and tasks - BMVC 2022

Tutorials

Check out all our tutorials at torch-uncertainty.github.io/auto_tutorials.

Experiments

We provide some configuration files in the experiments folder. You may find more examples in other repositories related to the Torch-Uncertainty organization, such as the Packed-Ensembles reproducibility repo. or the Torch-Uncertainty reproducibility repo.

Experiment results are tracked with MLflow. After running an experiment, launch mlflow ui (or mlflow ui --backend-store-uri sqlite:///logs/<name> for the SQLite configs) and open http://localhost:5000 to compare runs, inspect metric curves, and browse logged artifacts. See the MLflow Guide for full details.

🔭 Projects using TorchUncertainty

The following projects use TorchUncertainty:

  • Towards Understanding and Quantifying Uncertainty for Text-to-Image Generation - CVPR 2025
  • Towards Understanding Why Label Smoothing Degrades Selective Classification and How to Fix It - ICLR 2025
  • A Symmetry-Aware Exploration of Bayesian Neural Network Posteriors - ICLR 2024

If you are using TorchUncertainty in your project, please let us know, and we will add your project to this list!

Citation

If you use this software, please cite its corresponding paper:

@inproceedings{lafage2025torch_uncertainty,
    title={Torch-Uncertainty: A Deep Learning Framework for Uncertainty Quantification},
    author={Lafage, Adrien and Laurent, Olivier and Gabetni, Firas and Franchi, Gianni},
    booktitle={NeurIPS Datasets and Benchmarks Track},
    year={2025}
}

Metadata

Release files for torch-uncertainty 0.13.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for torch-uncertainty 0.13.0
File Size Uploaded
torch_uncertainty-0.13.0.tar.gz 261.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for torch-uncertainty 0.13.0
File Interpreter ABI Platform
torch_uncertainty-0.13.0-py3-none-any.whl Python 3 none any Details

Total release size: 699.3 kB

Release files / torch_uncertainty-0.13.0.tar.gz

Download URL torch_uncertainty-0.13.0.tar.gz
Size 261.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e1755c8158b71df44a60e949975d76a74e7d42dbbb0c8623ec41a6e46013ef84
BLAKE2b-256 checksum
How to use checksums
e03113c38610a0f68f1a0c67359fa03693c31ddc3460786e5924a38a58cd2c35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 22, 2026.

Transparency log

Release files / torch_uncertainty-0.13.0-py3-none-any.whl

Download URL torch_uncertainty-0.13.0-py3-none-any.whl
Size 438.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a15b1a79ef1306dfe9affc2e4c9d7bd235bfc2e048e745b23d08500368d52396
BLAKE2b-256 checksum
How to use checksums
379deaab456ef6d7f334a43e7c080989d4b0f4c39d6d68f31e60a6c158efa551
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 22, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.13.0 This release

2 release files

0.12.1

2 release files

0.12.0

2 release files

0.11.0

2 release files

0.10.4

2 release files

0.10.2

2 release files

0.10.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page