Blog · updated 29 Oct 2026 · 42 min read

Sparse variational Gaussian processes: Titsias, Hensman and what came after

How a Gaussian process scales from thousands to millions of points without changing the model. Variational inference from scratch, inducing points, Titsias's collapsed bound, Hensman's stochastic version, how many inducing points you need, and the 2025 bounds that go beyond p(f | u). Every step derived.

Contents
  1. Notation
  2. 1. The exact GP and its bill
  3. 2. Variational inference from scratch
  4. The problem it solves
  5. 3. Inducing points
  6. 4. Two ways to approximate
  7. 5. Titsias’s bound
  8. The augmented model
  9. The variational family
  10. The optimal q(u) and the collapsed bound
  11. Reading the bound
  12. 6. A sandwich: the upper bound
  13. 7. Predictions and an implementation you can trust
  14. 8. Hensman: stochastic variational GPs
  15. Why the collapsed bound does not minibatch
  16. Minibatches
  17. Any likelihood
  18. Whitening
  19. Natural gradients
  20. 9. How many inducing points, and where
  21. How many
  22. Where
  23. 10. After 2013: a map of the field
  24. Inter-domain inducing variables
  25. Decoupled and orthogonal bases
  26. Nearest neighbours instead of low rank
  27. Tighter bounds with conjugate gradients
  28. Sampling whole functions
  29. Numerical stability
  30. Or skip sparsity
  31. 11. 2025: beyond p(f | u)
  32. 12. A practical recipe
  33. Questions
  34. References

An exact Gaussian process has to factorise an N×NN \times N matrix. That is fine for a thousand points, slow for ten thousand, and impossible for a million. Sparse variational GPs keep the model exactly as it is and approximate only the posterior, through the values of the function at M≪NM \ll N chosen inputs, the inducing points. The cost drops from O(N3)O(N^3) to O(NM2)O(NM^2), or to O(M3)O(M^3) per minibatch step. The approximation also comes with a number, a lower bound on the log evidence, that says how much was lost.

Drag the diamonds, change MM, or press Greedy and then Optimise Z:

6

What to try. With six evenly spaced inducing points the sparse fit (teal) is far too smooth, and the bound F\mathcal{F} sits about a hundred nats below the exact log evidence. The grey bars under the plot show, at every training input, how much prior variance the inducing points fail to explain; the bound pays for each bar. Raise MM: by M=14M = 14 the sparse fit is indistinguishable from the exact one and F\mathcal{F} is within two nats of the exact log evidence. The upper bound U\mathcal{U} closes in more slowly, because it replaces the unexplained covariance by its trace (Section 6). Greedy places points where the bars are tallest, and Optimise Z then climbs F\mathcal{F} by moving them; at M=14M = 14 the pair brings the gap below half a nat. Finally, drag one point out of the data into the empty stretch near x=0.5x = 0.5: the bars grow where it left, and the gap jumps from about 1.6 to 7.6 nats.

This is the second post in the Gaussian-process series, after Gaussian processes, from first principles. It re-derives everything it uses, apart from three Gaussian facts proved in that post (its Lemmas 5, 6 and 8) and in the Gaussian toolkit: conditioning a joint Gaussian, the Woodbury identity with the matrix determinant lemma, and the marginal and posterior of a linear-Gaussian model. Proofs are folded and written as numbered steps.

The plan:

  1. what an exact GP costs, and why that bill is paid again at every training step;
  2. variational inference from scratch: the KL divergence, the ELBO and why it underestimates variance;
  3. inducing points, and what the Nyström matrix Qff\mathbf{Q}_{ff} keeps and loses;
  4. two ways to approximate: change the prior (DTC, FITC) or change the posterior (variational);
  5. Titsias’s collapsed bound, derived and read three ways;
  6. an upper bound, so you know how far from the truth you are;
  7. predictions and a numerically stable implementation;
  8. Hensman’s stochastic version: minibatches, non-Gaussian likelihoods, whitening and natural gradients;
  9. how many inducing points you need, and where to put them;
  10. a map of the field after 2013;
  11. the 2025 bounds that relax q(f∣u)=p(f∣u)q(\boldsymbol{f} \mid \boldsymbol{u}) = p(\boldsymbol{f} \mid \boldsymbol{u});
  12. a practical recipe.

Notation

Plain italic letters are scalars, bold italic lower case are column vectors, bold upright capitals are matrices. In this post f\boldsymbol{f} is shorthand for fX\boldsymbol{f}_{\mathbf{X}}, the latent function values at the training inputs (the primer’s notation).

SymbolMeaning
X∈RN×D\mathbf{X} \in \mathbb{R}^{N\times D}, y∈RN\boldsymbol{y} \in \mathbb{R}^Ntraining inputs (rows xi⊤\boldsymbol{x}_i^\top), observations
f=f(X)∈RN\boldsymbol{f} = f(\mathbf{X}) \in \mathbb{R}^Nlatent values at the training inputs
σn2\sigma_n^2noise variance; y=f+ε\boldsymbol{y} = \boldsymbol{f} + \boldsymbol{\varepsilon}, ε∼N(0,σn2I)\boldsymbol{\varepsilon} \sim \mathcal{N}(\mathbf{0}, \sigma_n^2\mathbf{I})
MM, Z∈RM×D\mathbf{Z} \in \mathbb{R}^{M\times D}number of inducing points, inducing inputs (rows zj⊤\boldsymbol{z}_j^\top)
u=f(Z)∈RM\boldsymbol{u} = f(\mathbf{Z}) \in \mathbb{R}^Minducing variables
Kff\mathbf{K}_{ff}, Kfu\mathbf{K}_{fu}, Kuu\mathbf{K}_{uu}k(X,X)k(\mathbf{X}, \mathbf{X}), k(X,Z)k(\mathbf{X}, \mathbf{Z}), k(Z,Z)k(\mathbf{Z}, \mathbf{Z}); Kuf=Kfu⊤\mathbf{K}_{uf} = \mathbf{K}_{fu}^\top
A=KfuKuu−1\mathbf{A} = \mathbf{K}_{fu}\mathbf{K}_{uu}^{-1}interpolation weights, N×MN \times M, rows ai⊤\boldsymbol{a}_i^\top
Qff=KfuKuu−1Kuf\mathbf{Q}_{ff} = \mathbf{K}_{fu}\mathbf{K}_{uu}^{-1}\mathbf{K}_{uf}Nyström approximation of Kff\mathbf{K}_{ff}, entries qijq_{ij}
C=Kff−Qff\mathbf{C} = \mathbf{K}_{ff} - \mathbf{Q}_{ff}, ci=kii−qiic_i = k_{ii} - q_{ii}covariance of f\boldsymbol{f} given u\boldsymbol{u}, its diagonal
t=tr⁡C=∑icit = \operatorname{tr}\mathbf{C} = \sum_i c_itotal prior variance the inducing variables leave unexplained
q(u)=N(m,S)q(\boldsymbol{u}) = \mathcal{N}(\boldsymbol{m}, \mathbf{S})variational distribution over u\boldsymbol{u}
Σ=(Kuu+σn−2KufKfu)−1\boldsymbol{\Sigma} = (\mathbf{K}_{uu} + \sigma_n^{-2}\mathbf{K}_{uf}\mathbf{K}_{fu})^{-1}appears in the optimal q∗(u)q^*(\boldsymbol{u})
L(q)\mathcal{L}(q), F\mathcal{F}, U\mathcal{U}ELBO of a given qq; collapsed (Titsias) bound; upper bound
KL[q ∥ p]\mathrm{KL}[q \,\Vert\, p]Kullback–Leibler divergence

N(a∣μ,Σ)\mathcal{N}(\boldsymbol{a} \mid \boldsymbol{\mu}, \boldsymbol{\Sigma}) is the Gaussian density in a\boldsymbol{a}. For symmetric matrices, P⪰R\mathbf{P} \succeq \mathbf{R} means P−R\mathbf{P} - \mathbf{R} is positive semi-definite.

1. The exact GP and its bill

With a zero-mean prior f∼GP(0,k)f \sim \mathcal{GP}(0, k) and Gaussian noise, the primer derives two formulas. The log marginal likelihood (the evidence) is

log⁡p(y)=−12 y⊤(Kff+σn2I)−1y−12log⁡∣Kff+σn2I∣−N2log⁡2π,\log p(\boldsymbol{y}) = -\tfrac12\,\boldsymbol{y}^\top(\mathbf{K}_{ff} + \sigma_n^2\mathbf{I})^{-1}\boldsymbol{y} - \tfrac12\log\lvert\mathbf{K}_{ff} + \sigma_n^2\mathbf{I}\rvert - \tfrac N2\log 2\pi ,

and the predictive distribution at a test input x∗\boldsymbol{x}_* has mean k∗⊤(Kff+σn2I)−1y\boldsymbol{k}_*^\top(\mathbf{K}_{ff} + \sigma_n^2\mathbf{I})^{-1}\boldsymbol{y} and variance k∗∗−k∗⊤(Kff+σn2I)−1k∗k_{**} - \boldsymbol{k}_*^\top(\mathbf{K}_{ff} + \sigma_n^2\mathbf{I})^{-1}\boldsymbol{k}_*.

Both need the Cholesky factor of the N×NN \times N matrix Kff+σn2I\mathbf{K}_{ff} + \sigma_n^2\mathbf{I}: about N3/3N^3/3 floating-point operations and N2N^2 numbers of memory. In double precision:

NNmemory for Kff\mathbf{K}_{ff}Cholesky flopsin practice
10310^38 MB3×1083\times10^{8}instant
10410^40.8 GB3×10113\times10^{11}seconds
10510^580 GB3×10143\times10^{14}needs a large GPU cluster
10610^68 TB3×10173\times10^{17}out of reach

Learning the kernel hyperparameters θ\boldsymbol{\theta} (length-scales, amplitude, noise) means maximising log⁡p(y)\log p(\boldsymbol{y}) by gradient ascent, and every step repeats the factorisation. So the target is a method that

  • costs O(N)O(N) in the number of data points, or less per step;
  • keeps the same model, so that the hyperparameters we learn mean what they meant before;
  • reports how much accuracy it gave up.

Variational inference with inducing points does all three.

2. Variational inference from scratch

The problem it solves

Write z\boldsymbol{z} for whatever is unknown and y\boldsymbol{y} for the data. Bayes’ rule gives the posterior

p(z∣y)=p(y∣z) p(z)p(y),p(y)=∫p(y∣z) p(z) dz.p(\boldsymbol{z} \mid \boldsymbol{y}) = \frac{p(\boldsymbol{y} \mid \boldsymbol{z})\,p(\boldsymbol{z})}{p(\boldsymbol{y})}, \qquad p(\boldsymbol{y}) = \int p(\boldsymbol{y} \mid \boldsymbol{z})\,p(\boldsymbol{z})\,d\boldsymbol{z} .

Often the posterior is intractable because the integral has no closed form. For GP regression it has one, but it costs O(N3)O(N^3). Variational inference (VI) turns both cases into optimisation: pick a family Q\mathcal{Q} of distributions we can handle, and find the member closest to the posterior.

“Closest” needs a notion of distance between distributions.

Definition 1 (Kullback–Leibler divergence)

For densities qq and pp on the same space, with p>0p > 0 wherever q>0q > 0,

KL[q ∥ p]=∫q(z)log⁡q(z)p(z) dz=Eq[log⁡q(z)−log⁡p(z)].\mathrm{KL}[q \,\Vert\, p] = \int q(\boldsymbol{z})\log\frac{q(\boldsymbol{z})}{p(\boldsymbol{z})}\,d\boldsymbol{z} = \mathbb{E}_{q}\big[\log q(\boldsymbol{z}) - \log p(\boldsymbol{z})\big].

The integral runs over the set where q>0q > 0. If p=0p = 0 somewhere q>0q > 0, the divergence is +∞+\infty.

It measures, on average under qq, how much more probable qq thinks a point is than pp does. It is not symmetric: KL[q ∥ p]≠KL[p ∥ q]\mathrm{KL}[q \,\Vert\, p] \neq \mathrm{KL}[p \,\Vert\, q] in general. But it is never negative.

Proposition 1 (Gibbs’ inequality)

KL[q ∥ p]≥0\mathrm{KL}[q \,\Vert\, p] \geq 0, with equality if and only if q=pq = p almost everywhere.

Proof

Step 1. Flip the ratio. On the set {q>0}\{q > 0\},

−KL[q ∥ p]=Eq[log⁡p(z)q(z)].-\mathrm{KL}[q \,\Vert\, p] = \mathbb{E}_q\Big[\log\frac{p(\boldsymbol{z})}{q(\boldsymbol{z})}\Big].

Step 2. Jensen’s inequality. The logarithm is concave, so E[log⁡W]≤log⁡E[W]\mathbb{E}[\log W] \leq \log \mathbb{E}[W] for any positive random variable WW. With W=p(z)/q(z)W = p(\boldsymbol{z})/q(\boldsymbol{z}) and z∼q\boldsymbol{z} \sim q:

Eq[log⁡pq]≤log⁡Eq[pq]=log⁡∫q>0q pq dz=log⁡∫q>0p dz.\mathbb{E}_q\Big[\log\frac{p}{q}\Big] \leq \log\mathbb{E}_q\Big[\frac{p}{q}\Big] = \log\int_{q>0} q\,\frac{p}{q}\,d\boldsymbol{z} = \log\int_{q>0} p\,d\boldsymbol{z}.

Step 3. Bound the last integral. pp is a density, so its integral over any set is at most 1, and log⁡\log of a number at most 1 is at most 0. Hence −KL≤0-\mathrm{KL} \leq 0.

Step 4. Equality. Jensen’s inequality for a strictly concave function is an equality only if WW is constant qq-almost everywhere, say p=λqp = \lambda q. Step 3 is an equality only if ∫q>0p=1\int_{q>0} p = 1. Together these force λ=1\lambda = 1, so p=qp = q almost everywhere.

Now the central identity of variational inference.

Theorem 1 (The evidence decomposition)

For any density q(z)q(\boldsymbol{z}) that is positive wherever the posterior is,

log⁡p(y)=Eq[log⁡p(y,z)−log⁡q(z)]⏟L(q), the ELBO+KL[q(z) ∥ p(z∣y)].\log p(\boldsymbol{y}) = \underbrace{\mathbb{E}_{q}\big[\log p(\boldsymbol{y}, \boldsymbol{z}) - \log q(\boldsymbol{z})\big]}_{\mathcal{L}(q),\ \text{the ELBO}} + \mathrm{KL}\big[q(\boldsymbol{z}) \,\Vert\, p(\boldsymbol{z} \mid \boldsymbol{y})\big].
Proof

