- Introduced by
- Vovk, Gammerman & Shafer
- Year
- 2005
- Type
- Distribution-free uncertainty quantification framework
- Family
- Trustworthy ML
What does it do?
Conformal Prediction is a distribution-free framework for turning the output of any pre-trained model into statistically valid prediction sets (for classification) or prediction intervals (for regression).
Vovk, Gammerman and Shafer developed the framework, and their 2005 monograph gives it a systematic treatment. For split conformal prediction under exchangeability of calibration and test points, the true label falls inside the returned set with probability at least 1-α, averaged over the calibration and test draws and holding in finite samples, without parametric assumptions about the data distribution.
The intuition behind the method
Instead of reporting a single predicted value, a conformal predictor reports a range or set of plausible labels. It measures how unusual each held-out calibration example is relative to the model, using a nonconformity score. The threshold is taken from the calibration scores at the level dictated by α, and the new prediction set contains every candidate label that scores below that threshold. The base model can be any black box; the guarantee comes from how the threshold is calibrated, not from the model's correctness.
History
Conformal Prediction was developed by Vovk, Gammerman and Shafer, whose 2005 monograph Algorithmic Learning in a Random World sets out the framework systematically. The split (inductive) variant, which separates training from calibration, is the form described in the mechanics section. Later work extended the framework to conditional and risk-controlling guarantees, which appear among the method's aliases.
When to use it
Choose Conformal Prediction when you already have a trained model and need prediction sets or intervals with a finite-sample coverage guarantee, and you can hold out a calibration set drawn under the same conditions as the test data. It applies to both classification and regression. Do not rely on it when the test distribution is expected to differ from the calibration data (covariate or label shift), because the exchangeability assumption then fails. Also do not use it if you need coverage that holds for each subgroup or each individual input, since the standard guarantee is marginal. Bayesian credible intervals require distributional modelling, and quantile regression lacks a finite-sample guarantee unless it is wrapped conformally.
Limitations and considerations
- The guarantee is marginal, averaged over test inputs; it does not ensure equal coverage for each subgroup or each x.
- Validity depends on exchangeability; under covariate or label shift the nominal 1-α level is not guaranteed.
- When the base model is weak or α is very small, the threshold becomes large and the sets are wide or uninformative.
- A dedicated calibration split is needed, which reduces the data available for training the base model.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- The coverage guarantee is finite-sample and holds without a parametric model of the data, provided calibration and test points are exchangeable.
- The method wraps an already trained model without retraining it, so it can be added to an existing pipeline.
- At prediction time only the stored calibration quantile is needed to form the set, so inference cost is small.
- The nonconformity score is a design choice, so the same procedure can be applied to different output types as long as a score can be defined.
Applications
- Classification with set-valued outputs, where a prediction set that includes the true class with a stated probability is more useful than a single label (for example, in triage settings where a missed class is costly).
- Regression with prediction intervals for forecasting, where the interval must hold under a specified miscoverage level and the model is treated as a black box.
- Wrapping pre-trained deep networks with calibrated uncertainty, since the calibration step needs only forward passes over the calibration set.
- Decision support where the output must be a set of candidates that a human reviews, rather than a single automated decision.
How it works
How it works
A base model (any classifier, regressor or neural network) is trained on a dedicated training split. Conformal Prediction treats this model as a black box and does not change it. The informativeness of the resulting sets depends on how accurate the base model is, but the coverage guarantee does not depend on that accuracy.
Formula
\hat{f} \leftarrow \text{Train}(\{(x_i, y_i)\}_{i=1}^{n_{\text{train}}})On a calibration split that the base model did not see during training, a nonconformity score s_i is computed for each example. The formula in the mechanics section uses the absolute residual, which applies to regression. For classification, a common choice is the inverse predicted probability of the true class, s(x, y) = 1 − p̂(y | x), where p̂(y | x) is the model's predicted probability for class y; the quantile and set-construction steps are unchanged. Larger scores indicate examples that the model finds more surprising.
Formula
s_i = \|y_i - \hat{f}(x_i)\|, \quad i = 1, \dots, n_{\text{cal}}The corrected empirical (1-α) quantile of the calibration scores is computed, using the finite-sample adjustment ⌈(n_cal+1)(1-α)⌉/n_cal. Under exchangeability of calibration and test data, using this threshold gives coverage of at least 1-α on a new test point. If the adjusted level exceeds 1, the threshold is infinite and the set covers all candidate labels.
Formula
\hat{q} = \text{Quantile}\!\left(\{s_i\}_{i=1}^{n_{\text{cal}}};\ \frac{\lceil (n_{\text{cal}}+1)(1-\alpha) \rceil}{n_{\text{cal}}}\right)For a new input x_new, the prediction set collects every candidate label y whose nonconformity score does not exceed q̂. In regression this gives an interval of the form f̂(x_new) ± q̂ for the absolute-residual score. In classification it gives the set of classes whose score is within the threshold. The guarantee is marginal: it holds on average over test inputs, not for each input separately.
Formula
\mathcal{C}(x_{\text{new}}) = \{y : s(x_{\text{new}}, y) \leq \hat{q}\}Common pitfalls
- Using training data for calibration makes the scores optimistic and invalidates the coverage guarantee; a separate held-out calibration split is required.
- Reading marginal coverage as conditional coverage: a 1-α guarantee on average does not mean every subpopulation is covered at that level.
- Applying a predictor calibrated on historical data to a deployment population that has shifted, which breaks the exchangeability assumption behind the guarantee.
- Interpreting set size as a measure of model confidence without accounting for both base-model quality and the chosen α.
Frequently asked questions
Does Conformal Prediction require knowing the distribution of the data?
No. The marginal coverage guarantee depends on exchangeability of the calibration and test points, which is weaker than assuming they are independent and identically distributed. No parametric family needs to be specified, which is the basis of the 'distribution-free' label. This differs from Bayesian credible intervals and classical intervals that rely on a distributional form such as normality.
How does the calibration set size affect results?
A larger calibration set gives a more stable empirical quantile, which generally yields tighter sets. The finite-sample correction shifts the quantile level upward, so with a small calibration set the adjusted level can exceed 1; the threshold is then infinite and the method returns sets that cover all labels. Choosing the split therefore involves a trade-off between the data used for training the base model and the data used for calibration.
Can Conformal Prediction be applied to deep neural networks?
Yes. The framework is model-agnostic and does not modify the network. For classification the score is typically built from the model's predicted probabilities; for regression it is based on the point prediction. Calibration needs only a forward pass over the calibration set, so the added cost is modest relative to training.
Related methods
Sources
Vovk, V., Gammerman, A., & Shafer, G. (2005). Algorithmic Learning in a Random World. Springer.
ISBN: 978-0-387-00152-4