Undefined class-label detection vs out-of-distribution detection

Xi Wang, Laurence AitchisonarXiv 2021

Abstract

We introduce a new problem, that of undefined class-label (UCL) detection. For instance, if we try to classify an image of a radio as cat vs dog, there will be no well-defined class label. In contrast, in out-of-distribution (OOD) detection, we are interested in the related but different problem of identifying regions of the input space with little training data, which might result in poor classifier performance. This difference is critical: it is quite possible for there to be a region of the input space where little training data is available but where class-labels are well-defined. Likewise, there may be regions with lots of training data, but without well-defined class-labels (though in practice this would often be the result of a bug in the labelling pipeline). We note that certain methods originally intended to detect OOD inputs might actually be detecting UCL points and develop a method for training on UCL points based on a generative model of data-curation originally used to explain the cold posterior effect in Bayesian neural networks. This approach gives superior performance to past methods originally intended for OOD detection.

Introduction: Beyond "Out-of-Distribution"

In machine learning, the standard approach to handling unexpected inputs is Out-of-Distribution (OOD) detection. The goal is typically to identify inputs that reside in low-density regions of the training data distribution. However, this definition conflates two distinct issues: data scarcity and semantic validity.

Consider a classifier trained to distinguish cats from dogs. If presented with a Sphynx cat, the input may be OOD if no such breed was in the training set, yet the label "cat" remains perfectly well-defined. Conversely, if presented with a radio, there is no valid label among the choices. This latter case represents an Undefined Class-Label (UCL). As models improve in their ability to generalize to novel but semantically valid inputs, it becomes crucial to distinguish them from "nonsense" inputs that truly lack a sensible category.

Defining the Distinction

The core contribution of this work is formalizing the difference between OOD and UCL. As shown in Figure 3, these concepts can overlap or diverge in ways that standard OOD methods fail to capture.

Comparison of OOD and UCL scenarios using MNIST/EMNIST data. (A) illustrates well-defined OOD (hollow digits) vs. undefined OOD (letters) when training only on digits. (B) shows the case where labels can be undefined even for in-distribution data.

A region of the input space can have little training data but well-defined labels (Well-defined OOD), or it can have significant training data but lack clear labels (Undefined In-distribution), perhaps due to labeling errors or inherent ambiguity in the data curation process. This distinction is critical for deciding when a model should reject an input versus when it should attempt to generalize.

Methodology: A Generative Model of Data Curation

To detect UCL points, we propose a framework based on a generative model of how datasets are curated. We frame the problem through an "annotator thought experiment."

Imagine $S$ human annotators are tasked with labeling an image. If the image belongs to a well-defined class (e.g., a dog), all $S$ annotators are expected to agree on the label. If the image is "undefined" (e.g., a radio), annotators are forced to guess, leading to high disagreement.

Mathematically, we define the probability of a label $y$ as proportional to the likelihood that all $S$ annotators agree: $P(Y=y) \propto p_y^S$. The probability of an input being "Undefined" is then the probability that they do not all agree. Unlike previous models that treat $S$ as a fixed hyperparameter, our approach allows $S$ and a bias parameter $c$ (representing the base rate of UCL points) to be real-valued parameters optimized via gradient descent. This objective allows the model to learn the boundaries of meaningful data more effectively than standard OOD baselines.

Experimental Results

We evaluated our UCL detection method against the "Outlier Exposure" baseline across several standard datasets, including CIFAR-10, CIFAR-100, and SVHN. We used downsampled ImageNet (with labels removed) as a proxy for undefined training data.

The UCL method demonstrated significant improvements in detection performance:

  • CIFAR-10: AUROC improved from 92.00% to 94.49%, with detection error dropping from 23.03% to 13.23%.
  • CIFAR-100: AUROC increased from 81.10% to 83.44%.
  • SVHN: Achieved a near-perfect AUROC of 99.79%.

Qualitatively, toy experiments showed that the UCL model learns a "well-defined" region that extends far beyond the immediate clusters of training data. It effectively "trusts" its predictions on OOD points that still resemble the target classes while remaining robust in rejecting true nonsense.

Conclusion

Distinguishing between data scarcity (OOD) and semantic ambiguity (UCL) is vital for building robust classifiers. By modeling UCL detection as a problem of annotator agreement, we provide a principled probabilistic framework that outperforms traditional OOD methods. This approach not only improves rejection of invalid inputs but also allows models to better leverage their generalization capabilities on novel but valid data.

Summary updated

BibTeX
@misc{wang2021undefined,
  author = {Xi Wang and Laurence Aitchison},
  title = {{Undefined class-label detection vs out-of-distribution detection}},
  year = {2021},
  eprint = {2102.12959},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2102.12959},
}
Figure