Set the noise floor and keep the variance stable

The posterior of a GP conditions on a covariance \(K + (\sigma^2 + \delta)I\). Here \(\sigma^2\) is the likelihood variance and \(\delta\) a numerical jitter. Both are in squared training-energy units. This guide lists the defaults of every interface, shows that the predictive variance stays finite and non-negative as the noise shrinks toward the resolution of double precision, and says which stabilisation work is on develop and which is not.

Status: implemented. The noise settings and the condition floor are always on. The principled nugget is on by default in gprn. The stable posterior variance series and the variance interval are on open branches, not on develop. Methods: numerics has the record behind each statement.

The defaults by interface

Interface

gp_sigma2

sigma2

jitter_sigma2

Where to set it

C gpr_model_config_defaults()

sigma2

1e-4

1e-4

gpr_model_config_t.sigma2, .jitter_sigma2

Python default_gpr_parameters()

1e-4

1e-4

1e-4

GaussianProcess(gpr_params={...})

gprn driver

1e-4

1e-4

1e-4

TOML [gp] gp_sigma2, noise_sigma2, jitter_sigma2

gprd driver

1e-4

1e-4

1e-4

applyGprdDimerDefaults

Sources: gpr/capi/gpridge_c.cpp, python/gpridge/_api.py, main_neb.cpp and gpr/ParameterDefaults.cpp. In the C API gpr_model_init copies sigma2 into both gp_sigma2 and sigma2. The hyperparameter fit keeps the noise fixed unless --gp-learn-noise true is given. Every interface now starts from the same values. Before commit a1ecc7666 (“align default options with gprn”) the C API and Python used 1e-8 for the variance and 1e-5 for the jitter, and gprd used 1e-5 and 1e-7, so an older release or an older script can still run with a different noise (GP settings).

At run time gpr_model_get_sigma2, gpr_model_get_jitter and gpr_model_set_sigma2 read and change them. gpr_model_set_sigma2 takes a positive, finite value and refreshes a trained model. Anything else returns GPR_ERR_INVALID_ARG. The jitter has no setter after initialisation.

The floor is 1e-4 for a recorded reason, written when the gprd value was still 1e-5: “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 (force_noise=0), trapping GP-OIE in posterior_unresolved thrash on Baker cells (campaign 1517: 22/24 SIGTERM with plateaued max_oracle_F).” (source comment in main_neb.cpp). A noise of 1e-4 corresponds to an RMS of about 0.01 eV/Angstrom.

Check the variance as the noise shrinks

The program trains the same two-atom Lennard-Jones model three times, on eight separations that include a near-duplicate pair (1.05 and 1.0500001). The only change between runs is the likelihood variance: 1e-4, 1e-8 and 1e-14. After each run it scans 60 query separations and reads the energy and the gradient variances. It counts every variance that is negative or not finite and reports the smallest and the largest energy variance. The variance convention is the default, predictive, so the likelihood variance is part of it.

#include <gpr/capi/gpridge_c.h>
#include <math.h>
#include <stdio.h>
#include <string.h>

#define N_COORDS 6
#define N_OBS 8
#define N_QUERY 60

static int scan(double sigma2)
{
    const double separation[N_OBS] = {0.95, 1.05, 1.0500001, 1.15,
                                      1.3,  1.5,  1.8,       2.2};
    double R[N_OBS * N_COORDS], E[N_OBS], G[N_OBS * N_COORDS];
    double lowest = INFINITY, highest = -INFINITY;
    int i, q, bad = 0;
    gpr_atoms_t atoms = gpr_atoms_create_simple(2);
    gpr_model_t model = gpr_model_create(GPR_MODEL_GP);
    gpr_model_config_t config = gpr_model_config_defaults();

    config.report_level = 0;
    config.sigma2 = sigma2;
    config.jitter_sigma2 = 1e-14;
    if (!atoms || !model) return -1;
    if (gpr_model_init(model, &config, atoms) != GPR_SUCCESS) return -1;
    for (i = 0; i < N_OBS; ++i) {
        memset(R + i * N_COORDS, 0, N_COORDS * sizeof *R);
        R[i * N_COORDS + 3] = separation[i];
        gpr_potential_lj(R + i * N_COORDS, 2, 1.0, 1.0, E + i,
                         G + i * N_COORDS);
    }
    if (gpr_model_train_checked(model, R, N_OBS * N_COORDS, E, N_OBS, G,
                                N_OBS * N_COORDS, N_OBS, N_COORDS))
        return -1;
    for (q = 0; q < N_QUERY; ++q) {
        double x[N_COORDS] = {0}, energy_variance, gradient_variance[N_COORDS];
        x[3] = 0.9 + 0.025 * q;
        if (gpr_model_predict_variance_checked(model, x, N_COORDS,
                                               &energy_variance,
                                               gradient_variance, N_COORDS,
                                               N_COORDS))
            return -1;
        if (!isfinite(energy_variance) || energy_variance < 0.0) ++bad;
        for (i = 0; i < N_COORDS; ++i)
            if (!isfinite(gradient_variance[i]) || gradient_variance[i] < 0.0)
                ++bad;
        if (energy_variance < lowest) lowest = energy_variance;
        if (energy_variance > highest) highest = energy_variance;
    }
    printf("sigma2 %.0e: bad values %d, energy variance from %.2e to %.2e\n",
           sigma2, bad, lowest, highest);
    gpr_model_destroy(model);
    gpr_atoms_destroy(atoms);
    return bad;
}

