Uncertainty Calibration for Linear Solvers

Summary

CG gives an excellent posterior mean ; the remaining task is to attach a trustworthy covariance. The idea: choose the prior covariance parameter to equal on the explored subspace and a scaled identity on its orthogonal complement, then estimate the single scale at runtime. Rayleigh regression predicts from CG’s own scalar by-products (the Rayleigh coefficients ), giving a genuinely probabilistic error estimate for arbitrary projections . A hard worst-case bound () gives a conservative but loose error estimate; a conjugate Gauss–Gamma prior (Ch. 22.5) gives a fully Bayesian scale.

Overview

From Conjugate Gradients as Probabilistic Inference and Computational Constraints on Probabilistic Solvers, the mean is fixed and good, but the naive empirical-Bayes covariance () collapses to zero on the null space of the observations. The final goal of Part III (Ch. 21) is a covariance that is (i) probabilistically consistent with (both arise from one generative model) and (ii) well-calibrated so it can serve as an uncertainty. Because the object is matrix-valued, different design criteria (diagonal vs off-diagonal error, projection error) pull towards different priors, so no single choice is perfect.

Main Content

The projection-complement covariance

Calibrated with a null-space scale

Set to act like on and estimate its effect on the complement using regularity assumptions:

with a general spd . The projection matrices ensure only acts on the space not covered by , so any such still reproduces the mean (20.3). For simplicity take a scalar (21.2): with no specific prior knowledge there is no way to prefer directions in the null-space of . Then

The scale scales the remaining uncertainty over the entire null-space of — the space CG has not yet explored.

The diagonal/off-diagonal trade-off of (20.4)–(20.6) persists: calibrated variance on the diagonal implies under-confidence off it, and vice versa, so strikes a balance.

Rayleigh regression: estimating from CG’s by-products

Rayleigh coefficients ^def-rayleigh

During a CG run on , the projected values

(the -th direction’s Rayleigh coefficient) are computed essentially for free (the term is line 7 of Algorithm 17.2, up to rescaling). For spd with eigenvalues ,

So carry (loose) spectral information about at no extra cost.

Empirically (SARCOS kernel-ridge example, Fig. 21.1): the collected projections decay rapidly in the first steps (an expanding subspace of relevant directions, related to but not equal to top eigenvectors), then a “kink”, then slow non-monotone decay. Since the come for free and are scalar, cheap univariate regression on them predicts (and hence for unseen ):

Rayleigh regression ^def-rayleigh-reg

Fit a parametric curve to the observed , e.g.

with constants found by least squares (the posterior mean of parametric Gaussian regression). Then estimate the average projection scale from stopping point to :

A more automatic GP-regression version on is possible (Wenger & Hennig, 2020).

Predicting general matrix projections ^thm-projection

Under the posterior , the marginal over a projection is Gaussian:

With set by Rayleigh regression (SARCOS: after , vs radically larger ), the standardised elements are close to standard-normal for random (Gaussian/uniform/binary), Fig. 21.2 — the posterior captures the two moments of well without access to the distribution of . This is a new, genuinely probabilistic error estimate emerging from the interpretation of linear solvers.

Why the good Gaussian fit is unsurprising: for i.i.d., is approximately Gaussian by the CLT, with and . Randomness “washes out structure”, leaving the maximum-entropy Gaussian the model already assumes — helpful here, but a sign the interesting structure has been removed.

The hard part: individual matrix elements

Predicting single elements (deterministic, not smeared by randomness) is genuinely harder. The marginal is

and (20.5)–(20.6) show no scalar (nor even a full spd ) makes this variance a tight prediction of the error on all elements simultaneously. Two options:

Two calibration regimes for elements ^def-two-regimes

  • Hard upper bound: upper-bounds if . For spd matrices () this holds if ; an a-priori bound is (SARCOS Gram matrix: known to be ). Guarantees a conservative bound but is loose for off-diagonal elements (the vast majority).
  • Estimated average: (21.5) gives no guarantee but captures the typical matrix scale — a more aggressive, often more useful error estimate for off-diagonal elements (), though on the diagonal some outliers can have true/estimated error ratios beyond (Fig. 21.3).

Conjugate-prior scale inference (Ch. 22.5)

An alternative, fully Bayesian calibration uses the scalar-covariance prior (which by Theorem 19.16 is also CG-consistent) and places a Gauss–Gamma conjugate prior on the hyperparameters .

Gauss–Gamma posterior on the scale (Eqs. 22.7–22.11) ^thm-gauss-gamma

With prior and marginal likelihood , the posterior sufficient statistics are

where, writing the SVD ,

Interpretation: the sufficient statistics compute an empirical expectation over the elements of in the left-singular basis of . is an empirical mean over the (rotated) diagonal; is an empirical variance. When is orthonormal, and directly. Both direct and iterative conjugate solvers thus project along a transformation of orthogonal directions — for CG, the sequence of residuals .

Examples

Why CG's step sizes calibrate the whole matrix

The Rayleigh coefficients are literally line 7 of the solver — CG already computes them. A cheap hand-crafted regression (21.4) on these scalars finds the right scale for the directions of that the mean has not captured. The predicted variance for a projection is then a fundamentally probabilistic error bar that “comes for free” — a concrete instance of the recurring thesis that a classical solver already carries the ingredients of its own uncertainty.

Conservative worst-case vs aggressive average (Fig. 21.3)

On the SARCOS Gram matrix, makes the posterior std a valid but loose upper bound on element errors. Switching to gives well-scaled () error ratios for off-diagonal elements, at the cost of losing the guarantee and occasionally under-estimating diagonal errors by . Calibration is thus a deliberate choice between conservative bounds and realistic average error.

Connections

See Also