PAC Prediction Sets Under Label Shift

Wenwen Si, Sangdon Park, Insup Lee, Edgar Dobriban, Osbert Bastani

In the high-stakes world of machine learning deployment—think medical diagnosis or autonomous robotics—knowing what a model doesn't know is just as important as its top prediction. Conformal prediction has emerged as a gold standard for this, offering "prediction sets" (a list of plausible labels) rather than a single guess, backed by rigorous statistical guarantees.

Standard prediction set on an X-ray image

However, there is a catch: these guarantees usually rely on the assumption that the future will look exactly like the past. When the distribution of data shifts, those guarantees often evaporate. A new paper from ICLR 2024, "PAC Prediction Sets Under Label Shift," introduces a clever way to maintain these safety guarantees even when the prevalence of different classes changes between training and deployment.

TL;DR

The authors present PS-W, a novel algorithm that provides Probably Approximately Correct (PAC) guarantees for prediction sets under "label shift." By propagating estimation uncertainty through a modified Gaussian elimination algorithm, they construct valid confidence intervals for importance weights, ensuring reliable uncertainty quantification even when class proportions change.

What Problem Does This Paper Address?

Standard conformal prediction provides a "coverage guarantee": there is a high probability (e.g., 90%) that the true label is contained within the predicted set. Most methods target PAC guarantees, which ensure this coverage holds with high probability over the randomness of the calibration data used to tune the model.

The "Achilles' heel" of these methods is distribution shift. The authors specifically tackle label shift, where the relationship between features and labels stays the same, but the frequency of the labels themselves changes. For example, during a pandemic, the symptoms of a cough (features) might remain the same, but the probability that a cough is caused by a specific virus (label) increases significantly.

Standard vs. Proposed Prediction Sets under Shift

Existing methods either ignore this shift (leading to under-coverage and "unsafe" models) or assume we know the exact "importance weights" needed to bridge the gap between the old and new distributions. In reality, we have to estimate these weights from data, and estimation error can break the mathematical guarantees.

Methods

The core of the paper is a transition from point estimates to interval estimates.

  1. Importance Weighting: To account for shift, the authors use the relationship $w^* = C_P^{-1} q^*$, where $C_P$ is a "confusion matrix" (how often the model confuses class A for class B) and $q^*$ is the distribution of predicted labels in the new environment.
  2. Interval Propagation: Since we only have samples, we don't know the true $C_P$ or $q^*$. The authors use Clopper-Pearson intervals to find the range of possible values for every entry in these matrices.
  3. Algorithmic Uncertainty: This is the "aha" moment. Instead of just calculating the weights, they developed Interval Gaussian Elimination. They take the intervals for $C_P$ and $q^*$ and propagate that uncertainty through every step of the Gaussian elimination process used to solve for the weights.
  4. Final Prediction: These weight intervals are then plugged into a modified conformal framework. By considering the "worst-case" valid weight within these intervals, the algorithm produces a prediction set that is guaranteed to meet the PAC requirement.

Datasets

The authors evaluated their approach across four diverse domains to prove its versatility:

  • CIFAR-10: A classic computer vision benchmark for object recognition.
  • ChestX-Ray: A medical imaging dataset where reliable uncertainty is a matter of patient safety.
  • CDC Heart Dataset: A tabular dataset used to predict heart attack risk.
  • AGNews: A text classification dataset for news categorization.

In each case, they simulated label shifts (e.g., making one class much more frequent) to test how well the algorithms adapted.

Key Insights and Results

  • Don't ignore the error in the error-correction: Most researchers use importance weights to fix distribution shift but treat those weights as perfect. This paper highlights that the uncertainty in the weights themselves is a primary source of failure for PAC guarantees.
  • Linear Algebra with Intervals: The idea of modifying a fundamental algorithm like Gaussian elimination to handle ranges instead of scalars is a powerful way to perform "algorithmic uncertainty propagation." It ensures that the final weights aren't just "best guesses" but are provably bounded.
  • Guarantees Met: In all experiments, the proposed PS-W algorithm was the only one (besides an overly conservative baseline) to consistently satisfy the PAC coverage guarantee across 100 independent trials.
  • Smaller Sets: Compared to the conservative PS-C baseline, PS-W produced significantly smaller prediction sets. In the AGNews dataset, for instance, PS-W maintained the required coverage while offering much higher precision.
  • Failure of Baselines: Standard conformal prediction (PS) and methods that account for shift but ignore weight uncertainty (PS-R) frequently failed to meet the required 90% coverage, sometimes dropping as low as 80%—a dangerous gap in a medical or safety-critical context.

Limitations and Future Work

The authors acknowledge that their method can be conservative if the calibration data is very limited or the label shift is extremely small. In these cases, the intervals for the weights become very wide, leading to larger prediction sets than might be strictly necessary.

Future research directions include improving performance when the calibration dataset is small, applying the "interval propagation" logic to other numerical methods (such as LU decomposition or iterative solvers), and extending the framework to handle more complex types of distribution shift beyond just label shift.

Summary updated

BibTeX
@inproceedings{si2024pac,
  author = {Wenwen Si and Sangdon Park and Insup Lee and Edgar Dobriban and Osbert Bastani},
  title = {{PAC Prediction Sets Under Label Shift}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=4vPVBh3fhz},
}
Figure