Step 1. The product rule, pointwise. For every z\boldsymbol{z}, p(y,z)=p(z∣y) p(y)p(\boldsymbol{y}, \boldsymbol{z}) = p(\boldsymbol{z} \mid \boldsymbol{y})\,p(\boldsymbol{y}), so

log⁡p(y)=log⁡p(y,z)−log⁡p(z∣y).\log p(\boldsymbol{y}) = \log p(\boldsymbol{y}, \boldsymbol{z}) - \log p(\boldsymbol{z} \mid \boldsymbol{y}).

Step 2. Add and subtract log⁡q(z)\log q(\boldsymbol{z}).

log⁡p(y)=[log⁡p(y,z)−log⁡q(z)]+[log⁡q(z)−log⁡p(z∣y)].\log p(\boldsymbol{y}) = \big[\log p(\boldsymbol{y}, \boldsymbol{z}) - \log q(\boldsymbol{z})\big] + \big[\log q(\boldsymbol{z}) - \log p(\boldsymbol{z} \mid \boldsymbol{y})\big].

Step 3. Average over qq. The left side does not depend on z\boldsymbol{z}, so its expectation under qq is itself. The expectation of the first bracket is L(q)\mathcal{L}(q); the expectation of the second is the KL divergence by definition.

Three consequences follow at once, and the rest of the post uses all of them.

  • It is a lower bound. By Gibbs’ inequality the KL term is non-negative, so L(q)≤log⁡p(y)\mathcal{L}(q) \leq \log p(\boldsymbol{y}): the name ELBO stands for evidence lower bound.
  • Maximising it is the right goal. log⁡p(y)\log p(\boldsymbol{y}) does not depend on qq. So raising L(q)\mathcal{L}(q) by some amount lowers KL[q ∥ p(⋅∣y)]\mathrm{KL}[q \,\Vert\, p(\cdot \mid \boldsymbol{y})] by exactly that amount.
  • It can replace the evidence when learning hyperparameters. When the model has hyperparameters θ\boldsymbol{\theta}, maximising L(q,θ)\mathcal{L}(q, \boldsymbol{\theta}) jointly over qq and θ\boldsymbol{\theta} approximates type-II maximum likelihood. The gap is the KL term, so the approximation is good when the KL term is small.

Corollary 1 (The ELBO as fit minus complexity)

L(q)=Eq[log⁡p(y∣z)]−KL[q(z) ∥ p(z)].\mathcal{L}(q) = \mathbb{E}_{q}\big[\log p(\boldsymbol{y} \mid \boldsymbol{z})\big] - \mathrm{KL}\big[q(\boldsymbol{z}) \,\Vert\, p(\boldsymbol{z})\big].
Proof

Step 1. Split the joint: log⁡p(y,z)=log⁡p(y∣z)+log⁡p(z)\log p(\boldsymbol{y}, \boldsymbol{z}) = \log p(\boldsymbol{y} \mid \boldsymbol{z}) + \log p(\boldsymbol{z}).

Step 2. Substitute into L(q)\mathcal{L}(q) and group the last two terms:

L(q)=Eq[log⁡p(y∣z)]+Eq[log⁡p(z)−log⁡q(z)]=Eq[log⁡p(y∣z)]−KL[q ∥ p(z)].\mathcal{L}(q) = \mathbb{E}_q[\log p(\boldsymbol{y} \mid \boldsymbol{z})] + \mathbb{E}_q[\log p(\boldsymbol{z}) - \log q(\boldsymbol{z})] = \mathbb{E}_q[\log p(\boldsymbol{y} \mid \boldsymbol{z})] - \mathrm{KL}[q \,\Vert\, p(\boldsymbol{z})].

The first term rewards explaining the data; the second penalises moving away from the prior. That reading is the same one the GP evidence has (data fit against complexity), and it will reappear in the inducing-point bound.

Remark (Why KL(q ‖ p) and not KL(p ‖ q))

We minimise KL[q ∥ p(⋅∣y)]\mathrm{KL}[q \,\Vert\, p(\cdot \mid \boldsymbol{y})], an expectation under qq, because we can sample from qq and evaluate it, but not the posterior. The choice has a consequence. Where the posterior is tiny and qq is not, log⁡(q/p)\log(q/p) is huge, so the optimum keeps qq small wherever pp is small. The resulting qq is zero-forcing: it sits inside the posterior and tends to be too narrow. The reverse divergence KL[p ∥ q]\mathrm{KL}[p \,\Vert\, q] (used by expectation propagation) behaves the opposite way and covers all of pp.

The next example makes “too narrow” exact. It is also the clearest preview of the 2025 bound in Section 11.

Example 1 (Mean-field VI underestimates variance)

Let the target be p=N(μ,Σ)p = \mathcal{N}(\boldsymbol{\mu}, \boldsymbol{\Sigma}) in DD dimensions, with precision Λ=Σ−1\boldsymbol{\Lambda} = \boldsymbol{\Sigma}^{-1}. Approximate it with a fully factorised Gaussian q=N(m,diag⁡(s1,…,sD))q = \mathcal{N}(\boldsymbol{m}, \operatorname{diag}(s_1, \dots, s_D)) by minimising KL[q ∥ p]\mathrm{KL}[q \,\Vert\, p]. The optimum is m=μ\boldsymbol{m} = \boldsymbol{\mu} and sd=1/Λdds_d = 1/\Lambda_{dd}, and 1/Λdd≤Σdd1/\Lambda_{dd} \leq \Sigma_{dd}.

For two variables with unit variances and correlation 0.90.9, Λ11=1/(1−0.81)≈5.26\Lambda_{11} = 1/(1 - 0.81) \approx 5.26. So qq has standard deviation 0.440.44 where the truth has 11. The approximation matches the conditional variance of each coordinate given the others, not its marginal variance.

Proof

Step 1. The Gaussian KL. For q=N(m,S)q = \mathcal{N}(\boldsymbol{m}, \mathbf{S}) and p=N(μ,Σ)p = \mathcal{N}(\boldsymbol{\mu}, \boldsymbol{\Sigma}) (proved in the toolkit),

KL[q ∥ p]=12[tr⁡(ΛS)+(m−μ)⊤Λ(m−μ)−D+log⁡∣Σ∣−log⁡∣S∣].\mathrm{KL}[q \,\Vert\, p] = \tfrac12\Big[\operatorname{tr}(\boldsymbol{\Lambda}\mathbf{S}) + (\boldsymbol{m} - \boldsymbol{\mu})^\top\boldsymbol{\Lambda}(\boldsymbol{m} - \boldsymbol{\mu}) - D + \log\lvert\boldsymbol{\Sigma}\rvert - \log\lvert\mathbf{S}\rvert\Big].

Step 2. The mean. Only the quadratic term depends on m\boldsymbol{m}. It is non-negative because Λ\boldsymbol{\Lambda} is positive definite, and zero at m=μ\boldsymbol{m} = \boldsymbol{\mu}.

Step 3. The variances. With S=diag⁡(sd)\mathbf{S} = \operatorname{diag}(s_d), tr⁡(ΛS)=∑dΛddsd\operatorname{tr}(\boldsymbol{\Lambda}\mathbf{S}) = \sum_d \Lambda_{dd}s_d and log⁡∣S∣=∑dlog⁡sd\log\lvert\mathbf{S}\rvert = \sum_d \log s_d. So the KL separates into 12∑d(Λddsd−log⁡sd)\tfrac12\sum_d(\Lambda_{dd}s_d - \log s_d) plus constants.

Step 4. Minimise each term. dds(Λdds−log⁡s)=Λdd−1/s\frac{d}{ds}(\Lambda_{dd}s - \log s) = \Lambda_{dd} - 1/s, which vanishes at s=1/Λdds = 1/\Lambda_{dd}. The second derivative 1/s21/s^2 is positive, so this is the minimum.

Step 5. Compare with the marginal variance. By the Cauchy–Schwarz inequality applied to the vectors Σ1/2ed\boldsymbol{\Sigma}^{1/2}\boldsymbol{e}_d and Σ−1/2ed\boldsymbol{\Sigma}^{-1/2}\boldsymbol{e}_d:

1=(ed⊤ed)2=(ed⊤Σ1/2 Σ−1/2ed)2≤(ed⊤Σed)(ed⊤Λed)=ΣddΛdd.1 = (\boldsymbol{e}_d^\top\boldsymbol{e}_d)^2 = \big(\boldsymbol{e}_d^\top\boldsymbol{\Sigma}^{1/2}\,\boldsymbol{\Sigma}^{-1/2}\boldsymbol{e}_d\big)^2 \leq (\boldsymbol{e}_d^\top\boldsymbol{\Sigma}\boldsymbol{e}_d)(\boldsymbol{e}_d^\top\boldsymbol{\Lambda}\boldsymbol{e}_d) = \Sigma_{dd}\Lambda_{dd}.

Hence 1/Λdd≤Σdd1/\Lambda_{dd} \leq \Sigma_{dd}, with equality only when coordinate dd is uncorrelated with the rest.

Note (What VI means for a GP)

In GP regression with Gaussian noise the posterior is already Gaussian, so VI is not about approximating a strange shape. It is about cost. We will restrict the posterior to those that are fully determined by MM numbers, the function values at MM inputs, and let VI pick the best such posterior and tell us its distance from the exact one.

3. Inducing points

Definition 2 (Inducing inputs and inducing variables)

Choose MM inputs Z=[z1,…,zM]⊤\mathbf{Z} = [\boldsymbol{z}_1, \dots, \boldsymbol{z}_M]^\top, the inducing inputs. The inducing variables are the function values there, u=f(Z)∈RM\boldsymbol{u} = f(\mathbf{Z}) \in \mathbb{R}^M.

The inducing variables are not data and not new parameters of the model. They are values of the same random function ff, at places of our choosing, and nothing is observed there. Because ff is a GP, f\boldsymbol{f} and u\boldsymbol{u} are jointly Gaussian:

[fu]∼N ⁣(0, [KffKfuKufKuu]).\begin{bmatrix}\boldsymbol{f}\\ \boldsymbol{u}\end{bmatrix} \sim \mathcal{N}\!\left(\mathbf{0},\ \begin{bmatrix}\mathbf{K}_{ff} & \mathbf{K}_{fu}\\ \mathbf{K}_{uf} & \mathbf{K}_{uu}\end{bmatrix}\right).

Lemma 1 (The function given the inducing variables)

p(u)=N(u∣0,Kuu),p(f∣u)=N(f∣Au, Kff−Qff),p(\boldsymbol{u}) = \mathcal{N}(\boldsymbol{u} \mid \mathbf{0}, \mathbf{K}_{uu}), \qquad p(\boldsymbol{f} \mid \boldsymbol{u}) = \mathcal{N}\big(\boldsymbol{f} \mid \mathbf{A}\boldsymbol{u},\ \mathbf{K}_{ff} - \mathbf{Q}_{ff}\big),

with A=KfuKuu−1\mathbf{A} = \mathbf{K}_{fu}\mathbf{K}_{uu}^{-1} and Qff=KfuKuu−1Kuf\mathbf{Q}_{ff} = \mathbf{K}_{fu}\mathbf{K}_{uu}^{-1}\mathbf{K}_{uf}.

Proof

Step 1. The marginal of u\boldsymbol{u}. Any sub-vector of a Gaussian vector is Gaussian with the matching blocks of the mean and covariance, so u∼N(0,Kuu)\boldsymbol{u} \sim \mathcal{N}(\mathbf{0}, \mathbf{K}_{uu}).

Step 2. Conditioning. For a joint Gaussian with zero mean, the conditional of the first block given the second has mean Σ12Σ22−1u\boldsymbol{\Sigma}_{12}\boldsymbol{\Sigma}_{22}^{-1}\boldsymbol{u} and covariance Σ11−Σ12Σ22−1Σ21\boldsymbol{\Sigma}_{11} - \boldsymbol{\Sigma}_{12}\boldsymbol{\Sigma}_{22}^{-1}\boldsymbol{\Sigma}_{21}, the Schur complement (the primer’s Lemma 5, Gaussian conditioning). Here Σ11=Kff\boldsymbol{\Sigma}_{11} = \mathbf{K}_{ff}, Σ12=Kfu\boldsymbol{\Sigma}_{12} = \mathbf{K}_{fu}, Σ22=Kuu\boldsymbol{\Sigma}_{22} = \mathbf{K}_{uu}.

Step 3. Name the pieces. The mean is KfuKuu−1u=Au\mathbf{K}_{fu}\mathbf{K}_{uu}^{-1}\boldsymbol{u} = \mathbf{A}\boldsymbol{u}, and the covariance is Kff−KfuKuu−1Kuf=Kff−Qff\mathbf{K}_{ff} - \mathbf{K}_{fu}\mathbf{K}_{uu}^{-1}\mathbf{K}_{uf} = \mathbf{K}_{ff} - \mathbf{Q}_{ff}.

Three readings of this lemma carry the whole post.

  • The mean interpolates. Au\mathbf{A}\boldsymbol{u} is what noise-free GP regression would predict at X\mathbf{X} if we had observed the values u\boldsymbol{u} at Z\mathbf{Z}. Row ii of A\mathbf{A} holds the kernel weights that turn the inducing values into a guess for f(xi)f(\boldsymbol{x}_i).
  • Qff\mathbf{Q}_{ff} is a low-rank stand-in for Kff\mathbf{K}_{ff}. It is the Nyström approximation (Williams and Seeger, 2001), built from the MM columns of the kernel at Z\mathbf{Z}. Its rank is at most MM.
  • C=Kff−Qff\mathbf{C} = \mathbf{K}_{ff} - \mathbf{Q}_{ff} is what the inducing variables cannot pin down. Its diagonal entry cic_i is the prior variance of f(xi)f(\boldsymbol{x}_i) that remains after u\boldsymbol{u} is known. These are the grey bars in the figure.

Proposition 2 (What the Nyström matrix keeps and loses)

Qff⪰0\mathbf{Q}_{ff} \succeq \mathbf{0} and C=Kff−Qff⪰0\mathbf{C} = \mathbf{K}_{ff} - \mathbf{Q}_{ff} \succeq \mathbf{0}. In particular 0≤ci≤kii0 \leq c_i \leq k_{ii} for every ii, and ci=0c_i = 0 whenever xi\boldsymbol{x}_i is one of the inducing inputs.

Proof

