Density Uncertainty Layers for Reliable Uncertainty Estimation

Yookoon Park, David M. Blei

Abstract

Deep neural networks often exhibit overconfidence in out-of-distribution scenarios, leading to high-confidence but incorrect predictions. We present Density Uncertainty Layers, a novel approach that ties predictive variance directly to empirical data density. By ensuring uncertainty is grounded in the training distribution, this method achieves superior calibration and out-of-distribution detection compared to traditional Bayesian approximations. Our results demonstrate that this approach effectively mitigates "uncertainty collapse" in regions where data is scarce.

Introduction

Deep neural networks are powerful but frequently "confidently wrong." When encountering out-of-distribution (OOD) inputs, they often produce high-confidence predictions rather than signaling uncertainty. While Bayesian Deep Learning (BDL) aims to address this, standard approximations like Mean-Field Variational Inference (MFVI) often suffer from "uncertainty collapse," failing to provide reliable estimates in practice.

In their AISTATS 2024 paper, Park and Blei propose Density Uncertainty Layers. This approach explicitly links a model's predictive variance to the density of the training data, making the model naturally more cautious in data-scarce regions.

The Challenge of Overconfidence

Traditional Bayesian Neural Networks (BNNs) capture uncertainty by placing distributions over model weights. However, common variational approximations often fail to maintain high uncertainty in regions far from the training data. For instance, a model trained at $x=-5$ and $x=5$ might erroneously show high confidence at $x=0$ because the weight distributions do not capture the lack of data in that specific input region.

Comparison of uncertainty estimation methods on a toy regression task. Note how Density Uncertainty (d) maintains high uncertainty in the data gap, unlike baselines (a-c) which exhibit uncertainty collapse.

The authors argue that reliable uncertainty should be high in low-density regions and low in high-density regions—a property they formalize as the density uncertainty criterion.

Methodology: Density Uncertainty Layers

The proposed solution involves two key components:

  1. Density Uncertainty Criterion: A formal requirement that predictive variance scales with an "energy function" $E(x)$, representing the negative log-density of the input. If the input is improbable, the energy is high, and the uncertainty scales accordingly.
  2. Density Uncertainty Layer: A stochastic layer for residual networks that incorporates an internal Gaussian energy model.
  3. The layer calculates the "typicality" of data representations during the forward pass.
  4. Noise is injected into hidden states, with the magnitude scaled by the calculated energy (lower density leads to more noise).
  5. To maintain efficiency, the authors use an LDL parametrization for the energy models and offer a Mixture of Rank-1 Gaussians version for large-scale architectures to reduce computational overhead.

The model is trained using a joint objective: the standard Evidence Lower Bound (ELBO) for the primary task and a generative objective to train the layer-wise energy models.

Experimental Results

The authors evaluated their method across several benchmarks, including toy regression, UCI datasets, and image classification (CIFAR-10/100).

Calibration and OOD Performance

On benchmark image classification tasks, Density Uncertainty Layers significantly outperformed baselines in calibration. As shown in the table below, the method achieved an Expected Calibration Error (ECE) of 0.011, which is substantially lower than MFVI (0.132) or Rank-1 BNNs (0.041). This indicates that the model's confidence is much better aligned with its actual predictive accuracy.

Quantitative comparison of Density Uncertainty against standard Bayesian methods. The proposed method achieves the best accuracy and the lowest calibration error (ECE).

Furthermore, the model demonstrated robust OOD detection. When trained on CIFAR-10 and tested on the SVHN dataset, it achieved an AUROC of 0.893, effectively using its internal energy signal to identify unfamiliar data. The Rank-1 Mixture version also proved scalable, providing these benefits with only a fraction of the parameters required for full-rank models.

Conclusion

Density Uncertainty Layers provide a principled way to ground deep learning uncertainty in data density. By restoring the density-awareness inherent in simpler models like Bayesian Linear Regression to deep architectures, this work offers a scalable path toward more reliable and trustworthy AI systems in high-stakes applications.

Reference: Park, Y., & Blei, D. M. (2024). Density Uncertainty Layers for Reliable Uncertainty Estimation. Proceedings of the 27th International Conference on Artificial Intelligence and Statistics (AISTATS).

Summary updated

BibTeX
@inproceedings{park2024density,
  author = {Yookoon Park and David M. Blei},
  title = {{Density Uncertainty Layers for Reliable Uncertainty Estimation}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2024},
}
Figure