Foundations to Frontier
Tests
I. Probabilistic ML and Uncertainty Quantification › I5 Robustness to Distribution Shift

Selective prediction: knowing when to abstain

A model that may say "I don't know" can be far more reliable on the cases it does answer. Selective prediction pairs a predictor with a confidence score and a threshold. Inputs above the threshold are answered, the rest go to a human, a slower model or a safe default. The trade-off is drawn as a risk–coverage curve: the error rate among accepted inputs against the share accepted. This page covers Chow's optimal reject rule and the cost of abstaining, risk–coverage curves and their area (AURC), and confidence scores and how training can improve them (SelectiveNet, deep gamblers, learning to defer). It then covers choosing a threshold with a statistical guarantee on the risk of accepted inputs, as in selective classification with guaranteed risk and Learn-then-Test. In the exercises you implement the curves, Chow's rule and a Learn-then-Test threshold. Then you run 100 calibration draws per method on a simulated classifier with 12% error and a 5% risk target. A threshold set from the empirical risk exceeded the target on the test set in 55% of draws. Learn-then-Test with δ = 0.1 exceeded it in 3%, but with 1000 calibration points it could accept only 6.9% of inputs. With 10 000 points it accepted 33.7%, against 44.5% for the unreliable empirical threshold.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Answer only when sure

A doctor refers difficult cases to a specialist; an autopilot hands control back to the pilot when conditions are unusual. A model can do the same: answer when its confidence is high, pass the rest on. The more it passes on, the fewer mistakes it makes on what it keeps, as long as its confidence actually tracks its correctness. The question is where to set the cut-off. Too strict and the model is rarely useful; too loose and the error rate creeps above what was promised. The demo draws this trade-off as a curve for scores of different quality.

Calibration, conformal and shift lab
Risk (error rate among accepted, axis to 25%) against coverage, error rate 20% at full coverage. AURC 0.066; coverage at 5% risk 49%. A score with no information (quality 0) gives a flat curve.
Why engineers care

An autonomous landing system can let its vision model choose the touchdown point only when the predicted hazard map is confident, and otherwise fall back to a lidar scan or a hover-and-retry. The required error rate on accepted decisions comes from the safety case, so the threshold must be certified, not just tuned.

📝 Quick check (Level 0)
0/3 answered
  1. 1. Selective prediction lets a model…
  2. 2. Coverage is…
  3. 3. A useful confidence score must…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

By hand

  • Selective classifier: a pair (f, g) with g(x) = 1 if a confidence score κ(x) ≥ τ. Coverage φ = P(g = 1); selective risk R = P(error given g = 1).
  • Chow’s rule (1970): if an error costs 1 and abstaining costs c, the optimal decision accepts when P(correct given x) ≥ 1 − c. With calibrated probabilities the threshold is set by costs alone.
  • Risk–coverage curve: sort by κ, plot cumulative error rate against coverage. AURC (Geifman et al., 2019) is its area; E-AURC subtracts the oracle area. AURC depends on both the accuracy and the ranking quality of κ.
  • Scores: maximum softmax probability is a strong baseline (Geifman and El-Yaniv, 2017); ensembles and MC dropout often rank better; trained heads include SelectiveNet (2019), deep gamblers (2019) and learning to defer to an expert (Mozannar and Sontag, 2020). For LLMs, sampling consistency and verbalised confidence drive abstention.
  • Guaranteed risk: choose τ on calibration data so that P(R > r*) ≤ δ. Selective classification with guaranteed risk, SGR (Geifman and El-Yaniv, 2017), uses binomial bounds with a binary search. Learn-then-Test (Angelopoulos et al., 2021) tests each threshold as a hypothesis and uses fixed-sequence testing to control the family-wise error. Conformal risk control handles other monotone losses.
📝 Quick check (Level 1)
0/3 answered
  1. 1. Chow's rule accepts when P(correct) ≥…
  2. 2. AURC measures…
  3. 3. Learn-then-Test controls…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.

Curves, costs and certified thresholds

Exercise 1.

  • The risk–coverage curve and AURC, and the oracle AURC.
  • Chow’s accept rule.
  • A Hoeffding p-value and a fixed-sequence Learn-then-Test threshold.

Practice.

  • Plot risk–coverage curves for each candidate score on held-out data; compare AURC and the coverage at your target risk.
  • If costs are known and probabilities calibrated, use Chow’s rule; otherwise target a selective risk.
  • Certify the threshold on calibration data the model never saw. Exact binomial bounds are much tighter than Hoeffding when the target risk is small.
  • Budget enough calibration data: certifying a 5% risk needs at least 45 error-free accepted points at δ = 0.1, and realistically thousands.
  • Monitor coverage and selective risk in deployment; shift changes both.
import numpy as np
from scipy.stats import binom
order = np.argsort(-conf_cal); err = 1 - correct_cal[order]; cum = np.cumsum(err)
tau = np.inf
for cov in np.arange(0.10, 1.0001, 0.01):              # fixed sequence, fixed in advance
    k = int(round(cov * len(err)))
    if binom.cdf(cum[k - 1], k, target_risk) > delta:   # p-value for H0: risk >= target
        break
    tau = conf_cal[order][k - 1]
accept = conf_test >= tau                              # P(risk on accepted > target) <= delta
🐍 Exercise 1: risk–coverage, Chow and Learn-then-Test
Compute risk–coverage curves and AURC, apply Chow's rule, and choose a Learn-then-Test threshold with Hoeffding p-values.
📝 Quick check (Level 2)
0/3 answered
  1. 1. For small target risks, prefer…
  2. 2. The fixed sequence of thresholds must be…
  3. 3. After deployment, monitor…

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

