Conjugate Gradients for Kernel Machines

Simon Bartels, Philipp Hennig

TL;DR

Kernel Machine Conjugate Gradients (KMCG) reimagines conjugate gradients through the lens of probabilistic numerics by treating the kernel itself as an unknown function to be inferred. By using search directions from conjugate gradients to learn a structured, low-rank approximation of the kernel, KMCG provides closed-form predictive means, variances, and marginal likelihood estimates that outperform traditional CG and excel on structured, large-scale datasets.

What Problem Does This Paper Address?

Exact Gaussian Process (GP) and kernel ridge regression scale cubically ($\mathcal{O}(N^3)$) with dataset size $N$ due to the inversion of the kernel matrix $(K + \sigma^2 I)$. While sparse inducing-point approximations (like FITC and VFE) reduce this cost to $\mathcal{O}(NM^2)$, they require pre-specifying fixed inducing points.

Iterative linear solvers like Conjugate Gradients (CG) provide adaptive stopping criteria, but they typically only compute a point estimate for the regression weights $(K + \sigma^2 I)^{-1}y$. Standard CG cannot naturally yield predictive uncertainties or log-marginal likelihoods without repeated, expensive runs. Furthermore, naive linear solver estimates often behave erratically when evaluated on out-of-sample test inputs.

Methods

The authors address these shortcomings by framing kernel approximation as a Bayesian inference problem (a core principle of probabilistic numerics):

  • Structured Gaussian Process Prior Over Kernels: A zero-mean GP prior $k \sim \mathcal{GP}(0, \gamma \psi)$ is placed directly on the bivariate kernel function. The covariance $\psi$ uses a symmetric Kronecker product structure, ensuring that sampled matrices remain symmetric and the posterior kernel mean remains guaranteed positive semi-definite.
  • Conjugate Gradients as Linear Projections: Instead of using CG merely to solve for regression coefficients, the algorithm runs CG on $K\alpha = y$ (without observation noise) and collects the search directions $S = [s_1, \dots, s_P]$ as projection observations.
  • Closed-Form Finite-Rank Kernel: The posterior mean kernel $\hat{k}_M$ forms an explicit low-rank factorization of rank $P$. Substituting $\hat{k}_M$ into standard GP equations yields analytic expressions for the predictive mean, posterior covariance, and log-marginal likelihood.
  • Theoretical Unification: The authors prove that existing approximation schemes—such as the Subset of Regressors (SoR) and the Projected Bayes Regressor—are exact special cases of this prior/likelihood framework under specific projection choices.

Datasets

The authors evaluated KMCG across three distinct settings:

  1. Standard UCI Benchmarks: Seven standard regression benchmarks: ABALONE ($N=2088$), PRECIPITATION ($N=2888$), PUMADYN ($N=4096$), MPG ($N=196$), POLETELECOMM ($N=7499$), ELEVATORS ($N=8299$), and AILERONS ($N=6874$).
  2. Synthetic Toy & Grid Datasets: A 1D toy dataset ($N=200$, introduced in this work using a Gaussian mixture/uniform input distribution) and multi-dimensional grid problems in 2D ($10 \times 10$ and $1000 \times 1000$), 3D ($100 \times 100 \times 100$), and 4D ($30 \times 30 \times 30 \times 30$).
  3. Natural Sound Modeling: The SOUND time-series regression benchmark ($N=59,309, D=1$), featuring missing audio regions on an equidistant grid where Toeplitz structure permits fast linear-time matrix-vector multiplications.

Key Insights and Ideas

  • Inference Over the Operator, Not the Weights: Instead of using iterative linear solvers merely to produce a vector output, KMCG uses the solver's computational history to learn a valid kernel function.
  • Consistent Kernel Replacement: Replacing the kernel in both train and test locations ensures well-calibrated out-of-sample predictions and prevents negative predictive variances (a known failure mode of Nyström-style approximations).
  • Rigorous Error Bounds: The authors prove that the relative squared estimation error $(k - k_M)^2$ divided by the posterior variance $\psi_M$ is strictly bounded from above by 2.
  • Fast Operators Unlock Massive Speedups: When matrix-vector products (MVMs) are cheap (e.g., $\mathcal{O}(N)$ or near-linear via Kronecker or Toeplitz structures), KMCG can afford many iterations, fundamentally shifting the trade-off compared to inducing-point methods.

Key Results

  • Grid and Structured Problems: On the multi-dimensional grid experiments and the $N \approx 59,300$ SOUND benchmark, KMCG drastically outperformed inducing-point baselines (VFE and FITC). It achieved useful posterior mean approximations within 100 CG steps where baselines plateaued or required substantially more runtime.
  • Dense Benchmark Convergence: On standard unstructured benchmarks, KMCG converged to low relative errors in fewer iterations than standard CG and showed steady per-step error reduction.
  • Predictive Variance & Evidence: KMCG successfully computes variance and marginal likelihood in a single solver run, whereas classical CG cannot do so directly.

Limitations and Future Work

  • Numerical Instability in Vanilla CG: Textbook conjugate gradients suffered from loss of orthogonality, causing subsequent Cholesky decompositions of $S^\top K S$ to fail after few steps. The authors had to rely on full reorthogonalization, which carries extra computational overhead.
  • Dense Matrix Wall-Clock Trade-Offs: On general dense datasets where MVMs cost $\mathcal{O}(N^2)$, inducing-point baselines ran faster in raw wall-clock time because block-matrix multiplications are far better optimized on modern hardware than looped MVMs.
  • Evidence Calibration: For the log-marginal likelihood, KMCG approximates the quadratic term more effectively than the log-determinant, which can cause the evidence estimate to overshoot in later iterations.
  • Extending the Framework: Incorporating Fully Independent Conditional (FIC) approximations into this probabilistic numerics framework remains an open challenge.

Summary updated

BibTeX
@article{bartels2020conjugate,
  author = {Simon Bartels and Philipp Hennig},
  title = {{Conjugate Gradients for Kernel Machines}},
  journal = {J. Mach. Learn. Res.},
  year = {2020},
  url = {https://openreview.net/forum?id=gSf7iX8Fwt},
}
Figure