int main(void)
{
    const double sigma2[3] = {1e-4, 1e-8, 1e-14};
    int k;
    for (k = 0; k < 3; ++k)
        if (scan(sigma2[k]) != 0) return 1;
    printf("variance stayed finite and non-negative\n");
    return 0;
}
sigma2 1e-04: bad values 0, energy variance from <s> to <s>
sigma2 1e-08: bad values 0, energy variance from <s> to <s>
sigma2 1e-14: bad values 0, energy variance from <s> to <s>
variance stayed finite and non-negative

The lowest variance follows the noise while the noise is resolvable: 1.1e-4 for 1e-4, and 1.2e-8 for 1e-8. At 1e-14 it is 1.8e-12, well above the likelihood variance. That is consistent with the floor described below, but this run does not isolate it, and the figures depend on the platform. The assertion that matters is the count of bad values, which is 0.

The condition floor

In the stable-basis solver every formula contains \((K+\sigma^2 I)^{-1}\). A symmetric eigensolver has backward error \(|\delta s^2| \le c\,n\,\varepsilon\,\|K\|_2\), so \(s^2+\sigma^2\) is resolved only if \(\sigma^2\) exceeds about \(n\varepsilon\, s^2_{\max}\). The backend therefore uses \(\sigma^2_{\mathrm{eff}} = \max(\sigma^2, f)\), where \(f \approx n\varepsilon\, s^2_{\max}\) when the discarded complement has \(s^2_{\min}=0\) (gpr/ml/gp/StableBasis.cpp). It is on by default and has no user setting.

The record behind it:

  • The earlier floor was \(\sqrt{\varepsilon}\,s^2_{\max}\), about \(1.5\times10^{-8}\,s^2_{\max}\). On the two-geometry CuH_2 fixture at \(\sigma^2=10^{-8}\) it put the dual training-row latent variance at 1.66 times the exact posterior and the leave-one-out calibration at 2.15 against 1.0 on the dense factor (gpr/ml/gp/StableBasis.cpp comment).

  • Commit e3985ab45: the variance inverted a different operator than the mean, “making the reported variance systematically smaller than the mean-consistent variance whenever the floor is active (median ratio 0.78, min 0.33 in the numerical check)”.

  • Commit 8d5ee6d6c: before the fix, “the joint covariance of a training channel and a nearby query exceeds the Cauchy-Schwarz bound (ratio 1.04 at noise 1e-16 on the rank-13 dual basis of the two-atom fixture)”.

  • Commit f72632ba9: the variance now conditions on \(\sigma^2+\delta\). On a diatomic fixture with a jitter of 1e-6, the old variance fell short of the dense one “0.77% at a query” at a likelihood variance of 1e-4 and “47.5%” at 1e-6. The test is HssvdVarianceConditionsOnTheJitter.

  • The rank cut. The legacy 1e-13 relative cutoff sat at the double precision noise floor, so the number of kept modes changed with the BLAS thread count, “system 16: barrier 0.99 at BLAS<=2 vs 0.166 at BLAS=4” (gpr/ml/gp/Decompose.cpp comment). The cut is now at the chop tolerance, 1e-6 by default.

The principled nugget

The Marchildon-Zingg nugget adds \(\eta = N/(\kappa_{\max}-1)\) to the diagonal, with \(N=n_x(d+1)\), so the condition number after Jacobi scaling is at most \(\kappa_{\max}\). The default is \(1/\sqrt{\varepsilon}\), about \(6.7\times10^{7}\). It is on by default in gprn (--principled-nugget, --kappa-max, TOML [gp] principled_nugget, kappa_max). The C++ member default is off, and neither the Python class nor the C API turns it on. An earlier cap, validated on one Baker cell, “over-regularizes systems whose WIDE spectrum is legitimate (vinyl-alcohol 14 regresses)” (commit 25b007554), which is why the present nugget is a separate design.

What is not on develop

None of these is in the tree. Do not look for their flags.

  • --stable-posterior-variance (pull request 275, open, branch fix/stable-posterior-variance-r3): bordered Cholesky pivots and non-negative eigenmode sums. The record says the default stays off because the stable variance “changes search decisions in the 44-cell determinism gate”. No study that would promote it is recorded.

  • gpr_model_predict_energy_variance_interval (pull request 249, open) and the noise-floor report of feat/interval-floor-v2. Both claim ABI minors that develop has since used.

  • A descriptor-blind variance floor appears only in the ledger, with “no gain” against develop (2026-11-13 19:59).

Choose a value

  • Keep the interface default unless a search stalls on an unresolved variance. The recorded failure of a too small noise is a posterior variance that collapses and a search that waits on it. The recorded fix was to raise the floor to 1e-4 in gprn.

  • Raise sigma2 for noisy oracles. Lower it only to the point where the variance still reads as above. The floor protects the arithmetic, not the physics.

  • Compare backends with --gp-hssvd false when a variance looks wrong. The Cholesky path with a jitter is the reference that the HS-SVD tests agree with (HS-SVD).