Uncertainty Quantification for Deep Regression using Contextualised Normalizing Flows

Adriel Sosa Marco, John D. Kirwan, Alexia Toumpa, Simos Gerasimou

TL;DR

MCNF (Monte Carlo Normalizing Flow) is a novel, "plug-and-play" method for quantifying uncertainty in deep learning regression models. Operating post hoc, it can be applied to already-trained models to generate highly accurate prediction intervals and full probability distributions without requiring expensive retraining or architectural overhauls.

The Challenge of Uncertainty in Deep Learning

Deep learning models excel at making predictions, but they often struggle to express uncertainty or say, "I don't know." In high-stakes domains like medical diagnostics or energy forecasting, understanding the confidence of a prediction is just as critical as the prediction itself.

Existing Uncertainty Quantification (UQ) methods generally fall into two flawed categories:

  1. Interval-only methods: Techniques like Conformal Prediction provide a valid range (e.g., "the value is between 10 and 20"), but they ignore the underlying shape of the distribution. They cannot distinguish between a standard bell curve and a bimodal distribution where the true value is likely at the edges but not in the middle.
  2. Bayesian methods: While these provide full predictive distributions, they typically demand complete changes to the model architecture and require retraining from scratch—a computationally prohibitive hurdle for modern, large-scale deep learning.

MCNF bridges this gap by offering the rich, distributional outputs of Bayesian methods with the convenience and efficiency of a post hoc approach.

How MCNF Works

MCNF stands for Monte Carlo Normalizing Flow. Its architecture is designed to operate on top of an underlying trained predictive model through a three-stage workflow:

MCNF Architecture
  1. The Prior (Monte Carlo Dropout): The process begins with a standard trained model utilizing dropout layers. By passing the same input through the model multiple times with dropout active (MCD), MCNF generates a "rough draft" of the predictive distribution.
  2. The Context: Rather than relying solely on the final output, MCNF extracts a "context vector" from the model. This includes summary statistics (like the mean and variance of the dropout samples) as well as internal feature representations from the model's hidden layers.
  3. The Refiner (Normalizing Flows): This context is fed into a Neural Spline Flow (NSF). Normalizing Flows are generative models capable of transforming simple distributions into complex, arbitrary ones. Crucially, MCNF does not model the target variable directly; instead, it models the prediction error ($\delta$). It learns to "correct" the rough dropout estimates into a well-calibrated, complex predictive distribution.

To ensure robustness, the authors also introduce a temperature-scaled loss function ($\tau$) that prevents the Normalizing Flow from being disproportionately influenced by outliers during training.

Key Insights

  • Modeling the Error: By focusing the Normalizing Flow on the residual (the difference between the dropout estimate and the ground truth), the model efficiently learns to "sharpen" its uncertainty estimates.
  • Context is King: Utilizing internal hidden states allows the UQ method to understand why a model is uncertain based on specific input features, rather than just looking at the final numerical output.
  • Distribution-Agnostic: Unlike methods that assume uncertainty follows a standard Gaussian "bell curve," MCNF can accurately represent skewed, heavy-tailed, or multi-peaked distributions—essential for messy, real-world data.
  • No Retraining Tax: Because it operates post hoc, engineers can seamlessly integrate rigorous UQ into existing production pipelines without starting from scratch.

Experimental Results

The researchers evaluated MCNF across a diverse suite of benchmarks, including standard regression datasets (Boston Housing, Concrete, Abalone, Protein, Wave, Superconductivity), a synthetic dataset designed with multimodal/asymmetric distributions (Romano-Mod), and structural graph data (Solubility).

Performance Comparison Table

MCNF consistently matched or outperformed state-of-the-art methods like Conformal Quantile Regression (CQR) and Monte Carlo Conformal Prediction (MCCP) across key metrics:

  • Calibration: MCNF reliably achieved target marginal coverage (e.g., the true value falling within the predicted interval ~90% of the time) more consistently than standard dropout methods.
  • Efficiency: It produced narrower prediction intervals ($\tilde{\Delta}$) than its competitors while maintaining the same level of coverage. In UQ, a narrower interval that still captures the truth indicates higher precision and usefulness.
  • Accuracy: MCNF yielded significantly lower Mean Absolute Error (MAE) compared to other conformal methods, largely because it tailors its distributional adjustments rather than applying a "one-size-fits-all" interval correction.

Limitations and Future Directions

While MCNF offers a powerful new tool for UQ, the authors note a few areas for future development:

  • Hyperparameter Tuning: The outlier-handling temperature parameter ($\tau$) currently requires fine-tuning, potentially necessitating a small, dedicated calibration dataset.
  • Computational Overhead at Inference: The method still relies on Monte Carlo Dropout during inference, requiring multiple forward passes. While vastly more efficient than training full Bayesian networks, it remains slower than a single-pass point prediction.
  • Expansion to Classification: The current framework is strictly designed for continuous regression tasks. Extending this contextualized normalizing flow approach to classification problems is a logical and promising next step.

Summary updated

BibTeX
@inproceedings{marco2025uncertainty,
  author = {Adriel Sosa Marco and John D. Kirwan and Alexia Toumpa and Simos Gerasimou},
  title = {{Uncertainty Quantification for Deep Regression using Contextualised Normalizing Flows}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=ZL7RuWd6QK},
}
Figure