GPyTorch: scalable Gaussian processes on PyTorch, and where the abstraction bites
A highly efficient implementation of Gaussian Processes in PyTorch
At a glance
- What is it?
- GPyTorch replaces the Cholesky solve at the centre of most GP libraries with matrix-vector products and preconditioned conjugate gradients. That choice buys GPU throughput and modularity, and it costs you a mental model that differs from scikit-learn's.
- Who is it for?
- Adopt GPyTorch if your GP has to live inside a PyTorch training loop, share a GPU with a neural network, or scale past what a dense Cholesky solve can hold; the MVM-based inference path and the deep kernel learning examples in the repository are built for exactly that.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 53 days ago.
- What is it written in?
- Mainly Python, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 24, 2026, and from our analysis. They are not legal advice.
Star history
- cornellius-gp/gpytorch3,942 ★ · +25
| Repository | 2026-09-24 | 2026-11-24 |
|---|---|---|
| cornellius-gp/gpytorch | 3.9k | 3.9k |
25 Stars in the last 61 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
What GPyTorch solves that a dense Cholesky solve does not
A Gaussian process regression costs O(n^3) time and O(n^2) memory in the number of training points when you solve it the textbook way, because you factor an n by n kernel matrix. On a CPU with a few thousand points that is fine. At tens of thousands of points, or on a GPU where the factorisation is a poor fit for the hardware, it stops being fine. GPyTorch's stated design goal is to make scalable GP methods easy to express, and its README says the library differs from many existing approaches by performing most inference operations with numerical linear algebra techniques like preconditioned conjugate gradients rather than a Cholesky decomposition. The audience is therefore narrower than "anyone who wants a Gaussian process". It is people who already work in PyTorch, who need the GP to sit inside a larger differentiable model, and who have a reason to care about how the linear algebra maps onto a GPU. If your dataset is a few hundred rows and your model is a GP and nothing else, the abstraction is overhead you did not ask for.
The LinearOperator contract and why kernels are the extension point
The mechanism is worth understanding before you write a model. GPyTorch does not ask a kernel for a matrix; it asks for a matrix multiplication routine with the kernel matrix and its derivative. That is the LinearOperator interface, and the README describes implementing a scalable GP method as providing such a routine, or composing the LinearOperators the library already ships. Everything downstream follows from that contract. Because the solver only ever needs kernel-vector products, it can use conjugate gradients, and because conjugate gradients needs only products, the kernel never has to be materialised as a dense n by n array. That is what makes the scalable variants in the README (SKI/KISS-GP, stochastic Lanczos expansions, LOVE, SKIP, stochastic variational inference, deep kernel learning) expressible as compositions rather than as separate solver code. The trade-off is that a custom kernel written the naive way, returning a dense tensor, silently opts out of the whole scheme. The repository layout reflects this: the examples directory is split into 01_Exact_GPs, 02_Scalable_Exact_GPs, 03_Multitask_Exact_GPs, 04_Variational_and_Approximate_GPs, 05_Deep_Gaussian_Processes, 06_PyTorch_NN_Integration_DKL and 07_Pyro_Integration, which is a fair map of the abstraction's reach and of the order in which the maintainers expect you to learn it.
Installing GPyTorch with pip and running a first ExactGP
The README lists two requirements: Python >= 3.10 and PyTorch >= 2.0. setup.py enforces the Python floor at import time and exits with a message if your interpreter is older. The supported installs are pip and conda.
pip install gpytorch
conda install gpytorch -c gpytorchThe conda route pulls from the gpytorch channel rather than defaults, which is why the channel flag is there. If you want the latest unstable code instead of a release, the README gives a two-step upgrade that installs linear_operator from git first, then gpytorch from git, in that order. Contributors are pointed at a manual install with extras:
git clone https://github.com/cornellius-gp/gpytorch.git
cd gpytorch
pip install -e .[dev,docs,examples,keops,pyro,test]The README notes that keops and pyro are optional. For a first model, the example tree starts at examples/00_Basic_Usage and examples/01_Exact_GPs. A minimal exact GP in GPyTorch is a class, not a function call: you subclass ExactGP, declare a mean and a kernel in __init__, and implement a forward method that builds the likelihood and returns the marginal distribution. Training is a normal PyTorch loop over an optimizer and a marginal log likelihood loss, which is the point of the library. The documentation at gpytorch.readthedocs.io carries the runnable versions; the README itself does not reproduce a full model, so treat the examples directory as the source of truth for the current API rather than any snippet you find elsewhere.
Where GPyTorch is the wrong tool
Two failure modes are worth naming. The first is conceptual: GPyTorch is not a drop-in replacement for scikit-learn's GaussianProcessRegressor. There is no fit-and-predict object you can hand a NumPy array. You supply a model class, a likelihood, and the training loop, and if you get the likelihood wrong for your observation type the model will train without complaining about the thing you actually cared about. The second is dependency-related. setup.py pins mpmath to a range with the comment that this avoids incompatibility with torch and sympy, and it requires linear_operator>=0.6.1. The linear_operator dependency is a separate repository, and the README's unstable install path upgrades it explicitly before gpytorch, which tells you the two are versioned in step. If you pin gpytorch without pinning linear_operator, or if you install into an environment where another package has already constrained mpmath, you can end up with an import error that looks like a GPyTorch bug and is not. There is also the ArchLinux package, which the README labels experimental and recommends against for most users in favour of conda or pip. Finally, the repository does not document a rollback procedure for a bad upgrade, so version pinning in your own environment file is the only recovery path the README supports.
GPyTorch versus scikit-learn and BoTorch
The comparison that matters most is with scikit-learn, because that is where most people start. scikit-learn's GaussianProcessRegressor solves the kernel system directly and exposes a small estimator API; the trade-off is that the O(n^3) factorisation is the whole story, and there is no path to a stochastic variational approximation or a deep kernel. GPyTorch gives you those paths and takes away the one-liner. The comparison with BoTorch is different in kind rather than in degree. BoTorch is a Bayesian optimization library, and GPyTorch is a GP library; the two are commonly used together, with GPyTorch supplying the surrogate model that the acquisition function optimizes. Choosing between them is not really a choice, since they operate at different layers. If what you want is Bayesian optimization, GPyTorch alone gives you a model but not an acquisition function or an optimization loop. The search data shows people asking about gpytorch versus gpy as well; both are GP libraries, but GPyTorch is built on PyTorch tensors and autograd while GPy is built on a separate parameter framework, so the deciding question is which ecosystem the rest of your model already lives in.
Maintenance, releases and the MIT licence
GPyTorch is MIT licensed, which permits commercial use, modification and redistribution provided the copyright notice and permission notice are retained. The repository is not archived and the last push was on 2026-07-10. The recent release history is v1.15 on 2026-01-14, v1.15.1 on 2026-01-16 and v1.15.2 on 2026-02-28, the last of which is labelled a maintenance release. That pattern, a feature release followed by two small follow-ups and then a gap, is typical of a project in a steady state rather than one adding large new subsystems. The practical upgrade cost is low for a patch bump and higher when linear_operator moves, because the two packages are released in step and the README's unstable path upgrades both. Note that MIT covers the gpytorch code; the optional keops and pyro extras are separate projects with their own licences, and the README does not restate them. Nothing here is legal advice, and if you redistribute GPyTorch inside a product you should read the LICENSE file at the repository root rather than this paragraph.
Editorial conclusion
Adopt GPyTorch if your GP has to live inside a PyTorch training loop, share a GPU with a neural network, or scale past what a dense Cholesky solve can hold; the MVM-based inference path and the deep kernel learning examples in the repository are built for exactly that. Do not adopt it if you want a one-line regressor: scikit-learn's GaussianProcessRegressor fits a small dataset in a few statements, and GPyTorch asks you to write a model class, a likelihood and a training loop before you get a prediction. Before committing, verify three things on your own data: that your PyTorch build is at least 2.0 and your Python at least 3.10, that linear_operator resolves to 0.6.1 or newer, and that the kernel you need has a lazy implementation, because a custom kernel that only exposes a dense matrix will run in the Cholesky path you were trying to avoid.
Frequently asked questions
How do I install GPyTorch?
The README gives two supported commands: pip install gpytorch, or conda install gpytorch -c gpytorch. Both require Python >= 3.10 and PyTorch >= 2.0, and there is an experimental AUR package that the README recommends against for most users.
What is a Gaussian process?
The README does not define the concept, so this article cannot answer it from the repository alone. GPyTorch's own framing is narrower: it is a library for building Gaussian process models in PyTorch, and the README points to gpytorch.readthedocs.io for tutorials on constructing them.
gpytorch vs pytorch: what is the difference?
PyTorch is the tensor and autograd framework GPyTorch is implemented on top of, not a competing GP library. GPyTorch requires PyTorch >= 2.0 and adds GP-specific pieces such as kernels, likelihoods and the LinearOperator abstraction used by its inference routines.
gpytorch vs sklearn: which should I use?
scikit-learn's GaussianProcessRegressor exposes a small estimator API and solves the kernel system directly, while GPyTorch asks you to write a model class, a likelihood and a training loop. The trade-off is that GPyTorch's MVM-based inference and its scalable approximations are not available in the scikit-learn estimator. Note that scikit-learn is a declared dependency of GPyTorch, so installing GPyTorch does not remove it from your environment.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/cornellius-gp-gpytorch)Star history chart for your README
[](https://hysenlabs.com/projects/cornellius-gp-gpytorch)Was this useful?