Active, anytime-valid risk controlling prediction sets

Ziyu Xu, Nikos Karampatziakis, Paul Mineiro

Introduction

Machine learning models deployed in high-stakes environments—such as medical image segmentation or filtering toxic outputs from Large Language Models (LLMs)—require rigorous safety guarantees. However, calibrating these models in real-time is expensive because it necessitates gathering ground-truth labels.

Recently, researchers introduced Risk Controlling Prediction Sets (RCPS) to provide statistical guarantees that a model won't exceed a certain level of risk. However, standard RCPS operates in a "batch" setting, requiring a large, pre-labeled calibration dataset before deployment. In the real world, data arrives sequentially in a stream, and ground-truth labels (like a doctor's diagnosis or a human's toxicity rating) are costly or time-consuming to acquire.

This paper extends RCPS to online, active-learning settings. It tackles two main challenges:

  1. Sequential updates: Continuously updating the model's safety calibration on the fly without violating statistical validity (overcoming the "multiple testing" problem).
  2. Active learning: Maintaining these guarantees while only paying to label a small, strategically chosen fraction of the incoming data.

Methodology: Active and Anytime-Valid RCPS

To solve these challenges, the authors combine RCPS with game-theoretic statistics, specifically utilizing e-processes and "testing by betting."

Flowchart of the active, anytime-valid risk control pipeline
  • Anytime-Valid Betting: Instead of traditional p-values, the system uses e-processes—a mathematical tool that treats hypothesis testing like a betting game. The system "bets" against the null hypothesis that the model is unsafe. If the model is safe, the system's virtual wealth grows. Thanks to the properties of martingales, this allows the system to continuously monitor and update the calibration parameter ($\beta$) at every single time step without inflating the false positive rate.
  • Active Sampling with Propensity Weighting: To conserve resources, a labeling policy decides whether to query a label for a new data point (flipping a coin with probability $q_t(X_t)$). To maintain unbiased mathematics despite selective sampling, the method uses inverse propensity weighting, scaling the impact of a labeled point by the inverse of its selection probability. Unqueried labels treat the risk as zero in the update step.
  • Variance Reduction via Prediction: To accelerate the betting process, the ML model's own predictions serve as a "control variate." By predicting the expected risk before seeing the true label, the variance of the risk estimate is drastically reduced. This allows the e-process wealth to grow faster, enabling the system to confidently shrink the prediction set using fewer labels.
  • Optimal Labeling Policies: The authors mathematically derive the "log-optimal" labeling policy. They prove that to maximize efficiency under a strict labeling budget, points should be sampled proportional to the conditional standard deviation of the risk. In short, the system labels the points where the model's risk estimate is most uncertain.

Experimental Validation

The framework was evaluated on both synthetic and real-world datasets:

  • Numerical Simulations: A synthetic dataset mimicking a pretrained classifier outputting probabilities, used to rigorously test false positive rate control.
  • ImageNet: A standard large-scale image classification benchmark where pretrained neural network classifiers were used to test the method's ability to control the miscoverage rate of the true class.

Key Results

  • Maintained Strict Safety: Across all experiments, the proposed methods successfully kept the safety violation rate below the target threshold ($\alpha = 0.05$) at all time steps.
  • High Label Efficiency: In both synthetic and ImageNet experiments, the active labeling strategies significantly outperformed baseline strategies like oblivious random sampling or even labeling all data.
  • Doing More with Less: With a labeling budget restricted to just 30% of the incoming data stream, the active methods converged to a tighter, more optimal calibration parameter ($\beta$) much faster than baselines. This proves that smart sampling combined with variance reduction yields higher utility for a fraction of the cost.

Key Insights and Future Directions

The core takeaway is that safety doesn't require labeling everything. You can maintain a rigorous, mathematically proven upper bound on a model's risk at all times, even if you only check the ground truth for a fraction of the data. Furthermore, uncertainty dictates value: focusing the budget on data points where the variance of the incurred risk is highest shrinks uncertainty bounds much faster. Finally, even a mediocre prediction of the expected risk from the model itself can be used as a control variate to speed up calibration without compromising safety.

Limitations: The current theoretical framework assumes the incoming data stream is independent and identically distributed (i.i.d.). It does not account for distribution shifts (e.g., covariate or label shift) that often occur in real-world deployments. Additionally, the mathematics require the labeling policy to have a strict lower bound, meaning the probability of labeling a point can never be exactly zero.

Future work aims to extend this framework to handle distribution shifts by incorporating empirical Bernstein supermartingales or adapting techniques from Adaptive Conformal Inference (ACI), as well as relaxing the bounded probability assumptions.

Summary updated

BibTeX
@inproceedings{xu2024active,
  author = {Ziyu Xu and Nikos Karampatziakis and Paul Mineiro},
  title = {{Active, anytime-valid risk controlling prediction sets}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=4ZH48aGD60},
}
Figure