HiGP: A high-performance Python package for Gaussian Process

Hua Huang, Tianshi Xu, Yuanzhe Xi, Edmond ChowarXiv 2025 · DOI

Abstract

Gaussian Processes (GPs) are powerful Bayesian models for non-parametric regression and uncertainty quantification, but their $O(n^3)$ computational complexity limits their application to large datasets. HiGP is a high-performance Python/C++ library designed to overcome these scaling challenges by optimizing the underlying numerical linear algebra. By utilizing hierarchical $\mathcal{H}^2$ matrices, specialized preconditioners, and hand-coded gradients, HiGP achieves near-linear complexity. Empirical results demonstrate that HiGP can outperform established frameworks like GPyTorch by up to two orders of magnitude on large-scale spatial problems, enabling efficient inference on datasets with over 150,000 points.

Introduction

Gaussian Processes (GPs) are considered a gold standard for non-parametric Bayesian modeling due to their ability to provide principled uncertainty estimates. However, they suffer from a significant computational bottleneck: standard GP operations, such as log-likelihood evaluation and predictive inference, scale cubically ($O(n^3)$) with the number of observations $n$.

While modern libraries like GPyTorch and GPflow have improved scalability through GPU acceleration and variational approximations, they often encounter performance walls with very large or ill-conditioned datasets. These frameworks typically prioritize modeling flexibility and seamless integration with automatic differentiation (autodiff) engines. This can come at the expense of the low-level numerical routines—specifically matrix-vector multiplications (MatVecs)—that dominate runtime in massive problems. HiGP aims to fill this gap by providing a hardware-efficient numerical core specifically tailored for high-scale GP inference.

Methods

HiGP distinguishes itself by focusing on high-performance C++ implementations of advanced linear algebra techniques, bypassing the overhead of high-level Python frameworks.

Hierarchical ($\mathcal{H}^2$) Matrices

For spatial datasets (typically 2D or 3D), HiGP compresses dense kernel matrices into an $\mathcal{H}^2$ representation. This hierarchical approach reduces both storage and computation costs from quadratic/cubic to near-linear ($O(n)$), making it feasible to model massive spatial fields.

On-the-Fly Evaluation

To handle high-dimensional data without exhausting system memory, HiGP employs an on-the-fly evaluation strategy. The library computes small kernel blocks as needed during computation and discards them immediately. This allows the processing of datasets that would otherwise not fit in RAM.

AFN Preconditioner

The library incorporates the Adaptive Factorized Nyström (AFN) preconditioner. This component ensures that iterative solvers, such as Preconditioned Conjugate Gradient (PCG), converge rapidly even when the underlying kernel matrices are poorly conditioned.

Hand-Coded Gradients

A key architectural choice in HiGP is the use of analytically derived, hand-coded gradients rather than relying on standard autodiff. This approach is significantly more efficient and numerically stable when calculating gradients through iterative solvers and complex preconditioners.

Experimental Results

The authors evaluated HiGP using a combination of real-world benchmarks from the UCI Machine Learning Repository (e.g., "Bike Sharing" and "3D Road Network") and synthetic functions (Rosenbrock, Rastrigin, and Branin) sampled at various dimensionalities.

Performance and Scalability

HiGP demonstrates massive speedups over state-of-the-art libraries. On the "Road3D" dataset with 50,000 points, HiGP completed the training task in 191.2 seconds, while GPyTorch required 14,739.3 seconds—representing a 77x speedup. Furthermore, HiGP successfully scaled to 150,000 points on the same dataset, whereas GPyTorch was unable to complete the task within the allocated computational budget.

Parallel Efficiency

The library shows strong parallel scaling on multi-core systems. On a 16-core machine, HiGP achieved speedups of approximately 11x for training and 10.7x for inference compared to single-core execution.

Accuracy

Despite the use of matrix compression and iterative approximations, HiGP maintains predictive accuracy (measured by RMSE) equivalent to or better than GPyTorch across the tested benchmarks.

Conclusion

The development of HiGP highlights that for extreme-scale Gaussian Processes, the primary bottleneck is the efficiency of the underlying MatVec "engine." By moving these operations to optimized C++ kernels and utilizing hierarchical matrix compression, HiGP enables GP modeling at scales previously unreachable for general-purpose libraries.

Currently, HiGP focuses on CPU-based shared-memory multithreading. While it integrates with the PyTorch ecosystem, future work may include extending the $\mathcal{H}^2$ kernels to support distributed-memory systems and native GPU acceleration. The benefits of $\mathcal{H}^2$ matrices are most pronounced for spatial datasets, while high-dimensional problems continue to benefit from the library's efficient on-the-fly evaluation and preconditioning strategies.

Summary updated

BibTeX
@misc{huang2025higp,
  author = {Hua Huang and Tianshi Xu and Yuanzhe Xi and Edmond Chow},
  title = {{HiGP: A high-performance Python package for Gaussian Process}},
  year = {2025},
  eprint = {2503.02259},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2503.02259},
}
Figure