GPyTorch: Blackbox Matrix-Matrix Gaussian Process Inference with GPU Acceleration

Jacob R. Gardner, Geoff Pleiss, Kilian Q. Weinberger, David Bindel, Andrew Gordon Wilson

Gaussian Processes (GPs) are widely considered the gold standard for probabilistic modeling due to their well-calibrated uncertainty estimates. However, they have historically lagged behind deep learning in scalability. The primary bottleneck is the Cholesky decomposition—a linear algebra operation required for exact GP inference that scales cubically, $O(n^3)$, with the number of data points. Doubling the dataset increases computation time eightfold. Furthermore, Cholesky decompositions parallelize poorly on modern GPUs and suffer from numerical instability, often forcing researchers to add artificial "jitter" to the data.

GPyTorch introduces a highly efficient framework that swaps these slow Cholesky decompositions for fast, GPU-accelerated matrix-matrix multiplications. By reducing the asymptotic complexity of exact GP inference and providing a "blackbox" interface, GPyTorch enables GPs to scale to massive datasets while remaining accessible to researchers.

Blackbox Matrix-Matrix (BBMM) Inference

The core innovation of GPyTorch is Blackbox Matrix-Matrix (BBMM) Inference. Instead of relying on explicit matrix decompositions, the framework leverages Matrix-Vector Multiplications (MVMs) and Matrix-Matrix Multiplications (MMMs)—operations highly optimized for GPU hardware.

Key components of this approach include:

  • Modified Batched Conjugate Gradients (mBCG): Standard Conjugate Gradients (CG) is an iterative method for solving linear systems. GPyTorch modifies it to handle multiple right-hand sides simultaneously. In a single call, mBCG computes the linear solves, estimates the log-determinant using a stochastic trace estimator, and calculates the gradients needed for training.
  • Pivoted Cholesky Preconditioning: To accelerate CG convergence, the authors use a low-rank approximation of the kernel matrix as a preconditioner. This drastically reduces the required iterations without sacrificing accuracy.
  • Decoupled Interface: GPyTorch treats the kernel matrix as a blackbox. As long as a user defines how to multiply the kernel by a matrix, the library automatically handles the underlying inference. This allows researchers to prototype complex models, like deep or multi-output GPs, in just a few lines of code.
mBCG achieves lower residual error in single precision than Cholesky.

Key Results and Performance

The authors evaluated GPyTorch across various standard regression benchmarks from the UCI Machine Learning Repository, ranging from small datasets (up to 3,500 points) for exact GPs to massive datasets (over 500,000 points) using approximations like Structured Kernel Interpolation (SKI).

Massive Speedups By reframing inference as a series of parallelizable matrix multiplications, GPyTorch unlocks the full potential of modern GPUs. For exact GPs, GPyTorch is up to 30x faster than standard CPU-based Cholesky implementations. When scaling to half a million points using the SKI approximation, the framework achieved a 15x speedup over previous state-of-the-art MVM methods.

GPyTorch demonstrates massive speedups across Exact GP, SGPR, and DKL+SKI models compared to CPU and GPU baselines.

Numerical Stability and Accuracy Surprisingly, the "approximate" iterative solves from mBCG often prove more robust than "exact" Cholesky solves. Because CG is less sensitive to the tiny eigenvalues that typically cause Cholesky to fail, GPyTorch achieves lower residual errors even when using single-precision (float32) arithmetic. This allows researchers to leverage faster, lower-precision hardware without degrading predictive performance.

Limitations and Future Work

While GPyTorch marks a significant leap forward for GP regression, the paper primarily focuses on Gaussian likelihoods. Although the authors note compatibility with variational techniques for non-Gaussian data (e.g., classification), detailed derivations for the Evidence Lower Bound (ELBO) are left for future work.

Additionally, theoretical guarantees for the preconditioner's convergence are currently limited to univariate RBF kernels, leaving room to explore more complex, multivariate, or non-stationary kernels. Finally, while reducing complexity to $O(n^2)$ is a major improvement, scaling to true "Big Data" regimes still requires further approximations like SKI.

Summary updated

BibTeX
@inproceedings{gardner2018gpytorch,
  author = {Jacob R. Gardner and Geoff Pleiss and Kilian Q. Weinberger and David Bindel and Andrew Gordon Wilson},
  title = {{GPyTorch: Blackbox Matrix-Matrix Gaussian Process Inference with GPU Acceleration}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2018},
}
Figure