Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Gauss-Newton inference for non-conjugate GPs

Gauss-Newton runs the same Newton iteration as Laplace but with a strictly-positive lower bound (a “PSD floor”) on the diagonal site precision:

Λn=max⁡ ⁣(−∂2log⁡p(yn∣fn)∂fn2, τ)\Lambda_n = \max\!\left(-\frac{\partial^2 \log p(y_n \mid f_n)}{\partial f_n^2}, \, \tau\right)

where τ>0\tau > 0 is the floor. The two strategies differ only in that floor’s default value — Laplace floors at 10-6, GN floors at 10-3. Everything else is identical.

Why the floor matters. For log-concave likelihoods (Bernoulli, Poisson) the negative Hessian is positive everywhere, so neither floor bites and GN ≡ Laplace exactly.

For non-log-concave likelihoods — StudentT, mixture-of-Gaussians, anything with heavy tails — the Hessian becomes positive in the tails:

∂2∂f2log⁡pStudentT(y∣f,ν,σ)=(ν+1)((y−f)2−νσ2)(νσ2+(y−f)2)2\frac{\partial^2}{\partial f^2} \log p_{\text{StudentT}}(y \mid f, \nu, \sigma) = \frac{(\nu+1)((y-f)^2 - \nu \sigma^2)}{(\nu \sigma^2 + (y-f)^2)^2}

which is positive whenever ∣y−f∣2>νσ2|y-f|^2 > \nu \sigma^2 (residual “big enough that the heavy tail kicks in”). At those points −hn<0-h_n < 0. Both Laplace and GN catch this with the floor; GN’s larger floor is just a more conservative safety belt.

What this notebook shows: two regimes of GP-Laplace-style inference. In both, GN and Laplace converge to the same posterior — the floor difference is invisible at convergence. The honest answer to “when do you pick GN over Laplace?” is almost never; pick GN if you want the larger floor as a safety habit, otherwise stick with Laplace. The real cost in non-log-concave problems is the damping parameter, not the floor.

/home/azureuser/localfiles/pyrox/.venv/lib/python3.13/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
  from .autonotebook import tqdm as notebook_tqdm

Regime 1 — Bernoulli classification (log-concave)

Same setup as the Laplace notebook. We expect GN and Laplace to match: the Bernoulli Hessian −σ(f)(1−σ(f))-\sigma(f)(1-\sigma(f)) is always negative, so the floor τ never bites.

Laplace        iters=6  log_marg=-25.6915
Gauss-Newton   iters=6  log_marg=-25.6915
max |q_mean diff|: 0.00e+00
max |q_var diff|:  0.00e+00

Identical posteriors to ~ float32 noise. Diagnostic plot of the per-point site precisions confirms the regimes match.

<Figure size 770x330 with 1 Axes>

Regime 2 — StudentT regression with outliers (non-log-concave)

Here the Hessian goes positive at points where the residual ∣y−f∣|y-f| is large. Two outliers are planted in an otherwise-clean sinusoid.

Laplace         iters= 35  conv=True  log_marg=-29.481
Gauss-Newton    iters= 35  conv=True  log_marg=-29.481

Inspect the signed per-point Hessian at convergence — values where −hn<0-h_n < 0 are where Laplace would float its precision down to the floor and GN bumps it up to τ=10−3\tau = 10^{-3}. The outlier points are exactly where the two strategies differ.

<Figure size 1210x385 with 2 Axes>

At the two outlier locations, the raw −h-h goes negative — these points are in the heavy-tail regime, where the StudentT log-likelihood is concave-up (positive curvature), so Newton’s exact-Hessian step would be ill-defined. Both strategies floor the precision at outliers; GN’s larger default floor leaves a more obvious “step up” pattern.

Predictive consequences

At convergence the two posteriors are essentially identical — the floor doesn’t bite when both strategies have damped their way to the same fixed point.

<Figure size 1210x396 with 2 Axes>
<Figure size 880x330 with 1 Axes>

Summary

  • Bernoulli (log-concave): GN ≡ Laplace to numerical precision. The floor is never reached.
  • StudentT (non-log-concave): the negative Hessian does go negative at outlier locations, but both strategies catch it — Laplace’s 10-6 floor and GN’s 10-3 floor both clip those points to a positive precision. The two strategies converge to the same posterior; the difference between the floors only affects intermediate iterates, not the fixed point.
  • The real lever for non-log-concave problems is damping, not the floor. Pure Newton (damping=1.0) oscillates on StudentT-with-outliers; we set damping=0.3 and both strategies converge in ~35 iterations.

Practical guidance:

  • On log-concave likelihoods (Bernoulli, Poisson): use Laplace. GN gives the same answer at the same cost.
  • On non-log-concave likelihoods (StudentT, mixture, etc.): use Laplace with damping ∈ [0.3, 0.7] as the first attempt; switch to GN only if you specifically prefer the more conservative floor for numerical safety. The two strategies will give virtually identical answers when both converge.
  • The much bigger story in non-log-concave inference is moment matching (EP) and statistical linearization (PL) — they give different posteriors, not just different numerical paths. See those notebooks.

Both strategies share the same API:

cond = prior.condition_nongauss(StudentTLikelihood(df=3, scale=0.3), y,
                                strategy=GaussNewtonInference(damping=0.3))