Sampling from Gaussian Process Posteriors using Stochastic Gradient Descent

Jihao Andreas Lin, Javier Antoran, Shreyas Padhy, David Janz, José Miguel Hernández-Lobato, Alexander Terenin

Abstract

Gaussian Processes (GPs) are widely regarded as the gold standard for uncertainty quantification in machine learning. However, their practical application is often hindered by a cubic computational complexity ($O(N^3)$) relative to the number of data points. While iterative solvers like Conjugate Gradient (CG) and approximation methods like Inducing Points (SVGP) have been developed to mitigate this, they often struggle with numerical instability or loss of fine-grained detail. In their NeurIPS 2023 paper, "Sampling from Gaussian Process Posteriors using Stochastic Gradient Descent," Lin et al. propose a novel framework that leverages Stochastic Gradient Descent (SGD) for GP posterior sampling. By framing inference as a quadratic optimization problem, the authors demonstrate that SGD achieves linear or even sub-linear scaling while exhibiting a "benign non-convergence" property that naturally captures the most relevant data structures.

Introduction

The primary bottleneck in Gaussian Process regression is the requirement to solve a linear system involving a kernel matrix. For a dataset of size $N$, exact methods like Cholesky decomposition require $O(N^3)$ time and $O(N^2)$ memory, rendering them impractical for the million-scale datasets common in modern applications. Traditional alternatives face significant trade-offs: SVGP methods reduce costs but may fail to capture complex local behaviors if the number of inducing points is insufficient, while CG solvers are notoriously sensitive to "ill-conditioned" matrices—scenarios where data points are clustered closely together, causing the solver to stall or fail.

Lin et al. address these challenges by introducing a sampling-based approach using SGD. While SGD is the standard for training deep neural networks, its application to GP inference has been limited. This research shows that SGD not only overcomes the scalability issues of exact methods but also provides superior stability compared to other iterative solvers.

Methodology

The core of the proposed method is the reformulation of GP posterior sampling as a quadratic optimization problem. Using pathwise conditioning, a posterior sample is expressed as a combination of a prior sample and a data-dependent correction term.

Stochastic Objectives and RFF

To make the optimization objective computable in $O(N)$ time, the authors utilize Random Fourier Features (RFF) to approximate the kernel regularizer. This allows the objective to be estimated using minibatches of both data and spectral features. To further improve efficiency, they introduced a variance reduction trick by shifting the likelihood noise term into the regularizer. This preserves the optimal solution while significantly reducing gradient noise, leading to faster and more stable convergence.

Scaling to Massive Datasets

For datasets reaching the multi-million point range, the authors extended the method to incorporate inducing points. This variant reduces the number of learnable parameters from the dataset size $N$ to the number of inducing points $M$, enabling sub-linear scaling without the typical stability issues associated with variational GP approximations.

Theoretical Insights: Benign Non-Convergence

A key contribution of the paper is the analysis of SGD’s "implicit bias" in the context of GPs. The authors identify several critical properties:

  1. Spectral Bias: SGD converges fastest along the top eigenvectors of the kernel matrix. These eigenvectors correspond to the large-scale structures and regions where data is most dense.
  2. Benign Non-convergence: Unlike exact solvers, SGD does not need to reach the global optimum to be useful. Because it captures the most important components of the data first, early-stopped SGD provides high-quality interpolations.
  3. Automatic Extrapolation: In regions far from the training data (the "tail" of the eigenvalues), SGD converges slowly. Because the optimization is typically initialized at zero, the model naturally reverts to the GP prior in unknown regions—a highly desirable trait for robust uncertainty quantification.
  4. Numerical Robustness: SGD is mathematically more robust to ill-conditioning than Conjugate Gradient. When data points are nearly identical, CG often fails to converge, whereas SGD remains stable because it does not attempt to invert the smallest, noise-dominated eigenvalues.

Experimental Results

The researchers evaluated the SGD-GP approach across several benchmarks, including UCI regression datasets and large-scale Bayesian Optimization tasks.

  • Large-Scale Performance: On the HouseElectric dataset ($N=2,000,000$), SGD achieved significantly better Negative Log-Likelihood (NLL) than Conjugate Gradient. While CG struggled to converge within the allocated time budget, SGD provided reliable posterior samples efficiently.
  • Computational Efficiency: The inducing point version of the SGD solver matched the performance of the standard SGD approach on 2M points while being an order of magnitude faster, demonstrating the effectiveness of the sub-linear scaling strategy.
  • Bayesian Optimization: In a Thompson Sampling task on an 8D synthetic function, SGD-GP provided uncertainty estimates that were as effective as exact methods but at a fraction of the compute cost, leading to superior optimization progress per unit of time.
  • Stability in Low-Noise Regimes: In tests with very low observation noise (high ill-conditioning), CG's error increased dramatically. In contrast, SGD's performance remained virtually unchanged, confirming its utility for high-precision tasks.

Conclusion and Future Work

Lin et al. demonstrate that SGD is a powerful, scalable, and robust tool for Gaussian Process inference. By embracing the spectral bias of stochastic gradients, the method provides a natural way to handle massive datasets that were previously inaccessible to GPs.

Future research directions include extending the stochastic regularizer to support non-stationary kernels, as the current RFF-based approach is limited to stationary kernels like RBF or Matérn. Additionally, while this work focuses on inference with fixed hyperparameters, integrating SGD-based hyperparameter learning directly into the sampling scheme remains a promising avenue for creating a fully end-to-end stochastic GP framework.

Summary updated

BibTeX
@inproceedings{lin2023sampling,
  author = {Jihao Andreas Lin and Javier Antoran and Shreyas Padhy and David Janz and José Miguel Hernández-Lobato and Alexander Terenin},
  title = {{Sampling from Gaussian Process Posteriors using Stochastic Gradient Descent}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=Sf9goJtTCE},
}
Figure