Know Your Limits: Monotonicity & Softmax Make Neural Classifiers Overconfident on OOD Data

Dennis Ulmer, Giovanni Cinà

Abstract

A crucial requirement for reliable deployment of deep learning models for safety-critical applications is the ability to identify out-of-distribution (OOD) data points, samples which differ from the training data and on which a model might underperform. Previous work has attempted to tackle this problem using uncertainty estimation techniques. However, there is empirical evidence that a large family of these techniques do not detect OOD reliably in classification tasks. This paper gives a theoretical explanation for said experimental findings and illustrates it on synthetic data. We prove that such techniques are not able to reliably identify OOD samples in a classification setting, since their level of confidence is generalized to unseen areas of the feature space. This result stems from the interplay between the representation of ReLU networks as piece-wise affine transformations, the saturating nature of activation functions like softmax, and the most widely-used uncertainty metrics.

TL;DR

ReLU-based neural classifiers, even when paired with popular uncertainty estimation techniques like MC Dropout or Ensembling, are theoretically prone to overconfidence on out-of-distribution (OOD) data. This paper proves that these models converge to a fixed, often dangerously high, level of certainty as inputs move further away from the training distribution, making reliable OOD detection fundamentally difficult for a large class of current architectures.

What Problem Does This Paper Address?

Deep learning models are notoriously "overconfident" when they encounter data that looks nothing like their training set. In safety-critical fields like healthcare or autonomous driving, a model needs to "know when it doesn't know"—a task called Out-of-Distribution (OOD) detection.

While researchers have developed various post-hoc uncertainty metrics (like predictive entropy or variance across an ensemble) to flag these samples, empirical evidence suggests they often fail. This paper provides a rigorous theoretical explanation for why these failures occur. The authors identify a structural "trap" created by the interplay between the linear nature of ReLU activations, the saturating behavior of the softmax function, and the mathematical definitions of common uncertainty metrics.

Methods

The authors approach the problem by analyzing the asymptotic behavior of ReLU networks. They leverage the fact that a ReLU network partitions the input space into a finite set of convex regions called polytopes. Within each polytope, the network behaves as a simple affine (linear) transformation.

Polytopal linear regions induced by a ReLU classifier. Far from the data, these regions become 'partially unbounded polytopes' (PUPs).

The core of their method involves:

  1. Linearization: Re-writing the network as a piece-wise affine function $f_\theta(x) = V(x)x + a(x)$.
  2. Asymptotic Analysis: Studying what happens to the network's output and uncertainty scores as the input $x$ is scaled toward infinity in at least one dimension.
  3. Theoretical Proofs: Deriving "Theorem 1," which shows that for four widely used uncertainty metrics, the scores converge to a constant value in the limit.

Key Insights and Ideas

  • The PUP Trap: Far away from the training data, inputs eventually land in "Partially Unbounded Polytopes" (PUPs). Because the network is linear here, the "logits" (pre-softmax outputs) grow linearly toward infinity.
  • Softmax Saturation: As logits grow, the softmax function "saturates," pushing the probability of one class to 1.0 and others to 0.0. This creates vast open-ended regions of stable, high confidence.
  • Vanishing Gradients of Uncertainty: The authors prove that the gradient of the uncertainty score with respect to the input approaches zero far from the data. This means the model's "certainty" becomes static and uninformative.
  • Metric Convergence: Crucially, this isn't just a problem for the "max softmax" probability. The paper proves that Class Variance, Predictive Entropy, and Mutual Information all converge to fixed constants in the limit. If a model is certain in one direction, it stays certain forever in that direction.

Key Results

The primary result is Theorem 1, which formally states that for any ReLU network, the four major uncertainty metrics will converge to fixed scores for OOD samples in the limit.

Empirically, the authors show this on the half-moon dataset. While some methods like Anchored Ensembles show more "fuzziness" and better local OOD detection than standard ensembles, they still eventually succumb to regions of static certainty.

Uncertainty surfaces on the half-moon dataset. Note the 'tubes' of high uncertainty along decision boundaries, but vast regions of high confidence elsewhere.

Limitations and Future Work

  • Continuous vs. Discrete: The "limit" reasoning relies on continuous variables. The authors note that more work is needed to understand these phenomena in models using discrete features.
  • Activation Functions: The proofs are specific to piece-wise linear activations like ReLU. While the authors suspect similar behavior in "smooth" versions like GELU, this remains an open question.
  • Path Forward: The results suggest that simply averaging predictions (ensembling) or using dropout isn't enough to fix the fundamental geometry of ReLU networks. The authors point toward density-based approaches, Dirichlet-based models, or distance-aware architectures as more promising avenues for reliable OOD detection.

Summary updated

BibTeX
@inproceedings{ulmer2021know,
  author = {Dennis Ulmer and Giovanni Cinà},
  title = {{Know Your Limits: Monotonicity \& Softmax Make Neural Classifiers Overconfident on OOD Data}},
  booktitle = {Conference on Uncertainty in Artificial Intelligence},
  year = {2021},
  url = {https://openreview.net/forum?id=qgm05nUYHoP},
}
Figure