Conformalized Quantile Regression
Summary
CQR (Romano, Patterson & Candès, NeurIPS 2019) fits lower and upper conditional quantile functions on a training fold, then uses a calibration fold to compute a single additive correction that widens (or narrows) the plug-in band so that in finite samples for any distribution and any quantile learner. It inherits adaptivity to heteroscedasticity from quantile regression and distribution-free validity from conformal prediction. Across 11 benchmark datasets CQR intervals averaged length – versus – for locally adaptive conformal and – for standard split conformal, all at ~90% coverage.
Overview
Two desiderata for a prediction interval (Sec. 1): (i) valid coverage in finite samples without strong distributional assumptions; (ii) intervals as short as possible at each point of the input space, which under heteroscedasticity means lengths that track local variability.
- Standard split conformal with absolute residuals satisfies (i) but gives , of fixed length independent of . Lei et al. observe that full conformal bands also vary only slightly when the regression algorithm is moderately stable.
- Plain quantile regression satisfies (ii): estimate the 5% and 95% conditional quantiles and report . But validity “is guaranteed only for specific models, under certain regularity and asymptotic conditions”, and the authors’ experiments show quantile neural networks can substantially under-cover.
CQR conformalizes the quantile band. Where the econometric treatment in Quantile Regression (Koenker–Bassett) targets inference on coefficients of a linear quantile model, CQR is agnostic about the learner — quantile random forests, quantile neural nets, gradient boosting with pinball loss — and targets predictive coverage.
Main Content
Conditional quantile function and oracle interval ^def-cond-quantile
With , the -th conditional quantile is . For , , the oracle interval satisfies conditional coverage , and its length adapts to .
Pinball (check) loss ^def-pinball
Quantile regression solves with
At this is half the absolute error and targets the conditional median. Any learner can be converted to a quantile learner by swapping MSE for the pinball loss (A&B Sec. 2.2).
Split conformal quantile regression (Romano et al., Algorithm 1) ^alg-cqr
Input: data , level , quantile regression algorithm .
- Randomly split into disjoint (proper training) and (calibration).
- Fit .
- For compute the conformity score
- Let be the -th empirical quantile of .
- Output: .
Reading the score. is a signed distance to the nearest band edge. If is below the lower estimate, ; if above the upper, ; if inside, is the (negative) distance to the closer edge. The score therefore “accounts for both undercoverage and overcoverage”: when the plug-in band is too wide, most are negative, , and conformalization shrinks the band. This is one reason CQR beats un-conformalized quantile forests in the experiments despite using half the data for training.
CQR coverage (Romano et al., Theorem 1) ^thm-cqr
If , , are exchangeable, then the split-CQR interval satisfies
If moreover the scores are almost surely distinct,
Proof. . Conditional on the proper training set the scores are exchangeable, so the inflated-quantile lemma (quantile lemma) gives both bounds; take expectations over .
Asymmetric (two-tailed) CQR (Romano et al., Theorem 2) ^thm-cqr-asym
Calibrate the tails separately: let be the -th empirical quantile of and that of , and set . Under exchangeability each one-sided bound holds with probability and respectively, hence for .
The symmetric version lets miscoverage be “spread arbitrarily over the left and right tails”; the asymmetric version controls each tail, at the price of longer intervals (average length for CQR neural nets, for CQR random forests).
Practical guidance from the paper (Sec. 4, 6.2)
- Tune the nominal quantiles. Quantile forests are often too conservative, quantile nets occasionally so. Treat of the base learner as hyper-parameters chosen by cross-validation to minimise average interval length; “this tuning does not invalidate the coverage guarantee”. In the experiments CQR selected quantiles below the nominal level.
- Share parameters. Use one network with a two-dimensional output for the lower and upper quantiles instead of two networks.
- Quantile crossing () is rare for 5%/95% but can affect neural nets; a rearrangement post-processing step reduced CQR-NN length from to .
- Ties break the upper bound only: CQR random forests were over-conservative on the two Facebook datasets because of ties among scores.
- A full-conformal (no-split) variant exists (footnote 2).
Empirical results (Table 1; ; 11 datasets 20 splits = 2,200 experiments)
| Method | Avg. length | Avg. coverage (%) |
|---|---|---|
| Ridge (split conformal) | 3.06 | 90.03 |
| Ridge Local | 2.94 | 90.13 |
| Random Forests | 2.24 | 89.99 |
| Random Forests Local | 1.82 | 89.95 |
| Neural Net | 2.16 | 89.92 |
| Neural Net Local | 1.81 | 89.95 |
| CQR Random Forests | 1.41 | 90.33 |
| CQR Neural Net | 1.40 | 90.05 |
| Quantile Random Forests (no guarantee) | 2.23 | 92.62 |
| Quantile Neural Net (no guarantee) | 1.49 | 88.51 |
Responses were rescaled by their mean absolute value; 80/20 train-test, with the training portion halved into . Every conformal method attains ~90%; un-conformalized quantile nets under-cover (88.5%) and quantile forests over-cover (92.6%). CQR was shortest on 10 of 11 datasets. On the simulated heteroscedastic-with-outliers example (Figure 2): split 2.91, locally adaptive 2.86, CQR 1.99 average length.
Why locally adaptive conformal loses is discussed in Conformity Scores and Adaptive Prediction Sets: its is trained on optimistically biased training residuals.
Examples
import numpy as np
from sklearn.ensemble import GradientBoostingRegressor as GBR
def cqr(X_tr, y_tr, X_cal, y_cal, X_new, alpha=0.1):
lo = GBR(loss="quantile", alpha=alpha / 2).fit(X_tr, y_tr)
hi = GBR(loss="quantile", alpha=1 - alpha / 2).fit(X_tr, y_tr)
E = np.maximum(lo.predict(X_cal) - y_cal, y_cal - hi.predict(X_cal)) # signed scores
n = len(y_cal)
Q = np.quantile(E, min(1.0, (1 - alpha) * (1 + 1 / n)), method="higher")
return lo.predict(X_new) - Q, hi.predict(X_new) + Q # Q may be negativeApplied sketch. Weekly store-level sales forecasting with promotional covariates: variance scales with store size and spikes in promo weeks. A constant-width split-conformal band is too wide for small stores and too narrow for promo weeks of large ones, although it is 90% valid on average. CQR’s band widens where the fitted quantiles diverge. Two cautions: (a) stores-within-week may be treated as exchangeable, weeks-within-store generally not (see the drift result in Conformal Prediction - Overview); (b) if the scoring population differs from the calibration population, use the weighted variant in Conformal Prediction Under Covariate Shift.
Connections
- Quantile Regression — the classical estimator (check loss, QTEs) that CQR wraps; CQR supplies the finite-sample predictive guarantee the asymptotic theory lacks.
- Split Conformal Prediction and the Coverage Guarantee — the exchangeability lemma behind Theorem 1.
- Conformity Scores and Adaptive Prediction Sets — CQR versus scaled-residual and locally adaptive scores.
- Marginal vs Conditional Coverage — CQR’s guarantee is marginal, but it inherits asymptotic conditional coverage when the quantile learner is consistent.
- Conformal Inference for Counterfactuals and ITEs — Lei & Candès use weighted split-CQR as their workhorse.
- Conformal Prediction - Overview — placement in the cluster.
See Also
- Regression and the CEF — conditional-mean regression, the target that standard split conformal wraps.
- Model Selection and Overfitting — the training-residual bias that undermines locally adaptive scores is an overfitting phenomenon.
- Cross Validation Checking — CV is used inside CQR to tune nominal quantiles without touching the calibration fold.