Uncertainty Quantification in Deep Learning

Deep learning has achieved remarkable success in a wide range of applications such as computer vision, natural language processing, and speech recognition. However, deep neural networks are often criticized for being black-box models that provide overconfident predictions without quantifying the uncertainty in their outputs.

Uncertainty quantification is crucial for deploying deep learning models in real-world scenarios, especially in high-stakes applications like healthcare, autonomous driving, and finance. By quantifying predictive uncertainty, we can identify situations where the model is likely to make unreliable predictions so that appropriate actions can be taken. For example, an autonomous vehicle can request human intervention when its uncertainty about the scene is high.

In this blog post, we will provide an overview of the key techniques for modeling and quantifying uncertainty in deep neural networks. We will also discuss some real-world applications that can benefit from modeling uncertainty.

Sources of Uncertainty in Deep Learning

There are two main types of uncertainty that can affect the predictions from a deep learning model:

Aleatoric uncertainty: This uncertainty is due to the inherent noise in the data. Even with abundant data, there will always be randomness that cannot be modeled. For example, sensor measurements naturally have some randomness.

Epistemic uncertainty: This uncertainty arises due to a lack of knowledge - either insufficient or unrepresentative training data. More data could potentially help reduce epistemic uncertainty.

In addition, there are model uncertainties stemming from the model architecture itself. Simplifying assumptions made in the model design induce biases that lead to uncertainty in predictions.

Capturing the various sources of uncertainty provides a more nuanced perspective on the model's limitations compared to a single confidence score. By decomposing the total uncertainty into aleatoric and epistemic components, we can focus on acquiring knowledge to reduce the epistemic uncertainty over time.

Uncertainty Quantification Methods

Many techniques have been proposed for quantifying uncertainty in deep neural networks:

Bayesian Neural Networks

These methods put probability distributions over the weights of a neural network and perform Bayesian inference to compute predictive distributions. Some popular methods include:

  • Monte Carlo Dropout: Apply dropout at test time to sample from the posterior. The variance of predictions captures model uncertainty.
  • Bayes by Backprop: Learn a distribution over weights by minimizing the negative log-likelihood loss.
  • Hamiltonian Monte Carlo: Use principles from Hamiltonian dynamics to sample from the posterior over weights.

Bayesian methods provide a principled approach to model uncertainty but incur higher computational costs.

Ensemble Methods

Ensembles leverage multiple models to quantify epistemic uncertainty. The variance of predictions across different models measures how much the prediction depends on a particular model configuration. Common approaches include:

  • Deep Ensembles: Train multiple models independently with different random initializations.
  • Snapshot Ensembles: Save models at different training stages and use their ensemble to quantify uncertainty.

Ensembles are simple to implement but require training and storing multiple models.

Output Uncertainty Methods

These methods directly model uncertainty in the neural network outputs without changing the model architecture itself:

  • Confidence Calibration: Apply post-processing techniques like temperature scaling to calibrate a model's confidence to be aligned with its accuracy.
  • Conformal Prediction: Use past model errors to assign confidence to new predictions. Provides guaranteed error rates.
  • Regression Models: Use a secondary regression model to predict uncertainty from the primary model's features/outputs.

Output uncertainty methods have lower computational overhead but may not fully capture all sources of uncertainty.

Applications of Uncertainty Quantification

Here are some promising applications of uncertainty quantification in deep learning:

Healthcare

  • Assess reliability of AI-assisted diagnosis and flag cases for expert review when uncertain.
  • Guide data collection to improve diagnosis for ambiguous cases.
  • Model risk factors by identifying uncertain predictions for patients.

Autonomous Driving

  • Detect unfamiliar/out-of-distribution objects and situations where uncertainty is high.
  • Use uncertainty map to control speed and request human takeover when necessary.
  • Focus data collection on uncertain scenarios to improve safety.

Drug Discovery

  • Guide experiment design by quantifying uncertainty in predictions.
  • Identify failure modes in molecular property prediction.
  • Assess confidence in generated molecular structures.

Anomaly Detection

  • Flag anomalies when model makes highly uncertain predictions.
  • Continuously monitor epistemic uncertainty to detect distributional shifts.
  • Use uncertainty to avoid false positives in detecting outliers.

Financial Forecasting

  • Build risk-aware portfolios by considering model confidence in return predictions.
  • Estimate Value at Risk (VaR) using predictive uncertainty.
  • Detect distributional shifts and concept drift for time series data.

Implementing Uncertainty Quantification

Here are some best practices when implementing uncertainty quantification in deep learning models:

  • Clearly define what types of uncertainty are most relevant to the problem.
  • Use data augmentation techniques like random crops and noise injection to expose the model to uncertainty during training.
  • Evaluate uncertainty estimation using metrics like negative log likelihood, Brier score, and calibration error.
  • Visualize uncertainty estimates on test cases to build intuition.
  • Monitor how uncertainty changes as the model trains - uncertainty should generally decrease with more data.
  • Use uncertainty-based sampling techniques like Bayesian active learning to select useful data for labeling.
  • Propagate uncertainty across pipeline stages for end-to-end quantification.

Conclusion

Uncertainty quantification unlocks a deeper understanding of deep learning model behavior and reliability. By providing predictive uncertainty estimates instead of just point predictions, users can appropriately trust and act on model outputs. As deep learning gets deployed in more mission-critical systems, quantifying uncertainty becomes crucial for operationalization. The techniques discussed in this post serve as useful tools for working towards safe and reliable AI applications.

References

  1. A review of uncertainty quantification in deep learning: Techniques, applications and challenges
  2. Deeply uncertain: comparing methods of uncertainty quantification in deep learning algorithms
  3. Uncertainty Quantification in Deep Learning