Robustness, Calibration, and Safe Control › Calibrated Uncertainty and Abstention
World Models HandbookAll chapters Robustness, Calibration, and Safe Control › Calibrated Uncertainty and AbstentionOne section · Sections in this chapter3 / 8 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
A model is calibrated if its stated probabilities match observed frequencies. Concretely: among all the predictions where the model says "there is a 90% chance the true value lies in this interval," roughly 90% should contain the truth. Calibration is a property of the whole predictive distribution, not of any single prediction, so it can only be measured in aggregate. This is a subtle but important point: you cannot ask whether a single interval is calibrated, any more than you can ask whether a single coin flip is fair. You ask it about the set of predictions that share the same confidence level, and you compare the claimed frequency to the realized one.
Coverage and width answer different questions. An interval of has coverage one, not calibrated 90% coverage. A useful interval should be narrow while achieving its stated coverage on the relevant population. Report both width and coverage; also inspect operationally important subgroups rather than relying only on an aggregate average.
In Bayesian Filtering and Belief States, a posterior represents state uncertainty; Stochasticity and Uncertainty distinguishes uncertainty sources. Here we additionally approximate predictions by . Producing a mean and variance does not imply Gaussian shape. Quantile-based coverage can be tested without finite moments; standardized residuals using mean and standard deviation require finite moments and a positive scale.
Measuring coverage
For a Gaussian predictive distribution, the natural diagnostic is the standardized residual. If the model is honest, each observation should look like a draw from , so dividing the raw error by the claimed standard deviation puts every prediction on a common scale:
where:
- : the observed target for the -th sample
- : the model's predicted mean at input
- : the model's predicted standard deviation at input
- : the standardized residual, measuring how many predicted standard deviations the observation deviates from the mean
For the Gaussian location-scale intervals used here, calibration at all central levels requires the absolute standardized residuals to have the corresponding Gaussian quantiles. Calibration alone does not imply that signed residuals are standard normal. The empirical coverage at nominal level is:
where:
- : the number of evaluated samples
- : the nominal coverage level, the fraction of probability mass the interval is supposed to contain
- : the standard normal quantile function, so is the half-width of the central interval containing fraction of a standard normal
- : the indicator, equal to when the inequality holds and otherwise
- : the empirical fraction of samples whose standardized residual falls inside that central interval
Plotting against gives a reliability diagram. The diagonal represents matching marginal coverage at the displayed levels; curves below it deliver less coverage than claimed, and curves above it deliver more. Sampling uncertainty remains, and the diagram does not establish conditional coverage at every state. Overcoverage may accompany unnecessarily wide intervals; undercoverage matters when decisions rely on margins that are too narrow. Neither direction alone measures controller safety.
LEVELS = np.array([0.50, 0.68, 0.80, 0.90, 0.95])
def z_scores(X, Y, scale=1.0):
mu_z, var_z, _ = predict(members, X)
return ((Y - mu_z) / np.sqrt(var_z * scale**2)).ravel()
def coverage_curve(z, levels=LEVELS):
return np.array(
[(np.abs(z) <= norm.ppf(0.5 + lv / 2.0)).mean() for lv in levels]
)
def fit_scale(X, Y):
"""One global multiplier that makes the average squared z-score equal to one."""
return float(np.sqrt(np.mean(z_scores(X, Y) ** 2)))
global_scale = fit_scale(X_recal, Y_recal)
z_id = z_scores(X_test, Y_test)
z_dyn = z_scores(X_dyn, Y_dyn)
cover_id = coverage_curve(z_id)
cover_id_scaled = coverage_curve(z_scores(X_test, Y_test, global_scale))
cover_dyn = coverage_curve(z_dyn)
oracle_scale = float(np.sqrt(np.mean(z_dyn**2)))
cover_dyn_scaled = coverage_curve(z_scores(X_dyn, Y_dyn, oracle_scale))global scale fitted on in-distribution calibration data: 1.000
scale that would be needed on the shifted regime: 1.065
nominal nominal cov shifted cov
0.50 0.492 0.493
0.68 0.667 0.671
0.80 0.789 0.775
0.90 0.891 0.862
0.95 0.947 0.929The executed global scale is 1.000 and the shifted-set diagnostic is 1.065. At nominal 90% coverage, the measured frequencies are 89.1% on nominal test transitions and 86.2% on shifted transitions. This is a modest empirical coverage loss in this experiment, not evidence of an arbitrary catastrophic collapse.
Read the two coverage columns at the same nominal level. They are measured frequencies for the specified data splits, not guarantees. The shifted-data scale is an oracle diagnostic fitted and evaluated on that same shifted set; it is not a deployable recalibration result or a held-out validation estimate.
The fitted multiplier adjusts average squared standardized residuals, not every conditional probability or tail. It may help on some shifted populations, but coverage does not automatically transfer. Our calibration targets are correlated transitions from independent episodes, so the curve describes their empirical mixture; it is not a finite-sample confidence guarantee for an adaptive controller.
The code pools both coordinate residuals. In this simulator, , not . The feature map includes current velocity, so the fitted predictions satisfy , up to numerical roundoff. Subtracting these predictions from their targets leaves position residuals equal to times velocity residuals; the standardized coordinate residuals therefore coincide up to numerical roundoff. In a general multi-output model, pooled coverage can hide opposing coordinate errors; report coordinate-specific diagnostics as well.
Split conformal prediction provides a different route to marginal coverage: fit a model on separate training data, compute nonconformity scores on calibration examples, and use the appropriate order statistic, typically rank , for target coverage . If the rank exceeds , an infinite threshold is the conservative convention. The finite-sample marginal result requires exchangeability of the calibration and test examples, conditional on the independently fitted predictor. Consecutive transitions from the same episode and adaptive control generally do not satisfy that assumption. Marginal coverage also does not guarantee coverage at every state or for an entire trajectory. This chapter implements Gaussian residual rescaling, not conformal intervals; see Angelopoulos and Bates for the distinction and conditions.


