Uncertainty Sets for Image Classifiers using Conformal Prediction

Anastasios Nikolas Angelopoulos, Stephen Bates, Michael Jordan, Jitendra Malik

Executive Summary

This paper introduces RAPS (Regularized Adaptive Prediction Sets), a method that allows any image classifier to output a set of possible labels instead of a single point prediction. Crucially, RAPS provides a mathematical, finite-sample guarantee that the true label will be in that set with a user-specified probability (e.g., 90%). It achieves this while keeping the set sizes significantly smaller and more stable than previous uncertainty quantification methods.

The Challenge of Uncertainty Quantification

When a deep learning model classifies an image, it typically outputs a "softmax" score—a list of numbers that resemble probabilities. However, these scores are notoriously unreliable, often exhibiting overconfidence and lacking formal statistical guarantees.

In high-stakes scenarios, such as medical diagnosis or autonomous driving, a single (potentially incorrect) guess is insufficient. Practitioners need to know the range of plausible outcomes to ensure critical possibilities are not ignored. The challenge lies in creating prediction sets that are:

  1. Guaranteed: They must contain the true label at a fixed, user-specified rate (e.g., 95% of the time).
  2. Small: A set containing every possible label is 100% accurate but practically useless. The goal is the smallest set possible that maintains the guarantee.
  3. Adaptive: The set should be small for "easy" or clear images and larger for "hard," ambiguous images.

Conformal Prediction and RAPS

The authors build upon a framework called Conformal Prediction, a wrapper technique that uses a small holdout dataset (calibration set) to determine a statistical threshold for the model's scores.

The paper introduces RAPS, which improves upon a baseline conformal method known as APS (Adaptive Prediction Sets).

  • The APS Baseline: APS constructs prediction sets by adding classes, starting from the highest probability down to the lowest, until a specific cumulative probability threshold is met.
  • The "Permutation Problem": The authors observed that for many images, models assign tiny, noisy probabilities to hundreds of irrelevant classes. In APS, these noisy "tail" probabilities can cause the prediction set to explode in size just to capture a marginal amount of extra confidence.
  • The RAPS Innovation: RAPS introduces a regularization term. It adds a penalty to classes that appear further down the list of predictions. This effectively "mutes" the noise in the tail, allowing the algorithm to satisfy the coverage guarantee using much smaller, more stable sets.

Experimental Setup

The researchers evaluated RAPS using standard benchmarks:

  • ImageNet: The gold-standard benchmark for image classification, featuring 1,000 classes.
  • ImageNet-V2: A separate test set designed to match the original ImageNet but collected later, used to test how models handle slight distribution shifts.

The method was tested across nine popular architectures, including ResNet-152, ResNeXt-101, and DenseNet-161. A major advantage of RAPS is its post-hoc power: it requires no retraining. A pre-trained model can be run through the RAPS calibration on a few thousand images to immediately gain formal safety guarantees.

Performance and Adaptiveness

The results demonstrate that RAPS offers a massive efficiency gain over naive calibration methods:

  • Massive Size Reduction: On ImageNet using a ResNeXt-101 model, a standard approach required an average set size of 17.1 to reach 90% coverage. RAPS achieved the same 90% guarantee with an average set size of only 2.0.
  • Robustness: Even on ImageNet-V2 (the shifted dataset), RAPS maintained its coverage guarantees, proving it is robust to real-world data variations.
  • Adaptiveness: RAPS correctly produces sets of size 1 for very clear images and larger sets for ambiguous images.
Examples of adaptive prediction sets generated by RAPS. Easy images yield single labels, while ambiguous images yield larger sets.

As shown above, a clear image of a squirrel results in a highly confident, single-label set. However, when the subject is partially obscured or visually similar to other classes (like a marmot), RAPS adaptively expands the prediction set to include other plausible labels, ensuring the true class is captured without overcommitting to a single incorrect guess.

Limitations and Future Directions

While RAPS significantly improves set stability, the coverage guarantee remains "marginal"—meaning it is accurate on average across the dataset, but specific subgroups of images might experience slightly worse coverage. Additionally, the method relies on a representative calibration dataset; if this data does not reflect the deployment environment, the guarantees may weaken.

Future work could explore using RAPS in cascaded systems, where a fast, lightweight model produces a prediction set, and a more expensive model (or human expert) is only queried if the resulting set size is too large.

Summary updated

BibTeX
@inproceedings{angelopoulos2021uncertainty,
  author = {Anastasios Nikolas Angelopoulos and Stephen Bates and Michael Jordan and Jitendra Malik},
  title = {{Uncertainty Sets for Image Classifiers using Conformal Prediction}},
  booktitle = {International Conference on Learning Representations},
  year = {2021},
  url = {https://openreview.net/forum?id=eNdiU_DbM9},
}
Figure