The Hidden Uncertainty in a Neural Networks Activations

Janis Postels, Hermann Blum, Yannick Strümpler, César Cadena, Roland Siegwart, Luc Van Gool, Federico Tombari · DOI

TL;DR

This paper proposes a novel, post-hoc method to estimate both epistemic (model uncertainty) and aleatoric (data uncertainty) in neural networks by analyzing the distribution of their internal "latent" representations. This approach offers a computationally efficient way to gain insights into model confidence without altering the training process, showing promise for safer and more reliable AI deployment.

What Problem Does This Paper Address?

Deep neural networks, despite their impressive performance, often lack reliable ways to express uncertainty about their predictions. This is a critical issue for safety-sensitive applications where knowing when a model is unsure is as important as its prediction itself. While methods like Bayesian Deep Learning exist, they are often computationally expensive and difficult to scale. Existing approaches to uncertainty estimation often focus on specific types of uncertainty (epistemic or aleatoric) or require modifications to the training process. This paper aims to bridge this gap by providing a unified, computationally efficient framework to estimate both types of uncertainty from the internal workings of already trained, deterministic neural networks.

Methods

The core idea is to leverage the distribution of latent representations – the intermediate outputs of layers within a neural network. The authors propose that:

  • Epistemic Uncertainty: Can be quantified by the "surprise" or negative log-likelihood of observing a particular latent representation. This essentially measures how unusual a given internal state is compared to what the model has seen during training.
  • Aleatoric Uncertainty: Can be quantified by analyzing the output-conditional distribution of these latent representations. Specifically, the entropy of the predictive distribution derived from these representations captures data uncertainty.

Crucially, this method works on deterministic neural networks and can be applied after training, making it a post-hoc analysis tool. They also explore the impact of adding a reconstruction loss during training to encourage more informative latent representations, which can improve Out-of-Distribution (OOD) detection.

Datasets

The paper uses several standard datasets for evaluation:

  • Image Classification: MNIST, FashionMNIST, CIFAR10, SVHN.
  • Regression: A synthetic dataset generated from the function $f(x) = \frac{1}{2}(\sin(4\pi x - \pi) + x)$ for $x \in [-1,1]^3$.
  • Semantic Segmentation: Cityscapes dataset.
  • Depth Regression: KITTI dataset.

Key Insights and Ideas

  • Latent Representations as Uncertainty Proxies: The distribution of internal network activations (latent representations) inherently encodes information about both model and data uncertainty. This is a powerful insight, as it suggests we can "read" uncertainty from a trained network's internal state.
  • Layer Depth Matters: Deeper layers tend to provide uncertainty estimates that behave more similarly to established, but computationally expensive, methods like deep ensembles. Conversely, shallower layers offer more conservative uncertainty estimates, which can be beneficial for OOD detection but might be less calibrated for in-distribution data.
  • Post-Hoc and Model-Agnostic: The method can be applied to existing, trained neural networks without any modifications to the training procedure or architecture. This significantly broadens its applicability.
  • Unified Framework: The approach provides a single framework to estimate both epistemic and aleatoric uncertainty, which is a significant advantage over methods that focus on only one type.
  • Reconstruction Loss Trade-off: Adding a reconstruction loss during training can improve OOD detection performance but may lead to ambiguous calibration close to the data distribution, highlighting a trade-off between OOD detection and in-distribution confidence.

Key Results

  • Classification: Uncertainty estimates from deeper layers of a network showed comparable performance to MC Dropout and Deep Ensembles in terms of generalization ability (measured by accuracy under input perturbations). Shallow layers provided more conservative OOD detection.
  • Regression: The latent density approach successfully captured uncertainty in a regression task, showing increasing uncertainty for inputs far from the training data, similar to deep ensembles and Gaussian Processes.
  • OOD Detection: The method demonstrated strong OOD detection capabilities, particularly with shallow layers, and in some cases outperformed deep ensembles.
  • Semantic Segmentation: The framework was applied to semantic segmentation, showing that aleatoric uncertainty estimates correlated with misclassifications, and epistemic uncertainty could detect anomalous objects.
  • Depth Regression: The method scaled to a large-scale depth regression task, demonstrating that aleatoric uncertainty estimates correlated with prediction errors.

Limitations and Future Work

  • Feature Collapse: The paper acknowledges the "feature collapse" problem, where OOD data can become indistinguishable from in-distribution data in latent representations. This can be a challenge for density-based methods, especially in convolutional networks where spatial features might not be easily aggregated.
  • High-Dimensional Densities: Estimating densities in high-dimensional latent spaces can be computationally challenging. The authors used Principal Component Analysis (PCA) to reduce dimensionality, but note that this might not be optimal for convolutional networks.
  • Regularization Trade-off: While regularization can improve OOD detection, it can also lead to ambiguous calibration near the data distribution, making hyperparameter tuning difficult.
  • Future Work: The authors suggest exploring the aggregation of uncertainty information from multiple layers to potentially improve OOD detection performance. Further investigation into the impact of feature collapse and density estimation in convolutional networks is also warranted.

Summary updated

BibTeX
@misc{postels2020hidden,
  author = {Janis Postels and Hermann Blum and Yannick Strümpler and César Cadena and Roland Siegwart and Luc Van Gool and Federico Tombari},
  title = {{The Hidden Uncertainty in a Neural Networks Activations}},
  year = {2020},
  eprint = {2012.03082},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2012.03082},
}
Figure