Step 1. Qff\mathbf{Q}_{ff} is positive semi-definite. For any v\boldsymbol{v}, v⊤Qffv=(Kufv)⊤Kuu−1(Kufv)≥0\boldsymbol{v}^\top\mathbf{Q}_{ff}\boldsymbol{v} = (\mathbf{K}_{uf}\boldsymbol{v})^\top\mathbf{K}_{uu}^{-1}(\mathbf{K}_{uf}\boldsymbol{v}) \geq 0, because Kuu−1\mathbf{K}_{uu}^{-1} is positive definite.

Step 2. C\mathbf{C} is positive semi-definite. By the lemma, C\mathbf{C} is the covariance of f\boldsymbol{f} given u\boldsymbol{u}, and every covariance matrix is positive semi-definite.

Step 3. The diagonal. Diagonal entries of a positive semi-definite matrix are non-negative: qii≥0q_{ii} \geq 0 and ci≥0c_i \geq 0. Since ci=kii−qiic_i = k_{ii} - q_{ii}, also ci≤kiic_i \leq k_{ii}.

Step 4. At an inducing input. If xi=zj\boldsymbol{x}_i = \boldsymbol{z}_j, then f(xi)=ujf(\boldsymbol{x}_i) = u_j is known exactly once u\boldsymbol{u} is, so its conditional variance cic_i is zero.

Example 2 (One inducing point)

With a single inducing input zz and the squared-exponential kernel k(x,x′)=σf2exp⁡ ⁣(−(x−x′)2/(2ℓ2))k(x, x') = \sigma_f^2\exp\!\big(-(x - x')^2/(2\ell^2)\big),

qii=k(xi,z)2k(z,z)=σf2e−(xi−z)2/ℓ2,ci=σf2(1−e−(xi−z)2/ℓ2).q_{ii} = \frac{k(x_i, z)^2}{k(z, z)} = \sigma_f^2 e^{-(x_i - z)^2/\ell^2}, \qquad c_i = \sigma_f^2\big(1 - e^{-(x_i - z)^2/\ell^2}\big).

One inducing point explains the variance of nearby inputs and almost none of the inputs more than about 2ℓ2\ell away. With length-scale ℓ\ell on a domain of width WW, you need on the order of W/ℓW/\ell well-spread points before every cic_i is small. The figure uses ℓ=0.07\ell = 0.07 on [0,1][0, 1], which is why about fourteen are needed.

4. Two ways to approximate

The exact prior can be written as p(f)=∫p(f∣u) p(u) dup(\boldsymbol{f}) = \int p(\boldsymbol{f} \mid \boldsymbol{u})\,p(\boldsymbol{u})\,d\boldsymbol{u}. Before 2009 most sparse GPs approximated the factor p(f∣u)p(\boldsymbol{f} \mid \boldsymbol{u}), and so changed the prior. Quiñonero-Candela and Rasmussen (2005) unified them this way.

  • DTC (deterministic training conditional). Replace p(f∣u)p(\boldsymbol{f} \mid \boldsymbol{u}) by a point mass at Au\mathbf{A}\boldsymbol{u}. The prior on f\boldsymbol{f} becomes N(0,Qff)\mathcal{N}(\mathbf{0}, \mathbf{Q}_{ff}), a degenerate rank-MM Gaussian, and the evidence becomes N(y∣0,Qff+σn2I)\mathcal{N}(\boldsymbol{y} \mid \mathbf{0}, \mathbf{Q}_{ff} + \sigma_n^2\mathbf{I}).
  • FITC (fully independent training conditional; Snelson and Ghahramani, 2006). Keep only the diagonal of the conditional covariance: N(f∣Au,diag⁡C)\mathcal{N}(\boldsymbol{f} \mid \mathbf{A}\boldsymbol{u}, \operatorname{diag}\mathbf{C}). The prior becomes N(0,Qff+diag⁡C)\mathcal{N}(\mathbf{0}, \mathbf{Q}_{ff} + \operatorname{diag}\mathbf{C}), which has the correct variances but the wrong correlations.

Each is a new GP with a new, Z\mathbf{Z}-dependent kernel. Fitting Z\mathbf{Z} and θ\boldsymbol{\theta} by maximising its evidence turns the inducing inputs into extra model parameters. Then nothing stops them from fitting the data better than the original model could: FITC is known to underestimate the noise and to overfit (Bauer, van der Wilk and Rasmussen, 2016).

The variational route keeps p(f)p(\boldsymbol{f}) exact and approximates the posterior instead. Then:

  • the hyperparameters belong to the original model;
  • Z\mathbf{Z} are variational parameters, which can only move the approximation closer to the true posterior;
  • the objective is a lower bound on the true evidence, so its value is a certificate.

5. Titsias’s bound

The augmented model

Add u\boldsymbol{u} to the model:

p(y,f,u)=p(y∣f) p(f∣u) p(u).p(\boldsymbol{y}, \boldsymbol{f}, \boldsymbol{u}) = p(\boldsymbol{y} \mid \boldsymbol{f})\,p(\boldsymbol{f} \mid \boldsymbol{u})\,p(\boldsymbol{u}).

Integrating out u\boldsymbol{u} returns p(y,f)=p(y∣f) p(f)p(\boldsymbol{y}, \boldsymbol{f}) = p(\boldsymbol{y} \mid \boldsymbol{f})\,p(\boldsymbol{f}), so the augmentation changes nothing: the evidence p(y)p(\boldsymbol{y}) is the same. We now approximate the posterior over (f,u)(\boldsymbol{f}, \boldsymbol{u}).

The variational family

Titsias (2009) chose

q(f,u)=p(f∣u) q(u).q(\boldsymbol{f}, \boldsymbol{u}) = p(\boldsymbol{f} \mid \boldsymbol{u})\,q(\boldsymbol{u}).

Given u\boldsymbol{u}, the function is distributed exactly as under the prior. All the information the data carry has to pass through the MM inducing variables. The exact posterior has this form only when u\boldsymbol{u} is a sufficient statistic for f\boldsymbol{f}, which is why it is an approximation.

Lemma 2 (The ELBO for the inducing-point family)

For q(f,u)=p(f∣u) q(u)q(\boldsymbol{f}, \boldsymbol{u}) = p(\boldsymbol{f} \mid \boldsymbol{u})\,q(\boldsymbol{u}),

L(q)=Eq(f,u)[log⁡p(y∣f)]−KL[q(u) ∥ p(u)].\mathcal{L}(q) = \mathbb{E}_{q(\boldsymbol{f}, \boldsymbol{u})}\big[\log p(\boldsymbol{y} \mid \boldsymbol{f})\big] - \mathrm{KL}\big[q(\boldsymbol{u}) \,\Vert\, p(\boldsymbol{u})\big].
Proof

Step 1. Write the ELBO with z=(f,u)\boldsymbol{z} = (\boldsymbol{f}, \boldsymbol{u}).

L(q)=Eq(f,u)[log⁡p(y∣f) p(f∣u) p(u)p(f∣u) q(u)].\mathcal{L}(q) = \mathbb{E}_{q(\boldsymbol{f}, \boldsymbol{u})}\left[\log\frac{p(\boldsymbol{y} \mid \boldsymbol{f})\,p(\boldsymbol{f} \mid \boldsymbol{u})\,p(\boldsymbol{u})}{p(\boldsymbol{f} \mid \boldsymbol{u})\,q(\boldsymbol{u})}\right].

Step 2. Cancel. The factor p(f∣u)p(\boldsymbol{f} \mid \boldsymbol{u}) appears above and below:

L(q)=Eq(f,u)[log⁡p(y∣f)]+Eq(f,u)[log⁡p(u)q(u)].\mathcal{L}(q) = \mathbb{E}_{q(\boldsymbol{f}, \boldsymbol{u})}\big[\log p(\boldsymbol{y} \mid \boldsymbol{f})\big] + \mathbb{E}_{q(\boldsymbol{f}, \boldsymbol{u})}\left[\log\frac{p(\boldsymbol{u})}{q(\boldsymbol{u})}\right].

Step 3. The second term depends only on u\boldsymbol{u}. Its expectation under q(f,u)q(\boldsymbol{f}, \boldsymbol{u}) equals its expectation under the marginal q(u)q(\boldsymbol{u}), which is −KL[q(u) ∥ p(u)]-\mathrm{KL}[q(\boldsymbol{u}) \,\Vert\, p(\boldsymbol{u})].

Note (Why the cancellation is the whole trick)

p(f∣u)p(\boldsymbol{f} \mid \boldsymbol{u}) is an NN-dimensional Gaussian with an N×NN \times N covariance. Evaluating its density would cost O(N3)O(N^3), which is exactly what we are avoiding. Because the same factor sits in the model and in qq, its density never has to be evaluated. We only need its moments, and only on the diagonal, as the next two lemmas show.

Lemma 3 (Expected Gaussian log-likelihood)

If f∼N(μ,P)\boldsymbol{f} \sim \mathcal{N}(\boldsymbol{\mu}, \mathbf{P}), then

E[log⁡N(y∣f,σn2I)]=log⁡N(y∣μ,σn2I)−12σn2tr⁡P.\mathbb{E}\big[\log\mathcal{N}(\boldsymbol{y} \mid \boldsymbol{f}, \sigma_n^2\mathbf{I})\big] = \log\mathcal{N}(\boldsymbol{y} \mid \boldsymbol{\mu}, \sigma_n^2\mathbf{I}) - \frac{1}{2\sigma_n^2}\operatorname{tr}\mathbf{P}.
Proof

Step 1. Write the log-density. log⁡N(y∣f,σn2I)=−N2log⁡(2πσn2)−12σn2∥y−f∥2\log\mathcal{N}(\boldsymbol{y} \mid \boldsymbol{f}, \sigma_n^2\mathbf{I}) = -\tfrac N2\log(2\pi\sigma_n^2) - \frac{1}{2\sigma_n^2}\lVert\boldsymbol{y} - \boldsymbol{f}\rVert^2. Only the norm is random.

Step 2. Split the residual. y−f=(y−μ)−(f−μ)\boldsymbol{y} - \boldsymbol{f} = (\boldsymbol{y} - \boldsymbol{\mu}) - (\boldsymbol{f} - \boldsymbol{\mu}), so

∥y−f∥2=∥y−μ∥2−2(y−μ)⊤(f−μ)+∥f−μ∥2.\lVert\boldsymbol{y} - \boldsymbol{f}\rVert^2 = \lVert\boldsymbol{y} - \boldsymbol{\mu}\rVert^2 - 2(\boldsymbol{y} - \boldsymbol{\mu})^\top(\boldsymbol{f} - \boldsymbol{\mu}) + \lVert\boldsymbol{f} - \boldsymbol{\mu}\rVert^2 .

Step 3. Take expectations. The middle term has mean zero because E[f]=μ\mathbb{E}[\boldsymbol{f}] = \boldsymbol{\mu}. The last has mean E∑i(fi−μi)2=∑iPii=tr⁡P\mathbb{E}\sum_i(f_i - \mu_i)^2 = \sum_i P_{ii} = \operatorname{tr}\mathbf{P}.

Step 4. Reassemble. E[log⁡N]=−N2log⁡(2πσn2)−12σn2∥y−μ∥2−12σn2tr⁡P\mathbb{E}[\log\mathcal{N}] = -\tfrac N2\log(2\pi\sigma_n^2) - \frac{1}{2\sigma_n^2}\lVert\boldsymbol{y} - \boldsymbol{\mu}\rVert^2 - \frac{1}{2\sigma_n^2}\operatorname{tr}\mathbf{P}, and the first two terms are log⁡N(y∣μ,σn2I)\log\mathcal{N}(\boldsymbol{y} \mid \boldsymbol{\mu}, \sigma_n^2\mathbf{I}).

Only the trace of the covariance enters: the expected log-likelihood is the log-likelihood at the mean, minus a penalty for the spread of f\boldsymbol{f}.

The optimal q(u) and the collapsed bound

Theorem 2 (Titsias (2009))

Over all densities q(u)q(\boldsymbol{u}), the ELBO of the family p(f∣u) q(u)p(\boldsymbol{f} \mid \boldsymbol{u})\,q(\boldsymbol{u}) is maximised by

q∗(u)∝N(y∣Au,σn2I) p(u),q^*(\boldsymbol{u}) \propto \mathcal{N}(\boldsymbol{y} \mid \mathbf{A}\boldsymbol{u}, \sigma_n^2\mathbf{I})\,p(\boldsymbol{u}),

and its maximum value is

 F=log⁡N(y∣0, Qff+σn2I)−12σn2tr⁡(Kff−Qff) \boxed{\ \mathcal{F} = \log\mathcal{N}\big(\boldsymbol{y} \mid \mathbf{0},\ \mathbf{Q}_{ff} + \sigma_n^2\mathbf{I}\big) - \frac{1}{2\sigma_n^2}\operatorname{tr}\big(\mathbf{K}_{ff} - \mathbf{Q}_{ff}\big)\ }
Proof

Step 1. Do the inner expectation over f\boldsymbol{f}. For fixed u\boldsymbol{u}, f∼p(f∣u)=N(Au,C)\boldsymbol{f} \sim p(\boldsymbol{f} \mid \boldsymbol{u}) = \mathcal{N}(\mathbf{A}\boldsymbol{u}, \mathbf{C}). The expected-log-likelihood lemma gives

Ep(f∣u)[log⁡p(y∣f)]=log⁡N(y∣Au,σn2I)−t2σn2,t=tr⁡C.\mathbb{E}_{p(\boldsymbol{f} \mid \boldsymbol{u})}\big[\log p(\boldsymbol{y} \mid \boldsymbol{f})\big] = \log\mathcal{N}(\boldsymbol{y} \mid \mathbf{A}\boldsymbol{u}, \sigma_n^2\mathbf{I}) - \frac{t}{2\sigma_n^2}, \qquad t = \operatorname{tr}\mathbf{C}.

Step 2. Put it into the ELBO. Write the KL as an expectation and collect everything under one Eq(u)\mathbb{E}_{q(\boldsymbol{u})}:

L(q)=Eq(u)[log⁡N(y∣Au,σn2I) p(u)q(u)]−t2σn2.\mathcal{L}(q) = \mathbb{E}_{q(\boldsymbol{u})}\left[\log\frac{\mathcal{N}(\boldsymbol{y} \mid \mathbf{A}\boldsymbol{u}, \sigma_n^2\mathbf{I})\,p(\boldsymbol{u})}{q(\boldsymbol{u})}\right] - \frac{t}{2\sigma_n^2}.

