Conformal prediction

On this page 7

Conformal prediction is a distribution-free framework that turns the output of any trained model into a prediction set or prediction interval that contains the true answer with a user-chosen probability, such as 90 percent. In model evaluation and in applied artificial intelligence, it is valued because the coverage guarantee holds in finite samples and requires only one assumption about the data: that calibration and test examples are exchangeable.

Instead of trusting a single point prediction or a softmax score, conformal prediction measures how unusual each candidate answer looks compared with held-out examples. The result is an honest statement of uncertainty: small sets when the model is confident and correct, larger sets when the input is hard or ambiguous.

How conformal prediction builds a prediction set

Conformal prediction builds a prediction set by comparing a nonconformity score for each candidate answer with the distribution of scores observed on a calibration set. The nonconformity score expresses how strange a pair of input and label looks to the model; a common choice for classification is one minus the predicted probability of the true class, and for regression it is the absolute residual.

The most widely used variant, split conformal prediction, follows a short recipe. The model is trained on one part of the data, scores are computed on a separate calibration part, and a threshold is taken as an adjusted quantile of those scores. At inference time, every label whose score falls below the threshold enters the set.

The following table lists the steps of the split procedure and what each step contributes.

StepActionPurpose
TrainFit any model on the training splitProvides the underlying predictor
ScoreCompute nonconformity scores on n calibration examplesMeasures typical model error
ThresholdTake the ceiling of (n+1)(1-alpha) divided by n quantileCorrects for finite sample size
PredictInclude every label or value scoring below the thresholdProduces the set or interval
Steps of split conformal prediction

The finite-sample correction of (n+1) instead of n is what makes the guarantee exact rather than asymptotic. With 1,000 calibration points and a target miscoverage alpha of 0.1, the threshold is the 901st smallest score.

The coverage guarantee and what it does not promise

The central property is marginal coverage: averaged over random draws of calibration and test data, the probability that the true label lies in the set is at least 1 minus alpha. Under continuous scores the coverage is also bounded above by 1 minus alpha plus 1/(n+1), so the method does not simply produce oversized sets.

Marginal coverage is frequently misread as conditional coverage, which would mean the guarantee holds for every individual input or every subgroup. Exact conditional coverage is impossible without further assumptions, so a model can meet 90 percent overall while covering a minority subgroup at only 75 percent.

The table below separates the guarantees that conformal prediction provides from those it does not.

Coverage typeGuaranteed by standard methodHow to approach it
Marginal coverageYes, in finite samplesDefault split procedure
Class-conditional coverageNoCalibrate separately per class (Mondrian)
Group-conditional coverageNoCalibrate per known subgroup
Input-conditional coverageNo, impossible in generalApproximate with adaptive scores
Types of coverage in conformal prediction

Main variants and score functions

Conformal prediction is a family of methods, and the choice of variant controls the balance between statistical efficiency and computational cost. Full conformal prediction refits the model for every candidate label and is exact but expensive; split conformal requires only one fit; cross-conformal and the jackknife+ reuse data more efficiently.

The score function decides how informative the sets are. Conformalized quantile regression produces intervals whose width adapts to local noise, while adaptive prediction sets for classification accumulate sorted probabilities so that harder inputs receive larger sets.

VariantModel fits requiredTypical use
Full conformalOne per candidate labelSmall datasets, simple models
Split conformalOneDeep learning, large datasets
Jackknife+ and CV+One per foldModerate data, tighter intervals
Conformalized quantile regressionOne quantile modelRegression with varying noise
Adaptive prediction setsOneMulti-class image or text classification
Common conformal prediction variants

How conformal prediction relates to calibration and other metrics

Conformal prediction complements, rather than replaces, model calibration. A calibrated classifier reports probabilities that match observed frequencies on average, as measured by the expected calibration error or a reliability diagram, but it gives no formal guarantee for a single prediction set. Conformal methods deliver that guarantee without requiring calibration, although better-calibrated models usually yield smaller sets.

Classic metrics such as accuracy, the F1 score or the Brier score summarize performance over a dataset. Conformal prediction instead evaluates uncertainty quantification with two numbers: empirical coverage on a test set and the average set size or interval width, which measures efficiency.

ApproachOutputFormal guarantee
Conformal predictionSet or intervalFinite-sample marginal coverage
Temperature scalingRecalibrated probabilitiesNone
Bayesian credible intervalsPosterior intervalOnly if the prior and model are correct
Bootstrap intervalsResampled intervalAsymptotic, often approximate
Conformal prediction compared with related approaches

Limitations and common mistakes

The guarantee depends entirely on exchangeability, so the most damaging failure is distribution shift between calibration and deployment data. Time series, seasonal drift or a new user population can silently push real coverage well below the target; weighted conformal and adaptive conformal inference were developed to handle such shifts.

  • Reusing training data for calibration shrinks the scores and breaks coverage.
  • Tiny calibration sets of under about 100 points make realized coverage highly variable.
  • Large sets signal a weak model, not a defect of the method itself.
  • Reporting only coverage hides inefficiency; average set size must accompany it.
  • Ignoring subgroups can conceal unequal coverage across classes or populations.

A plain-language summary

Most models give one answer, even when they are unsure. Conformal prediction makes them give a short list of answers instead. The list is built so that it contains the right answer at a chosen rate, for example nine times out of ten.

Think of a weather forecast that says the temperature will be between 18 and 23 degrees. A good forecaster widens the range on uncertain days. Conformal prediction does the same for a model. It looks at past mistakes on fresh examples and sets the width of the range from them. The main condition is that tomorrow must resemble the examples used for checking.

An example from practice

A hospital imaging team uses a deep neural network to classify skin lesion photographs into eight diagnostic categories. The network reaches 84 percent top-1 accuracy, but clinicians need to know when a single label is not reliable. The team holds out 2,000 labeled images for calibration and applies adaptive prediction sets with a target coverage of 95 percent.

On a separate test set of 3,000 images, the sets contain the correct diagnosis 95.3 percent of the time. About 70 percent of images receive a single label, while ambiguous cases receive two or three candidates. The workflow routes every image with a set of three or more labels to a senior dermatologist, which concentrates expert time on the hardest cases. When the clinic later adds a new camera model, the team recalibrates on fresh images before trusting the coverage figure again.