arXiv:2610.16861cs.LGOct 2026

Manuscript Offprint

arXiv:2610.16861

GpFlash: Maximizing Speed and Minimizing Memory for Gaussian Process Training and Prediction

Andre Marchildon

Abstract

This paper presents GpFlash, a Gaussian process library that is focused on fast training and posterior evaluations, minimal memory usage, and scalability to high-dimensional problems. GpFlash was compared to the popular GP libraries scikit-learn, GPy, GPflow, GPyTorch, and SMT on a MacBook Pro and the supercomputer Trillium. GpFlash was found to use less memory and to be faster for training and posterior evaluations relative to the other GP libraries for all cases considered. For example, when using nx=104n_x = 10^4 training points in a 10-dimensional space GpFlash required 9.6 to 35 times less memory and was 2.6 to 54 times faster than the other GP libraries for the evaluation of the marginal log likelihood and its gradient. The memory reduction was achieved by only using one matrix of size nx×nxn_x \times n_x to store different symmetric matrices in its lower and upper triangular entries. The computational speedup was the result of designing algorithms to access memory efficiently, using BLAS and LAPACK methods extensively, and factoring kernel equations so that expensive exponential calculations could be reused. GpFlash was more than 440 times faster than all of the other GP libraries considered when evaluating the posterior mean together with its gradient for the case with 10410^4 training points and 10 dimensions. GpFlash is available at https://github.com/marchildon/gpflash.

Keywords: Gaussian process, surrogate modeling, computational efficiency, memory efficiency, hyperparameter optimization, BLAS

1^{1}This work was conducted independently of Amazon.com, Inc. The views expressed are solely those of the author and do not represent Amazon or its affiliates. No Amazon proprietary data or systems were used.

1. Introduction

Gaussian processes (GPs) are a popular surrogate method that can quantify the uncertainty in their predictions [1]. A strength of GPs is the wide range of data that they can use, which includes noisy data [2, 3] and also gradients [4, 5, 6, 7]. A common application of GPs is Bayesian optimization, usually global optimization [8, 9], but also local optimization [10, 11], and nonlinearly constrained optimization [12, 13, 14].

It is important to select the hyperparameters of a GP carefully in order to have an accurate posterior surrogate [1]. The most popular method for hyperparameter tuning is to maximize the marginal log likelihood, which can be done without gradients [15, 16], but it is generally done with a gradient-based optimizer since this requires fewer iterations [17, 18]. A significant challenge of using GPs with a large number of training points, nxn_x, is that their memory and training costs scale as O(nx2)\mathcal{O}(n_x^2) and O(nx3)\mathcal{O}(n_x^3), respectively [1].

Approximation methods for the calculation of the marginal log likelihood and its gradient have been developed to address the high training cost of GPs [19, 20]. These involve approximating the logarithm of the determinant of a symmetric positive definite matrix [21]. The drawback is that these methods only approximate the marginal log likelihood and its gradient [22], and most gradient-based optimizers struggle with inexact gradients [23, 24].

GPUs can also accelerate the O(nx3)\mathcal{O}(n_{x}^{3}) computations [25, 26], but they are not as widely available as CPUs. For example, the GPUs on MacBooks with M chips are limited to single precision, which is generally insufficient since GPs often have matrices that are significantly ill-conditioned [27, 28].

This paper develops algorithms that are faster and use less memory to evaluate the marginal log likelihood and its gradient exactly on CPUs compared to existing GP libraries. Together they form the open-source library GpFlash: Gaussian Process – Fast Likelihood, Analytic, Storage-efficient, and High-dimensional. GpFlash is compared to the GP libraries scikit-learn [29], GPy [30], GPflow [31], GPyTorch [26], and SMT [32]. GpFlash was found to be the fastest for both training and posterior evaluations.

Sections 2 and 3 present the notation and an overview of GPs. Sections 4, 5, and 6 show how to efficiently evaluate the kernel function, the marginal log likelihood, and the posterior evaluations, respectively. Section 7 details the benchmarking methodology before Sections 8 and 9 cover the training studies and library comparisons, respectively. Section 10 covers the posterior evaluations and Section 11 presents the conclusions.

References (32)