ConceptsThe three engines

The three engines

CLI has three statistics engines. All three live in one network-free package, cli_sdk.stats, which is also what the hosted service runs; every hosted guarantee card reports the engine version in guarantee.stats_version.

EngineModulePowersDeep dive
Conformal predictioncli_sdk.stats.conformalSet, Interval, Gate, Claim, Judge, Routethis page
Venn-Abers calibrationcli_sdk.stats.venn_abersBelief, per-option intervals on Set, Judge cascadesVenn-Abers
E-valuescli_sdk.stats.evaluesdrift monitors, e-BH FDR control, label-efficient calibrationE-values

Every guarantee below is marginal (averaged over calibration and test data drawn exchangeably) or group-conditional (averaged within a declared group). None of them is a statement about one individual decision.

Conformal prediction

Split conformal sets

Given any nonconformity score s(x,y)s(x, y) — higher means “less plausible” — and nn labelled calibration pairs (xi,yi)(x_i, y_i) drawn exchangeably with production data, split conformal prediction computes

q^=the ⌈(n+1)(1−α)⌉-th smallest of s(x1,y1),…,s(xn,yn)\hat q = \text{the } \lceil (n+1)(1-\alpha) \rceil\text{-th smallest of } s(x_1,y_1), \dots, s(x_n,y_n)

and returns C(x)={y:s(x,y)≤q^}C(x) = \{y : s(x,y) \le \hat q\}. This set satisfies

1−α  ≤  P(Yn+1∈C(Xn+1))  ≤  1−α+1n+11-\alpha \;\le\; P\big(Y_{n+1} \in C(X_{n+1})\big) \;\le\; 1-\alpha+\frac{1}{n+1}

for any score and any underlying model, in finite samples, under exchangeability alone (the upper bound needs continuous scores without ties). The probability is over the calibration draw and the test point together. If ⌈(n+1)(1−α)⌉>n\lceil (n+1)(1-\alpha) \rceil > n, then q^=+∞\hat q = +\infty and every option is included; this is why a profile needs n≥⌈(1−α)/α⌉n \ge \lceil (1-\alpha)/\alpha \rceil examples.

Scores(x,y)s(x, y)ModulePrimitive
LAC1−p^(y∣x)1 - \hat p(y \mid x)conformal.lacSet (method="LAC")
APSprobability mass of all options ranked at or above yyconformal.apsSet (default)
RAPSAPS plus λ⋅max⁡(0,rank(y)−kreg)\lambda \cdot \max(0, \text{rank}(y) - k_{\text{reg}})conformal.rapsSet (method="RAPS")
CQRmax⁡(q^lo(x)−y, y−q^hi(x))\max(\hat q_{\text{lo}}(x) - y,\ y - \hat q_{\text{hi}}(x))conformal.cqrInterval

Risk control

A gate accepts an input when its confidence score clears a threshold λ\lambda. Write Li(λ)L_i(\lambda) for the loss on calibration example ii at threshold λ\lambda (for a gate: 1 if the example would be accepted and is wrong, 0 otherwise), with Li≤BL_i \le B and LiL_i non-increasing in λ\lambda, and R^n(λ)=1n∑iLi(λ)\hat R_n(\lambda) = \frac{1}{n}\sum_i L_i(\lambda).

Conformal risk control (CRC) picks

λ^=inf⁡{λ:nn+1R^n(λ)+Bn+1≤α}\hat\lambda = \inf\Big\{\lambda : \tfrac{n}{n+1}\hat R_n(\lambda) + \tfrac{B}{n+1} \le \alpha\Big\}

and guarantees E[Ln+1(λ^)]≤α\mathbb{E}\big[L_{n+1}(\hat\lambda)\big] \le \alpha — a bound on the expected loss, over the calibration draw and the test point. Powers Gate(guarantee="risk").

Risk-controlling prediction sets (RCPS) instead test, for each candidate λ\lambda from most to least conservative, the null H0(λ):R(λ)>αH_0(\lambda) : R(\lambda) > \alpha with a Hoeffding-Bentkus p-value, and stop at the first λ\lambda that cannot be rejected at level δ\delta (fixed-sequence testing). The result satisfies

Pcalibration(R(λ^)≤α)≥1−δ,P_{\text{calibration}}\big(R(\hat\lambda) \le \alpha\big) \ge 1 - \delta,

a high-probability bound: with probability at least 1−δ1-\delta over the draw of the calibration set, the deployed threshold’s true risk is at most α\alpha. Powers Gate(guarantee="risk_high_probability") and the agreement guarantee of Judge.

Learn-then-Test (LTT) generalizes RCPS to several jointly tuned knobs (for example a sample count and a quality threshold) and to non-monotone losses, by testing every configuration and controlling the family-wise error rate (fixed-sequence or Bonferroni).

Group-conditional (Mondrian) calibration

Fitting one quantile per group gg (account tier, language, product line) gives P(Y∈C(X)∣G=g)≥1−αP(Y \in C(X) \mid G = g) \ge 1-\alpha for every group with enough calibration data. Groups below ⌈(1−α)/α⌉\lceil (1-\alpha)/\alpha \rceil examples fall back to the marginal threshold and are reported as underpowered (profile.groups[g].status == "underpowered"), so a marginal 90% cannot hide a much lower rate on a group you care about.

Selection with FDR control

When a gate auto-approves many decisions, the relevant quantity is the false discovery rate: the expected fraction of approved decisions that are wrong. Conformal selection computes a conformal p-value for each candidate from the calibration set and applies Benjamini-Hochberg, giving FDR≤q\mathrm{FDR} \le q. When the decisions may be dependent (related inputs, the same underlying model), CLI uses e-BH on e-values instead, which keeps FDR≤q\mathrm{FDR} \le q under arbitrary dependence; see E-values: e-BH. Powers Gate(guarantee="fdr").

Venn-Abers calibration

An Inductive Venn-Abers Predictor (IVAP) fits isotonic regression twice — once postulating that the test label is 0, once that it is 1 — and returns the two fitted values [p0,p1][p_0, p_1]. The endpoint selected by the true label is perfectly calibrated on average over exchangeable data, whatever the quality of the underlying score; a poor score only widens the interval. Full construction, the merge rule p=p1/(1−p0+p1)p = p_1/(1 - p_0 + p_1), and the straddle decision rule are on Venn-Abers calibration.

E-values

An e-value is a nonnegative statistic EE with E[E]≤1\mathbb{E}[E] \le 1 under a null hypothesis. E-values support safe optional stopping (monitor continuously, stop whenever you like), e-BH FDR control under arbitrary dependence, and post-hoc choice of the significance level. CLI’s drift monitors are betting martingales, and its label-efficient calibration uses prediction-powered inference. Full construction, Ville’s inequality, the e-BH rule, the p-to-e calibrator, and the PPI estimator are on E-values.

How they compose

A single CLI deployment typically uses all three together: Venn-Abers turns a raw score into a calibrated probability interval; the conformal engine turns scores into coverage-, risk-, or FDR-bounded decisions; the e-value engine watches the deployed decision stream for drift and lets the calibration set grow from a small human sample plus a large judge-labelled pool.