Abstract
State-of-the-art Deep Neural Networks can be easily fooled into providing incorrect high-confidence predictions for images with small amounts of adversarial noise. Does this expose a flaw with deep neural networks, or do we simply need a better way to estimate confidence? In this paper we consider the problem of accurately estimating predictive confidence. We formulate this problem as that of density modelling, and show how traditional methods such as softmax produce poor estimates. To address this issue, we propose a novel confidence measure based on density modelling approaches. We test these measures on images distorted by blur, JPEG compression, random noise and adversarial noise. Experiments show that our confidence measure consistently shows reduced confidence scores in the presence of such distortions - a property which softmax often lacks.
Introduction
Standard Deep Neural Networks (DNNs) are notoriously overconfident, often assigning high probability scores to noisy or even nonsensical images. In modern computer vision, the softmax function is typically used at the final layer to produce a probability distribution. While effective for training, softmax is a poor measure of actual predictive confidence.
The authors identify a specific "pathology": because DNNs use monotonically increasing activation functions like ReLU, simply scaling up the magnitude of an input image often leads to higher softmax scores, even if the image hasn't become clearer. This makes networks vulnerable to adversarial attacks and causes them to remain dangerously confident when faced with blurred, noisy, or compressed images that should ideally be flagged as uncertain.
Methodology: Density Modelling for Confidence
The proposed approach moves away from the traditional "distance-from-hyperplane" logic of softmax and instead adopts a Density Modelling framework.
- Feature Extraction: The model analyzes the "pre-softmax" activations ($z$)—the raw outputs produced just before the final probability conversion.
- Class-Specific Densities: During training, the distribution of these features for each class is modeled using a multivariate Gaussian distribution with a diagonal covariance matrix.
- Bayesian Inference: At test time, Bayes' Rule is applied to calculate the probability that a feature vector $z$ belongs to a specific class based on these learned Gaussian densities.
- The High-Dimension Fix: To address the "Annulus Theorem" in high-dimensional spaces—where probability mass concentrates in a thin shell—the authors scale the covariance by the dimensionality ($d$). This ensures density values remain meaningful and discriminative.
Experimental Setup
The researchers evaluated their approach on two standard benchmarks:
- MNIST: Handwritten digit dataset using a LeNet-5 architecture.
- ImageNet (ILSVRC12): Large-scale image database using VGG-16 to test scalability to complex, real-world data.
Key Results and Discussion
A central finding is the "Softmax Magnitude Trap." The paper provides a formal proof (Lemma 3.1) showing that increasing an input's $L_2$ norm mathematically increases softmax confidence, tying it to feature scale rather than correctness. In contrast, a robust confidence measure should reflect proximity to the actual cluster of known data.
Robustness to Distortions
Unlike softmax, which often maintains high confidence even as an image is degraded by noise or blur, the density-based measure exhibits a monotonically decreasing profile.
As shown in the figures above, on MNIST, as Gaussian noise ($\sigma$) increased, the proposed measure's confidence dropped significantly, while softmax remained deceptively high. Similar trends were observed for Gaussian blurring. This behavior is crucial for safety-critical applications where a model must "know what it doesn't know."
Adversarial Robustness
The models were also tested against adversarial examples on the ImageNet validation set. Softmax "failed" (showed increased confidence for the wrong label) 5,795 times. The proposed density measure reduced these failures to 2,214, demonstrating a significant improvement in detecting anomalous adversarial inputs.
Conclusion
While diagonal Gaussian models are computationally efficient, they are relatively simple. The authors hypothesize that performance drops during extreme blurring or specific adversarial attacks may stem from the difficulty of accurate density estimation in high-dimensional spaces. Future work will explore more sophisticated density models, such as Gaussian Mixture Models, to better capture the intricate structure of data in the feature space and provide even more reliable uncertainty estimates.
Summary updated