This is a study of the engine’s conformal numerics on tier 04’s live predictions. It carries two payloads:
A measured tour of the score families — APS, RAPS, LAC for the subject-classification sets; the absolute-residual interval and CQR for the year-regression intervals. Every coverage and size is measured here, and each finding ends in the claim it makes.
The score-aligned weighted restore — the keystone (tier 04) showed that on the real ogbn-arxiv time-split, importance-weighting is a no-op for the subject sets, because the shift is nearly orthogonal to their conformal score. Here we demonstrate the complement: a transparently-synthetic, clearly-labelled covariate shift that moves the score distribution, on which weighted split-conformal (Tibshirani et al. 2019)genuinely restores coverage to nominal. The two results are the two halves of one thesis: weighted conformal repairs a shift if and only if the shift moves the nonconformity-score distribution.
First, tier 04’s substrate — the subject classifier’s scores and the year predictor’s served distributions over the calibration (2018) and test (2019–) eras:
2026-10-03T07:42:24.356241Z WARN jammi_kernels::admission: fused-kernel domain check failed; falling back to the eager composition op="attention_block_fused" predicate="head_dim_is_attention_block_fixed_head_dim"
target coverage 1 − α = 0.90
58.1 Part A — the classification scores: LAC, APS, RAPS
The classification task is subject prediction; the predictor is the tier-04 nearest-neighbour vote on the propagated (citation-graph conditioned) embeddings — a paper’s class scores are the similarity-weighted subjects of its nearest training-era papers. We form prediction sets with each nonconformity family.
The three families differ only in the nonconformity they rank by:
LAC (least-ambiguous set classifier) — score is \(1 - \hat p_y\); the smallest sets at exact nominal calibration but the least adaptive (Romano, Sesia, and Candès 2020).
APS (adaptive prediction sets) — score is the cumulative softmax mass up to the true class; adaptive, with conditional-coverage behaviour (Romano, Sesia, and Candès 2020).
RAPS (regularized APS) — APS with a rank-penalty \((\lambda, k_{\text{reg}})\) that discourages long tails (Angelopoulos et al. 2021).
def coverage_size(sets): cov =float(np.mean([y in s for y, s inzip(test_labels, sets)])) size =float(np.mean([len(s) for s in sets]))return cov, sizelac_sets = db.conformalize(cal_scores, cal_labels, test_scores, alpha=alpha, score="lac")aps_sets = db.conformalize(cal_scores, cal_labels, test_scores, alpha=alpha, score="aps")# RAPS takes raps_params = (lambda, k_reg): the penalty weight and the 1-based rank# past which it bites.raps_sets = db.conformalize( cal_scores, cal_labels, test_scores, alpha=alpha, score="raps", raps_params=(0.1, 1))lac_cov, lac_size = coverage_size(lac_sets)aps_cov, aps_size = coverage_size(aps_sets)raps_cov, raps_size = coverage_size(raps_sets)print(f"LAC : coverage {lac_cov:.3f} mean set size {lac_size:.2f}")print(f"APS : coverage {aps_cov:.3f} mean set size {aps_size:.2f}")print(f"RAPS: coverage {raps_cov:.3f} mean set size {raps_size:.2f}")
LAC : coverage 0.906 mean set size 1.82
APS : coverage 0.958 mean set size 3.04
RAPS: coverage 0.958 mean set size 2.88
band = shift.binomial_band(alpha, len(test_labels))claim("every family covers to within three binomial standard errors of nominal",all(abs(c - (1- alpha)) < band for c in (lac_cov, aps_cov, raps_cov)),f"LAC {lac_cov:.3f}, APS {aps_cov:.3f}, RAPS {raps_cov:.3f}; nominal {1- alpha:.2f} ± {band:.3f}")claim("and their sets order LAC < RAPS < APS in size", lac_size < raps_size < aps_size,f"{lac_size:.2f} < {raps_size:.2f} < {aps_size:.2f}")
✓ every family covers to within three binomial standard errors of nominal (LAC 0.906, APS 0.958, RAPS 0.958; nominal 0.90 ± 0.092)
✓ and their sets order LAC < RAPS < APS in size (1.82 < 2.88 < 3.04)
Two facts, measured at full scale. First, every family holds its coverage across the time split: each lands within sampling error of the nominal 0.90 — a binomial standard error on the test era is about 0.01, and no family sits more than a little over one of them away. The later-era papers are not exchangeable with the calibration era in general, but the guarantee needs less than that: it needs the nonconformity score’s distribution to carry over, and here it does. The keystone (tier 04) measures why — the score barely correlates with how test-era-like a calibration paper is.
Second, LAC gives the smallest sets. LAC scores a class by its own probability, \(1-\hat p_y\), so it admits only the classes the model is confident in; APS scores by the cumulative mass up to the true class, so a set grows to cover the mass ranked above it, and it admits more classes for about the same coverage. That is APS’s trade: its sets adapt to how hard each paper is, rather than being the smallest on average.
RAPS sits between them. The rank penalty \((\lambda, k_{\text{reg}})\) taxes every class admitted past rank \(k_{\text{reg}}\), trimming APS’s longest sets — and with them some of the slack APS carries above nominal. How much it trims depends on how long the APS sets run relative to the penalty rank — the cell above prints all three, so you can see it at the scale you ran.
58.2 Part B — the regression intervals: absolute-residual and CQR
The regression task is paper-year prediction; the Gaussian context predictor serves a mean and a standard deviation per paper. Two interval constructions:
Absolute-residual (conformalize_interval) — calibrate \(|y - \hat\mu|\) on the calibration era, apply the quantile symmetrically. A constant-width band.
CQR (conformalize_cqr) — calibrate the conformity of the predictor’s own \([\hat\mu - \hat\sigma,\ \hat\mu + \hat\sigma]\) band, so the interval inherits the predictor’s heteroscedastic width (Romano, Patterson, and Candès 2019).
year = { r["paper_id"]: r["year"]for r in db.sql(f"SELECT paper_id, year FROM {arxiv.papers}.public.{arxiv.papers}").to_pylist()}cal_ids, test_ids = arxiv.split["valid"], arxiv.split["test"]cal_mean, cal_sd = (a.tolist() for a in keystone.predict_years(db, arxiv, predictor, cal_ids))test_mean, test_sd = (a.tolist() for a in keystone.predict_years(db, arxiv, predictor, test_ids))cal_year = [float(year[k]) for k in cal_ids]test_year = [year[k] for k in test_ids]# Absolute-residual interval.iv = db.conformalize_interval(cal_mean, cal_year, test_mean, alpha=alpha)iv_cov =float(np.mean([lo <= test_year[i] <= hi for i, (lo, hi) inenumerate(iv)]))iv_width =float(np.mean([hi - lo for lo, hi in iv]))# CQR over the predictor's ±1σ band (the band CQR conformalizes).cal_lo = [m - s for m, s inzip(cal_mean, cal_sd)]cal_hi = [m + s for m, s inzip(cal_mean, cal_sd)]test_lo = [m - s for m, s inzip(test_mean, test_sd)]test_hi = [m + s for m, s inzip(test_mean, test_sd)]cqr = db.conformalize_cqr(cal_lo, cal_hi, cal_year, test_lo, test_hi, alpha=alpha)cqr_cov =float(np.mean([lo <= test_year[i] <= hi for i, (lo, hi) inenumerate(cqr)]))cqr_width =float(np.mean([hi - lo for lo, hi in cqr]))print(f"abs-residual interval: coverage {iv_cov:.3f} width {iv_width:.2f} years")print(f"CQR interval: coverage {cqr_cov:.3f} width {cqr_width:.2f} years")
abs-residual interval: coverage 0.938 width 3.88 years
CQR interval: coverage 0.948 width 4.09 years
if SCALE is scale.Scale.FULL: claim("both intervals under-cover under the time split; CQR recovers a little more, ""still far short of nominal", iv_cov < cqr_cov <1- alpha -0.1,f"{iv_cov:.3f} < {cqr_cov:.3f}, nominal {1- alpha:.2f}")
At full scale both intervals under-cover under the time split — unlike the classification sets, which hold. CQR’s interval scales with the predictor’s own \(\hat\sigma\) rather than imposing one constant half-width; here the predictor serves nearly the same \(\hat\sigma\) for every paper, so the two bands are about as wide, and CQR recovers only a little more coverage. The keystone (tier 04) carries the why: the test era’s residuals run about one and a half times the calibration era’s. Residual size does track test-era likeness within the calibration set, so importance-reweighting widens the interval a little — but the weights only redistribute mass over residuals the calibration era already has, and it has too few of the test era’s size to reach nominal.
58.3 Part C — the score-aligned weighted restore (the keystone’s complement)
Here is the genuinely novel payoff of this chapter. The keystone showed that on the real ogbn-arxiv time-split, importance-weighted conformal (Tibshirani et al. 2019) is a no-op for the subject sets, with the diagnostic that the shift is nearly orthogonal to their conformal score: corr(nonconformity, test-likeness) is near zero. The lesson there was the negative one — weighting cannot move a quantile along a shift the score cannot see.
This is the complement, and we are explicit about its status:
This shift is a constructed teaching device
The covariate shift in this section is transparently synthetic and deliberately constructed. It is not a property of the real ogbn-arxiv time-split, and we make no claim that the real time-split is repairable by weighting — it is not (the keystone shows the orthogonal-shift no-op for the subject sets, and a year-interval shift that reaches past what the calibration era’s residuals can cover). The purpose here is to exhibit the other half of the theorem: the case where the shift does move the nonconformity-score distribution, so that the weighted restore is real. We label it as a device precisely so the two halves stay honest.
The construction. We take only the genuinely-exchangeable calibration-era pool and split it 50/50 into a synthetic test holdout and a calibration pool — so the base data is exchangeable and the only shift is the one we inject. The shift runs along a real covariate: a nearest-neighbour regression of the APS nonconformity on the paper’s neighbourhood — the mean nonconformity of its nearest calibration-era papers, one query-by-example search each. It is a genuine feature of each paper’s position in the embedding space that correlates with the score (by construction of the regression).
nc = shift.aps_nonconformity(scores.cal_scores, scores.cal_labels)# A REAL covariate axis along which the score varies: each paper's neighbours' mean# nonconformity. (This is the transparently-synthetic part — we regress onto the# score, on purpose.)nc_of =dict(zip(scores.cal_keys, nc))shift_axis = np.array([ np.mean([nc_of[n["paper_id"]] for n in keystone.neighbours( db, arxiv, propagated, key, f"year = {datasets.VALID_YEAR}", 10)])for key in scores.cal_keys])shift_axis = (shift_axis - shift_axis.mean()) / shift_axis.std()shift_corr =float(np.corrcoef(nc, shift_axis)[0, 1])print(f"corr(nonconformity, shift feature): {shift_corr:+.3f}")
corr(nonconformity, shift feature): +0.378
claim("the synthetic shift aligns with the nonconformity score", shift_corr >0.3,f"correlation {shift_corr:+.3f}")
✓ the synthetic shift aligns with the nonconformity score (correlation +0.378)
The diagnostic that distinguishes this from the keystone: the nonconformity correlates clearly and positively with the shift feature — the inverse of the keystone’s ≈ 0. That is what lets a shift along this axis move the score distribution.
The biased calibration set keeps each pool paper independently, with probability \(\pi(s) = 1/(1 + e^{\gamma s})\) — likelier the lower its shift feature \(s\), so the calibration set leans toward easy (low-nonconformity) papers, and about half the pool survives. Because each paper’s inclusion is its own coin, the calibration density is exactly the pool’s times \(\pi(s)\), and the test-to-calibration likelihood ratio is exactly \(1/\pi(s) = 1 + e^{\gamma s}\) — the weights are known, not estimated, so any failure to restore would be the method’s, not an estimator’s.
Weighted split-conformal (Tibshirani et al. 2019) takes, for each test paper, the quantile of the calibration nonconformity where calibration paper \(i\) holds mass \(w_i / (\sum_j w_j + w_{\text{test}})\) and the test paper’s own weight sits at \(+\infty\); with every weight one, that is exactly the marginal \(\lceil (n+1)(1-\alpha) \rceil\)-th smallest. shift.score_coverage is that one routine, so the two passes differ only in the weights. Its guarantee is in expectation over the calibration draw, and one draw of a few hundred papers swings coverage by several points either way — so we measure both passes over many draws, the way the theorem states them.
# gamma is the shift strength; every draw is a fresh 50/50 split and a fresh# biased calibration set, seeded so the book reproduces.GAMMA, DRAWS =3.0, 200rng = np.random.default_rng(0)def draw(): order = rng.permutation(len(nc)) test_idx, pool_idx = order[: len(nc) //2], order[len(nc) //2 :] kept = rng.random(len(pool_idx)) <1/ (1+ np.exp(GAMMA * shift_axis[pool_idx])) cal_idx = pool_idx[kept] weights = shift.Weights( cal=1+ np.exp(GAMMA * shift_axis[cal_idx]), test=1+ np.exp(GAMMA * shift_axis[test_idx]), ) marginal = shift.score_coverage(nc[cal_idx], nc[test_idx], weights=None, alpha=alpha) weighted = shift.score_coverage(nc[cal_idx], nc[test_idx], weights=weights, alpha=alpha)return marginal, weighted, nc[cal_idx].mean() - nc[test_idx].mean()marginal_covs, weighted_covs, lean = np.array([draw() for _ inrange(DRAWS)]).Tmarginal_cov, weighted_cov =float(marginal_covs.mean()), float(weighted_covs.mean())print(f"calibration − holdout mean nonconformity: {lean.mean():+.3f} (the lean toward easy)")print(f"nominal coverage: {1- alpha:.2f}")print(f"MARGINAL coverage, mean of {DRAWS}: {marginal_cov:.3f}")print(f"WEIGHTED coverage, mean of {DRAWS}: {weighted_cov:.3f}")print(f"Δ (weighted − marginal): {weighted_cov - marginal_cov:+.3f}")
calibration − holdout mean nonconformity: -0.041 (the lean toward easy)
nominal coverage: 0.90
MARGINAL coverage, mean of 200: 0.918
WEIGHTED coverage, mean of 200: 0.932
Δ (weighted − marginal): +0.015
if SCALE is scale.Scale.FULL: claim("on a score-aligned shift the marginal pass under-covers", marginal_cov <1- alpha -0.01, f"coverage {marginal_cov:.3f}") claim("and the exact-weight pass holds nominal", weighted_cov >=1- alpha,f"coverage {weighted_cov:.3f}")
Averaged over the draws, marginal split-conformal under-covers on the biased calibration set, and weighted split-conformal restores coverage to nominal. Any one draw can land on either side of 0.90 — the guarantee never promised otherwise. At small scale the calibration pool is a few dozen papers, so the average is noisier still, and the restore is asserted as the full-scale finding.
Note these are client-local numpy computations. The engine’s conformalize* surface is the marginal one (valid under exchangeability); Mondrian / weighted conformal is not an OSS Python lever — the weighting here is the consumer’s client-side construction, exactly where the conformal doctrine places the cohort choice.
The session’s work is done, so it is closed. An embedded engine holds its catalog until close() returns, which is why close() comes before anything removes the directory the catalog lives in.
db.close()
58.4 The two halves of one thesis
Weighted conformal repairs a covariate shift if and only if the shift moves the nonconformity-score distribution. The keystone (tier 04) is one half: on the real ogbn-arxiv time-split the classification shift is orthogonal to the score (a near-zero correlation), so coverage holds and reweighting has nothing to move; the regression residuals do shift across eras, further than a reweight of the calibration era’s residuals can reach — and the honest remedy there is a governed, time-aware cohort. This chapter is the other half: a transparently-constructed, score-aligned shift, positively correlated with the score, on which marginal under-covers and the weighted restore (Tibshirani et al. 2019) is real. Together they are the complete statement — neither half alone is the theorem. A graph-aware, productionized version of the governed cohort is out of scope here (Huang et al. 2023); the OSS Python surface exposes the marginal conformalize* and leaves the cohort/weight choice to you.
Angelopoulos, Anastasios N., and Stephen Bates. 2021. “A Gentle Introduction to Conformal Prediction and Distribution-Free Uncertainty Quantification.”arXiv Preprint arXiv:2107.07511.
Angelopoulos, Anastasios N., Stephen Bates, Jitendra Malik, and Michael I. Jordan. 2021. “Uncertainty Sets for Image Classifiers Using Conformal Prediction.” In International Conference on Learning Representations (ICLR).
Barber, Rina Foygel, Emmanuel J. Candès, Aaditya Ramdas, and Ryan J. Tibshirani. 2023. “Conformal Prediction Beyond Exchangeability.”The Annals of Statistics 51 (2): 816–45.
Huang, Kexin, Ying Jin, Emmanuel Candès, and Jure Leskovec. 2023. “Uncertainty Quantification over Graph with Conformalized Graph Neural Networks.” In Advances in Neural Information Processing Systems 36 (NeurIPS).
Romano, Yaniv, Evan Patterson, and Emmanuel J. Candès. 2019. “Conformalized Quantile Regression.” In Advances in Neural Information Processing Systems 32 (NeurIPS).
Romano, Yaniv, Matteo Sesia, and Emmanuel J. Candès. 2020. “Classification with Valid and Adaptive Coverage.” In Advances in Neural Information Processing Systems 33 (NeurIPS).
Tibshirani, Ryan J., Rina Foygel Barber, Emmanuel J. Candès, and Aaditya Ramdas. 2019. “Conformal Prediction Under Covariate Shift.” In Advances in Neural Information Processing Systems 32 (NeurIPS), 2526–36.
Vovk, Vladimir, Alexander Gammerman, and Glenn Shafer. 2005. Algorithmic Learning in a Random World. Springer.