Step 3. Normalise the numerator. Let Z0=∫N(y∣Au,σn2I) p(u) duZ_0 = \int\mathcal{N}(\boldsymbol{y} \mid \mathbf{A}\boldsymbol{u}, \sigma_n^2\mathbf{I})\,p(\boldsymbol{u})\,d\boldsymbol{u} and q∗(u)=N(y∣Au,σn2I) p(u)/Z0q^*(\boldsymbol{u}) = \mathcal{N}(\boldsymbol{y} \mid \mathbf{A}\boldsymbol{u}, \sigma_n^2\mathbf{I})\,p(\boldsymbol{u})/Z_0, a probability density. Then the numerator is Z0 q∗(u)Z_0\,q^*(\boldsymbol{u}), and

L(q)=log⁡Z0−KL[q ∥ q∗]−t2σn2.\mathcal{L}(q) = \log Z_0 - \mathrm{KL}\big[q \,\Vert\, q^*\big] - \frac{t}{2\sigma_n^2}.

Step 4. Maximise. By Gibbs’ inequality the KL term is at least zero, with equality exactly at q=q∗q = q^*. So q∗q^* is the maximiser and the maximum is log⁡Z0−t/(2σn2)\log Z_0 - t/(2\sigma_n^2).

Step 5. Compute Z0Z_0. It is the marginal of y\boldsymbol{y} in the linear-Gaussian model u∼N(0,Kuu)\boldsymbol{u} \sim \mathcal{N}(\mathbf{0}, \mathbf{K}_{uu}), y∣u∼N(Au,σn2I)\boldsymbol{y} \mid \boldsymbol{u} \sim \mathcal{N}(\mathbf{A}\boldsymbol{u}, \sigma_n^2\mathbf{I}). That marginal is N(0,AKuuA⊤+σn2I)\mathcal{N}(\mathbf{0}, \mathbf{A}\mathbf{K}_{uu}\mathbf{A}^\top + \sigma_n^2\mathbf{I}) (the primer’s Lemma 8, linear-Gaussian model), and

AKuuA⊤=KfuKuu−1KuuKuu−1Kuf=Qff.\mathbf{A}\mathbf{K}_{uu}\mathbf{A}^\top = \mathbf{K}_{fu}\mathbf{K}_{uu}^{-1}\mathbf{K}_{uu}\mathbf{K}_{uu}^{-1}\mathbf{K}_{uf} = \mathbf{Q}_{ff}.

So log⁡Z0=log⁡N(y∣0,Qff+σn2I)\log Z_0 = \log\mathcal{N}(\boldsymbol{y} \mid \mathbf{0}, \mathbf{Q}_{ff} + \sigma_n^2\mathbf{I}).

Corollary 2 (The optimal q(u) in closed form)

q∗(u)=N(m∗,S∗)q^*(\boldsymbol{u}) = \mathcal{N}(\boldsymbol{m}^*, \mathbf{S}^*) with

S∗=KuuΣKuu,m∗=σn−2 KuuΣKufy,Σ=(Kuu+σn−2KufKfu)−1.\mathbf{S}^* = \mathbf{K}_{uu}\boldsymbol{\Sigma}\mathbf{K}_{uu}, \qquad \boldsymbol{m}^* = \sigma_n^{-2}\,\mathbf{K}_{uu}\boldsymbol{\Sigma}\mathbf{K}_{uf}\boldsymbol{y}, \qquad \boldsymbol{\Sigma} = \big(\mathbf{K}_{uu} + \sigma_n^{-2}\mathbf{K}_{uf}\mathbf{K}_{fu}\big)^{-1}.
Proof

Step 1. It is a linear-Gaussian posterior. q∗q^* is proportional to a Gaussian prior on u\boldsymbol{u} times a Gaussian likelihood with design matrix A\mathbf{A}. So it is Gaussian, with precision Kuu−1+σn−2A⊤A\mathbf{K}_{uu}^{-1} + \sigma_n^{-2}\mathbf{A}^\top\mathbf{A} and mean S∗σn−2A⊤y\mathbf{S}^*\sigma_n^{-2}\mathbf{A}^\top\boldsymbol{y} (the primer’s Lemma 8, in information form).

Step 2. Factor the precision. With A⊤A=Kuu−1KufKfuKuu−1\mathbf{A}^\top\mathbf{A} = \mathbf{K}_{uu}^{-1}\mathbf{K}_{uf}\mathbf{K}_{fu}\mathbf{K}_{uu}^{-1},

Kuu−1+σn−2A⊤A=Kuu−1(Kuu+σn−2KufKfu)Kuu−1=Kuu−1Σ−1Kuu−1.\mathbf{K}_{uu}^{-1} + \sigma_n^{-2}\mathbf{A}^\top\mathbf{A} = \mathbf{K}_{uu}^{-1}\big(\mathbf{K}_{uu} + \sigma_n^{-2}\mathbf{K}_{uf}\mathbf{K}_{fu}\big)\mathbf{K}_{uu}^{-1} = \mathbf{K}_{uu}^{-1}\boldsymbol{\Sigma}^{-1}\mathbf{K}_{uu}^{-1}.

Step 3. Invert. (PRP)−1=P−1R−1P−1(\mathbf{P}\mathbf{R}\mathbf{P})^{-1} = \mathbf{P}^{-1}\mathbf{R}^{-1}\mathbf{P}^{-1}, so S∗=KuuΣKuu\mathbf{S}^* = \mathbf{K}_{uu}\boldsymbol{\Sigma}\mathbf{K}_{uu}.

Step 4. The mean. m∗=σn−2KuuΣKuuKuu−1Kufy=σn−2KuuΣKufy\boldsymbol{m}^* = \sigma_n^{-2}\mathbf{K}_{uu}\boldsymbol{\Sigma}\mathbf{K}_{uu}\mathbf{K}_{uu}^{-1}\mathbf{K}_{uf}\boldsymbol{y} = \sigma_n^{-2}\mathbf{K}_{uu}\boldsymbol{\Sigma}\mathbf{K}_{uf}\boldsymbol{y}.

Every matrix here is M×MM \times M or M×NM \times N. Nothing N×NN \times N is ever formed.

Reading the bound

  • The first term is the DTC evidence. log⁡N(y∣0,Qff+σn2I)\log\mathcal{N}(\boldsymbol{y} \mid \mathbf{0}, \mathbf{Q}_{ff} + \sigma_n^2\mathbf{I}) is the log evidence of the low-rank model from Section 4, with its usual data-fit and complexity parts.
  • The second term is what makes it honest. −t/(2σn2)=−∑ici/(2σn2)-t/(2\sigma_n^2) = -\sum_i c_i/(2\sigma_n^2) charges, at every training input, the prior variance the inducing points leave unexplained, measured in units of noise variance. Inducing points that leave data uncovered are penalised. In the figure this is the sum of the grey bars, divided by 2σn22\sigma_n^2.
  • The optimal q∗(u)q^*(\boldsymbol{u}) is the DTC posterior over u\boldsymbol{u}. The variational solution predicts like DTC, but it learns hyperparameters and Z\mathbf{Z} with the extra trace term.

Proposition 3 (The gap is a KL divergence)

log⁡p(y)−F=KL[p(f∣u) q∗(u) ∥ p(f,u∣y)]≥0.\log p(\boldsymbol{y}) - \mathcal{F} = \mathrm{KL}\big[p(\boldsymbol{f} \mid \boldsymbol{u})\,q^*(\boldsymbol{u}) \,\big\Vert\, p(\boldsymbol{f}, \boldsymbol{u} \mid \boldsymbol{y})\big] \geq 0.
Proof

Step 1. Apply the evidence decomposition of Section 2 to the augmented model, with z=(f,u)\boldsymbol{z} = (\boldsymbol{f}, \boldsymbol{u}) and q(f,u)=p(f∣u) q∗(u)q(\boldsymbol{f}, \boldsymbol{u}) = p(\boldsymbol{f} \mid \boldsymbol{u})\,q^*(\boldsymbol{u}).

Step 2. The augmented model has the same evidence p(y)p(\boldsymbol{y}), and L(q)=F\mathcal{L}(q) = \mathcal{F} at this qq by the theorem. Rearranging the decomposition gives the identity, and Gibbs’ inequality gives the sign.

Matthews, Hensman, Turner and Ghahramani (2016) proved more: the same number is the KL divergence between the approximating process and the posterior process, over the whole function, not only at X\mathbf{X} and Z\mathbf{Z}. So moving Z\mathbf{Z} to raise F\mathcal{F} always brings the approximation closer to the true posterior. It cannot overfit in the way FITC’s evidence can.

Proposition 4 (More inducing points never hurt)

  1. If Z=X\mathbf{Z} = \mathbf{X}, then F=log⁡p(y)\mathcal{F} = \log p(\boldsymbol{y}).
  2. Adding an inducing input to Z\mathbf{Z} cannot lower the optimal bound F\mathcal{F}.
Proof

Step 1. The case Z=X\mathbf{Z} = \mathbf{X}. Then Kfu=Kuu=Kff\mathbf{K}_{fu} = \mathbf{K}_{uu} = \mathbf{K}_{ff}, so Qff=Kff\mathbf{Q}_{ff} = \mathbf{K}_{ff} and C=0\mathbf{C} = \mathbf{0}. The trace term vanishes and the first term is log⁡N(y∣0,Kff+σn2I)=log⁡p(y)\log\mathcal{N}(\boldsymbol{y} \mid \mathbf{0}, \mathbf{K}_{ff} + \sigma_n^2\mathbf{I}) = \log p(\boldsymbol{y}).

