arXiv:2605.17898cs.LG2026-05

轻量级高斯过程库,用C+++金属和CUDA实现超快推理。

Lightweight Gaussian Process Inference in C++ on Metal and CUDA

  • 纯C++17编写,支持金属和CUDA,无外部依赖
  • 在苹果M4上比GPyTorch快2.6至8.7倍,显存占用仅线性增长
  • 适合需要低延迟、高并发的工业级高斯过程应用

高斯过程(GP)在Python中通常依赖于如GPyTorch和GPflow等深度学习框架构建的库,这些库继承了调度开销和依赖臃肿的问题。本文提出LightGP,一个不依赖外部库的C++17库,用于高斯过程回归,并提供Python绑定,支持Apple Metal与NVIDIA CUDA后端,以及通过Apple Accelerate和OpenBLAS优化的CPU路径。LightGP提供四种推断路径:精确的Cholesky分解、免矩阵共轭梯度、稀疏变分自由能和基于FFT的结构化核插值(SKI),覆盖从$N=100$到$N=500{,}000$的问题规模。在搭载Apple M4的设备上,LightGP CPU在所有测试规模下,精确GP比GPyTorch快2.6–8.7倍,稀疏GP快约1.5倍;在NVIDIA RTX 3060上,对$N \leq 2{,}048$的精确GP,LightGP CUDA速度是GPyTorch的2.3–6.7倍,当$N=4{,}096$时差距缩小。在金属上融合的矩阵自由核向量乘法在$N=20{,}000$时达到32倍加速,且内存复杂度为$O(N)$;利用Accelerate vDSP的FFT加速SKI矩阵向量乘法在$N=200{,}000$时耗时低于1毫秒。LightGP可编译为单一静态库,零外部依赖,可通过`pip install lightgp`安装。

原文摘要 · Abstract (English)

Gaussian process (GP) inference in Python is dominated by libraries such as GPyTorch and GPflow, which are built on deep-learning frameworks and inherit their dispatch overhead and dependency footprint. We present LightGP, a dependency-free C++17 library for GP regression with Python bindings, supporting Apple Metal and NVIDIA CUDA backends alongside tuned CPU paths via Apple Accelerate and OpenBLAS. LightGP provides four inference paths -- exact Cholesky, matrix-free conjugate gradients, sparse variational free energy, and structured kernel interpolation with FFT -- covering problems from $N{=}100$ to $N{=}500{,}000$. On an Apple M4, LightGP CPU is 2.6--8.7$\times$ faster than GPyTorch CPU for exact GP and ${\sim}1.5\times$ faster for sparse GP at every scale tested. On an NVIDIA RTX~3060, LightGP CUDA is 2.3--6.7$\times$ faster than GPyTorch CUDA for exact GP up to $N{=}2{,}048$, with GPyTorch closing the gap at $N{=}4{,}096$. A fused matrix-free kernel-vector product on Metal achieves 32$\times$ over the explicit path at $N{=}20{,}000$ with $O(N)$ memory, and an FFT-accelerated SKI matvec via Accelerate vDSP runs in sub-millisecond time at $N{=}200{,}000$. LightGP compiles as a single static library with zero external dependencies and is installable via \texttt{pip install lightgp

高斯过程C++优化金属CUDA

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。