What is conformal prediction, and how would you use it to put a statistical guarantee on a classifier's or an LLM pipeline's outputs?
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
Conformal prediction wraps any trained model and turns its scores into prediction sets with a guaranteed coverage rate: for a chosen error level α, the set contains the true label at least 1 − α of the time, averaged over new examples. It assumes nothing about the model being correct or calibrated, only that calibration and test data are exchangeable (roughly, drawn from the same distribution).
Full worked answer with diagram
Conformal prediction wraps any trained model and turns its scores into prediction sets with a guaranteed coverage rate: for a chosen error level α, the set contains the true label at least 1 − α of the time, averaged over new examples. It assumes nothing about the model being correct or calibrated, only that calibration and test data are exchangeable (roughly, drawn from the same distribution).
Split conformal, the version you actually ship:
- Hold out a calibration set the model never trained on, a few hundred to a few thousand examples.
- Define a nonconformity score, for example 1 − p(true class) for a classifier, or |y − ŷ| for regression.
- Score every calibration example and take the ⌈(n+1)(1−α)⌉/n empirical quantile, q̂.
- At inference, keep every label whose score is at most q̂. For regression that gives the interval ŷ ± q̂.
The set size is the useful signal. An easy input gets a singleton, an ambiguous one gets several labels, an out-of-scope one gets a large set. That maps straight onto product decisions: act automatically on singletons, route large sets to a human or a stronger model. The same machinery applies to LLM pipelines, for example choosing a threshold on a verifier or judge score so that answers accepted without review meet a target error rate. Conformal risk control generalises the guarantee from miscoverage to other bounded losses.
What candidates get wrong: the guarantee is marginal, averaged over inputs, not per input. A model can over-cover easy cases and under-cover a hard subgroup. Class-conditional or group-conditional conformal fixes that at the cost of more calibration data per group. And exchangeability breaks under distribution shift, so refresh the calibration set from recent traffic and monitor realised coverage in production like any other metric.
Worth sketching. The quantile step is the whole method, and placing it between the frozen model and the routing decision shows it is a thin, model-agnostic wrapper.
flowchart LR
A["Trained model, frozen"] --> B["Score a held-out<br/>calibration set"]
B --> C["Nonconformity scores,<br/>e.g. 1 - p(true label)"]
C --> D["Take the 1 - alpha<br/>quantile, q_hat"]
D --> E["New input: keep every<br/>label scoring at most q_hat"]
E -->|"singleton"| F["Act automatically"]
E -->|"large set"| G["Route to a human<br/>or a stronger model"]
What a good answer covers
- Conformal prediction wraps any trained model and turns its scores into prediction sets with a guaranteed…
- It assumes nothing about the model being correct or calibrated, only that calibration and test data are…
- Hold out a calibration set the model never trained on, a few hundred to a few thousand examples
- Define a nonconformity score, for example 1 − p(true class) for a classifier, or |y − ŷ| for regression
- Score every calibration example and take the ⌈(n+1)(1−α)⌉/n empirical quantile, q̂
Key terms: prediction sets · exchangeable · marginal
In the glossary: Calibration · Judge (LLM-as-judge)
Interviewer follow-ups to expect
Why the (n+1) correction in the quantile?
How would you get coverage that holds per class rather than on average?
Traffic shifts after a product launch: what happens to coverage, and how would you detect it?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep