Adaptive Uncertainty Estimation via High-Dimensional Testing on Latent Representations

Tsai Hor Chan, Kin Wai Lau, Jiajun Shen, Guosheng Yin, Lequan Yu

Overview

Deep Neural Networks (DNNs) are notoriously overconfident, often making high-certainty predictions on data they have never seen before—known as Out-of-Distribution (OOD) samples. Accurately estimating a model's uncertainty is critical for safe deployment, yet existing solutions face significant hurdles. This paper introduces a novel framework for uncertainty estimation that performs high-dimensional hypothesis testing directly on the latent representations of a Bayesian Neural Network (BNN). By utilizing the Adaptable Regularized Hotelling $T^2$ (ARHT) statistic, the method accurately detects OOD data without needing exposure to it during training or modifying the original task's objective function.

The Challenge of Uncertainty Estimation

Current approaches to uncertainty estimation typically struggle with three main issues:

  1. The Curse of Dimensionality: Most methods evaluate low-dimensional outputs, such as final classification probabilities. When attempting to analyze internal "latent" features, standard statistical tools fail because these features are highly dimensional, leading to singular covariance matrices.
  2. OOD Data Requirements: Many state-of-the-art methods require the model to be exposed to OOD data during training to learn what anomalous data looks like. In real-world applications, it is impossible to anticipate and train on every possible type of OOD data.
  3. Task Rigidity: Existing methods are often hard-coded for discrete classification tasks, making them difficult to generalize to regression or broader representation learning.

Proposed Methodology

To overcome these limitations, the authors propose a two-part framework that separates the feature encoding process from the uncertainty testing phase.

Overview of the proposed BNN-ARHT framework
  • The BNN Encoder: Instead of a standard "frequentist" network with fixed weights, the framework employs a Bayesian Neural Network. By sampling weights from a learned distribution, the BNN captures epistemic uncertainty (model uncertainty). For every input, the BNN generates a distribution (or "cloud") of latent features rather than a single deterministic point.
  • The ARHT Statistic: To compare the features of a new test sample against the known training data, the authors apply the Adaptable Regularized Hotelling $T^2$ (ARHT) statistic. Standard distance measures like Mahalanobis distance break down in high dimensions. ARHT regularizes this process, making it robust even when the number of features vastly exceeds the number of samples.
  • Optimal Thresholding: The framework treats OOD detection as a multiple hypothesis testing problem. It uses the Benjamini-Hochberg (BH) procedure to set a detection threshold that statistically minimizes the False Discovery Rate (FDR), ensuring reliable real-world deployment.

Key Insights

Testing directly on latent representations proves to be far more discriminative than testing on final output probabilities, as it captures the core essence of what the model has learned. Furthermore, because the method operates purely on these extracted features, it offers significant post-hoc flexibility. It does not require retraining the encoder with a specialized "uncertainty loss." A BNN trained for standard classification can have this OOD detection logic applied afterward. The authors also demonstrated that this approach is robust across various architectures, from simple LeNets to deep ResNets.

Experimental Results

The framework was evaluated across a wide range of benchmarks, including standard vision datasets (MNIST, CIFAR-10/100, TinyImageNet), medical imaging (Diabetes Retinopathy Detection), and simulated regression data.

Histogram showing clear separation between in-distribution and OOD scores
  • Superior OOD Detection: On the MNIST vs. Fashion-MNIST task, the proposed BNN-ARHT achieved an AUROC of 99.51%, outperforming competitors like MC Dropout and Deep Ensembles.
  • Medical Utility: In the Diabetes Retinopathy Detection benchmark, where training data is limited and the stakes are high, the method achieved a 93.44% AUROC. This is significantly higher than standard Bayesian approaches, which hovered around 59-60% in some baselines.
  • Preserved Accuracy: Unlike methods that trade classification accuracy for better uncertainty scores, BNN-ARHT maintained or slightly improved top-1 accuracy on the primary task (e.g., 99.26% on MNIST).
  • Unseen OOD: Crucially, the model performed exceptionally well even though it never saw a single OOD image during its training phase.

Limitations and Future Work

While highly effective, the framework does have limitations. BNNs require multiple forward passes to sample weights and generate feature distributions, making inference computationally heavier and slower than standard point-estimate DNNs. Additionally, scaling BNNs to massive, exceptionally deep architectures remains an industry-wide challenge. Finally, the current method requires access to the training set (or its summary statistics) to perform the hypothesis test. Future work may explore reconstructing "pseudo-training data" for zero-shot scenarios where the original data is restricted or unavailable.

Summary updated

Abstract

Uncertainty estimation aims to evaluate the confidence of a trained deep neural network. However, existing uncertainty estimation approaches rely on low-dimensional distributional assumptions and thus suffer from the high dimensionality of latent features. Existing approaches tend to focus on uncertainty on discrete classification probabilities, which leads to poor generalizability to uncertainty estimation for other tasks. Moreover, most of the literature requires seeing the out-of-distribution (OOD) data in the training for better estimation of uncertainty, which limits the uncertainty estimation performance in practice because the OOD data are typically unseen. To overcome these limitations, we propose a new framework using data-adaptive high-dimensional hypothesis testing for uncertainty estimation, which leverages the statistical properties of the feature representations. Our method directly operates on latent representations and thus does not require retraining the feature encoder under a modified objective. The test statistic relaxes the feature distribution assumptions to high dimensionality, and it is more discriminative to uncertainties in the latent representations. We demonstrate that encoding features with Bayesian neural networks can enhance testing performance and lead to more accurate uncertainty estimation. We further introduce a family-wise testing procedure to determine the optimal threshold of OOD detection, which minimizes the false discovery rate (FDR). Extensive experiments validate the satisfactory performance of our framework on uncertainty estimation and task-specific prediction over a variety of competitors. The experiments on the OOD detection task also show satisfactory performance of our method when the OOD data are unseen in the training. Codes are available at https://github.com/HKU-MedAI/bnn_uncertainty.
BibTeX
@inproceedings{chan2023adaptive,
  author = {Tsai Hor Chan and Kin Wai Lau and Jiajun Shen and Guosheng Yin and Lequan Yu},
  title = {{Adaptive Uncertainty Estimation via High-Dimensional Testing on Latent Representations}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=0DpKUzl1Se},
}
Figure