Revisiting One-vs-All Classifiers for Predictive Uncertainty and Out-of-Distribution Detection in Neural Networks

Shreyas Padhy, Zachary Nado, Jie Ren, Jeremiah Z. Liu, Jasper Snoek, Balaji LakshminarayananarXiv 2020

Abstract

Accurate estimation of predictive uncertainty in modern neural networks is critical to achieve well calibrated predictions and detect out-of-distribution (OOD) inputs. The most promising approaches have been predominantly focused on improving model uncertainty (e.g. deep ensembles and Bayesian neural networks) and post-processing techniques for OOD detection (e.g. ODIN and Mahalanobis distance). However, there has been relatively little investigation into how the parametrization of the probabilities in discriminative classifiers affects the uncertainty estimates, and the dominant method, softmax cross-entropy, results in misleadingly high confidences on OOD data and under covariate shift. We investigate alternative ways of formulating probabilities using (1) a one-vs-all formulation to capture the notion of "none of the above", and (2) a distance-based logit representation to encode uncertainty as a function of distance to the training manifold. We show that one-vs-all formulations can improve calibration on image classification tasks, while matching the predictive performance of softmax without incurring any additional training or test-time complexity.

Introduction

Modern deep learning models are notoriously overconfident, often assigning high probabilities to inputs they have never encountered during training. This lack of reliable uncertainty estimation is a significant hurdle for deploying neural networks in high-stakes domains like healthcare or autonomous driving. A primary driver of this issue is the standard softmax cross-entropy loss. Softmax operates under a "closed-world" assumption, requiring class probabilities to sum to one. Consequently, when presented with an out-of-distribution (OOD) input, the model is forced to distribute probability among known classes, often leading to high confidence in the "least unlikely" class.

While complex solutions like Deep Ensembles or Bayesian Neural Networks offer improvements, they often come with prohibitive computational costs. This work explores simpler architectural modifications to the final layer—specifically One-vs-All (OvA) formulations and distance-based logits—to improve calibration and OOD detection without increasing test-time latency.

Methodology

The proposed approach involves two key modifications to the final layer of a standard discriminative classifier:

  1. One-vs-All (OvA) Normalization: Instead of a single softmax over $K$ classes, the problem is decomposed into $K$ independent binary classification tasks. Each class is assigned a sigmoid output, allowing the model to represent a "none of the above" state when all class probabilities are low.
  2. Distance-based Logits: Standard affine transformations ($w^T f(x) + b$) are replaced with negative Euclidean distances between the input embedding and learned class prototypes ($z_j = -||f_\theta(x) - w_j||$).
  3. One-vs-All Distance Maximization (OvADM): This hybrid approach combines both techniques. Confidence is determined by proximity to a class center in the embedding space, while independent sigmoids ensure that inputs far from all centers result in low confidence across all classes.

Confidence Landscapes

A key insight of this work is how these formulations affect the "confidence landscape" of the model. In 2D toy examples, standard softmax creates infinite regions of high confidence extending away from the training data. In contrast, the distance-based OvA approach creates "islands" of high confidence centered strictly on the training manifold.

Comparison of confidence landscapes between Softmax and One-vs-all Distance-based (OvADM) formulations on a 2D toy dataset.

Experimental Evaluation

The effectiveness of these methods was evaluated across several benchmarks:

  • Image Classification: CIFAR-10, CIFAR-100, and ImageNet.
  • Robustness and Dataset Shift: Evaluated using corrupted versions of these datasets (CIFAR-10-C, CIFAR-100-C, ImageNet-C) featuring noise and blur.
  • OOD Detection: Using SVHN as unseen data for CIFAR-trained models.
  • Natural Language Processing: The CLINC intent classification dataset, which includes explicit "out-of-scope" queries.

Key Results

The experiments yielded several significant findings:

  • Improved Calibration: OvA-based methods consistently achieved lower Expected Calibration Error (ECE) compared to softmax, particularly as dataset shift (corruption intensity) increased. This suggests that OvA models are more "honest" about their uncertainty when faced with unfamiliar data.
  • Maintained Predictive Accuracy: Crucially, switching to an OvA formulation did not degrade top-1 accuracy. The models remained as performant as their softmax counterparts while providing better uncertainty estimates.
  • NLP Robustness: On the CLINC dataset, the OvADM model demonstrated superior robustness to OOD inputs compared to the standard softmax baseline.
  • Computational Efficiency: Unlike ensemble methods, these improvements are achieved without any additional memory overhead or test-time latency.
Expected Calibration Error (ECE) across different shift intensities, comparing standard cross-entropy with the proposed One-vs-all and distance-based losses.

Conclusion and Future Work

This research demonstrates that revisiting the fundamental parametrization of probabilities in neural networks can yield significant gains in predictive uncertainty. By moving from the relative comparisons of softmax to the absolute assessments of One-vs-All distance-based classifiers, models can better identify when they are operating outside their training manifold.

Despite these advantages, the authors noted that OvADM can perform poorly on traditional scalar OOD metrics like AUROC. This occurs because it assigns low confidence to both OOD points and misclassified in-distribution points, creating overlap that scalar metrics struggle to resolve. Future work will focus on scaling distance-based losses to massive datasets like ImageNet, where gradient imbalance in mini-batches currently poses a challenge.

Summary updated

BibTeX
@misc{padhy2020revisiting,
  author = {Shreyas Padhy and Zachary Nado and Jie Ren and Jeremiah Z. Liu and Jasper Snoek and Balaji Lakshminarayanan},
  title = {{Revisiting One-vs-All Classifiers for Predictive Uncertainty and Out-of-Distribution Detection in Neural Networks}},
  year = {2020},
  eprint = {2007.05134},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2007.05134},
}
Figure