Chow’s rule is optimal. For an input with P(correct) = p, accepting costs 1 − p in expectation and abstaining costs c. Accept exactly when 1 − p ≤ c, that is p ≥ 1 − c. Integrating over x shows that no other rule has lower expected cost. With an estimated score instead of p, the loss is the cost of the inputs it ranks on the wrong side.

Why a naive threshold fails half the time. Choosing the largest coverage whose calibration risk is at most r* places the threshold where the empirical risk just reaches r*. The true risk there is r* plus noise of order √(r*(1 − r*)/k), positive about half the time. More calibration data shrinks the excess but not the 50% chance of exceeding the target.

Fixed-sequence testing. Order the thresholds in advance from strict to loose, with hypotheses H_j: risk at threshold j ≥ r*. Test them in order at level δ and stop at the first failure. The family-wise error rate is at most δ without any Bonferroni correction: a wrong rejection needs the first true null in the sequence to be rejected, which has probability at most δ. The price is that an early failure stops the search, which is why small calibration sets lead to near-total abstention.

Certifying small risks is expensive. With zero errors among n accepted points, the binomial p-value is (1 − r*)^n, so at least ln δ / ln(1 − r*) points are needed: 45 for r* = 5% at δ = 0.1, and 299 for 1% at δ = 0.05.

📝 Quick check (Level 3)
0/3 answered
  1. 1. A naive empirical threshold exceeds the target about…
  2. 2. Fixed-sequence testing avoids…
  3. 3. Zero errors among n points gives p-value…

Level 4: Expert

★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.

How much do better scores help, and what does a guarantee on the accepted risk cost?

History.

  • C. K. Chow (1970) “On optimum recognition error and reject tradeoff”.
  • R. El-Yaniv and Y. Wiener (2010) foundations of selective classification; Y. Geifman and R. El-Yaniv (2017) SGR and (2019) SelectiveNet.
  • H. Mozannar and D. Sontag (2020) learning to defer; A. Angelopoulos, S. Bates, E. Candès, M. Jordan and L. Lei (2021) Learn-then-Test; A. Angelopoulos et al. (2024) conformal risk control.

Exercise 2. A simulated classifier.

  • Correctness: each input is correct with probability p ~ 0.5 + 0.5 Beta(3, 1), so the test error at full coverage is 0.121.
  • Scores: the true p; a good score p + N(0, 0.05²); a weak score p + N(0, 0.25²); a random score.
  • Thresholds: target risk 5%, δ = 0.1, threshold from the good score. A naive empirical threshold is compared with Learn-then-Test using exact binomial p-values over coverages 10%, 11%, …, 100%, with 1000 or 10 000 calibration points and 100 draws each. Test set: 20 000 points.
score AURC
oracle (errors last) 0.0077
true probability p 0.0496
good score 0.0600
weak score 0.0939
random 0.1195
Chow’s rule, expected cost accept all true p good score
abstain cost 0.05 0.1213 0.0430 0.0476
abstain cost 0.15 0.1213 0.0932 0.0966
threshold rule (target 5%) calibration points draws above target on test mean coverage mean test risk
naive empirical 1000 55% 0.445 0.0523
Learn-then-Test 1000 3% 0.069 0.0105
naive empirical 10 000 44% 0.413 0.0496
Learn-then-Test 10 000 8% 0.337 0.0443
  • Score quality mattered. The random score’s AURC equals the base error; the weak score removed less than half the gap to the true probability. Even the true probability is far from the oracle, because correct and wrong answers share the same p.
  • Chow’s rule cut expected cost by 65% when abstaining was cheap (0.121 → 0.043). The good score lost little against the true probability.
  • The naive threshold was a coin flip: it exceeded 5% in 55% of draws, and still 44% with ten times more data.
  • The guarantee held but was expensive. Learn-then-Test stayed within δ = 0.1, but with 1000 points it mostly abstained (coverage 6.9%), because the early, small-coverage tests rarely pass. With 10 000 points it kept 33.7% of inputs at a test risk of 4.4%.
  • Seeds 1 and 2: naive violation rates 48% and 57% (n = 1000); LTT coverage 0.049 and 0.059 (n = 1000) and 0.341 and 0.333 (n = 10 000) with violation rates 1% and 0%; good-score AURC 0.0590 and 0.0602.
🐍 Exercise 2 (research): how much do better scores help, and what does a guarantee on the accepted risk cost?
Compare risk–coverage curves of confidence scores of different quality, apply Chow's rule, and compare naive and Learn-then-Test thresholds for a 5% risk target over many calibration draws.

Selective prediction in AI, robotics and aerospace

  • Human–machine teaming: triage systems in medicine and satellite-image analysis send low-confidence cases to analysts with a certified error rate on the rest.
  • Autonomy: a perception module that abstains triggers a fallback (slower sensor, safe stop); the abstention rate becomes a design parameter in the safety case.
  • LLM assistants: abstaining or retrieving more context when sampled answers disagree; conformal abstention gives guarantees on hallucination rates for accepted answers.

References

  1. C. K. Chow (1970). “On optimum recognition error and reject tradeoff.” IEEE Trans. Information Theory.
  2. Y. Geifman and R. El-Yaniv (2017). “Selective classification for deep neural networks.” NeurIPS.
  3. Y. Geifman and R. El-Yaniv (2019). “SelectiveNet: a deep neural network with an integrated reject option.” ICML.
  4. H. Mozannar and D. Sontag (2020). “Consistent estimators for learning to defer to an expert.” ICML.
  5. A. Angelopoulos, S. Bates, E. Candès, M. I. Jordan and L. Lei (2021). “Learn then Test: calibrating predictive algorithms to achieve risk control.” arXiv.