Step 2. Embed the old family in the new one. Let u′=(u,unew)\boldsymbol{u}' = (\boldsymbol{u}, u_{\mathrm{new}}). In the new family choose q(u′)=p(unew∣u) q(u)q(\boldsymbol{u}') = p(u_{\mathrm{new}} \mid \boldsymbol{u})\,q(\boldsymbol{u}). Then q(f,u′)=p(f,unew∣u) q(u)q(\boldsymbol{f}, \boldsymbol{u}') = p(\boldsymbol{f}, u_{\mathrm{new}} \mid \boldsymbol{u})\,q(\boldsymbol{u}).

Step 3. Same ELBO. The ratio inside the new ELBO is

p(y∣f) p(f,unew∣u) p(u)p(f,unew∣u) q(u)=p(y∣f) p(u)q(u),\frac{p(\boldsymbol{y} \mid \boldsymbol{f})\,p(\boldsymbol{f}, u_{\mathrm{new}} \mid \boldsymbol{u})\,p(\boldsymbol{u})}{p(\boldsymbol{f}, u_{\mathrm{new}} \mid \boldsymbol{u})\,q(\boldsymbol{u})} = \frac{p(\boldsymbol{y} \mid \boldsymbol{f})\,p(\boldsymbol{u})}{q(\boldsymbol{u})},

the same as before. So every ELBO value reachable with Z\mathbf{Z} is reachable with the larger set.

Step 4. Conclude. The maximum over a larger set is at least the maximum over a smaller one.

6. A sandwich: the upper bound

A lower bound alone cannot say how close it is to the truth. Titsias (2014) gave an upper bound that costs the same O(NM2)O(NM^2); Burt, Rasmussen and van der Wilk (2019) used it to prove their convergence results.

Proposition 5 (Upper bound on the evidence)

With t=tr⁡(Kff−Qff)t = \operatorname{tr}(\mathbf{K}_{ff} - \mathbf{Q}_{ff}),

log⁡p(y)≤U=−12 y⊤(Qff+(σn2+t)I)−1y−12log⁡∣Qff+σn2I∣−N2log⁡2π.\log p(\boldsymbol{y}) \leq \mathcal{U} = -\tfrac12\,\boldsymbol{y}^\top\big(\mathbf{Q}_{ff} + (\sigma_n^2 + t)\mathbf{I}\big)^{-1}\boldsymbol{y} - \tfrac12\log\big\lvert\mathbf{Q}_{ff} + \sigma_n^2\mathbf{I}\big\rvert - \tfrac N2\log 2\pi .
Proof

Step 1. Split the exact covariance. Kff+σn2I=(Qff+σn2I)+C\mathbf{K}_{ff} + \sigma_n^2\mathbf{I} = (\mathbf{Q}_{ff} + \sigma_n^2\mathbf{I}) + \mathbf{C} with C⪰0\mathbf{C} \succeq \mathbf{0} (Section 3).

Step 2. The determinant can only grow. If P⪰R≻0\mathbf{P} \succeq \mathbf{R} \succ \mathbf{0}, then R−1/2PR−1/2⪰I\mathbf{R}^{-1/2}\mathbf{P}\mathbf{R}^{-1/2} \succeq \mathbf{I} has all eigenvalues at least 1, so ∣P∣≥∣R∣\lvert\mathbf{P}\rvert \geq \lvert\mathbf{R}\rvert. Hence

−12log⁡∣Kff+σn2I∣≤−12log⁡∣Qff+σn2I∣.-\tfrac12\log\lvert\mathbf{K}_{ff} + \sigma_n^2\mathbf{I}\rvert \leq -\tfrac12\log\lvert\mathbf{Q}_{ff} + \sigma_n^2\mathbf{I}\rvert .

Step 3. Bound C\mathbf{C} by a multiple of the identity. C\mathbf{C} is positive semi-definite, so its eigenvalues are non-negative and sum to tt. Its largest eigenvalue is therefore at most tt, and C⪯t I\mathbf{C} \preceq t\,\mathbf{I}.

Step 4. So the exact covariance is dominated. Kff+σn2I⪯Qff+(σn2+t)I\mathbf{K}_{ff} + \sigma_n^2\mathbf{I} \preceq \mathbf{Q}_{ff} + (\sigma_n^2 + t)\mathbf{I}.

Step 5. Inversion reverses the order. If P⪯R\mathbf{P} \preceq \mathbf{R} (both positive definite), then P−1⪰R−1\mathbf{P}^{-1} \succeq \mathbf{R}^{-1}. Hence

−12y⊤(Kff+σn2I)−1y≤−12y⊤(Qff+(σn2+t)I)−1y.-\tfrac12\boldsymbol{y}^\top(\mathbf{K}_{ff} + \sigma_n^2\mathbf{I})^{-1}\boldsymbol{y} \leq -\tfrac12\boldsymbol{y}^\top\big(\mathbf{Q}_{ff} + (\sigma_n^2 + t)\mathbf{I}\big)^{-1}\boldsymbol{y}.

Step 6. Add the pieces. The exact log⁡p(y)\log p(\boldsymbol{y}) is the sum of the two left-hand sides and −N2log⁡2π-\tfrac N2\log 2\pi; replacing each by its upper bound gives U\mathcal{U}.

So F≤log⁡p(y)≤U\mathcal{F} \leq \log p(\boldsymbol{y}) \leq \mathcal{U}, and U−F\mathcal{U} - \mathcal{F} bounds the KL divergence of the approximation. Both depend on how small tt is. Burt et al. (2019, Lemma 1) turn this into an explicit bound:

KL≤t2σn2(1+∥y∥2σn2+t).\mathrm{KL} \leq \frac{t}{2\sigma_n^2}\left(1 + \frac{\lVert\boldsymbol{y}\rVert^2}{\sigma_n^2 + t}\right).

To make the approximation good, make tt small: place inducing points so that the training inputs’ prior variance is explained. That is what Greedy does in the figure.

7. Predictions and an implementation you can trust

The variational posterior is a GP. At a test input, the inducing variables carry everything the data said.

Proposition 6 (The predictive distribution)

With q(u)=N(m,S)q(\boldsymbol{u}) = \mathcal{N}(\boldsymbol{m}, \mathbf{S}), ku=k(Z,x∗)\boldsymbol{k}_u = k(\mathbf{Z}, \boldsymbol{x}_*) and a∗=Kuu−1ku\boldsymbol{a}_* = \mathbf{K}_{uu}^{-1}\boldsymbol{k}_u,

q(f∗)=N(f∗∣a∗⊤m, k∗∗−ku⊤Kuu−1ku+a∗⊤S a∗).q(f_*) = \mathcal{N}\big(f_* \mid \boldsymbol{a}_*^\top\boldsymbol{m},\ k_{**} - \boldsymbol{k}_u^\top\mathbf{K}_{uu}^{-1}\boldsymbol{k}_u + \boldsymbol{a}_*^\top\mathbf{S}\,\boldsymbol{a}_*\big).

At the optimum q∗q^* this is mean σn−2ku⊤ΣKufy\sigma_n^{-2}\boldsymbol{k}_u^\top\boldsymbol{\Sigma}\mathbf{K}_{uf}\boldsymbol{y} and variance k∗∗−ku⊤(Kuu−1−Σ)kuk_{**} - \boldsymbol{k}_u^\top(\mathbf{K}_{uu}^{-1} - \boldsymbol{\Sigma})\boldsymbol{k}_u.

Proof

Step 1. The conditional at the test point. Exactly as in the lemma of Section 3, p(f∗∣u)=N(a∗⊤u, k∗∗−ku⊤Kuu−1ku)p(f_* \mid \boldsymbol{u}) = \mathcal{N}(\boldsymbol{a}_*^\top\boldsymbol{u},\ k_{**} - \boldsymbol{k}_u^\top\mathbf{K}_{uu}^{-1}\boldsymbol{k}_u).

Step 2. Integrate out u\boldsymbol{u}. q(f∗)=∫p(f∗∣u) q(u) duq(f_*) = \int p(f_* \mid \boldsymbol{u})\,q(\boldsymbol{u})\,d\boldsymbol{u} is a linear-Gaussian marginal: the mean is a∗⊤m\boldsymbol{a}_*^\top\boldsymbol{m} and the variance is the conditional variance plus a∗⊤Sa∗\boldsymbol{a}_*^\top\mathbf{S}\boldsymbol{a}_* (the primer’s Lemma 8).

Step 3. Substitute the optimum. From the corollary, Kuu−1m∗=σn−2ΣKufy\mathbf{K}_{uu}^{-1}\boldsymbol{m}^* = \sigma_n^{-2}\boldsymbol{\Sigma}\mathbf{K}_{uf}\boldsymbol{y} and Kuu−1S∗Kuu−1=Σ\mathbf{K}_{uu}^{-1}\mathbf{S}^*\mathbf{K}_{uu}^{-1} = \boldsymbol{\Sigma}. So a∗⊤m∗=σn−2ku⊤ΣKufy\boldsymbol{a}_*^\top\boldsymbol{m}^* = \sigma_n^{-2}\boldsymbol{k}_u^\top\boldsymbol{\Sigma}\mathbf{K}_{uf}\boldsymbol{y} and a∗⊤S∗a∗=ku⊤Σku\boldsymbol{a}_*^\top\mathbf{S}^*\boldsymbol{a}_* = \boldsymbol{k}_u^\top\boldsymbol{\Sigma}\boldsymbol{k}_u.

Far from every inducing point ku≈0\boldsymbol{k}_u \approx \mathbf{0}, so the prediction returns to the prior: mean 00, variance k∗∗k_{**}. That is the right behaviour in a gap of the data, and the wrong one if the inducing points do not cover the data, which the bound punishes.

The formulas above invert Kuu\mathbf{K}_{uu} and Σ−1\boldsymbol{\Sigma}^{-1} directly, which is numerically fragile: Kuu\mathbf{K}_{uu} is often badly conditioned. Production code (for example GPflow’s SGPR) works with two M×MM \times M Cholesky factors instead.

Proposition 7 (A stable form of the bound and the predictions)

Let LL⊤=Kuu\mathbf{L}\mathbf{L}^\top = \mathbf{K}_{uu}, A^=L−1Kuf/σn\hat{\mathbf{A}} = \mathbf{L}^{-1}\mathbf{K}_{uf}/\sigma_n (M×NM \times N), B=I+A^A^⊤\mathbf{B} = \mathbf{I} + \hat{\mathbf{A}}\hat{\mathbf{A}}^\top with LBLB⊤=B\mathbf{L}_B\mathbf{L}_B^\top = \mathbf{B}, and b=LB−1A^y/σn\boldsymbol{b} = \mathbf{L}_B^{-1}\hat{\mathbf{A}}\boldsymbol{y}/\sigma_n. Then

F=−N2log⁡2π−Nlog⁡σn−∑jlog⁡(LB)jj−y⊤y2σn2+12b⊤b−tr⁡Kff2σn2+12tr⁡(A^A^⊤),\mathcal{F} = -\tfrac N2\log 2\pi - N\log\sigma_n - \sum_{j}\log(\mathbf{L}_B)_{jj} - \frac{\boldsymbol{y}^\top\boldsymbol{y}}{2\sigma_n^2} + \tfrac12\boldsymbol{b}^\top\boldsymbol{b} - \frac{\operatorname{tr}\mathbf{K}_{ff}}{2\sigma_n^2} + \tfrac12\operatorname{tr}\big(\hat{\mathbf{A}}\hat{\mathbf{A}}^\top\big),

and with g1=L−1ku\boldsymbol{g}_1 = \mathbf{L}^{-1}\boldsymbol{k}_u, g2=LB−1g1\boldsymbol{g}_2 = \mathbf{L}_B^{-1}\boldsymbol{g}_1, the optimal predictive has mean g2⊤b\boldsymbol{g}_2^\top\boldsymbol{b} and variance k∗∗−g1⊤g1+g2⊤g2k_{**} - \boldsymbol{g}_1^\top\boldsymbol{g}_1 + \boldsymbol{g}_2^\top\boldsymbol{g}_2.

Proof

Step 1. Rewrite Qff\mathbf{Q}_{ff}. Qff=KfuL−⊤L−1Kuf=σn2A^⊤A^\mathbf{Q}_{ff} = \mathbf{K}_{fu}\mathbf{L}^{-\top}\mathbf{L}^{-1}\mathbf{K}_{uf} = \sigma_n^2\hat{\mathbf{A}}^\top\hat{\mathbf{A}}, so Qff+σn2I=σn2(IN+A^⊤A^)\mathbf{Q}_{ff} + \sigma_n^2\mathbf{I} = \sigma_n^2(\mathbf{I}_N + \hat{\mathbf{A}}^\top\hat{\mathbf{A}}).

Step 2. The determinant. Sylvester’s identity gives ∣IN+A^⊤A^∣=∣IM+A^A^⊤∣=∣B∣\lvert\mathbf{I}_N + \hat{\mathbf{A}}^\top\hat{\mathbf{A}}\rvert = \lvert\mathbf{I}_M + \hat{\mathbf{A}}\hat{\mathbf{A}}^\top\rvert = \lvert\mathbf{B}\rvert. To see it, take the determinant of the block matrix [IM−A^A^⊤IN]\begin{bmatrix}\mathbf{I}_M & -\hat{\mathbf{A}}\\ \hat{\mathbf{A}}^\top & \mathbf{I}_N\end{bmatrix} in two ways, eliminating either block by its Schur complement: one way gives ∣IN+A^⊤A^∣\lvert\mathbf{I}_N + \hat{\mathbf{A}}^\top\hat{\mathbf{A}}\rvert, the other ∣IM+A^A^⊤∣\lvert\mathbf{I}_M + \hat{\mathbf{A}}\hat{\mathbf{A}}^\top\rvert. So log⁡∣Qff+σn2I∣=2Nlog⁡σn+2∑jlog⁡(LB)jj\log\lvert\mathbf{Q}_{ff} + \sigma_n^2\mathbf{I}\rvert = 2N\log\sigma_n + 2\sum_j\log(\mathbf{L}_B)_{jj}.

Step 3. The quadratic form. The Woodbury identity (the primer’s Lemma 6 with Σw=I\boldsymbol{\Sigma}_w = \mathbf{I}, Φ=A^\boldsymbol{\Phi} = \hat{\mathbf{A}} and unit noise) gives (IN+A^⊤A^)−1=IN−A^⊤B−1A^(\mathbf{I}_N + \hat{\mathbf{A}}^\top\hat{\mathbf{A}})^{-1} = \mathbf{I}_N - \hat{\mathbf{A}}^\top\mathbf{B}^{-1}\hat{\mathbf{A}}. Hence

y⊤(Qff+σn2I)−1y=σn−2y⊤y−σn−2∥LB−1A^y∥2=σn−2y⊤y−b⊤b.\boldsymbol{y}^\top(\mathbf{Q}_{ff} + \sigma_n^2\mathbf{I})^{-1}\boldsymbol{y} = \sigma_n^{-2}\boldsymbol{y}^\top\boldsymbol{y} - \sigma_n^{-2}\lVert\mathbf{L}_B^{-1}\hat{\mathbf{A}}\boldsymbol{y}\rVert^2 = \sigma_n^{-2}\boldsymbol{y}^\top\boldsymbol{y} - \boldsymbol{b}^\top\boldsymbol{b}.

Step 4. The trace term. tr⁡Qff=σn2tr⁡(A^⊤A^)=σn2tr⁡(A^A^⊤)\operatorname{tr}\mathbf{Q}_{ff} = \sigma_n^2\operatorname{tr}(\hat{\mathbf{A}}^\top\hat{\mathbf{A}}) = \sigma_n^2\operatorname{tr}(\hat{\mathbf{A}}\hat{\mathbf{A}}^\top), so −tr⁡(Kff−Qff)/(2σn2)=−tr⁡Kff/(2σn2)+12tr⁡(A^A^⊤)-\operatorname{tr}(\mathbf{K}_{ff} - \mathbf{Q}_{ff})/(2\sigma_n^2) = -\operatorname{tr}\mathbf{K}_{ff}/(2\sigma_n^2) + \tfrac12\operatorname{tr}(\hat{\mathbf{A}}\hat{\mathbf{A}}^\top). Steps 2 to 4 assemble into the stated F\mathcal{F}.

Step 5. Σ\boldsymbol{\Sigma} in factored form. Σ−1=Kuu+σn−2KufKfu=L(I+A^A^⊤)L⊤=LBL⊤\boldsymbol{\Sigma}^{-1} = \mathbf{K}_{uu} + \sigma_n^{-2}\mathbf{K}_{uf}\mathbf{K}_{fu} = \mathbf{L}(\mathbf{I} + \hat{\mathbf{A}}\hat{\mathbf{A}}^\top)\mathbf{L}^\top = \mathbf{L}\mathbf{B}\mathbf{L}^\top, so Σ=L−⊤B−1L−1\boldsymbol{\Sigma} = \mathbf{L}^{-\top}\mathbf{B}^{-1}\mathbf{L}^{-1}.

Step 6. The predictive mean. σn−2ku⊤ΣKufy=σn−2g1⊤B−1(σnA^y)=g1⊤LB−⊤LB−1A^y/σn=g2⊤b\sigma_n^{-2}\boldsymbol{k}_u^\top\boldsymbol{\Sigma}\mathbf{K}_{uf}\boldsymbol{y} = \sigma_n^{-2}\boldsymbol{g}_1^\top\mathbf{B}^{-1}(\sigma_n\hat{\mathbf{A}}\boldsymbol{y}) = \boldsymbol{g}_1^\top\mathbf{L}_B^{-\top}\mathbf{L}_B^{-1}\hat{\mathbf{A}}\boldsymbol{y}/\sigma_n = \boldsymbol{g}_2^\top\boldsymbol{b}.

Step 7. The predictive variance. ku⊤Kuu−1ku=g1⊤g1\boldsymbol{k}_u^\top\mathbf{K}_{uu}^{-1}\boldsymbol{k}_u = \boldsymbol{g}_1^\top\boldsymbol{g}_1 and ku⊤Σku=g1⊤B−1g1=g2⊤g2\boldsymbol{k}_u^\top\boldsymbol{\Sigma}\boldsymbol{k}_u = \boldsymbol{g}_1^\top\mathbf{B}^{-1}\boldsymbol{g}_1 = \boldsymbol{g}_2^\top\boldsymbol{g}_2.

In NumPy, with a kernel function k(A, B) that returns the matrix of kernel values (the figure above runs the same lines in JavaScript):

import numpy as np
from scipy.linalg import cholesky, solve_triangular

def sgpr(X, y, Z, k, sn, jitter=1e-6):
    """Titsias's collapsed bound F and a predictor, in O(N M^2) time and O(N M) memory."""
    N, M = len(X), len(Z)
    L = cholesky(k(Z, Z) + jitter * np.eye(M), lower=True)     # K_uu = L L^T
    A = solve_triangular(L, k(Z, X), lower=True) / sn            # \hat{A}, M x N
    B = np.eye(M) + A @ A.T
    LB = cholesky(B, lower=True)
    b = solve_triangular(LB, A @ y, lower=True) / sn
    trace_Kff = sum(k(X[i:i+1], X[i:i+1])[0, 0] for i in range(N))   # only the diagonal is needed
    F = (-0.5 * N * np.log(2 * np.pi) - N * np.log(sn) - np.log(np.diag(LB)).sum()
         - 0.5 * y @ y / sn**2 + 0.5 * b @ b
         - 0.5 * trace_Kff / sn**2 + 0.5 * np.sum(A * A))

    def predict(Xs):
        g1 = solve_triangular(L, k(Z, Xs), lower=True)
        g2 = solve_triangular(LB, g1, lower=True)
        mean = g2.T @ b
        var = np.array([k(x[None], x[None])[0, 0] for x in Xs]) - np.sum(g1**2, 0) + np.sum(g2**2, 0)
        return mean, var
    return F, predict

The dominant costs are forming A^\hat{\mathbf{A}} and A^A^⊤\hat{\mathbf{A}}\hat{\mathbf{A}}^\top, both O(NM2)O(NM^2), plus two O(M3)O(M^3) Cholesky factorisations. For N=106N = 10^6 and M=103M = 10^3 that is about 101210^{12} flops, minutes on a CPU. But A^\hat{\mathbf{A}} alone holds 10910^9 numbers, 8 GB. The collapsed bound still touches every data point at every step, which is what Hensman’s method removes.

8. Hensman: stochastic variational GPs

Why the collapsed bound does not minibatch

Stochastic gradient methods need an objective that is a sum over data points: then a random minibatch, rescaled, gives an unbiased estimate of it and of its gradient. F\mathcal{F} is not such a sum. Its quadratic term y⊤(Qff+σn2I)−1y\boldsymbol{y}^\top(\mathbf{Q}_{ff} + \sigma_n^2\mathbf{I})^{-1}\boldsymbol{y} couples every pair of points, because optimising q(u)q(\boldsymbol{u}) analytically has already mixed all the data into q∗q^*.

Hensman, Fusi and Lawrence (2013) undo that step. They keep q(u)=N(m,S)q(\boldsymbol{u}) = \mathcal{N}(\boldsymbol{m}, \mathbf{S}) explicit and optimise m\boldsymbol{m} and S\mathbf{S} by stochastic gradients along with everything else.

Proposition 8 (The SVGP bound)

For a likelihood that factorises over data points, p(y∣f)=∏ip(yi∣fi)p(\boldsymbol{y} \mid \boldsymbol{f}) = \prod_i p(y_i \mid f_i), and q(u)=N(m,S)q(\boldsymbol{u}) = \mathcal{N}(\boldsymbol{m}, \mathbf{S}):

L(m,S)=∑i=1NEq(fi)[log⁡p(yi∣fi)]−KL[N(m,S) ∥ N(0,Kuu)],\mathcal{L}(\boldsymbol{m}, \mathbf{S}) = \sum_{i=1}^{N}\mathbb{E}_{q(f_i)}\big[\log p(y_i \mid f_i)\big] - \mathrm{KL}\big[\mathcal{N}(\boldsymbol{m}, \mathbf{S}) \,\Vert\, \mathcal{N}(\mathbf{0}, \mathbf{K}_{uu})\big],

where each q(fi)q(f_i) is the one-dimensional Gaussian

q(fi)=N(fi∣ai⊤m, ci+ai⊤S ai).q(f_i) = \mathcal{N}\big(f_i \mid \boldsymbol{a}_i^\top\boldsymbol{m},\ c_i + \boldsymbol{a}_i^\top\mathbf{S}\,\boldsymbol{a}_i\big).
Proof

Step 1. Start from the lemma of Section 5. L=Eq(f,u)[log⁡p(y∣f)]−KL[q(u) ∥ p(u)]\mathcal{L} = \mathbb{E}_{q(\boldsymbol{f}, \boldsymbol{u})}[\log p(\boldsymbol{y} \mid \boldsymbol{f})] - \mathrm{KL}[q(\boldsymbol{u}) \,\Vert\, p(\boldsymbol{u})].

Step 2. Only the marginal of f\boldsymbol{f} matters. The first term depends on f\boldsymbol{f} alone, so it is an expectation under q(f)=∫p(f∣u) q(u) duq(\boldsymbol{f}) = \int p(\boldsymbol{f} \mid \boldsymbol{u})\,q(\boldsymbol{u})\,d\boldsymbol{u}. That is a linear-Gaussian marginal: q(f)=N(Am,C+ASA⊤)q(\boldsymbol{f}) = \mathcal{N}(\mathbf{A}\boldsymbol{m}, \mathbf{C} + \mathbf{A}\mathbf{S}\mathbf{A}^\top).

Step 3. The log-likelihood is a sum. log⁡p(y∣f)=∑ilog⁡p(yi∣fi)\log p(\boldsymbol{y} \mid \boldsymbol{f}) = \sum_i\log p(y_i \mid f_i), and the expectation of a sum is the sum of expectations.

Step 4. Each term needs one marginal. log⁡p(yi∣fi)\log p(y_i \mid f_i) depends only on fif_i, whose marginal under q(f)q(\boldsymbol{f}) has mean (Am)i=ai⊤m(\mathbf{A}\boldsymbol{m})_i = \boldsymbol{a}_i^\top\boldsymbol{m} and variance Cii+(ASA⊤)ii=ci+ai⊤SaiC_{ii} + (\mathbf{A}\mathbf{S}\mathbf{A}^\top)_{ii} = c_i + \boldsymbol{a}_i^\top\mathbf{S}\boldsymbol{a}_i.

For a Gaussian likelihood each term has a closed form, by the expected-log-likelihood lemma in one dimension:

Eq(fi)[log⁡N(yi∣fi,σn2)]=log⁡N(yi∣ai⊤m,σn2)−ci+ai⊤S ai2σn2.\mathbb{E}_{q(f_i)}\big[\log\mathcal{N}(y_i \mid f_i, \sigma_n^2)\big] = \log\mathcal{N}(y_i \mid \boldsymbol{a}_i^\top\boldsymbol{m}, \sigma_n^2) - \frac{c_i + \boldsymbol{a}_i^\top\mathbf{S}\,\boldsymbol{a}_i}{2\sigma_n^2}.

The KL term, between two MM-dimensional Gaussians, is

KL=12[tr⁡(Kuu−1S)+m⊤Kuu−1m−M+log⁡∣Kuu∣−log⁡∣S∣].\mathrm{KL} = \tfrac12\Big[\operatorname{tr}(\mathbf{K}_{uu}^{-1}\mathbf{S}) + \boldsymbol{m}^\top\mathbf{K}_{uu}^{-1}\boldsymbol{m} - M + \log\lvert\mathbf{K}_{uu}\rvert - \log\lvert\mathbf{S}\rvert\Big].

Proposition 9 (SVGP contains Titsias’s bound)

For a Gaussian likelihood, max⁡m,SL(m,S)=F\max_{\boldsymbol{m}, \mathbf{S}}\mathcal{L}(\boldsymbol{m}, \mathbf{S}) = \mathcal{F}, attained at (m∗,S∗)(\boldsymbol{m}^*, \mathbf{S}^*). For any other (m,S)(\boldsymbol{m}, \mathbf{S}), L(m,S)≤F\mathcal{L}(\boldsymbol{m}, \mathbf{S}) \leq \mathcal{F}.

Proof

Step 1. Titsias’s theorem maximised L\mathcal{L} over all densities q(u)q(\boldsymbol{u}) and found the maximiser q∗q^*, which is Gaussian (corollary).

Step 2. Gaussians are a subset of all densities, and q∗q^* belongs to that subset. So the maximum over Gaussians is the same value F\mathcal{F}, at the same point, and every other Gaussian does no better.

So SVGP gives up nothing at its optimum. Away from the optimum it is a looser bound, the price of being able to minibatch.

Minibatches

Pick a random minibatch B\mathcal{B} of size BB. Then

L^=NB∑i∈BEq(fi)[log⁡p(yi∣fi)]−KL[q(u) ∥ p(u)]\hat{\mathcal{L}} = \frac{N}{B}\sum_{i \in \mathcal{B}}\mathbb{E}_{q(f_i)}\big[\log p(y_i \mid f_i)\big] - \mathrm{KL}\big[q(\boldsymbol{u}) \,\Vert\, p(\boldsymbol{u})\big]

has expectation L\mathcal{L} over the random choice of batch, and so does its gradient. One step costs O(BM2)O(BM^2) for the marginals and O(M3)O(M^3) for the KL and the Cholesky factor of Kuu\mathbf{K}_{uu}, independent of NN. The parameters are m\boldsymbol{m}, a lower-triangular factor of S\mathbf{S}, Z\mathbf{Z} and θ\boldsymbol{\theta}.

Any likelihood

Nothing in the bound assumed a Gaussian likelihood except the closed form above. For classification, counts or robust regression, only the one-dimensional expectations change (Hensman, Matthews and Ghahramani, 2015). Gauss–Hermite quadrature with JJ nodes ξj\xi_j and weights wjw_j computes them accurately:

EN(f∣μ,v)[g(f)]≈1π∑j=1Jwj g(μ+2v ξj).\mathbb{E}_{\mathcal{N}(f \mid \mu, v)}\big[g(f)\big] \approx \frac{1}{\sqrt{\pi}}\sum_{j=1}^{J} w_j\,g\big(\mu + \sqrt{2v}\,\xi_j\big).

It comes from the substitution f=μ+2v ξf = \mu + \sqrt{2v}\,\xi, which turns the Gaussian weight into e−ξ2/πe^{-\xi^2}/\sqrt{\pi}. Twenty nodes are typically plenty. This is how GP classification scales to millions of points.

Whitening

The parameters (m,S)(\boldsymbol{m}, \mathbf{S}) live on the scale of Kuu\mathbf{K}_{uu}, which changes whenever a hyperparameter does. Optimising both at once is like steering while someone moves the road. Whitening changes variables to remove that coupling.

Proposition 10 (The whitened parametrisation)

Write u=Lv\boldsymbol{u} = \mathbf{L}\boldsymbol{v} with LL⊤=Kuu\mathbf{L}\mathbf{L}^\top = \mathbf{K}_{uu}, so that p(v)=N(0,I)p(\boldsymbol{v}) = \mathcal{N}(\mathbf{0}, \mathbf{I}), and let q(v)=N(m~,S~)q(\boldsymbol{v}) = \mathcal{N}(\tilde{\boldsymbol{m}}, \tilde{\mathbf{S}}). Then, with a~i=L−1k(Z,xi)\tilde{\boldsymbol{a}}_i = \mathbf{L}^{-1}k(\mathbf{Z}, \boldsymbol{x}_i),

q(fi)=N(a~i⊤m~, ci+a~i⊤S~ a~i),KL=12[tr⁡S~+m~⊤m~−M−log⁡∣S~∣].q(f_i) = \mathcal{N}\big(\tilde{\boldsymbol{a}}_i^\top\tilde{\boldsymbol{m}},\ c_i + \tilde{\boldsymbol{a}}_i^\top\tilde{\mathbf{S}}\,\tilde{\boldsymbol{a}}_i\big), \qquad \mathrm{KL} = \tfrac12\big[\operatorname{tr}\tilde{\mathbf{S}} + \tilde{\boldsymbol{m}}^\top\tilde{\boldsymbol{m}} - M - \log\lvert\tilde{\mathbf{S}}\rvert\big].
Proof

Step 1. The prior on v\boldsymbol{v}. v=L−1u\boldsymbol{v} = \mathbf{L}^{-1}\boldsymbol{u} has covariance L−1KuuL−⊤=I\mathbf{L}^{-1}\mathbf{K}_{uu}\mathbf{L}^{-\top} = \mathbf{I}.

Step 2. The KL is unchanged by an invertible linear map. Both densities pick up the same Jacobian factor ∣L∣−1\lvert\mathbf{L}\rvert^{-1}, which cancels in the ratio. So KL[q(u) ∥ p(u)]=KL[q(v) ∥ N(0,I)]\mathrm{KL}[q(\boldsymbol{u}) \,\Vert\, p(\boldsymbol{u})] = \mathrm{KL}[q(\boldsymbol{v}) \,\Vert\, \mathcal{N}(\mathbf{0}, \mathbf{I})], which is the Gaussian KL with Λ=I\boldsymbol{\Lambda} = \mathbf{I}.

Step 3. The marginals. q(u)=N(Lm~,LS~L⊤)q(\boldsymbol{u}) = \mathcal{N}(\mathbf{L}\tilde{\boldsymbol{m}}, \mathbf{L}\tilde{\mathbf{S}}\mathbf{L}^\top). Substituting into Hensman’s marginal, ai⊤L=k(xi,Z)Kuu−1L=k(xi,Z)L−⊤=a~i⊤\boldsymbol{a}_i^\top\mathbf{L} = k(\boldsymbol{x}_i, \mathbf{Z})\mathbf{K}_{uu}^{-1}\mathbf{L} = k(\boldsymbol{x}_i, \mathbf{Z})\mathbf{L}^{-\top} = \tilde{\boldsymbol{a}}_i^\top, which gives both moments.

No Kuu−1\mathbf{K}_{uu}^{-1} remains. When a length-scale changes, the prior on v\boldsymbol{v} stays fixed, so (m~,S~)(\tilde{\boldsymbol{m}}, \tilde{\mathbf{S}}) stay meaningful. In practice whitening makes the optimisation much better conditioned, and libraries use it by default.

Natural gradients

Ordinary gradients on (m,S)(\boldsymbol{m}, \mathbf{S}) ignore the geometry of distributions. A small change to S\mathbf{S} can be a large change to qq, and the reverse. Natural gradients precondition by the Fisher information, and for this model they do something remarkable.

Proposition 11 (One natural-gradient step solves the Gaussian case)

Write q(u)q(\boldsymbol{u}) in exponential-family form with natural parameters η=(S−1m, −12S−1)\boldsymbol{\eta} = (\mathbf{S}^{-1}\boldsymbol{m},\ -\tfrac12\mathbf{S}^{-1}), and let η∗\boldsymbol{\eta}^* be those of q∗q^*. For a Gaussian likelihood the natural gradient of the ELBO is η∗−η\boldsymbol{\eta}^* - \boldsymbol{\eta}. So the update η←η+ρ (η∗−η)\boldsymbol{\eta} \leftarrow \boldsymbol{\eta} + \rho\,(\boldsymbol{\eta}^* - \boldsymbol{\eta}) with step size ρ=1\rho = 1 lands exactly on the optimum.

Proof

Step 1. Exponential-family facts. q(u)=h(u)exp⁡(⟨η,T(u)⟩−A(η))q(\boldsymbol{u}) = h(\boldsymbol{u})\exp(\langle\boldsymbol{\eta}, T(\boldsymbol{u})\rangle - A(\boldsymbol{\eta})) with T(u)=(u,uu⊤)T(\boldsymbol{u}) = (\boldsymbol{u}, \boldsymbol{u}\boldsymbol{u}^\top). The mean parameters are μ=Eq[T(u)]=∇A(η)\boldsymbol{\mu} = \mathbb{E}_q[T(\boldsymbol{u})] = \nabla A(\boldsymbol{\eta}), and the Fisher information is F(η)=∇2A(η)=∂μ/∂η\mathbf{F}(\boldsymbol{\eta}) = \nabla^2 A(\boldsymbol{\eta}) = \partial\boldsymbol{\mu}/\partial\boldsymbol{\eta}, a symmetric matrix.

Step 2. The natural gradient is the gradient in mean parameters. By the chain rule, ∇ηL=F ∇μL\nabla_{\boldsymbol{\eta}}\mathcal{L} = \mathbf{F}\,\nabla_{\boldsymbol{\mu}}\mathcal{L}. So F−1∇ηL=∇μL\mathbf{F}^{-1}\nabla_{\boldsymbol{\eta}}\mathcal{L} = \nabla_{\boldsymbol{\mu}}\mathcal{L}.

Step 3. The ELBO as a KL to q∗q^*. Step 3 of Titsias’s proof gave L(q)=const−KL[q ∥ q∗]\mathcal{L}(q) = \text{const} - \mathrm{KL}[q \,\Vert\, q^*], and q∗q^* is in the same family. Writing both log-densities out,

−KL[q ∥ q∗]=Eq[⟨η∗−η,T(u)⟩]−A(η∗)+A(η)=⟨η∗−η,μ⟩−A(η∗)+A(η).-\mathrm{KL}[q \,\Vert\, q^*] = \mathbb{E}_q\big[\langle\boldsymbol{\eta}^* - \boldsymbol{\eta}, T(\boldsymbol{u})\rangle\big] - A(\boldsymbol{\eta}^*) + A(\boldsymbol{\eta}) = \langle\boldsymbol{\eta}^* - \boldsymbol{\eta}, \boldsymbol{\mu}\rangle - A(\boldsymbol{\eta}^*) + A(\boldsymbol{\eta}).

Step 4. Differentiate in μ\boldsymbol{\mu}. Here η\boldsymbol{\eta} is a function of μ\boldsymbol{\mu}. Write J=∂η/∂μ\mathbf{J} = \partial\boldsymbol{\eta}/\partial\boldsymbol{\mu}. Then

∇μ[⟨η∗−η,μ⟩+A(η)]=(η∗−η)−J⊤μ+J⊤∇A(η)=η∗−η,\nabla_{\boldsymbol{\mu}}\big[\langle\boldsymbol{\eta}^* - \boldsymbol{\eta}, \boldsymbol{\mu}\rangle + A(\boldsymbol{\eta})\big] = (\boldsymbol{\eta}^* - \boldsymbol{\eta}) - \mathbf{J}^\top\boldsymbol{\mu} + \mathbf{J}^\top\nabla A(\boldsymbol{\eta}) = \boldsymbol{\eta}^* - \boldsymbol{\eta},

because ∇A(η)=μ\nabla A(\boldsymbol{\eta}) = \boldsymbol{\mu}.

Step 5. Take the step. η+1⋅(η∗−η)=η∗\boldsymbol{\eta} + 1\cdot(\boldsymbol{\eta}^* - \boldsymbol{\eta}) = \boldsymbol{\eta}^*.

With minibatches the natural gradient is noisy, so ρ<1\rho < 1. Salimbeni, Eleftheriadis and Hensman (2018) recommend natural-gradient steps for q(u)q(\boldsymbol{u}) and Adam for θ\boldsymbol{\theta} and Z\mathbf{Z}. That combination is far more robust than Adam on everything.

9. How many inducing points, and where

How many

The figure’s answer was “about the domain width divided by the length-scale”, and Burt, Rasmussen and van der Wilk (ICML 2019; JMLR 2020) made it precise. The KL divergence of the approximation is controlled by tt, the total unexplained variance (Section 6). For well-placed inducing points, tt is controlled by how fast the eigenvalues of the kernel’s integral operator decay under the input distribution.

  • Smooth kernels need very few. For the squared-exponential kernel with Gaussian-distributed inputs in DD dimensions, M=O(log⁡DN)M = O(\log^D N) inducing points suffice to make the KL divergence small with high probability. As NN grows, MM barely has to.
  • Rough kernels need more. For Matérn kernels the eigenvalues decay polynomially, and MM must grow polynomially in NN; the smoother the kernel, the slower.
  • Concentrated inputs help. Inputs packed into a small region need fewer inducing points than inputs spread thinly.

Where

  • Greedy conditional variance. Repeatedly add the training input with the largest current cic_i. This is a pivoted Cholesky factorisation of Kff\mathbf{K}_{ff}, it attacks tt directly, and it costs O(NM2)O(NM^2). Burt et al. (2020) show that this kind of initialisation, close to sampling from a determinantal point process, achieves their bounds. It is the Greedy button above.
  • k-means. Cluster centres of the inputs are a common, cheap alternative.
  • Then optimise. Z\mathbf{Z} are variational parameters, so gradient ascent on F\mathcal{F} or L\mathcal{L} can only improve the approximation.
Remark (VFE and FITC behave differently)

Bauer, van der Wilk and Rasmussen (2016) compared the two in detail. FITC tends to underestimate the noise variance and can overfit badly, because its inducing inputs act as model parameters. The variational bound (VFE) behaves well as MM grows, but with too few inducing points it overestimates the noise: inflating σn2\sigma_n^2 shrinks the trace penalty t/(2σn2)t/(2\sigma_n^2). Section 11 shows a bound that reduces this bias.

10. After 2013: a map of the field

The ideas above are the core. Most later work changes one ingredient: what u\boldsymbol{u} is, how qq is structured, or how the bound is computed.

Inter-domain inducing variables

u\boldsymbol{u} need not be function values. Any linear functional works, for example um=∫f(x) gm(x) dxu_m = \int f(\boldsymbol{x})\,g_m(\boldsymbol{x})\,d\boldsymbol{x}; only Kuu\mathbf{K}_{uu} and Kfu\mathbf{K}_{fu} change, by integrating the kernel against the gmg_m (Lázaro-Gredilla and Figueiras-Vidal, 2009). With Fourier features on an interval, variational Fourier features make Kuu\mathbf{K}_{uu} diagonal plus low rank, and much of the cost can be precomputed (Hensman, Durrande and Solin, 2017). On the sphere, spherical harmonics make Kuu\mathbf{K}_{uu} exactly diagonal by the Funk–Hecke theorem (Dutordoir, Durrande and Hensman, 2020); the harmonics themselves are introduced in Fourier and wavelets on the sphere.

Decoupled and orthogonal bases

The mean of qq usually needs many more basis functions than its covariance. Decoupled representations give each its own inducing set (Cheng and Boots, 2017), and orthogonally decoupled ones make the two sets complementary (Salimbeni et al., 2018). SOLVE-GP (Shi, Titsias and Mnih, 2020) splits ff into a part spanned by the inducing points and an independent orthogonal remainder with its own inducing points, which gives tighter bounds at similar cost.

Nearest neighbours instead of low rank

Low-rank approximations struggle when the length-scale is short compared with the domain, because MM must then grow with the volume. Sparse-within-sparse GPs (Tran et al., 2021) let each data point use only its nearest inducing points. The variational nearest-neighbour GP (Wu, Pleiss and Cunningham, 2022) puts a Vecchia-style prior with a sparse precision on u\boldsymbol{u}, with cost O(K3)O(K^3) per point for KK neighbours, and can use one inducing point per observation.

Tighter bounds with conjugate gradients

The quadratic term of F\mathcal{F} is where the low-rank approximation loses most. Artemev, Burt and van der Wilk (2021) replace it with a bound tightened by a few conjugate-gradient iterations on the exact Kff+σn2I\mathbf{K}_{ff} + \sigma_n^2\mathbf{I}, which reduces hyperparameter bias.

Sampling whole functions

Bayesian optimisation and Thompson sampling need posterior functions, not marginals. Pathwise conditioning (Wilson et al., 2020) draws them by Matheron’s rule. A cheap random-feature prior sample is corrected by an inducing-point update, so the cost stays linear in the number of evaluation points. The rule itself is derived in the primer, Section 6.

Numerical stability

Inducing points that nearly coincide make Kuu\mathbf{K}_{uu} singular. Jitter helps but biases the result. Terenin et al. (2024) give conditions on the minimum separation of inducing points under which the computations are provably stable, and build such sets with cover trees for low-dimensional problems.

Or skip sparsity

On a GPU, exact GPs reach a million points with conjugate gradients and preconditioning, using only matrix-vector products (Gardner et al., 2018; Wang et al., 2019). When the hardware is there and the length-scale is short, exact inference can beat a sparse approximation.

11. 2025: beyond p(f | u)

For sixteen years the family q(f,u)=p(f∣u) q(u)q(\boldsymbol{f}, \boldsymbol{u}) = p(\boldsymbol{f} \mid \boldsymbol{u})\,q(\boldsymbol{u}) was taken as fundamental: it is what makes the N×NN \times N density cancel. In 2025 three papers relaxed it.

The weakness is visible in the bound. Given u\boldsymbol{u}, each fif_i keeps its prior conditional variance cic_i, as if yiy_i had never been observed. But yiy_i is a direct, noisy measurement of fif_i, and it should shrink that variance.

Theorem 3 (A tighter collapsed bound (Titsias, ICML 2025))

Let q(f∣u)=N(f∣Au, C1/2VC1/2)q(\boldsymbol{f} \mid \boldsymbol{u}) = \mathcal{N}\big(\boldsymbol{f} \mid \mathbf{A}\boldsymbol{u},\ \mathbf{C}^{1/2}\mathbf{V}\mathbf{C}^{1/2}\big) with V=diag⁡(v1,…,vN)\mathbf{V} = \operatorname{diag}(v_1, \dots, v_N), vi>0v_i > 0: the prior conditional mean, with a rescaled covariance. For a Gaussian likelihood, the optimal scales are

vi∗=(1+ciσn2)−1,v_i^* = \Big(1 + \frac{c_i}{\sigma_n^2}\Big)^{-1},

the optimal q(u)q(\boldsymbol{u}) is unchanged, and the collapsed bound is

 Fnew=log⁡N(y∣0, Qff+σn2I)−12∑i=1Nlog⁡(1+ciσn2) \boxed{\ \mathcal{F}_{\mathrm{new}} = \log\mathcal{N}\big(\boldsymbol{y} \mid \mathbf{0},\ \mathbf{Q}_{ff} + \sigma_n^2\mathbf{I}\big) - \frac12\sum_{i=1}^{N}\log\Big(1 + \frac{c_i}{\sigma_n^2}\Big)\ }

with F≤Fnew≤log⁡p(y)\mathcal{F} \leq \mathcal{F}_{\mathrm{new}} \leq \log p(\boldsymbol{y}), and Fnew>F\mathcal{F}_{\mathrm{new}} > \mathcal{F} whenever some ci>0c_i > 0.

Proof

We assume C\mathbf{C} is invertible to keep the algebra short; the paper treats the general case.

Step 1. The ELBO of the new family. With q(f,u)=q(f∣u) q(u)q(\boldsymbol{f}, \boldsymbol{u}) = q(\boldsymbol{f} \mid \boldsymbol{u})\,q(\boldsymbol{u}), the log-ratio inside the ELBO is log⁡p(y∣f)+log⁡p(f∣u)q(f∣u)+log⁡p(u)q(u)\log p(\boldsymbol{y} \mid \boldsymbol{f}) + \log\frac{p(\boldsymbol{f} \mid \boldsymbol{u})}{q(\boldsymbol{f} \mid \boldsymbol{u})} + \log\frac{p(\boldsymbol{u})}{q(\boldsymbol{u})}. Taking expectations,

L=Eq[log⁡p(y∣f)]−Eq(u)KL[q(f∣u) ∥ p(f∣u)]−KL[q(u) ∥ p(u)].\mathcal{L} = \mathbb{E}_q\big[\log p(\boldsymbol{y} \mid \boldsymbol{f})\big] - \mathbb{E}_{q(\boldsymbol{u})}\mathrm{KL}\big[q(\boldsymbol{f} \mid \boldsymbol{u}) \,\Vert\, p(\boldsymbol{f} \mid \boldsymbol{u})\big] - \mathrm{KL}\big[q(\boldsymbol{u}) \,\Vert\, p(\boldsymbol{u})\big].

The middle term was zero before; now it is the price of departing from the prior conditional.

Step 2. The conditional KL. Both Gaussians have mean Au\mathbf{A}\boldsymbol{u}; the covariances are C1/2VC1/2\mathbf{C}^{1/2}\mathbf{V}\mathbf{C}^{1/2} and C\mathbf{C}. The Gaussian KL formula gives

KL=12[tr⁡(C−1C1/2VC1/2)−N+log⁡∣C∣−log⁡∣C1/2VC1/2∣].\mathrm{KL} = \tfrac12\Big[\operatorname{tr}\big(\mathbf{C}^{-1}\mathbf{C}^{1/2}\mathbf{V}\mathbf{C}^{1/2}\big) - N + \log\lvert\mathbf{C}\rvert - \log\lvert\mathbf{C}^{1/2}\mathbf{V}\mathbf{C}^{1/2}\rvert\Big].

The trace is tr⁡(C−1/2VC1/2)=tr⁡V\operatorname{tr}(\mathbf{C}^{-1/2}\mathbf{V}\mathbf{C}^{1/2}) = \operatorname{tr}\mathbf{V} by the cyclic property, and ∣C1/2VC1/2∣=∣C∣∣V∣\lvert\mathbf{C}^{1/2}\mathbf{V}\mathbf{C}^{1/2}\rvert = \lvert\mathbf{C}\rvert\lvert\mathbf{V}\rvert. So

KL=12∑i=1N(vi−1−log⁡vi),\mathrm{KL} = \tfrac12\sum_{i=1}^{N}\big(v_i - 1 - \log v_i\big),

which does not depend on u\boldsymbol{u}.

Step 3. The expected log-likelihood given u\boldsymbol{u}. By the expected-log-likelihood lemma with covariance C1/2VC1/2\mathbf{C}^{1/2}\mathbf{V}\mathbf{C}^{1/2},

Eq(f∣u)[log⁡p(y∣f)]=log⁡N(y∣Au,σn2I)−12σn2tr⁡(VC),\mathbb{E}_{q(\boldsymbol{f} \mid \boldsymbol{u})}\big[\log p(\boldsymbol{y} \mid \boldsymbol{f})\big] = \log\mathcal{N}(\boldsymbol{y} \mid \mathbf{A}\boldsymbol{u}, \sigma_n^2\mathbf{I}) - \frac{1}{2\sigma_n^2}\operatorname{tr}(\mathbf{V}\mathbf{C}),

and tr⁡(VC)=∑ivici\operatorname{tr}(\mathbf{V}\mathbf{C}) = \sum_i v_i c_i because V\mathbf{V} is diagonal.

Step 4. Separate the V\mathbf{V}-terms. Everything that involves V\mathbf{V} is a sum of independent one-dimensional terms,

∑i=1Ngi(vi),gi(v)=−ci2σn2 v−12(v−1−log⁡v),\sum_{i=1}^{N} g_i(v_i), \qquad g_i(v) = -\frac{c_i}{2\sigma_n^2}\,v - \tfrac12\big(v - 1 - \log v\big),

and the rest is exactly the expression Titsias maximised over q(u)q(\boldsymbol{u}).

Step 5. Maximise each gig_i. gi′(v)=−ci2σn2−12+12vg_i'(v) = -\frac{c_i}{2\sigma_n^2} - \frac12 + \frac{1}{2v}, which is zero at v=(1+ci/σn2)−1v = (1 + c_i/\sigma_n^2)^{-1}. Since gi′′(v)=−1/(2v2)<0g_i''(v) = -1/(2v^2) < 0, this is the maximum.

Step 6. Its value. At vi∗v_i^*, vi∗(1+ci/σn2)=1v_i^*(1 + c_i/\sigma_n^2) = 1, so

gi(vi∗)=−12[vi∗(1+ci/σn2)−1−log⁡vi∗]=−12log⁡(1+ciσn2).g_i(v_i^*) = -\tfrac12\big[v_i^*(1 + c_i/\sigma_n^2) - 1 - \log v_i^*\big] = -\tfrac12\log\Big(1 + \frac{c_i}{\sigma_n^2}\Big).

Step 7. Maximise over q(u)q(\boldsymbol{u}). The remaining terms are those of Titsias’s proof, Steps 2 to 5, so the optimal q(u)q(\boldsymbol{u}) is the same q∗q^* and contributes log⁡N(y∣0,Qff+σn2I)\log\mathcal{N}(\boldsymbol{y} \mid \mathbf{0}, \mathbf{Q}_{ff} + \sigma_n^2\mathbf{I}).

Step 8. Compare. V=I\mathbf{V} = \mathbf{I} recovers the 2009 family, with gi(1)=−ci/(2σn2)g_i(1) = -c_i/(2\sigma_n^2). And log⁡(1+a)≤a\log(1 + a) \leq a for a≥0a \geq 0, with equality only at a=0a = 0, so each new term is at least the old one. Finally Fnew\mathcal{F}_{\mathrm{new}} is an ELBO, so it is at most log⁡p(y)\log p(\boldsymbol{y}).

Note (The optimal scale is one observation’s worth of shrinkage)

vi∗ci=ci σn2ci+σn2=(1ci+1σn2)−1v_i^*c_i = \dfrac{c_i\,\sigma_n^2}{c_i + \sigma_n^2} = \Big(\dfrac{1}{c_i} + \dfrac{1}{\sigma_n^2}\Big)^{-1}. That is the posterior variance of a Gaussian quantity with prior variance cic_i after one noisy observation with noise variance σn2\sigma_n^2: precisions add. The new family lets each fif_i learn from its own yiy_i what u\boldsymbol{u} could not tell it. Because V\mathbf{V} is diagonal it ignores the correlations among the residuals, just as the mean-field example of Section 2 ignored correlations. The same idea, one level down.

What changes in practice:

  • Hyperparameters. The penalty grows like log⁡(1+ci/σn2)\log(1 + c_i/\sigma_n^2) instead of ci/σn2c_i/\sigma_n^2, so there is less pressure to inflate σn2\sigma_n^2 to hide unexplained variance. Titsias reports less biased hyperparameters and often better predictions.
  • Predictions. Test points get no extra parameters and q∗(u)q^*(\boldsymbol{u}) is unchanged, so Section 7’s predictive formulas still apply.
  • Code. In the stochastic SVGP bound the per-point term −ci2σn2-\frac{c_i}{2\sigma_n^2} becomes −12log⁡(1+ci/σn2)-\frac12\log(1 + c_i/\sigma_n^2); the rest is untouched, minibatching included. The figure’s readout shows how much of the 2009 gap this closes.

Two companion papers develop the idea. Bui, Ashman and Turner (TMLR 2025) independently relax the same assumption, choosing conditional posteriors with smaller variances than the prior at the training points, at unchanged cost. Bui and Titsias (2025) replace the diagonal V\mathbf{V} with a block-diagonal one, which provably tightens the bound further, and revisit Power-EP, which unifies VFE- and FITC-like methods, with these structured posteriors.

12. A practical recipe

  • NN up to about 10410^4: use the exact GP. With a GPU and conjugate gradients, exact inference goes much further.
  • Gaussian likelihood, and A^\hat{\mathbf{A}} fits in memory: use the collapsed bound (SGPR), with the 2025 regulariser where your library has it. MM from a few hundred to a few thousand.
  • Larger NN, streaming data, or a non-Gaussian likelihood: use SVGP with minibatches, whitening, natural gradients for q(u)q(\boldsymbol{u}) and Adam for θ\boldsymbol{\theta} and Z\mathbf{Z}.
  • Initialise Z\mathbf{Z} with greedy conditional variance or k-means, then optimise.
  • Check the gap. Compute U−F\mathcal{U} - \mathcal{F} on a subset. If it is large, increase MM before trusting the hyperparameters.
  • Short length-scales on a large domain: consider nearest-neighbour variants (VNNGP) or inter-domain features rather than a huge MM.
  • Numerics: factorise Kuu\mathbf{K}_{uu} in double precision with a small jitter, and keep inducing points from collapsing onto each other.

Questions

Question 1

With no inducing points (M=0M = 0), what is F\mathcal{F}, and what does it mean?

Answer

With no u\boldsymbol{u}, Qff=0\mathbf{Q}_{ff} = \mathbf{0} and t=tr⁡Kfft = \operatorname{tr}\mathbf{K}_{ff}, so F=log⁡N(y∣0,σn2I)−tr⁡Kff/(2σn2)\mathcal{F} = \log\mathcal{N}(\boldsymbol{y} \mid \mathbf{0}, \sigma_n^2\mathbf{I}) - \operatorname{tr}\mathbf{K}_{ff}/(2\sigma_n^2). The model explains the data as pure noise, and pays for all the prior variance of ff at the data, unexplained. It is the ELBO of the approximation q(f)=p(f)q(\boldsymbol{f}) = p(\boldsymbol{f}), which ignores the data entirely.

Question 2

Show that at an inducing input zj\boldsymbol{z}_j the predictive variance of f(zj)f(\boldsymbol{z}_j) is SjjS_{jj}.

Answer

At x∗=zj\boldsymbol{x}_* = \boldsymbol{z}_j, ku\boldsymbol{k}_u is the jj-th column of Kuu\mathbf{K}_{uu}, so a∗=Kuu−1ku=ej\boldsymbol{a}_* = \mathbf{K}_{uu}^{-1}\boldsymbol{k}_u = \boldsymbol{e}_j and k∗∗−ku⊤Kuu−1ku=kjj−kjj=0k_{**} - \boldsymbol{k}_u^\top\mathbf{K}_{uu}^{-1}\boldsymbol{k}_u = k_{jj} - k_{jj} = 0. The variance is ej⊤Sej=Sjj\boldsymbol{e}_j^\top\mathbf{S}\boldsymbol{e}_j = S_{jj}: of course, since f(zj)=ujf(\boldsymbol{z}_j) = u_j.

Question 3

Why does the 2009 bound push the noise variance up when MM is too small?

Answer

σn2\sigma_n^2 appears in the penalty −t/(2σn2)-t/(2\sigma_n^2). When the inducing points leave a lot of variance unexplained (tt large), raising σn2\sigma_n^2 shrinks the penalty, at some cost in the DTC evidence. The optimiser trades data fit for a smaller penalty by calling the unexplained signal “noise”. The 2025 penalty 12∑ilog⁡(1+ci/σn2)\tfrac12\sum_i\log(1 + c_i/\sigma_n^2) grows only logarithmically in ci/σn2c_i/\sigma_n^2, so the incentive is weaker.

Question 4

For GP classification with a Bernoulli likelihood, which parts of the SVGP objective change, and which stay?

Answer

Only the NN one-dimensional expectations Eq(fi)[log⁡p(yi∣fi)]\mathbb{E}_{q(f_i)}[\log p(y_i \mid f_i)] change, now computed by Gauss–Hermite quadrature. The marginals q(fi)q(f_i), the KL term, whitening, minibatching and the predictive distribution of f∗f_* are all unchanged. To predict the class probability, average the likelihood over q(f∗)q(f_*), again by quadrature.

Question 5

What does one SVGP step cost with minibatch size BB, and which term dominates when B≈MB \approx M?

Answer

The marginals cost O(BM2)O(BM^2) (one triangular solve per point) and the Cholesky factor of Kuu\mathbf{K}_{uu} plus the KL cost O(M3)O(M^3). With B≈MB \approx M both are O(M3)O(M^3), so the inducing points, not the data, set the cost. That is why MM in the low thousands is the practical limit, and why structured Kuu\mathbf{K}_{uu} (inter-domain features) or local methods are attractive.

References

  • M. K. Titsias. Variational learning of inducing variables in sparse Gaussian processes. AISTATS, 2009. PMLR
  • J. Hensman, N. Fusi, N. D. Lawrence. Gaussian processes for big data. UAI, 2013. arXiv:1309.6835
  • J. Hensman, A. G. de G. Matthews, Z. Ghahramani. Scalable variational Gaussian process classification. AISTATS, 2015. arXiv:1411.2005
  • A. G. de G. Matthews, J. Hensman, R. E. Turner, Z. Ghahramani. On sparse variational methods and the Kullback–Leibler divergence between stochastic processes. AISTATS, 2016. arXiv:1504.07027
  • J. Quiñonero-Candela, C. E. Rasmussen. A unifying view of sparse approximate Gaussian process regression. JMLR, 2005. JMLR
  • E. Snelson, Z. Ghahramani. Sparse Gaussian processes using pseudo-inputs. NeurIPS, 2006.
  • C. K. I. Williams, M. Seeger. Using the Nyström method to speed up kernel machines. NeurIPS, 2001.
  • M. Bauer, M. van der Wilk, C. E. Rasmussen. Understanding probabilistic sparse Gaussian process approximations. NeurIPS, 2016. arXiv:1606.04820
  • M. K. Titsias. Variational inference for Gaussian and determinantal point processes. NeurIPS Workshop on Advances in Variational Inference, 2014. (The upper bound of Section 6, as cited by Burt et al.)
  • D. R. Burt, C. E. Rasmussen, M. van der Wilk. Rates of convergence for sparse variational Gaussian process regression. ICML, 2019. arXiv:1903.03571
  • D. R. Burt, C. E. Rasmussen, M. van der Wilk. Convergence of sparse variational inference in Gaussian processes regression. JMLR, 2020.
  • H. Salimbeni, S. Eleftheriadis, J. Hensman. Natural gradients in practice: non-conjugate variational inference in Gaussian process models. AISTATS, 2018. arXiv:1803.09151
  • M. Lázaro-Gredilla, A. Figueiras-Vidal. Inter-domain Gaussian processes for sparse inference using inducing features. NeurIPS, 2009.
  • J. Hensman, N. Durrande, A. Solin. Variational Fourier features for Gaussian processes. JMLR, 2017. arXiv:1611.06740
  • V. Dutordoir, N. Durrande, J. Hensman. Sparse Gaussian processes with spherical harmonic features. ICML, 2020.
  • C.-A. Cheng, B. Boots. Variational inference for Gaussian process models with linear complexity. NeurIPS, 2017.
  • H. Salimbeni, C.-A. Cheng, B. Boots, M. Deisenroth. Orthogonally decoupled variational Gaussian processes. NeurIPS, 2018.
  • J. Shi, M. K. Titsias, A. Mnih. Sparse orthogonal variational inference for Gaussian processes. AISTATS, 2020. PMLR
  • G.-L. Tran, D. Milios, P. Michiardi, M. Filippone. Sparse within sparse Gaussian processes using neighbor information. ICML, 2021. PMLR
  • L. Wu, G. Pleiss, J. P. Cunningham. Variational nearest neighbor Gaussian process. ICML, 2022. arXiv:2202.01694
  • A. Artemev, D. R. Burt, M. van der Wilk. Tighter bounds on the log marginal likelihood of Gaussian process regression using conjugate gradients. ICML, 2021.
  • J. T. Wilson, V. Borovitskiy, A. Terenin, P. Mostowsky, M. P. Deisenroth. Efficiently sampling functions from Gaussian process posteriors. ICML, 2020. arXiv:2002.09309
  • A. Terenin, D. R. Burt, A. Artemev, S. Flaxman, M. van der Wilk, C. E. Rasmussen, H. Ge. Numerically stable sparse Gaussian processes via minimum separation using cover trees. JMLR, 2024. JMLR
  • J. R. Gardner, G. Pleiss, D. Bindel, K. Q. Weinberger, A. G. Wilson. GPyTorch: blackbox matrix-matrix Gaussian process inference with GPU acceleration. NeurIPS, 2018. arXiv:1809.11165
  • K. A. Wang, G. Pleiss, J. R. Gardner, S. Tyree, K. Q. Weinberger, A. G. Wilson. Exact Gaussian processes on a million data points. NeurIPS, 2019. arXiv:1903.08114
  • M. K. Titsias. New bounds for sparse variational Gaussian processes. ICML, 2025. arXiv:2502.08730
  • T. D. Bui, M. Ashman, R. E. Turner. Tighter sparse variational Gaussian processes. TMLR, 2025. arXiv:2502.04750
  • T. D. Bui, M. K. Titsias. Sparse Gaussian processes: structured approximations and Power-EP revisited. 2025. arXiv:2507.02377
  • F. Leibfried, V. Dutordoir, S. T. John, N. Durrande. A tutorial on sparse Gaussian processes and variational inference. 2020. arXiv:2012.13962
  • D. M. Blei, A. Kucukelbir, J. D. McAuliffe. Variational inference: a review for statisticians. JASA, 2017. arXiv:1601.00670
  • C. M. Bishop. Pattern Recognition and Machine Learning, Chapter 10. Springer, 2006.