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.
| Engine | Module | Powers | Deep dive |
|---|---|---|---|
| Conformal prediction | cli_sdk.stats.conformal | Set, Interval, Gate, Claim, Judge, Route | this page |
| Venn-Abers calibration | cli_sdk.stats.venn_abers | Belief, per-option intervals on Set, Judge cascades | Venn-Abers |
| E-values | cli_sdk.stats.evalues | drift monitors, e-BH FDR control, label-efficient calibration | E-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 — higher means “less plausible” — and labelled calibration pairs drawn exchangeably with production data, split conformal prediction computes
and returns . This set satisfies
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 , then and every option is included; this is why a profile needs examples.
| Score | Module | Primitive | |
|---|---|---|---|
| LAC | conformal.lac | Set (method="LAC") | |
| APS | probability mass of all options ranked at or above | conformal.aps | Set (default) |
| RAPS | APS plus | conformal.raps | Set (method="RAPS") |
| CQR | conformal.cqr | Interval |
Risk control
A gate accepts an input when its confidence score clears a threshold . Write for the loss on calibration example at threshold (for a gate: 1 if the example would be accepted and is wrong, 0 otherwise), with and non-increasing in , and .
Conformal risk control (CRC) picks
and guarantees — 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 from most to least conservative, the null with a Hoeffding-Bentkus p-value, and stop at the first that cannot be rejected at level (fixed-sequence testing). The result satisfies
a high-probability bound: with probability at least over the
draw of the calibration set, the deployed threshold’s true risk is at most
. 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 (account tier, language, product line)
gives for every group with enough
calibration data. Groups below 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
. When the decisions may be dependent (related inputs,
the same underlying model), CLI uses e-BH on e-values instead, which
keeps 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 . 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 , and the straddle decision rule are on Venn-Abers calibration.
E-values
An e-value is a nonnegative statistic with 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.