Methods: the linear solve¶
The GP covariance matrix has one energy row and \(D\) gradient rows per observation, so \(n\) observations give \((D+1)\,n\) rows. Every fit and every prediction solves a system with that matrix. This page lists each alternative to the dense Cholesky factor that GPRidge has tried, in the form set out on the section index.
Status: explanation. Commit hashes are abbreviated and are ancestors of
origin/develop at e944f60acc unless the text says otherwise. A ledger
entry is cited by its date and time.
The default: dense Cholesky¶
What it is. The covariance matrix is factored once, and the weights, the
log determinant and the posterior variance come from the factor. The
KernelInverse interface hides the implementation: a dense Eigen factor, a
ScaLAPACK factor for several MPI ranks, or a cuSOLVER factor
(gpr/linalg/KernelInverse.h, commit 9903a83aa).
Status. On develop, default. The HODLR and Nystrom implementations of the
interface were removed (d22aeeca8).
Use. The backend is chosen when you build: -Dlinalg_backend. No flag,
key or C function selects an implementation at run time.
Measured. The dense implementation matches an in-test Eigen factor to a
relative \(10^{-10}\) on a 200-row fixture (9903a83aa). A dense factor of
1408 rows takes 0.056 s and one of 4480 rows takes 0.366 s (ledger
2026-11-13 16:36, from the improve/sparse-precision and
improve/spectral-approx runs).
Why it stays. At the matrix orders that a search produces, no approximation below beat it in total search cost. The sections that follow give the evidence for each.
Covariance operator layer and the Krylov objective¶
What it is. gpr/linalg/linop holds a small interface for symmetric
positive semi-definite operators and a solver interface with four
questions: \(K^{-1}y\), \(\log\det K\), \(y^{T}K^{-1}y\) and
\(\operatorname{diag}(B^{T}K^{-1}B)\). DenseCholeskySolver answers them
from the Cholesky factor and calls the backend one for one, so the dense
path stays bitwise identical (commit 59f83a3a6). KrylovCovarianceSolver
answers the same questions with preconditioned batched conjugate gradients
(mBCG), stochastic Lanczos quadrature (SLQ) for the log determinant and
Hutchinson probes for traces. A cost model compares operation counts and
picks the cheaper route.
Status. On develop. The dense solver is the default and every covariance
consumer goes through it (5718851c8, 16c7f0295, 2026-11-16). The Krylov
objective is opt-in and C++ only. 88d1c7064 changed the default from
Auto to Dense. quadraticDiagonal has two implementations and only
the dense one is used. DenseCholeskySolver::quadraticDiagonal is the
variance diagonal of the model: trainingSolver()
in gpr/ml/GaussianProcessRegression.h always returns a
DenseCholeskySolver, and it is called from calculateVariance
in gpr/ml/gp/Variance.cpp, tryGateEnergyVariance
in the same file, trainingInverseDiagonalInFactorLayout
in gpr/ml/gp/Predict.cpp and tryActivePosteriorEnergyVariance
in gpr/ml/gp/ActivePosterior.cpp. With GPR_LINALG_SCALAPACK
(the scalapack and slate branches of meson.build) the
quadraticDiagonal calls in calculateVariance and
trainingInverseDiagonalInFactorLayout are compiled out: each sits in
the #else of a GPR_LINALG_SCALAPACK test. calculateVariance
replaces it with forward_solve_mat_colwise_squared_norm_distributed.
trainingInverseDiagonalInFactorLayout replaces it with
cholesky_inverse_diagonal_distributed when the factor is distributed,
and with an explicit triangular solve of the identity otherwise. The calls in
tryGateEnergyVariance and tryActivePosteriorEnergyVariance stay in
that build and run only for a factor that is not distributed:
tryGateEnergyVariance returns through the distributed forward solve
when training_cholesky_is_distributed_ is set, and
tryActivePosteriorEnergyVariance returns false in that case.
The Krylov variant, KrylovCovarianceSolver::quadraticDiagonal, and the
Lanczos variance cache (LOVE) behind it,
LanczosVarianceCache::quadraticDiagonal, are built but unused: only
tests/gpr/linalg/linop/KrylovTest.cpp calls them.
CallbackOperator has no caller outside its own file. The layer has no
CLI flag, TOML key, C function or Python name.
Use. See The covariance operator layer and Krylov solvers.
Measured.
The earlier branch
improve/linop-coregave identical search counts to develop: “infrastructure only” (ledger 2026-11-13 17:58).No search-level result is recorded for the landed layer. The 44-cell UMA gate named in the relaunch brief (ledger 2026-11-15) has no recorded numbers. The only 44-cell figures on develop describe the determinism gate: 44 cells and 1881 calls (
bench/linalg-backend-spec.md).The cost model refuses Krylov on the 16_oxirane refit Gram matrix (order 820). The pivot residual traces are \(1.2\times10^{5}\), \(9.2\times10^{4}\), \(1.9\times10^{4}\) and 802 at ranks 0, 100, 300 and 600, and the smallest eigenvalue is \(5.2\times10^{-4}\). “CG cannot beat the factor there, at any rank” (test comment in
tests/gpr/linalg/linop/KrylovTest.cpp).The opposite regime plans Krylov: noise 10.0 and tolerance 10.0 plan it, noise \(10^{-6}\) and tolerance \(10^{-3}\) stay dense (
tests/gpr/ml/gp/ObjectiveBackendTest.cpp).Accuracy tests, not campaign results: the Krylov objective agrees with the dense one within 5 times the tolerance \(10^{-2}\), and the gradient within \(10^{-2}|g_{\mathrm{ref}}|\) plus 5 times the tolerance (same test file).
The variance-diagonal memo in the dense solver was removed because “that O(n^2) compare and copy was pure host overhead” (
dd775d6dd). No number is recorded.
Why it is not the default. No benefit is recorded. The objective carries
stochastic error. The Krylov path needs a dense covariance. It does not run
in a ScaLAPACK or SLATE build: evaluateKrylovObjective and
planObjectiveBackend inside evaluateEnergyFromGeometry, and the Krylov
branch of evaluateGradientWithGeometry, are each inside
#ifndef GPR_LINALG_SCALAPACK in gpr/ml/gp/EnergyGradient.cpp, and the
slate branch of meson.build defines that macro too. It also does not
run with HS-SVD, with a manifold chart or geodesic heat kernel, with a
nonzero kernel nugget or the principled nugget, with a correction term,
with Hutchinson probes, or without a Gaussian likelihood:
krylovAddedDiagonal in gpr/ml/gp/KrylovObjective.cpp returns no
diagonal for each of them.
The pivoted-Cholesky preconditioner¶
What it is. A greedy partial Cholesky factor \(F\) of the kernel part of \(K=A_0+\operatorname{diag}(s)\) gives \(P=FF^{T}+\operatorname{diag}(s)\). \(K-P\) is positive semi-definite, so the eigenvalues of \(P^{-1}K\) lie in \([1,\,1+\lambda_{\max}(E)/\min s]\). The cost model chooses the rank from the Schur residual trace of the last dense factor.
Status. On develop, opt-in. It runs only inside the Krylov objective. No search-level benefit is recorded.
Matrix-free PCG on the predict path¶
What it is. A deterministic preconditioned CG (gpr/linalg/IterativeSolver.h)
that replaces the Cholesky solves in the prediction weights. Inner products
accumulate in long double, so the iteration is bit-identical at every rank
count. Convergence is declared only from an explicitly recomputed residual.
A two-dimensional reproducer reports a recursive residual of
\(8\times10^{-17}\) while the true residual is \(2.6\times10^{-6}\)
(dc8aa459b).
Status. On develop, opt-in at build time: -Dgp_predict_via_pcg=true. The
default is false. The preconditioner that remains is a replicated full
Cholesky factor, which saves nothing (“Its cubic setup cost offers no
factorization saving”, gpr/ml/gp/Predict.cpp). If PCG does not converge,
the code falls back to the direct solve (45a864817).
Measured, not adopted. On d016 with PET-MAD, PCG with the replicated
factor needs 18 or 19 iterations and does not beat the Cholesky baseline
(f8e7a9a4e).
Ranks |
PCG iterations |
PCG wall (s) |
Cholesky wall (s) |
|---|---|---|---|
1 |
18 |
57.62 |
57.05 |
8 |
18 |
18.89 |
14.66 |
16 |
19 |
34.03 |
12.62 |
Five preconditioners failed on the d016 PET-MAD derivative kernel. The first three ran at \(N=430\) (9fa28ef56).
Preconditioner |
Outcome |
Source |
|---|---|---|
Nystrom, \(k=108\) |
dimer forces stuck at 21 and above |
|
Pivoted Cholesky, \(k=256\), tol \(10^{-8}\) |
forces oscillated between 11 and 12 |
|
Lanczos deflation, \(k=64\) |
forces fell slowly and did not converge tightly |
|
Lanczos deflation on the smallest Ritz values, \(k_{\mathrm{eff}}=32\) |
forces bounced between 0.5 and 6 |
|
Block Jacobi, 8 ranks |
outer iteration 47 and not converged; baseline 18 |
|
Why. “K’s spectrum on derivative-augmented GP kernels has too much mass
beyond rank k for the low-rank Nystrom approximation to be a usable
preconditioner” (485c8b54d). The eigenvalues span about 8 decades, so
cutting the condition number from \(10^{6}\) to \(10^{2}\) needs the smallest
\(0.7N\) eigenvalues (21cadced3). The meson option text claims that PCG
crosses the Cholesky factor near \(N\ge500\). No measurement in the history
supports that sentence, and the table above contradicts it for the full
factor.
HODLR¶
What it is. A hierarchically off-diagonal low-rank factor of the kernel
(binary tree, adaptive cross approximation on off-diagonal blocks, dense
leaves). It replaced the dense factor for the solve, the log determinant and
the trace of \(K^{-1}\,dK\) (e241aec30, 3a1e54150).
Status. Removed from develop. 718a9f975 (2026-04-29) mapped
ApproxMode::HODLR to NONE. d22aeeca8 deleted the code: 35 files, 78
insertions, 5680 deletions. git grep -i hodlr on develop finds nothing.
The old flag was --approx-mode hodlr.
Measured.
Gradient error against dense: 30 of 30 perturbations within 0.01 relative; maximum \(2.72\times10^{-13}\) at \(n_{\mathrm{obs}}=14\) (
f106292f7).Time for the Laplace Hessian, one sample (
5a314c8d3):
Observations |
Rows |
Dense (ms) |
HODLR (ms) |
|---|---|---|---|
30 |
210 |
92 |
148 |
100 |
700 |
1561 |
3442 |
The commit predicted a gain “at PETMAD scale (n_obs >> 100)” and about 14 times cheaper at \(n=430\) with rank 30 (
b8a33cef1). That is a prediction. No end-to-end search time is recorded.
Why it was dropped. No reason is recorded. 718a9f975 and d22aeeca8
have empty bodies. The follow-up commits kept Laplace prediction, the INLA
Hessian and the optimiser on the exact backend. Later measurements show that
the derivative kernel has a flat spectrum, so the off-diagonal blocks do not
compress (see the Route 2 and Route 3 sections below).
Nystrom subset-of-data¶
What it is. A Williams-Seeger Nystrom approximation \(Q=K_{nm}K_{mm}^{-1}K_{nm}^{T}\)
with \(m\) inducing rows chosen by farthest-point sampling. The Woodbury
identity reduces the solve to an \(m\times m\) factor (1f070bcbd).
Status. Removed from develop by d22aeeca8, with --approx-mode nystrom
and --nystrom-rank. The name survives in unrelated code: the pivoted
Cholesky solver, the sketched L-BFGS start matrix and the IRC Hessian
sketch.
Measured. The record holds a cost table and exactness tests at \(m=n\) only. No wall time or error at \(m<n\) is recorded.
Why it was dropped. No reason is recorded. The flat-spectrum measurements
below argue against it. 70a89a96b groups it with random features as
killed by “the same flat/smooth-spectrum wall”.
Pivoted Cholesky and Woodbury: LowRankCholesky¶
What it is. A greedy-diagonal pivoted partial Cholesky factor that stops
at the numerical rank, plus a Woodbury noisy solve and a determinant-lemma
log determinant. The cost is \(O(n_{\mathrm{obs}}^{2}r)\) on the exact
kernel (99e740164).
Status. On develop, built but unused. Only tests/gpr/ml/gp/LowRankSolveTest.cpp
includes gpr/ml/gp/LowRankSolve.h. It has no flag, key or C function.
Measured. The test pins exactness at full rank and a truncation bound at
moderate noise (\(\sigma^{2}=10^{-4}\), error below \(10^{-4}\)). At
\(\sigma^{2}=10^{-7}\) the solve is near interpolation and the rank must
follow the number of eigenvalues above \(\sigma^{2}\): the test then asserts an
alpha error below \(5\times10^{-6}\) and a log-determinant error below
\(5\times10^{-5}\) (52f0caf76, acf4adf19). The derivation commit titled
this route a win (85e5255e5) and asked for validation on d016. No d016
validation is recorded.
Vecchia local conditioning¶
What it is. DerivativeVecchia factors the joint density into ordered
conditionals that keep at most \(m\) predecessors. A point keeps its value
and its gradient components in one block, so one \((D+1)n\) solve becomes
\(n\) local solves of size \((m+1)(D+1)\) (916d380b2).
Status. On develop, built but unused. Only the tests and
benchmarks/bench_vecchia_accuracy.cpp use it. The likelihood gradient that
hyperparameter fitting needs was never built: “measure the payoff before
building it” (139252f3a). A separate experiment forced local Vecchia GPs
for every NEB inner-loop prediction on 02_hcch (f4534163e, 2026-05-26). It
was reverted and reapplied and reverted again. The only number recorded is
the baseline of 168 oracle calls. The reason for the reverts is not recorded.
Measured, not adopted. bench_vecchia_accuracy sweeps \(n\) of 64 and 128,
\(D\) of 2 to 4 and \(m\) of 1 to 32. No output is recorded. The ledger entry
for improve/sparse-precision says “none beat the dense Cholesky at
gpridge sizes … Vecchia gradient error exceeds tolerance” (2026-11-13
16:36).
SPDE, Wendland, link-cell and hierarchical matrices¶
Status. Not on develop, except as noted.
SPDE and GMRF:
benchmarks/bench_path_gmrf.cppcompares an along-path Matern field with a linear-element SPDE precision against the dense GP, leaving one configuration out (96a0331e8). It is a bench and is not on any search path. No result is recorded.Wendland kernels and Vecchia nearest neighbours: no code on develop.
Link-cell: used for geometry only (
gpr/auxiliary/CutoffNeighbors.cpp). The compact pair feature is--gp-pair-cutoff(default 0, off) with a switching shell. It is a cutoff on the descriptor, not a compact kernel.Hierarchical matrices:
improve/hmatrixfound that “linkcell cutoff within noise keeps all pairs (Grignard cutoff 8809 A vs 9.5 A diameter), Gram stays dense, factor off. Negative.” (ledger 2026-11-14 00:21).
Measured, not adopted. Vecchia, SPDE, Wendland and link-cell nearest neighbours: “none beat the dense Cholesky at gpridge sizes” (ledger 2026-11-13 16:36). The cause given in the record is that dense Cholesky is already cheap at these orders.
Sparse inverse Cholesky (Route 3)¶
What it is. A test of whether the inverse Cholesky factor of the SE kernel
is nearly sparse under reverse-maximin ordering, as the screening effect
predicts (scripts/check_route3_sparsity.py, 70a89a96b).
Status. Measured, not adopted. The script stays on develop.
Measured. On d016 the inverse factor is dense: “9.4% rel error at 54%
fill, needs 100% fill for accuracy”, while a rough Matern-1/2 kernel reaches
0.2 % at 54 % fill (70a89a96b).
Why. The SE kernel is smooth and global. “Same flat/smooth-spectrum wall that kills truncation (Nystrom/RFF) and CG/Lanczos.”
Inducing directional derivatives (Route 2)¶
What it is. A gate for the method of Padidar et al. (arXiv:2107.04061).
It asks whether the d016 forces of one configuration are directionally low
rank (scripts/route2_directional_rank_gate.py, d27e4e6a6).
Status. Measured, not adopted.
Measured. The rank of the Jacobian per configuration is 36 of 42. The six
missing directions are the rigid translations and rotations that the
inverse-distance descriptors remove. The singular spectrum across the 36
internal coordinates is flat. The top 5 directions hold 43 % of the force
energy, and the value reaches machine zero only at \(k=36\). Choosing
\(k\) of 3 to 5 directions “would discard 65-80% of force info”
(d27e4e6a6).
Why. No dimension is left to remove. The same commit states that “All 3 scalability routes now dead by measurement; np=1 GP-host O(N^3) eigensolve is algorithmically irreducible.” The tree names Routes 2 and 3 only. Which technique “Route 1” denotes is not recorded.
D-SKI and D-SKIP¶
What it is. D-SKI interpolates onto a grid with Keys cubic convolution and
differentiates the interpolant, so the joint matrix factors as
\([W;dW]\,K_{UU}\,[W;dW]^{T}\). D-SKIP keeps the product form of an ARD kernel
and compresses each pairwise product to low rank (1fe746642).
Status. On develop, built but unused (gpr/ml/gp/DerivativeSKI.h,
benchmarks/bench_dskip_rank.cpp). Measured, not adopted.
Measured.
“At a descriptor-like lengthscale the product rank reaches n by about the fifth dimension (d=8 and d=12 both saturate at dim 5), a shorter lengthscale saturates at dim 3, and only a 1e-4 trace tolerance keeps it meaningfully bounded, at 1.9e-4 relative error.” The \(n=200\) case reached rank 199 (
6b51112b8).On the real d016 geometry the reconstruction error is \(3.5\times10^{-33}\). There are 91 inverse-distance features. Each per-feature factor has rank near 13, but the product is full rank. The energy-only condition number is \(10^{0}\) and the gradient-enhanced one is \(10^{4.2}\). The structured matrix-vector cost \(\Theta(drN^{2})\) exceeds the dense \(\Theta(N^{3}/6)\) for all \(N<6dr=7098\), and d016 has \(N=1118\) (
a3ba215e5).improve/structured-solvesgave search counts identical to develop and GP-host time “only 1-2% lower. Marginal, not worth relaunching” (ledger 2026-11-13 17:50).
IterGP¶
What it is. After \(i\) actions \(S\), the model carries
\(C_i=S(S^{T}\hat K S)^{-1}S^{T}\) in place of \(\hat K^{-1}\). The reported
variance is an upper bound on the exact variance and splits into a data part
and a computational part (485333255).
Status. On develop, built but unused. Only tests/gpr/ml/gp/IterGPTest.cpp
calls gpr::itergp::IterGP::run. It accepts a dense Eigen matrix.
Measured. A fix replaced a plain factorisation of \(S^{T}\hat KS\) with a
truncated pseudo-inverse, because “at 26 of 32 iterations the reported
variance fell below the exact posterior and by 27 it reached -0.167”
(55692d812). No speed number is recorded.
Hutchinson trace for the hyperparameter gradient¶
What it is. \(\operatorname{tr}(K^{-1}\,dK_i)\approx\frac1m\sum_j w_j^{T}dK_iz_j\)
with Rademacher probes (281905ee6).
Status. On develop, opt-in: --gp-hutch-probes N in gprn. The default
uses the exact inverse trace. A later single-rank Eigen inverse with
matrix-free probes (7ae64e7b0) recorded “inverse ~9.9 s -> ~1.7 s,
trainstep ~16.1 s -> ~7.2 s” at \(N=400\). It was reverted in 7c060fd8a,
and no reason is recorded.
Reading the evidence together¶
Every low-rank or sparse route above ran into the same fact. The derivative-augmented kernel of the inverse-distance descriptor has a flat spectrum, a nearly full numerical rank and a dense inverse factor. The recorded checks of that fact are the Route 2 and Route 3 numbers, the D-SKIP rank, the PCG preconditioner failures and the HS-SVD mode counts. They hold for the systems measured: d016 with 14 atoms, the \(N=430\) kernel of the PCG study, and the cells behind the ledger entries. They do not prove the same for a different descriptor or a much larger system. The decision table says which regime has a measurement and which has none.