Methods: numerics, noise and uncertainty¶
This page covers the numerical choices around the GP: the HS-SVD stable basis, the noise floor and variance stabilisation, factor appends and refits, mixed-precision products, priors, uncertainty arms, derivative providers and the quantum-path library. The entry form is the one on the section index.
Status: explanation. Hashes are ancestors of origin/develop at
e944f60acc unless the text says otherwise.
HS-SVD stable basis¶
What it is. The Hilbert-Schmidt SVD of Fasshauer and McCourt expands the
Gaussian kernel in its Mercer eigenfunctions, \(K=A A^{T}\) with
\(A=\Phi\,\mathrm{diag}(\sqrt\lambda)\). A thin SVD \(A=USV^{T}\) gives the
stable basis \(\Psi=AVS^{-1}\), which is orthonormal at the nodes. The nearest orthonormal polar factor of those columns is computed only in StableBasisND::factorize; the dual-kernel path and factorizeGPCartesian keep the SVD factor. The
Mercer tail with \(S_i\le\mathrm{sv\_rtol}\,S_0\) is dropped. The
gradient-enhanced kernel stacks energy and gradient rows, so one SVD
conditions the whole joint system (gpr/ml/gp/StableBasis.h, 3935d3973).
With this basis
and \(\log\det(K+\sigma^{2}I)=\sum_i\log(S_i^{2}+\sigma^{2})+(n-r)\log\sigma^{2}\)
(34930aee1). The production route is the dual form. It eigendecomposes the
\(n_{\mathrm{obs}}\times n_{\mathrm{obs}}\) kernel with Eigen’s self-adjoint solver on the host and chops the
spectrum at \(10^{-6}\) (2937db94f).
Status. On develop, default in gprn, gprd and the C++ library
(23530462a, 7b1169da7, 2026-06-09). The Python Surrogate default is
off. The paper campaign passes --gp-hssvd false
(docs/orgmode/howto/gp_settings.org). The C API selects the solver with
gpr_model_set_hssvd_backend and the use_hssvd_backend field of
gpr_model_config_t (ABI 1.19, #267). Zero keeps the HS-SVD default
and GPR_HSSVD_BACKEND_CHOLESKY (2) selects Cholesky.
Use. See Use the HS-SVD solver. The flags are
--gp-hssvd, --gp-hssvd-dual-chop-tol, --gp-hssvd-dual-lapack-rrr and
--gp-hssvd-dual-randomized-sketch. The TOML table is [gp.hssvd].
Measured.
Conditioning: \(\mathrm{cond}(K)=6.4\times10^{13}\) becomes \(\mathrm{cond}(\Psi)=1.000\) (
3935d3973). On the real 01_hcn fixture, \(\mathrm{cond}(C)=1.2\times10^{6}\) becomes \(1.000000\) at rank 40 of 2925 (390995907).Agreement with a direct solve at \(\sigma^{2}=10^{-4}\): alpha \(2.0\times10^{-9}\), log determinant \(7.3\times10^{-10}\), posterior mean \(1.4\times10^{-10}\), variance \(5.8\times10^{-10}\) (
34930aee1).The dual route removes the primal eigendecomposition, which was “30 percent of the converged np=1 NEB wall on the Baker 01_hcn probe” (
2937db94f).One d016 split (PET-MAD-S, 1 rank, MAP): accurate calls 54.7 %, hyperparameter optimisation 44.4 %, prediction 0.1 %. Internal wall 4.916 s. The full table is on Where the time goes.
No head-to-head wall time of HS-SVD against the dense Cholesky on the same search is recorded.
Mode pruning and the randomized dual sketch¶
Measured, not adopted (85e5255e5, 2026-05-31).
Magnitude pruning “keeps ~all 2925 modes (tail/max=9.6e-6 >> 1e-13); the rank-39 collapse is Phi-column correlation, not eigenvalue size”. The option
mode_prune_rtolexists and its default stays 0.The randomized range finder speed-up is about \(n_{\mathrm{obs}}/l\): 0.65 times at \(n_{\mathrm{obs}}=96\) and 13.6 times at 2000. It is “neutral in the GP-NEB regime”. It stays as
--gp-hssvd-dual-randomized-sketch N(default 0). A cachegrind row gives 218509283 instructions for the randomized dual against 60287128 for the baseline at \(n=25\) (benchmark ledger).
Theta-skip and basis append¶
Status. The flag --theta-shift-skip-auto is on develop, opt-in. The
append function was later removed (2dee78c26). Measured, not adopted.
Measured. On d016 with PET-MAD at 1 rank, “GP-optimize 3.5s -> 14.0s under
–theta-shift-skip-auto”, “15 full factorizations / 0 appends”, and an
append that would win only 1.3 to 1.6 times on an eigensolve that is about 9
% of the wall (e43efef3e). The rank argument in that commit was corrected
later: rank 40 of 215 at 99.9 % of the energy (ffdc32831).
The d016 cut-and-revert series¶
The benchmark ledger marks a series of d016 arms as
screened, which means rejected. Examples: hssvd_image_hvp_secant failed the
parity envelope with 13 outer iterations in all trials;
prepared_full_hssvd_hvp rose to 24 evaluations and 5.86897 s;
hssvd_analytic_image_trial_reuse cut predict calls to 307 but the wall rose
to 6.99658, 7.83536 and 8.01313 s. The default dual eigensolver took 6.317 s
(standard deviation 0.385) against 4.916 s with RRR.
Noise, jitter and the condition floor¶
What it is. The posterior conditions on the likelihood variance plus the
jitter (totalPosteriorNoiseVariance). Every surface now has the same
defaults, since a1ecc7666 aligned the C API, Python and gprd with gprn.
Before it, the C API and Python used 1e-8 and 1e-5, and gprd used 1e-5
and 1e-7. Variances are in squared training energy units.
Surface |
|
|
|
Source |
|---|---|---|---|---|
C |
|
1e-4 |
1e-4 |
|
Python |
1e-4 |
1e-4 |
1e-4 |
|
|
1e-4 |
1e-4 |
1e-4 |
|
|
1e-4 |
1e-4 |
1e-4 |
|
gpr_model_init copies the config sigma2 into both gp_sigma2 and
sigma2. See Noise floor and variance
for the settings and a runnable check.
Why the driver floor is 1e-4. “The historical gprd dimer value 1e-5
collapses posterior max_var to ~1e-7 once NEB training grows past ~50 rows
under deterministic PET-MAD … Floor at 1e-4 (RMS ~0.01 eV/Angstrom)”
(source comment in main_neb.cpp; campaign 1517 had 22 of 24 runs end in
SIGTERM).
Condition-floored noise in the stable basis¶
What it is. A symmetric eigensolver has backward error
\(|\delta s^{2}|\le c\,n\,\varepsilon\,\|K\|_2\), so \(s^{2}+\sigma^{2}\) is
resolvable only when \(\sigma^{2}\) exceeds about \(n\varepsilon s_{\max}^{2}\).
The backend uses \(\sigma^{2}_{\mathrm{eff}}=\max(\sigma^{2},f)\) with
\(f=(s_{\max}^{2}-\kappa s_{\min}^{2})/(\kappa-1)\) and \(\kappa=1/(n\varepsilon)\)
(conditionFlooredSigma2 in gpr/ml/gp/StableBasis.cpp).
Status. On develop, default. There is no user setting.
Measured. The previous floor of \(\sqrt\varepsilon\,s_{\max}^{2}\approx1.5\times10^{-8}s_{\max}^{2}\)
put the training-row latent variance on the CuH2 fixture at 1.66 times the
explicit posterior and the LOO calibration at 2.15 against 1.0
(gpr/ml/gp/StableBasis.cpp; docs/theory/si_gp_operator_algebra.tex). With
the resolution floor both backends agree to \(10^{-6}\) relative. Related
fixes:
Commit |
Defect and size |
|---|---|
|
Variance inverted a different operator than the mean: median ratio 0.78, minimum 0.33. |
|
Joint covariance exceeded the Cauchy-Schwarz bound by a ratio of 1.04 at noise \(10^{-16}\). |
|
Variance ignored the jitter. The gap was 0.77 % at \(\sigma^{2}=10^{-4}\) and 47.5 % at \(10^{-6}\). |
|
The predictive convention now carries the likelihood variance at a training configuration. |
Principled nugget¶
A Marchildon-Zingg diagonal nugget bounds the condition number after Jacobi
scaling by \(\kappa_{\max}\), with \(\eta=N/(\kappa_{\max}-1)\). The default
\(\kappa_{\max}\) is \(1/\sqrt\varepsilon\), about \(6.7\times10^{7}\). It is on
by default in gprn (--principled-nugget, --kappa-max). An earlier
env-gated cap validated one Baker cell but “over-regularizes systems whose
WIDE spectrum is legitimate (vinyl-alcohol 14 regresses)” (25b007554).
Stable posterior variance and the variance interval¶
Status. Branch only. None of these is on develop.
Branch |
PR |
What it adds |
|---|---|---|
|
275, open |
Bordered Cholesky pivots and nonnegative eigenmode sums, flag |
|
249, open |
|
|
none found |
Interval at ABI 1.14 and |
|
251, closed |
Earlier series, replaced |
Why the series is off by default. “The default retains the historical
reductions because the stable variance changes search decisions in the
44-cell determinism gate.” The study that would promote it is not recorded.
The file it cites, bench/variance-floor-spec.md, does not exist in the
tree or on any of the five branches. The diff of the r3 branch against
develop is 29 files, 1797 insertions and 426 deletions.
On develop the floor can be inferred only from gpr_model_get_sigma2 and
gpr_model_get_jitter. A clamp sets a negative diagonal to zero when its size
is within \(\varepsilon\) times the prior value (d21542965).
Descriptor-blind variance floor¶
Not in the tree. The ledger records “blind-direction variance floor (prior + mean^2) gives z 1.29/1.01” and later “descriptor-blind = develop (no gain)” (2026-11-13 19:59). Do not document it as a feature.
Appends, warm refits and the factor cache¶
Technique |
Status |
Record |
|---|---|---|
Schur-border append of the factor |
on develop, default |
\(O(n^{2}k)\) against \(O(n^{3})\) for \(k\) new rows ( |
|
on develop, C API, ABI 1.13 |
Returns |
Factor reuse across variance, append, refit |
on develop, default |
Branch run: Cope loop 2.07 s to 1.94 s, counts unchanged (ledger 2026-11-13 14:07). |
Arrowhead append |
measured, not adopted |
At \(m=800\): 4.84 times faster at \(k=1\), 0.56 at \(k=8\), 0.09 at \(k=62\) ( |
L-BFGS warm-start record |
on develop, opt-in in |
Kept sessions took 26 evaluations against 13 cold, and cells flipped both ways ( |
Theta-skip |
on develop, opt-in |
|
Mixed precision and exact sums¶
On develop, default. The predict product is the compensated sum
(CompensatedSum.h). The classic Sexpat energy and force prefactor use the
exact Kulisch accumulator when the pair cutoff is 0 (ExactSum.h,
8c77198a8). tryCertifiedProduct accepts a rounded dot product only when
it lies within one binary64 rounding cell (227cd7caa).
On develop, opt-in. --predict-sum scheme1|scheme2|kernel_float selects an
Ozaki Scheme I or II product. --training-product-library scheme2:fp64|scheme2:int8|PATH
moves the covariance Cholesky, projections, solves and Gram products to an
Ozaki Scheme II engine. The C function is gpr_set_training_product.
Measured.
Scheme I at 64 and 96 terms matches the compensated contraction, both with zero error against a binary128 sum. The predict product stays compensated (
d513a28fb).Scheme II reproduces an mpmath result at 1400 digits (
7f016a2cb). It stays off because “this kernel would move the pipeline clock” (c7199c5da).With 56 bits the rounding error bound is half the worst case of an FP64 GEMM (
docs/training-products.md).Eight ranks with one A100 each, \(n=12500\): the factor takes 1.27 s with all products on the device, 1.29 s from a \(2^{24}\) threshold and 1.51 s from \(2^{27}\) (
a29c6dfb3).In 54 complete molecular searches on an A100, “the native CPU product gives the lowest complete-search times on all three reactions”, and the product provider changes the oracle count on two reactions (
docs/orgmode/howto/gpu.org). The per-search table is in an external repository.The script pair
scripts/mixed_precision_host.cand.cutimes half and bfloat16 dots. They are stand-alone and no output is recorded.
Priors¶
Prior |
Status |
Use and record |
|---|---|---|
Switched ZBL residual mean |
on develop, opt-in |
|
Bare ZBL mean |
measured, not adopted |
2.9 eV for H-C at 1.1 A and 3.4 eV for C-C at 1.5 A. The commit says 01_hcn “converged to bar 2.92 vs 2.16 with the bare mean” ( |
Teng Morse force-field mean |
on develop, opt-in |
|
Constant mean statistic |
on develop, opt-in |
|
Population prior on length scales |
on develop, opt-in |
|
Additive kernel candidate |
on develop, off by default |
Routing rows to it sent seven Baker bands over 120 s; 05_cyclopropyl spent 62 s in 37 fits ( |
Kernel algebra, multi-fidelity, gPoE |
branch only |
|
Uncertainty arms¶
The map arm is the default. laplace-slice samples the hyperparameter
posterior by slice sampling. laplace is the Rue et al. central-composite
mixture. PSIS and the delta method correct the Laplace arm. All are on
develop, opt-in: --uncertainty-mode, --use-psis-laplace,
--use-delta-method. The Python names are uncertainty set to
laplace, psis, use_delta and hyperparameters set to inla.
Measured. No number is recorded for the arms themselves. A fix to the INLA
box records that on a frozen-shell Si vacancy band “every INLA fit sat on it
… the surrogate then mispredicted measured forces by 10 to 55 eV/A”
(282764260). The nested-delta branch was measured and rejected:
“9 cells more than 2 search calls worse (h2co 52->176, formyloxyethyl 50->110,
oxirane 367->539); band GP/host 203->1072 s. Stays off” (ledger 2026-11-13
18:47). The laplace-slice arm costs about 100 Cholesky factorisations per
fit (gp_settings.org).
Derivative providers and curvature¶
What it is. gpr::derivatives::DerivativeProvider is a header-only C++
object that holds two callables, the Hessian and the Hessian-vector product
of a scalar energy. Three factories build one: an analytic provider from a
prepared Hessian action, a centered finite-difference provider from a
physical force, and an Enzyme provider that is a stub.
Status. On develop, built but unused. PR 264 (merge e944f60acc, two
commits: daa953cc9 and 5458686a9) added it with no C function, no Python
name and no flag. Only tests/gpr/derivatives/DerivativeProviderTest.cpp and
tests/gpr/quantum/GPMeanHessianTest.cpp use it. The meson option enzyme
(default disabled) probes for a toolchain, but the bridge returns an empty
provider and kEnzymeDerivativeProviderAvailable is false.
Use. See Derivative providers.
Measured. The commit bodies and PR text give no number. The tests derive
their tolerances from named safety factors, which are constants in the two
test files and not in the design note
(docs/design/derivative-provider.md, which describes the method only):
64 is
kRoundoffSafetyin`tests/gpr/derivatives/DerivativeProviderTest.cpp<../../../../tests/gpr/derivatives/DerivativeProviderTest.cpp>`_. The analytic Hessian uses \(64\,\varepsilon\lVert H\rVert_{\mathrm F}\). The finite-difference Hessian uses a Richardson comparison of the steps \(h\) and \(2h\), plus a force-roundoff floor:\[64\left(\frac{\lVert D(h)-D(2h)\rVert_{\mathrm F}}{3} + \frac{\varepsilon\lVert F(x)\rVert_2}{\min_j h_j}\right).\]Here \(h_j\) is the actual coordinate step. The action uses the same comparison with its directional step and multiplies its roundoff floor by \(\lVert v\rVert_2\). Thus both finite-difference checks have a Richardson comparison; the analytic action retains the analytic-Hessian tolerance multiplied by \(\lVert v\rVert_2\).
32 is
kFiniteDifferenceSafetyand 256 iskAlgebraSafety, both in`tests/gpr/quantum/GPMeanHessianTest.cpp<../../../../tests/gpr/quantum/GPMeanHessianTest.cpp>`_ (lines 15 and 16).The factor 32 multiplies a Richardson estimate and force-roundoff floor. Let \(D(h)\) be the finite-difference Hessian at the default relative step and \(D(2h)\) the result with the step doubled. With the stable Frobenius matrix norm, the result is
\[\mathrm{tol}_{\mathrm{fd}} = 32\left(\frac{\lVert D(h)-D(2h)\rVert_{\mathrm F}}{3} + \frac{\varepsilon\lVert F(q)\rVert_2}{\min_j h_j}\right).\]It bounds the analytic-minus-finite-difference Hessian. The action has its own Richardson comparison and uses \(32(\lVert A(h)-A(2h)\rVert_2/3 + \varepsilon\lVert F(q)\rVert_2\lVert v\rVert_2/h)\), where \(h\) is the directional step.
The factor 256 builds
algebra_toleranceas \(256\,\varepsilon\lVert Hv\rVert_2\), where \(Hv\) isfirst, the analytic Hessian action ondirection. It bounds \(\lVert H(2v)-2Hv\rVert_2\). The test separately checks that the analytic provider rejects a zero direction.
4 is
kMixedStencilSafetyin`tests/gpr/derivatives/DerivativeProviderTest.cpp<../../../../tests/gpr/derivatives/DerivativeProviderTest.cpp>`_, used by the mixed-direction anisotropic HVP test. Its tolerance adds the Richardson term, the force-roundoff floor and a coordinate-rounding term \(\lVert H\rVert_{\mathrm F}\lVert r\rVert_2\lVert v\rVert_2/\mathrm{sep}\), where \(r\) is the part of the representable displacement not along the direction, \(\lvert r_i\rvert\le(\varepsilon/2)(\lvert x_i^+\rvert+\lvert x_i^-\rvert+2h\lvert u_i\rvert)\), and sep is the displacement along the unit direction.
An earlier direct check of the same GP mean-Hessian action had a maximum
derivative error of \(2.36371\times10^{-7}\) and \(2.36053\times10^{-7}\) for the
isolated and periodic cases (docs/orgmode/explanation/line_integral_instanton.org).
Posterior-mean Hessian in the C API¶
On develop, default. gpr_model_predict_hessian takes the dense
posterior-mean Hessian from the first available source. An active posterior
whose terms are all exact assembles their matrices. Otherwise a MAP, EB or
Laplace-slice model with a prepared HS-SVD descriptor operator applies it to
the identity, before any exact MAP kernel is consulted; a failed apply returns
GPR_ERR_UNSUPPORTED and is not replaced. Without that operator, the matrix
is assembled from the columns of the prepared kernel action. For an
inverse-distance squared-exponential model, each column uses the
extended-precision contraction and pair-local radial blocks.
gpr_model_predict_hessian_action (ABI 1.8) and
gpr_model_predict_hessian_action_checked (ABI 1.12) apply the prepared
operator to one vector. On the HS-SVD and descriptor-predictor path,
prepareMeanHessianVectorHssvd precomputes weighted 3 by 3 Cartesian
pair-Hessian blocks (InverseDistanceDescriptor::computeWeightedHessianPairs)
once per query geometry so repeated Hessian-vector and Hessian-block actions
(applyMeanHessianBlockHssvd) contract the descriptor pullback curvature in
\(O(d_{\mathrm{feat}})\) per direction without rebuilding dense
\(d_{\mathrm{feat}}\times 3N_{\mathrm{mov}}\) directional Hessian matrices.
In the kernel operator layer, AdditivePairKernel, Pullback and Matern52
implement prepareMeanHessian and prepareMeanHessianVector (with analytic
prepareMean and meanHessianVector on Matern52). A kernel that prepares
an exact Hessian and then refuses it returns GPR_ERR_UNSUPPORTED rather
than a finite-difference stencil. A random-feature mean uses the exact
cosine-feature Hessian-vector product.
MeanHessianVectorIsExactAndMakesNoPredictions checks that product against
a Richardson difference and a frozen potential-call count. A mean with no
analytic contraction still uses a fourth-order central difference of the
posterior gradient.
The ledger describes a branch with HVP variance, curvature mean and variance
and a surface-functional variance (ABI 1.3 and 1.4, ledger 2026-11-12 and
2026-11-13). A handoff patch carries similar functions
(gpr_model_predict_hessian_action_variance). Neither is on develop.
AtomicDimer::directionalCurvatureUncertainty is on develop and is not
exposed outside the dimer.
Quantum-path library¶
Warning
Experimental instanton and quantum-path work in progress. These interfaces may change.
gpr/quantum/ holds about 100 headers and sources for instanton and
imaginary-time work: a GP-assisted fixed-energy line-integral NEB, compact
arcs, harmonic bath elimination, a Fredholm-determinant prefactor and a
first-order posterior response of the log rate. docs/orgmode/explanation/quantum_paths.org
and line_integral_instanton.org state that no gprn or gprd flag runs
it.
Measured. One cheap-potential run needs 1251 native evaluations for direct
LI-NEB against 37 and two fits for the GP-assisted search, a ratio of 33.8.
The wall times are 0.000266384 s and 0.351174431 s. “This measurement does
not establish a CPMD wall-time speedup.” The Krylov code in that tree is a
GMRES refinement with a reused GP preconditioner, opt-in through
PotentialPathOptions::nativeJacobianRefinement (default false).
Krylov and the dimer¶
On develop, default. The terminal dimer rotation keeps measured Hessian
directions in a Krylov subspace and checks each Ritz mode against an
endpoint force (9380a4aeb).
Measured, not adopted. Preconditioning the measured curvature probes with
the inverse absolute prior Hessian (85d5f2c58) was reverted (aad413c45).
No reason is recorded.
Branch only. A Krylov index certificate cut HCN from 43 to 31 calls but added 24 calls on other cells and was superseded by a certificate from rgmin eigenpairs (ledger 2026-11-13 12:53 and 2026-11-12 14:03). The branch commits are not in the tree.