Abstention: turning uncertainty into a decision
Calibration describes predictions on a population. Abstention is a decision rule built on top of an uncertainty score. Here we rank predictions by predictive variance and evaluate only a retained fraction. An informative ranking may reduce retained-set error; it does not entitle a model to act safely. An actual abstention system must also specify what happens to the rejected cases and evaluate that alternative.
Possible designs include a planner that defers high-disagreement proposals, a manipulator that requests confirmation, or a controller that selects a predefined fallback. These are examples of design choices, not claims about every deployed system. A percentile trigger asks whether a score is unusual relative to a reference population; an absolute trigger asks whether a specified tolerance is exceeded. Either can be appropriate when its operating population and consequences have been validated.
One way to evaluate this ranking is the risk-coverage curve. Sweep the retained fraction , compute retained-set RMSE, and plot it against . The area summarizes this particular loss and population, so report the loss definition and coverage range. An uncertainty score independent of errors gives approximately unchanged expected error under random retention; finite samples fluctuate. Useful rankings often give lower error at lower coverage, but empirical curves need not be monotone.
def risk_coverage(X, Y, fractions):
"""RMSE of the retained predictions as a function of the retained fraction."""
mu_rc, var_rc, _ = predict(members, X)
per_point_err = np.sqrt(np.mean((Y - mu_rc) ** 2, axis=1))
per_point_sd = np.sqrt(var_rc.mean(axis=1))
order = np.argsort(per_point_sd) # most confident first
curve = []
for frac in fractions:
keep = order[: max(1, int(round(frac * len(order))))]
curve.append(float(np.sqrt(np.mean(per_point_err[keep] ** 2))))
return np.array(curve)
FRACTIONS = np.linspace(0.15, 1.0, 18)
curve_id = risk_coverage(X_test, Y_test, FRACTIONS)
curve_in = risk_coverage(X_in, Y_in, FRACTIONS)
curve_dyn = risk_coverage(X_dyn, Y_dyn, FRACTIONS)retain 0.25 | in-dist 0.0421 | input shift 0.0425 | dynamics shift 0.0424 retain 0.50 | in-dist 0.0430 | input shift 0.0424 | dynamics shift 0.0427 retain 1.00 | in-dist 0.0437 | input shift 0.0451 | dynamics shift 0.0459
At retained fraction 0.25, executed aggregate RMSEs are 0.0421, 0.0425, and 0.0424 for nominal, input-shifted, and damping-shifted data. At full coverage they are 0.0437, 0.0451, and 0.0459. The input-shift curve has 0.0424 at fraction 0.50, slightly below its 0.25 value: the empirical curve is not strictly monotone. These modest differences describe the chosen score and populations, not a universal benefit of abstention.
Three questions guide the reading. Does retaining fewer predictions reduce RMSE in the nominal population? Is that relationship preserved under input shift? Does it persist under dynamics shift? A favorable result in one regime cannot answer the other two. The score combines a residual variance floor with ensemble disagreement, while realized errors also contain unpredictable process noise. That noise can dominate errors and make a useful epistemic ranking difficult to see in aggregate RMSE.
Ranking and calibration are separate properties. A single positive rescaling preserves score rankings while potentially changing interval coverage. A percentile threshold targets a rejection fraction on its reference population, subject to finite-sample quantile and tie conventions, but a rolling window can normalize a sustained harmful shift into the new normal. An absolute threshold can encode a physically meaningful tolerance but needs validation under changed conditions. Neither form automatically survives distribution shift. Choose thresholds using retained-case risk, rejected-case outcomes, and the cost of deferral, not coverage alone.
