Abstract
Reliable Out-of-Distribution (OOD) detection is essential for deploying neural networks in safety-critical environments. Current uncertainty estimation techniques, such as Deep Ensembles and MC Dropout, often fail at the strict False Positive Rate (FPR) thresholds required for real-world applications. We present Uncertainty Adversarial Training (UAT), a method that explicitly calibrates a model's epistemic uncertainty. By training on adversarial samples designed to minimize predicted uncertainty, UAT forces the model to be significantly more uncertain as data moves away from the training manifold. Our results demonstrate substantial improvements in OOD detection, particularly at low FPRs where traditional methods collapse.
Introduction
In domains like autonomous driving or medical diagnosis, a model must accurately identify when an input is significantly different from its training data. This "out-of-distribution" detection allows the system to defer to human experts rather than making overconfident, incorrect predictions. While metrics like Area Under the Curve (AUC) are commonly used to evaluate OOD detection, they often mask failures at low False Positive Rates. For instance, an "Ordinary" ensemble might achieve a high overall AUC but fail to detect simple Gaussian noise at a 1% FPR threshold. This paper addresses this gap by shifting the focus from label-based adversarial training to uncertainty-based adversarial training.
Methodology
The core of our approach is the creation and utilization of uncertainty-based adversaries.
Uncertainty Fast Gradient Sign Method (UFGSM)
Standard adversarial attacks (FGSM) perturb inputs to change the predicted class label. In contrast, UFGSM perturbs an input in a direction that minimizes its predicted epistemic uncertainty, measured via Mutual Information (MI). This creates "adversarial OOD" samples that attempt to trick the model into being overconfident about data it has never seen.
Uncertainty Adversarial Training (UAT)
UAT incorporates these UFGSM samples into the training process. We introduce a regularization term to the loss function that penalizes low epistemic uncertainty for samples distant from the training data manifold. This forces the model's uncertainty to scale proportionally with the distance from the in-distribution data. We implement this on "Dropout Ensembles," which combine multiple networks with dropout at inference time to provide a robust approximation of the model's posterior distribution.
Results and Analysis
We evaluated UAT across several datasets, including MNIST, CIFAR-10, and a subset of ImageNet, against various OOD sets such as cross-dataset testing and Gaussian noise.
Separation of Uncertainty Distributions
A key indicator of OOD detection performance is the separation between the uncertainty distributions of in-distribution (ID) and OOD data. As shown in Figure 3, UAT (green) achieves a much wider separation in Mutual Information compared to Ordinary (blue) or Label Adversarial Training (LAT, red) methods.
Performance at Low False Positive Rates
The most significant gains are observed at strict FPR thresholds. While Ordinary ensembles often fail to distinguish noise from real data at low FPRs, UAT maintains high reliability. For example, on MNIST-trained models, UAT achieved a perfect $AUC_{FPR<1\%}$ of 1.00 on Gaussian noise, whereas the Ordinary ensemble performed near random (0.53).
Discussion and Limitations
UAT effectively breaks the typical trade-off between accuracy and robustness. While standard adversarial training often significantly degrades clean-label accuracy, UAT maintains accuracy within 2-7% of the baseline.
However, UAT does come with increased computational costs, as it requires calculating gradients of Mutual Information across the entire ensemble during training. Additionally, UFGSM is a first-order attack; future work could explore iterative attacks like Projected Gradient Descent (PGD) to create even more challenging uncertainty adversaries. Scaling UAT to full-scale foundation models also remains an open area for research.
Summary updated