Blog · updated 29 Oct 2026 · 55 min read

Deep Gaussian processes: stacking uncertainty

What composing Gaussian processes buys and what it costs. If a composition of GPs is not a GP, how is anything computed? What does all the mathematics buy, what is new, and where are deep GPs still the right tool? Fundamentals first, every step derived, with a deep GP fitted and taken apart.

Contents
  1. Notation
  2. 1. What one GP cannot do
  3. One texture everywhere
  4. Two classic remedies
  5. 2. Composing Gaussian processes
  6. The model
  7. Sampling a deep GP
  8. If it is not a GP, how does anything work?
  9. The covariance of a two-layer deep GP
  10. 3. What depth does
  11. 4. Why exact inference is impossible
  12. 5. Doubly stochastic variational inference
  13. One layer, recalled
  14. The model, augmented
  15. The variational family
  16. A forward pass by hand
  17. Turning it into an algorithm
  18. A deep GP, fitted
  19. 6. Is all this mathematics worth it?
  20. 7. Where deep GPs are the right tool today
  21. 8. What is new, 2018 to 2026
  22. 9. Deep GPs, neural networks and deep kernels
  23. Width matters
  24. Neural networks as deep GPs, and the other way round
  25. 10. A checklist
  26. Questions
  27. References

A Gaussian process is shallow in one precise sense. Its kernel, chosen before any data arrive, fixes the texture of every function it believes in: how often it wiggles, how smooth it is, and, for the usual stationary kernels, that this texture is the same everywhere. Real functions are calm in some places and sharp in others. A deep GP feeds one GP into another, so that the first layer can stretch and squeeze the input before the second one sees it.

Below are draws from deep GPs with one to five layers, each layer a GP with the same squared-exponential kernel. Raise the number of layers:

What to try. With one layer the draws look like any GP: about 6% of the axis is nearly flat. At three layers more than half of it is (55% for the default draws), with steep cliffs in between, and at five layers the steepest slope has grown from about 2 to about 16. That is the pathology of Section 3. Switch to input-connected: at five layers only about 5% of the axis is flat. Identity mean sits in between, at about 19%. Shorten the length-scale and the collapse slows down, because the ratio σ/ℓ\sigma/\ell approaches the critical value 1.891.89 that Section 3 derives.

This is the third post in the Gaussian-process series, after Gaussian processes, from first principles and sparse variational GPs. It is written to answer four questions that beginners ask, and that many experts never quite settle:

  1. If a composition of GPs is not a GP, how is anything computed? (Section 2.)
  2. What does all this mathematics buy, compared with a GP or a neural network? (Section 6.)
  3. Is it still relevant, and for which tasks is it the right tool? (Section 7.)
  4. What is new? (Section 8.)

Every result is derived in numbered steps, with nothing left to the reader. The Gaussian identities it uses are proved in the primer and in the Gaussian toolkit, and the one formula it needs from the sparse GP post is re-derived here.

The plan:

  1. what one GP cannot do;
  2. composing GPs: what the model is, and how anything is computed although it is not a GP;
  3. what depth does: the pathology of deep compositions, and two fixes;
  4. why exact inference is impossible;
  5. doubly stochastic variational inference: one layer recalled, the bound derived, a forward pass by hand, and a deep GP fitted;
  6. is the mathematics worth it?
  7. where deep GPs are the right tool today;
  8. what is new, 2018 to 2026;
  9. deep GPs, neural networks and deep kernels;
  10. a checklist.

Notation

Plain italic letters are scalars, bold italic lower case are vectors, bold upright capitals are matrices. To keep the derivations readable, every hidden layer has one output; Section 5 explains what changes with more.

SymbolMeaning
LLnumber of layers; l=1,…,Ll = 1, \dots, L indexes them
flf_llayer ll, a GP: fl∼GP(0,kl)f_l \sim \mathcal{GP}(0, k_l), independent across layers
h0(x)=xh_0(\boldsymbol{x}) = \boldsymbol{x},  hl(x)=fl(hl−1(x))\ h_l(\boldsymbol{x}) = f_l\big(h_{l-1}(\boldsymbol{x})\big)hidden values; the model output is hLh_L
σl2\sigma_l^2, ℓl\ell_lamplitude and length-scale of the squared-exponential kernel kl(a,b)=σl2e−(a−b)2/(2ℓl2)k_l(a, b) = \sigma_l^2e^{-(a - b)^2/(2\ell_l^2)}
fl∈RN\boldsymbol{f}_l \in \mathbb{R}^N, fl,nf_{l,n}layer-ll values at the NN training inputs, and the nn-th of them
Zl\mathbf{Z}_l, ul=fl(Zl)\boldsymbol{u}_l = f_l(\mathbf{Z}_l)inducing inputs and inducing variables of layer ll (MM of each)
q(ul)=N(ml,Sl)q(\boldsymbol{u}_l) = \mathcal{N}(\boldsymbol{m}_l, \mathbf{S}_l)variational distribution of layer ll
μl(h)\mu_l(h), sl2(h)s_l^2(h)mean and variance of layer ll‘s variational marginal at a single input hh
σn2\sigma_n^2observation-noise variance
ε\varepsilon, ZZstandard normal variables; SS is a number of Monte Carlo samples

1. What one GP cannot do

One texture everywhere

A kernel is stationary if k(x,x′)=k(x−x′)k(\boldsymbol{x}, \boldsymbol{x}') = k(\boldsymbol{x} - \boldsymbol{x}'). Then shifting a zero-mean GP does not change its distribution: f(⋅+a)f(\cdot + \boldsymbol{a}) has the same covariance as ff, for every shift a\boldsymbol{a}. The prior therefore expects the same behaviour in every region of the input space. One concrete measure: for a one-dimensional stationary GP, the expected number of times a draw crosses zero upwards on an interval of unit length is 12π−k′′(0)/k(0)\frac{1}{2\pi}\sqrt{-k''(0)/k(0)} (Rice’s formula; Rasmussen and Williams, 2006, Section 4.1). For the squared-exponential kernel that is 1/(2πℓ)1/(2\pi\ell): the same in every region.

Data rarely cooperate. Take a step: flat, a jump, flat again. A stationary GP has one length-scale to spend. A long one cannot follow the jump. A short one follows the jump, but it also expects wiggles on both plateaus, rings near the jump, and forgets everything a short distance outside the data. Type-II maximum likelihood picks a compromise, and it is not a good one. The fitted figure in Section 5 shows it: the GP takes ℓ=0.075\ell = 0.075 and inflates the noise estimate to more than twice its true value, to explain the wiggles it cannot avoid.

Two classic remedies

  • Design a non-stationary kernel. Let the length-scale depend on the input (Gibbs, 1997), or put non-stationarity in the basis, as wavelet features do (From Fourier to wavelets). This works when you know what form the non-stationarity takes.
  • Warp the input. Use a stationary kernel on transformed inputs, k(w(x),w(x′))k\big(w(\boldsymbol{x}), w(\boldsymbol{x}')\big) (Sampson and Guttorp, 1992; Snoek et al., 2014). Where ww is steep, a small change of x\boldsymbol{x} is a large change of w(x)w(\boldsymbol{x}), so the function changes quickly there.

Proposition 1 (A warped kernel is a kernel)

If kk is a positive semi-definite kernel and ww is any function, then kw(x,x′)=k(w(x),w(x′))k_w(\boldsymbol{x}, \boldsymbol{x}') = k\big(w(\boldsymbol{x}), w(\boldsymbol{x}')\big) is a positive semi-definite kernel.

Proof

Step 1. What must be shown. For any inputs x1,…,xN\boldsymbol{x}_1, \dots, \boldsymbol{x}_N and any real coefficients c1,…,cNc_1, \dots, c_N, ∑i,jcicj kw(xi,xj)≥0\sum_{i,j}c_ic_j\,k_w(\boldsymbol{x}_i, \boldsymbol{x}_j) \geq 0.

Step 2. Rename the points. Let vi=w(xi)\boldsymbol{v}_i = w(\boldsymbol{x}_i). By the definition of kwk_w, the sum equals ∑i,jcicj k(vi,vj)\sum_{i,j}c_ic_j\,k(\boldsymbol{v}_i, \boldsymbol{v}_j).

Step 3. Use the property of kk. That is the quadratic form c⊤Kvc\boldsymbol{c}^\top\mathbf{K}_v\boldsymbol{c} of the Gram matrix of kk at the points v1,…,vN\boldsymbol{v}_1, \dots, \boldsymbol{v}_N. It is non-negative because kk is positive semi-definite. Repeated points are allowed in that definition, so it does not matter whether ww is one-to-one.

A deep GP takes the second remedy and does not choose the warp by hand: it puts a GP prior on it and learns it, with uncertainty, from the data.

2. Composing Gaussian processes

The model

Definition 1 (Deep Gaussian process (Damianou and Lawrence, 2013))

Let f1,…,fLf_1, \dots, f_L be independent GPs. The deep GP with LL layers is the random function

hL=fL∘fL−1∘⋯∘f1,that ishl(x)=fl(hl−1(x)),  h0(x)=x,h_L = f_L \circ f_{L-1} \circ \dots \circ f_1, \qquad\text{that is}\qquad h_l(\boldsymbol{x}) = f_l\big(h_{l-1}(\boldsymbol{x})\big),\ \ h_0(\boldsymbol{x}) = \boldsymbol{x},

and the observations are y=hL(x)+εy = h_L(\boldsymbol{x}) + \varepsilon with ε∼N(0,σn2)\varepsilon \sim \mathcal{N}(0, \sigma_n^2). A layer with several outputs is a vector of independent GPs, one per output.

Sampling a deep GP

To draw the function at NN inputs X\mathbf{X}:

  1. Draw the first layer at the inputs: f1∼N(0, k1(X,X))\boldsymbol{f}_1 \sim \mathcal{N}\big(\mathbf{0},\ k_1(\mathbf{X}, \mathbf{X})\big). This is an ordinary GP draw.
  2. Draw the second layer at the points f1\boldsymbol{f}_1: f2∼N(0, k2(f1,f1))\boldsymbol{f}_2 \sim \mathcal{N}\big(\mathbf{0},\ k_2(\boldsymbol{f}_1, \boldsymbol{f}_1)\big), where k2(f1,f1)k_2(\boldsymbol{f}_1, \boldsymbol{f}_1) is the N×NN \times N matrix with entries k2(f1,i,f1,j)k_2(f_{1,i}, f_{1,j}). Another ordinary GP draw, at random inputs.
  3. Continue to layer LL.

Each step is a Cholesky factorisation and a matrix-vector product; the figure at the top does exactly this. Nothing in the recipe is exotic. But the result is not a GP. The next subsection shows what that means, and why it does not stop us computing anything.

If it is not a GP, how does anything work?

Start with the smallest possible question: the output at one input.

Proposition 2 (At a single input, the output is Gaussian)

In a deep GP whose last layer is zero-mean and stationary, hL(x)∼N(0,kL(0))h_L(\boldsymbol{x}) \sim \mathcal{N}(0, k_L(0)) at every single input x\boldsymbol{x}, exactly as for a GP. (For the squared-exponential kernel, kL(0)=σL2k_L(0) = \sigma_L^2.)

Proof

Step 1. Condition on the layer below. Fix the lower layers, and with them the value h=hL−1(x)h = h_{L-1}(\boldsymbol{x}). Then hL(x)=fL(h)h_L(\boldsymbol{x}) = f_L(h) is the GP fLf_L at one fixed input, so hL(x)∣h∼N(0,kL(h,h))h_L(\boldsymbol{x}) \mid h \sim \mathcal{N}(0, k_L(h, h)).

Step 2. Stationarity removes the dependence. kL(h,h)=kL(h−h)=kL(0)k_L(h, h) = k_L(h - h) = k_L(0), whatever hh is. The conditional distribution is the same for every value of the lower layers.

Step 3. Average. The marginal is the average of the conditional over the lower layers: p(hL(x))=∫N(hL(x)∣0,kL(0)) p(h) dh=N(hL(x)∣0,kL(0))p(h_L(\boldsymbol{x})) = \int\mathcal{N}\big(h_L(\boldsymbol{x}) \mid 0, k_L(0)\big)\,p(h)\,dh = \mathcal{N}\big(h_L(\boldsymbol{x}) \mid 0, k_L(0)\big), because the integrand does not depend on hh and p(h)p(h) integrates to 1.

So one point at a time, you cannot tell a deep GP from a GP. The difference is entirely in how different points relate to each other. Take two inputs, xx and x′x', and two one-dimensional layers.

Proposition 3 (At two inputs, a mixture of Gaussians)

Write d=f1(x)−f1(x′)d = f_1(x) - f_1(x') and ρ(d)=e−d2/(2ℓ22)\rho(d) = e^{-d^2/(2\ell_2^2)}. With zero-mean layers,

p(y(x),y(x′))=∫N ⁣([y(x)y(x′)] | 0, σ22[1ρ(d)ρ(d)1])p(d) dd,d∼N(0,s2),p\big(y(x), y(x')\big) = \int\mathcal{N}\!\left(\begin{bmatrix}y(x)\\ y(x')\end{bmatrix}\,\middle|\,\mathbf{0},\ \sigma_2^2\begin{bmatrix}1 & \rho(d)\\ \rho(d) & 1\end{bmatrix}\right)p(d)\,dd, \qquad d \sim \mathcal{N}(0, s^2),

with s2=k1(x,x)+k1(x′,x′)−2k1(x,x′)s^2 = k_1(x, x) + k_1(x', x') - 2k_1(x, x'). It is a continuous mixture of bivariate Gaussians whose correlation is random, and it is not a Gaussian.

Proof

Step 1. Condition on layer 1. Given f1f_1, the pair (f2(f1(x)),f2(f1(x′)))\big(f_2(f_1(x)), f_2(f_1(x'))\big) is the GP f2f_2 at two fixed inputs, so it is bivariate Gaussian with variances k2(0)=σ22k_2(0) = \sigma_2^2 and covariance k2(f1(x),f1(x′))=σ22ρ(d)k_2(f_1(x), f_1(x')) = \sigma_2^2\rho(d).

Step 2. Only dd matters. That conditional depends on f1f_1 only through d=f1(x)−f1(x′)d = f_1(x) - f_1(x').

Step 3. The law of dd. f1(x)f_1(x) and f1(x′)f_1(x') are jointly Gaussian with mean zero. A linear combination of jointly Gaussian variables is Gaussian, so dd is Gaussian with mean 00 and variance Var⁡f1(x)+Var⁡f1(x′)−2Cov⁡(f1(x),f1(x′))=s2\operatorname{Var}f_1(x) + \operatorname{Var}f_1(x') - 2\operatorname{Cov}(f_1(x), f_1(x')) = s^2.

Step 4. Average. The joint density is the conditional averaged over dd, which is the integral in the statement.

Step 5. Not Gaussian. If it were Gaussian, the difference y(x)−y(x′)y(x) - y(x') would be Gaussian too, with kurtosis 3. The proposition on heavy tails below shows its kurtosis is strictly larger.

Here is that joint density, next to the Gaussian with exactly the same covariance matrix. Move the distance between the two inputs:

Same covariance, very different shapes. The GP’s density is a single ellipse. The deep GP’s is a sharp ridge along the diagonal on top of a round cloud. When the two hidden values happen to be close, f2f_2 sees almost the same input twice, so y(x)≈y(x′)y(x) \approx y(x'): that is the ridge. When they are far apart, the two outputs are almost unrelated: that is the cloud. Averaging the two situations gives the same correlation as the ellipse (0.490.49 at ∣x−x′∣=0.3|x - x'| = 0.3) but not the same shape, and the difference y(x)−y(x′)y(x) - y(x') has kurtosis 4.54.5 instead of 33. The shape carries information that a GP throws away: the deep GP says “either the same or unrelated”, where the GP can only say “moderately related”.

That answers the question in the heading. Three things still work exactly as for a GP, and one does not:

  • Each layer, given the layer below, is an ordinary GP. Conditioning, sampling and Gaussian marginals all work within a layer.
  • Joint densities are averages of Gaussians, so they can be computed by averaging: exactly in small cases like the one above, by Monte Carlo in general.
  • Predictions are averages too, by the next proposition.
  • What is lost is a closed form for the posterior and the evidence, because they need an average over all the hidden values at once. Section 5 replaces the evidence by a lower bound that can be computed.

Proposition 4 (Prediction by Monte Carlo)

Let p(h∗)p(h_*) be the distribution of the hidden value at a test input (under the approximate posterior), and p(y∗∣h∗)p(y_* \mid h_*) the Gaussian of the last layer given it. Then

p(y∗)=Eh∗[p(y∗∣h∗)]≈p^S(y∗)=1S∑s=1Sp(y∗∣h^(s)),h^(s)∼p(h∗) independently,p(y_*) = \mathbb{E}_{h_*}\big[p(y_* \mid h_*)\big] \approx \hat p_S(y_*) = \frac1S\sum_{s=1}^{S}p\big(y_* \mid \hat h^{(s)}\big), \qquad \hat h^{(s)} \sim p(h_*) \text{ independently},

and p^S(y∗)\hat p_S(y_*) is unbiased with variance Var⁡h∗[p(y∗∣h∗)]/S\operatorname{Var}_{h_*}\big[p(y_* \mid h_*)\big]/S.

Proof

Step 1. Sum rule. p(y∗)=∫p(y∗∣h∗) p(h∗) dh∗p(y_*) = \int p(y_* \mid h_*)\,p(h_*)\,dh_*, which is the expectation of the function h∗↦p(y∗∣h∗)h_* \mapsto p(y_* \mid h_*) under p(h∗)p(h_*).

Step 2. Unbiased. Each term p(y∗∣h^(s))p(y_* \mid \hat h^{(s)}) has expectation p(y∗)p(y_*) by Step 1, and the expectation of an average is the average of the expectations.

Step 3. Variance. The terms are independent and identically distributed, so the variance of their average is the variance of one term divided by SS. The error therefore shrinks like 1/S1/\sqrt{S}.

Each term is a Gaussian in y∗y_*, so the prediction is a mixture of Gaussians. The animation does this for the deep GP fitted in Section 5, at x∗=1.2x^* = 1.2, just beyond the data, where the hidden value is uncertain. Most samples of the hidden value land where the second layer is at +1+1; a few land where it falls away. The average is sharp at +1+1 with a long tail downwards. The Gaussian with the same mean and variance, in grey, spreads its mass where the model does not believe the answer lies.

Predicting at x* = 1.2 with the fitted two-layer deep GP: the Gaussian of the hidden value (top), samples pushed through layer 2 (middle), one Gaussian per sample and their average (right).

The covariance of a two-layer deep GP

For two one-dimensional layers with squared-exponential kernels, the covariance has a closed form. It shows what composition does to correlations, and it uses one tool worth proving first.

Lemma 1 (Law of total covariance)

For random variables AA, BB and CC with finite second moments,

Cov⁡(A,B)=E[Cov⁡(A,B∣C)]+Cov⁡(E[A∣C], E[B∣C]).\operatorname{Cov}(A, B) = \mathbb{E}\big[\operatorname{Cov}(A, B \mid C)\big] + \operatorname{Cov}\big(\mathbb{E}[A \mid C],\ \mathbb{E}[B \mid C]\big).
Proof

Step 1. Definitions. Cov⁡(A,B)=E[AB]−E[A] E[B]\operatorname{Cov}(A, B) = \mathbb{E}[AB] - \mathbb{E}[A]\,\mathbb{E}[B], and likewise conditionally: Cov⁡(A,B∣C)=E[AB∣C]−E[A∣C] E[B∣C]\operatorname{Cov}(A, B \mid C) = \mathbb{E}[AB \mid C] - \mathbb{E}[A \mid C]\,\mathbb{E}[B \mid C].

Step 2. Tower property. E[AB]=E[E[AB∣C]]\mathbb{E}[AB] = \mathbb{E}\big[\mathbb{E}[AB \mid C]\big], E[A]=E[E[A∣C]]\mathbb{E}[A] = \mathbb{E}\big[\mathbb{E}[A \mid C]\big] and E[B]=E[E[B∣C]]\mathbb{E}[B] = \mathbb{E}\big[\mathbb{E}[B \mid C]\big].

Step 3. Substitute the conditional identity of Step 1.

E[AB]=E[Cov⁡(A,B∣C)]+E[E[A∣C] E[B∣C]].\mathbb{E}[AB] = \mathbb{E}\big[\operatorname{Cov}(A, B \mid C)\big] + \mathbb{E}\big[\mathbb{E}[A \mid C]\,\mathbb{E}[B \mid C]\big].

Step 4. Subtract E[A] E[B]=E[E[A∣C]] E[E[B∣C]]\mathbb{E}[A]\,\mathbb{E}[B] = \mathbb{E}\big[\mathbb{E}[A \mid C]\big]\,\mathbb{E}\big[\mathbb{E}[B \mid C]\big]. The last term of Step 3 minus this product is Cov⁡(E[A∣C],E[B∣C])\operatorname{Cov}\big(\mathbb{E}[A \mid C], \mathbb{E}[B \mid C]\big), by the definition of covariance.

Proposition 5 (Two-layer covariance)

Let f1∼GP(0,k1)f_1 \sim \mathcal{GP}(0, k_1) and f2∼GP(0,k2)f_2 \sim \mathcal{GP}(0, k_2) be independent with squared-exponential kernels, and y(x)=f2(f1(x))y(x) = f_2(f_1(x)). Then

Cov⁡(y(x),y(x′))=σ221+s2/ℓ22,s2=2σ12(1−e−(x−x′)2/(2ℓ12)).\operatorname{Cov}\big(y(x), y(x')\big) = \frac{\sigma_2^2}{\sqrt{1 + s^2/\ell_2^2}}, \qquad s^2 = 2\sigma_1^2\Big(1 - e^{-(x - x')^2/(2\ell_1^2)}\Big).
Proof

Step 1. Law of total covariance, conditioning on f1f_1.

Cov⁡(y(x),y(x′))=E[Cov⁡(y(x),y(x′)∣f1)]+Cov⁡(E[y(x)∣f1], E[y(x′)∣f1]).\operatorname{Cov}\big(y(x), y(x')\big) = \mathbb{E}\big[\operatorname{Cov}(y(x), y(x') \mid f_1)\big] + \operatorname{Cov}\big(\mathbb{E}[y(x) \mid f_1],\ \mathbb{E}[y(x') \mid f_1]\big).

Step 2. The second term vanishes. Given f1f_1, y(x)=f2(f1(x))y(x) = f_2(f_1(x)) is the zero-mean GP f2f_2 at a fixed point, so E[y(x)∣f1]=0\mathbb{E}[y(x) \mid f_1] = 0, and the covariance of two constants is zero.

Step 3. The first term is an expected kernel. Given f1f_1, the covariance is k2(f1(x),f1(x′))=σ22e−d2/(2ℓ22)k_2(f_1(x), f_1(x')) = \sigma_2^2e^{-d^2/(2\ell_2^2)} with d=f1(x)−f1(x′)d = f_1(x) - f_1(x').

Step 4. The law of dd. As in the previous proposition, d∼N(0,s2)d \sim \mathcal{N}(0, s^2) with s2=2k1(0)−2k1(x,x′)=2σ12(1−e−(x−x′)2/(2ℓ12))s^2 = 2k_1(0) - 2k_1(x, x') = 2\sigma_1^2\big(1 - e^{-(x - x')^2/(2\ell_1^2)}\big).

Step 5. Write the expectation as an integral and collect the exponents.

E[e−d2/(2ℓ22)]=∫−∞∞12πs2 e−d2/(2s2) e−d2/(2ℓ22) dd=12πs2∫−∞∞e−a2d2 dd,a=1s2+1ℓ22.\mathbb{E}\big[e^{-d^2/(2\ell_2^2)}\big] = \int_{-\infty}^{\infty}\frac{1}{\sqrt{2\pi s^2}}\,e^{-d^2/(2s^2)}\,e^{-d^2/(2\ell_2^2)}\,dd = \frac{1}{\sqrt{2\pi s^2}}\int_{-\infty}^{\infty}e^{-\frac{a}{2}d^2}\,dd, \qquad a = \frac{1}{s^2} + \frac{1}{\ell_2^2}.

Step 6. The Gaussian integral. ∫e−ad2/2 dd=2π/a\int e^{-a d^2/2}\,dd = \sqrt{2\pi/a}. So the expectation is 2π/a /2πs2=1/as2=1/1+s2/ℓ22\sqrt{2\pi/a}\,/\sqrt{2\pi s^2} = 1/\sqrt{a s^2} = 1/\sqrt{1 + s^2/\ell_2^2}.

Step 7. Multiply by σ22\sigma_2^2.

A Monte Carlo check with σ1=σ2=1\sigma_1 = \sigma_2 = 1, ℓ1=0.3\ell_1 = 0.3, ℓ2=0.5\ell_2 = 0.5 and ∣x−x′∣=0.2|x - x'| = 0.2 gives 0.62120.6212 against the formula’s 0.62090.6209. Three readings:

  • Still stationary. The covariance depends only on x−x′x - x', because the first layer is stationary. The non-stationarity of a deep GP is not in its covariance. It is in its individual draws, and in its posterior once the data have chosen a warp.
  • Long-range memory. As ∣x−x′∣→∞|x - x'| \to \infty, s2→2σ12s^2 \to 2\sigma_1^2 and the covariance tends to σ22/1+2σ12/ℓ22>0\sigma_2^2/\sqrt{1 + 2\sigma_1^2/\ell_2^2} > 0. Far-apart inputs stay correlated: their hidden values land in the same range, and f2f_2 is evaluated there twice.
  • The covariance is not the whole story. A GP with this kernel has the same covariance and Gaussian increments. The deep GP’s increments are not Gaussian.

Proposition 6 (Heavy-tailed increments)

The increment Δ=y(x)−y(x′)\Delta = y(x) - y(x') of the two-layer model has kurtosis

E[Δ4]E[Δ2]2=3 1−2ρˉ1+ρˉ2(1−ρˉ1)2>3,ρˉ1=(1+s2ℓ22)−1/2,ρˉ2=(1+2s2ℓ22)−1/2,\frac{\mathbb{E}[\Delta^4]}{\mathbb{E}[\Delta^2]^2} = 3\,\frac{1 - 2\bar\rho_1 + \bar\rho_2}{(1 - \bar\rho_1)^2} > 3, \qquad \bar\rho_1 = \Big(1 + \frac{s^2}{\ell_2^2}\Big)^{-1/2},\quad \bar\rho_2 = \Big(1 + \frac{2s^2}{\ell_2^2}\Big)^{-1/2},

whenever x≠x′x \neq x'. A Gaussian has kurtosis 3.

Proof

Step 1. Conditionally Gaussian. Given f1f_1, Δ\Delta is a difference of two jointly Gaussian values of f2f_2, so Δ∣f1∼N(0,v)\Delta \mid f_1 \sim \mathcal{N}(0, v) with v=Var⁡(Δ∣f1)=σ22+σ22−2σ22ρ(d)=2σ22(1−ρ(d))v = \operatorname{Var}(\Delta \mid f_1) = \sigma_2^2 + \sigma_2^2 - 2\sigma_2^2\rho(d) = 2\sigma_2^2\big(1 - \rho(d)\big).

Step 2. Moments of a Gaussian. For N(0,v)\mathcal{N}(0, v) the second moment is vv and the fourth is 3v23v^2. Averaging over f1f_1 (tower property): E[Δ2]=E[v]\mathbb{E}[\Delta^2] = \mathbb{E}[v] and E[Δ4]=3 E[v2]\mathbb{E}[\Delta^4] = 3\,\mathbb{E}[v^2].

Step 3. Compute E[v]\mathbb{E}[v]. E[ρ(d)]=ρˉ1\mathbb{E}[\rho(d)] = \bar\rho_1 by Steps 5 and 6 of the covariance proof, so E[v]=2σ22(1−ρˉ1)\mathbb{E}[v] = 2\sigma_2^2(1 - \bar\rho_1).

Step 4. Compute E[v2]\mathbb{E}[v^2]. v2=4σ24(1−2ρ+ρ2)v^2 = 4\sigma_2^4(1 - 2\rho + \rho^2), and ρ(d)2=e−d2/ℓ22=e−d2/(2(ℓ2/2)2)\rho(d)^2 = e^{-d^2/\ell_2^2} = e^{-d^2/(2(\ell_2/\sqrt2)^2)}. So E[ρ2]\mathbb{E}[\rho^2] is the same integral with ℓ22\ell_2^2 replaced by ℓ22/2\ell_2^2/2, which is ρˉ2\bar\rho_2. Hence E[v2]=4σ24(1−2ρˉ1+ρˉ2)\mathbb{E}[v^2] = 4\sigma_2^4(1 - 2\bar\rho_1 + \bar\rho_2).

Step 5. Divide. 3 E[v2]/E[v]23\,\mathbb{E}[v^2]/\mathbb{E}[v]^2 is the stated ratio; the factors 4σ244\sigma_2^4 cancel.

Step 6. Why it exceeds 3. E[v2]−E[v]2=Var⁡(v)≥0\mathbb{E}[v^2] - \mathbb{E}[v]^2 = \operatorname{Var}(v) \geq 0, with equality only if vv is constant. For x≠x′x \neq x', dd is a non-degenerate Gaussian, so vv is not constant and the inequality is strict.

With the numbers above the kurtosis is 5.155.15 (Monte Carlo: 5.145.14). A random variance makes a scale mixture of Gaussians: most increments are small, where the warp is flat, and a few are large, where it is steep. That is the prior of a function that is calm in most places and sharp in a few, which is what the step needed.

The animation shows the mechanism with the warp the deep GP of Section 5 actually learned. Evenly spaced inputs pass through the first layer; they bunch where it is flat and spread where it is steep. A stationary second layer then sees them, and the composition changes fast only where the warp is steep.

Layer 1 (left) is the warp learned on the step data; layer 2 (top right) is one draw from a stationary GP; their composition (bottom right) is calm where the warp is flat and busy where it is steep.

3. What depth does

If two layers help, do ten help more? The figure at the top says no. With plain layers the draws become flat almost everywhere, with a few cliffs. Duvenaud, Rippel, Adams and Ghahramani (2014) explained why. The one-dimensional argument needs one fact about GPs, proved first.

Lemma 2 (The derivative of a stationary GP at a point)

If f∼GP(0,k)f \sim \mathcal{GP}(0, k) with kk stationary and twice differentiable at 0, then at every input tt the derivative f′(t)f'(t) is Gaussian with mean 0 and variance −k′′(0)-k''(0), the same for every tt. For the squared-exponential kernel, −k′′(0)=σ2/ℓ2-k''(0) = \sigma^2/\ell^2.

Proof

Step 1. A difference quotient is Gaussian. For δ>0\delta > 0, Qδ=(f(t+δ)−f(t))/δQ_\delta = \big(f(t + \delta) - f(t)\big)/\delta is a linear combination of two jointly Gaussian values, so it is Gaussian with mean 0.

Step 2. Its variance. Using Var⁡f(t)=k(0)\operatorname{Var}f(t) = k(0) and Cov⁡(f(t+δ),f(t))=k(δ)\operatorname{Cov}(f(t + \delta), f(t)) = k(\delta),

Var⁡Qδ=k(0)+k(0)−2k(δ)δ2=2(k(0)−k(δ))δ2.\operatorname{Var}Q_\delta = \frac{k(0) + k(0) - 2k(\delta)}{\delta^2} = \frac{2\big(k(0) - k(\delta)\big)}{\delta^2}.

Step 3. Taylor expansion. A stationary kernel is even, k(δ)=k(−δ)k(\delta) = k(-\delta), so k′(0)=0k'(0) = 0 and k(δ)=k(0)+12k′′(0)δ2+o(δ2)k(\delta) = k(0) + \tfrac12k''(0)\delta^2 + o(\delta^2).

Step 4. Take the limit. Substituting, Var⁡Qδ=−k′′(0)+o(1)→−k′′(0)\operatorname{Var}Q_\delta = -k''(0) + o(1) \to -k''(0) as δ→0\delta \to 0. Mean-square limits of Gaussian variables are Gaussian with the limiting mean and variance, so f′(t)∼N(0,−k′′(0))f'(t) \sim \mathcal{N}(0, -k''(0)). Nothing depends on tt.

Step 5. The squared-exponential case. k(δ)=σ2e−δ2/(2ℓ2)k(\delta) = \sigma^2e^{-\delta^2/(2\ell^2)} has k′(δ)=−σ2(δ/ℓ2)e−δ2/(2ℓ2)k'(\delta) = -\sigma^2(\delta/\ell^2)e^{-\delta^2/(2\ell^2)} and k′′(0)=−σ2/ℓ2k''(0) = -\sigma^2/\ell^2.

Proposition 7 (The derivative of a deep composition)

Let every layer be one-dimensional, zero-mean and stationary, with rl2=−kl′′(0)r_l^2 = -k_l''(0). At any fixed input xx, the derivative of the composition is a product of independent Gaussians:

DL=ddx hL(x)=∏l=1Lgl,gl∼N(0,rl2) independent.D_L = \frac{d}{dx}\,h_L(x) = \prod_{l=1}^{L} g_l, \qquad g_l \sim \mathcal{N}(0, r_l^2)\ \text{independent}.
Proof

Step 1. Chain rule. hl(x)=fl(hl−1(x))h_l(x) = f_l(h_{l-1}(x)), so hl′(x)=fl′(hl−1(x)) hl−1′(x)h_l'(x) = f_l'(h_{l-1}(x))\,h_{l-1}'(x). Unrolling from h0′(x)=1h_0'(x) = 1 gives DL=∏l=1Lfl′(hl−1(x))D_L = \prod_{l=1}^{L}f_l'\big(h_{l-1}(x)\big). Call the factors glg_l.

Step 2. Each factor, given the layers below. hl−1(x)h_{l-1}(x) is determined by layers 1,…,l−11, \dots, l-1, which are independent of flf_l. Given them, glg_l is fl′f_l' evaluated at a fixed point, which is N(0,rl2)\mathcal{N}(0, r_l^2) by the lemma.

Step 3. The conditional law does not depend on the condition. It is N(0,rl2)\mathcal{N}(0, r_l^2) for every value of the lower layers, so glg_l is independent of those layers.

Step 4. Hence of the earlier factors. g1,…,gl−1g_1, \dots, g_{l-1} are functions of the lower layers, so glg_l is independent of them. By induction all factors are independent.

Corollary 1 (The log-derivative is a random walk)

With gl=rlZlg_l = r_lZ_l, Zl∼N(0,1)Z_l \sim \mathcal{N}(0, 1),

log⁡∣DL∣=∑l=1L(log⁡rl+log⁡∣Zl∣),Elog⁡∣Z∣=−12(γ+log⁡2)≈−0.635,Var⁡log⁡∣Z∣=π28≈1.234,\log\lvert D_L\rvert = \sum_{l=1}^{L}\big(\log r_l + \log\lvert Z_l\rvert\big), \qquad \mathbb{E}\log\lvert Z\rvert = -\tfrac12(\gamma + \log 2) \approx -0.635, \qquad \operatorname{Var}\log\lvert Z\rvert = \tfrac{\pi^2}{8} \approx 1.234,

where γ≈0.577\gamma \approx 0.577 is the Euler–Mascheroni constant. For equal layers the mean of log⁡∣DL∣\log\lvert D_L\rvert is L(log⁡r−0.635)L(\log r - 0.635) and its standard deviation is 1.11L1.11\sqrt{L}.

Proof

Step 1. Logs turn the product into a sum of independent terms, because the glg_l are independent; log⁡∣rlZl∣=log⁡rl+log⁡∣Zl∣\log\lvert r_lZ_l\rvert = \log r_l + \log\lvert Z_l\rvert.

Step 2. Reduce to a Gamma variable. X=Z2X = Z^2 is chi-squared with one degree of freedom, which is the Gamma distribution with shape k=12k = \tfrac12 and scale θ=2\theta = 2, with density xk−1e−x/θ/(Γ(k)θk)x^{k-1}e^{-x/\theta}/(\Gamma(k)\theta^k). And log⁡∣Z∣=12log⁡X\log\lvert Z\rvert = \tfrac12\log X.

Step 3. The mean of log⁡X\log X. Start from the normalisation ∫0∞xk−1e−x/θ dx=Γ(k)θk\int_0^\infty x^{k-1}e^{-x/\theta}\,dx = \Gamma(k)\theta^k and differentiate both sides with respect to kk. On the left, ∂kxk−1=xk−1log⁡x\partial_kx^{k-1} = x^{k-1}\log x. On the right, Γ′(k)θk+Γ(k)θklog⁡θ\Gamma'(k)\theta^k + \Gamma(k)\theta^k\log\theta. Dividing by Γ(k)θk\Gamma(k)\theta^k gives Elog⁡X=ψ(k)+log⁡θ\mathbb{E}\log X = \psi(k) + \log\theta, where ψ=Γ′/Γ\psi = \Gamma'/\Gamma is the digamma function.

Step 4. The variance of log⁡X\log X. Differentiate once more. The left side becomes ∫xk−1(log⁡x)2e−x/θ dx\int x^{k-1}(\log x)^2e^{-x/\theta}\,dx, and after dividing, E(log⁡X)2=ψ′(k)+(ψ(k)+log⁡θ)2\mathbb{E}(\log X)^2 = \psi'(k) + \big(\psi(k) + \log\theta\big)^2. Subtracting the square of the mean gives Var⁡log⁡X=ψ′(k)\operatorname{Var}\log X = \psi'(k).

Step 5. Plug in. The standard values ψ(12)=−γ−2log⁡2\psi(\tfrac12) = -\gamma - 2\log 2 and ψ′(12)=π2/2\psi'(\tfrac12) = \pi^2/2 give Elog⁡X=−γ−log⁡2\mathbb{E}\log X = -\gamma - \log 2 and Var⁡log⁡X=π2/2\operatorname{Var}\log X = \pi^2/2. Since log⁡∣Z∣=12log⁡X\log\lvert Z\rvert = \tfrac12\log X, halve the mean and divide the variance by 4.

So with r=1r = 1 the typical slope shrinks by a factor e−0.635≈0.53e^{-0.635} \approx 0.53 per layer, while the spread of the log-slope grows like L\sqrt{L}. A simulation of DLD_L for r=1r = 1:

layers LLmedian ∣DL∣\lvert D_L\rvertshare of inputs with ∣DL∣<0.1\lvert D_L\rvert < 0.199.9% quantile of ∣DL∣\lvert D_L\rvert
10.678%3.3
20.3722%5.8
40.1049%9.9
80.00881%11.1

Flat almost everywhere, with rare steep places: the draws look piecewise constant. Unless rr is tuned to about e0.635≈1.89e^{0.635} \approx 1.89, the median slope drifts to zero or to infinity, and even then the spread grows. With multi-dimensional hidden layers the same happens to the Jacobian, a product of random matrices: its singular values spread apart exponentially, so a deep representation keeps effectively one direction of variation (Duvenaud et al., 2014).

Remark (Two fixes, both familiar from neural networks)
  • Input connections (Duvenaud et al., 2014). Feed the original input to every layer: hl=fl(hl−1,x)h_l = f_l(h_{l-1}, \boldsymbol{x}). The derivative gains a term ∂fl/∂x\partial f_l/\partial\boldsymbol{x} that is not multiplied through the earlier layers, so it cannot collapse.
  • Identity mean functions (Salimbeni and Deisenroth, 2017). Make each hidden layer a correction to the identity: hl=hl−1+fl(hl−1)h_l = h_{l-1} + f_l(h_{l-1}). The chain rule now gives factors 1+gl1 + g_l instead of glg_l. For small rr, a second-order Taylor expansion gives log⁡∣1+gl∣≈gl−gl2/2\log\lvert 1 + g_l\rvert \approx g_l - g_l^2/2, whose mean is about −r2/2-r^2/2: the drift per layer is O(r2)O(r^2) instead of −0.635-0.635. This is a residual connection, and it is the default in practice. For a hidden layer that changes dimension, a fixed linear map (for example a PCA projection of the inputs) plays the role of the identity.

Switch the figure to input-connected or identity mean and raise LL: the draws stay alive.

4. Why exact inference is impossible

For a GP, the evidence and the posterior are Gaussian integrals. For a deep GP, already with two layers,

p(y)=∫N(y∣0, k2(f1,f1)+σn2I) N(f1∣0, k1(X,X)) df1.p(\boldsymbol{y}) = \int\mathcal{N}\big(\boldsymbol{y} \mid \mathbf{0},\ k_2(\boldsymbol{f}_1, \boldsymbol{f}_1) + \sigma_n^2\mathbf{I}\big)\,\mathcal{N}\big(\boldsymbol{f}_1 \mid \mathbf{0},\ k_1(\mathbf{X}, \mathbf{X})\big)\,d\boldsymbol{f}_1 .

Look at where f1\boldsymbol{f}_1 appears in the first factor: inside e−(f1,i−f1,j)2/(2ℓ22)e^{-(f_{1,i} - f_{1,j})^2/(2\ell_2^2)}, inside a matrix, which is then inverted and whose determinant is taken. As a function of f1\boldsymbol{f}_1 that is nothing like the exponential of a quadratic, so the integral over RN\mathbb{R}^N has no closed form. The posterior over the hidden layer is not Gaussian, and typically multimodal. For example, with even kernels the pairs (f1,f2)(f_1, f_2) and (−f1, f2(−⋅))(-f_1,\ f_2(-\cdot)) produce the same output and have the same prior probability, so every posterior mode has a mirror image.

So inference is approximate, by one of two routes:

  • Variational inference, fast and scalable: Damianou and Lawrence (2013), and the doubly stochastic method of Salimbeni and Deisenroth (2017) that is now standard.
  • Monte Carlo, slower but able to represent several modes: stochastic-gradient Hamiltonian Monte Carlo (Havasi et al., 2018), and elliptical slice sampling for full Bayesian surrogates (Sauer, Gramacy and Higdon, 2023).

5. Doubly stochastic variational inference

One layer, recalled

Each layer is a sparse variational GP. Everything below needs one formula from the sparse GP post: the variational distribution of a layer’s output at a single input. Here it is again, derived.

Proposition 8 (One layer’s marginal at one input)

Let a layer have inducing inputs Z\mathbf{Z}, inducing variables u=f(Z)\boldsymbol{u} = f(\mathbf{Z}) with q(u)=N(m,S)q(\boldsymbol{u}) = \mathcal{N}(\boldsymbol{m}, \mathbf{S}), and let ku(h)=k(Z,h)\boldsymbol{k}_u(h) = k(\mathbf{Z}, h) and a(h)=Kuu−1ku(h)\boldsymbol{a}(h) = \mathbf{K}_{uu}^{-1}\boldsymbol{k}_u(h). Then q(f(h))=∫p(f(h)∣u) q(u) du=N(μ(h),s2(h))q(f(h)) = \int p(f(h) \mid \boldsymbol{u})\,q(\boldsymbol{u})\,d\boldsymbol{u} = \mathcal{N}\big(\mu(h), s^2(h)\big) with

μ(h)=a(h)⊤m,s2(h)=k(h,h)−ku(h)⊤a(h)⏟c(h)+a(h)⊤S a(h).\mu(h) = \boldsymbol{a}(h)^\top\boldsymbol{m}, \qquad s^2(h) = \underbrace{k(h, h) - \boldsymbol{k}_u(h)^\top\boldsymbol{a}(h)}_{c(h)} + \boldsymbol{a}(h)^\top\mathbf{S}\,\boldsymbol{a}(h).
Proof

Step 1. The joint of f(h)f(h) and u\boldsymbol{u}. Both are values of the same GP, so they are jointly Gaussian with mean zero, Var⁡f(h)=k(h,h)\operatorname{Var}f(h) = k(h, h), Cov⁡(f(h),u)=ku(h)⊤\operatorname{Cov}(f(h), \boldsymbol{u}) = \boldsymbol{k}_u(h)^\top and Cov⁡(u)=Kuu\operatorname{Cov}(\boldsymbol{u}) = \mathbf{K}_{uu}.

Step 2. Condition on u\boldsymbol{u} (Gaussian conditioning, the primer’s Lemma 5): p(f(h)∣u)=N(a(h)⊤u, c(h))p(f(h) \mid \boldsymbol{u}) = \mathcal{N}\big(\boldsymbol{a}(h)^\top\boldsymbol{u},\ c(h)\big) with c(h)=k(h,h)−ku(h)⊤Kuu−1ku(h)c(h) = k(h, h) - \boldsymbol{k}_u(h)^\top\mathbf{K}_{uu}^{-1}\boldsymbol{k}_u(h).

Step 3. Write it as a linear-Gaussian model. f(h)=a(h)⊤u+ef(h) = \boldsymbol{a}(h)^\top\boldsymbol{u} + e with e∼N(0,c(h))e \sim \mathcal{N}(0, c(h)) independent of u\boldsymbol{u}.

Step 4. Integrate out u∼N(m,S)\boldsymbol{u} \sim \mathcal{N}(\boldsymbol{m}, \mathbf{S}). A linear function of a Gaussian plus independent Gaussian noise is Gaussian. Its mean is a(h)⊤m\boldsymbol{a}(h)^\top\boldsymbol{m}, and its variance is Var⁡(a⊤u)+Var⁡(e)=a(h)⊤Sa(h)+c(h)\operatorname{Var}(\boldsymbol{a}^\top\boldsymbol{u}) + \operatorname{Var}(e) = \boldsymbol{a}(h)^\top\mathbf{S}\boldsymbol{a}(h) + c(h), because variances of independent terms add.

Read the variance as two parts. c(h)c(h) is what the inducing points cannot pin down at hh: zero at an inducing input, the full prior variance far from all of them. a(h)⊤Sa(h)\boldsymbol{a}(h)^\top\mathbf{S}\boldsymbol{a}(h) is our remaining uncertainty about the inducing values themselves. For a layer with an identity mean, add hh to μ(h)\mu(h); the variance is unchanged. Each evaluation costs O(M2)O(M^2) once Kuu\mathbf{K}_{uu} is factorised.

The model, augmented

Give every layer MM inducing inputs Zl\mathbf{Z}_l and inducing variables ul=fl(Zl)\boldsymbol{u}_l = f_l(\mathbf{Z}_l). With f0=X\boldsymbol{f}_0 = \mathbf{X}, the augmented joint distribution is

p(y,{fl,ul}l=1L)=∏n=1Np(yn∣fL,n) ∏l=1Lp(fl∣ul; fl−1) p(ul),p\big(\boldsymbol{y}, \{\boldsymbol{f}_l, \boldsymbol{u}_l\}_{l=1}^{L}\big) = \prod_{n=1}^{N}p(y_n \mid f_{L,n})\ \prod_{l=1}^{L}p(\boldsymbol{f}_l \mid \boldsymbol{u}_l;\ \boldsymbol{f}_{l-1})\,p(\boldsymbol{u}_l),

where p(fl∣ul;fl−1)p(\boldsymbol{f}_l \mid \boldsymbol{u}_l; \boldsymbol{f}_{l-1}) is the GP conditional of layer ll at the inputs fl−1\boldsymbol{f}_{l-1}. Integrating out every ul\boldsymbol{u}_l gives back the deep GP, so nothing has been approximated yet.

The variational family

Salimbeni and Deisenroth (2017) keep the layers’ dependence on each other and approximate only the inducing variables:

q({fl,ul})=∏l=1Lp(fl∣ul; fl−1) q(ul),q(ul)=N(ml,Sl).q\big(\{\boldsymbol{f}_l, \boldsymbol{u}_l\}\big) = \prod_{l=1}^{L}p(\boldsymbol{f}_l \mid \boldsymbol{u}_l;\ \boldsymbol{f}_{l-1})\,q(\boldsymbol{u}_l), \qquad q(\boldsymbol{u}_l) = \mathcal{N}(\boldsymbol{m}_l, \mathbf{S}_l).

Each layer is a sparse variational GP whose inputs are the previous layer’s outputs. The earlier method of Damianou and Lawrence (2013) instead gave the hidden values of each layer their own independent Gaussian, which breaks exactly the dependence between layers that makes the model deep.

a two-layer deep GPxlayer 1: f₁ ~ GP(x, k₁)inducing inputs Z₁, q(u₁)hlayer 2: f₂ ~ GP(0, k₂)inducing inputs Z₂, q(u₂)fy+ noisehidden values are random,so the kernel of layer 2 is randomone training point, through the layers (doubly stochastic VI)xₙμ₁(xₙ), σ₁²(xₙ)closed form, O(M²)ĥₙ = μ₁ + σ₁ εsample, ε ~ N(0, 1)μ₂(ĥₙ), σ₂²(ĥₙ)closed form, O(M²)E log p(yₙ | f)in closed formtwo sources of randomness: a minibatch of points n, and the noise εboth give unbiased gradients of the ELBO, and no N × N matrix appears anywhere

Theorem 1 (The doubly stochastic ELBO (Salimbeni and Deisenroth, 2017))

For this family,

L=∑n=1NEq(fL,n)[log⁡p(yn∣fL,n)]−∑l=1LKL[q(ul) ∥ p(ul)],\mathcal{L} = \sum_{n=1}^{N}\mathbb{E}_{q(f_{L,n})}\big[\log p(y_n \mid f_{L,n})\big] - \sum_{l=1}^{L}\mathrm{KL}\big[q(\boldsymbol{u}_l) \,\Vert\, p(\boldsymbol{u}_l)\big],

and the marginal q(fL,n)q(f_{L,n}) depends only on the nn-th input, through a chain of one-dimensional Gaussians:

q(fL,n)=∫∏l=1LN(fl,n∣μl(fl−1,n), sl2(fl−1,n)) df1,n⋯dfL−1,n.q(f_{L,n}) = \int\prod_{l=1}^{L}\mathcal{N}\big(f_{l,n} \mid \mu_l(f_{l-1,n}),\ s_l^2(f_{l-1,n})\big)\,df_{1,n}\cdots df_{L-1,n}.
Proof

Step 1. The ELBO. By definition, L=Eq[log⁡p(y,{fl,ul})−log⁡q({fl,ul})]\mathcal{L} = \mathbb{E}_q\big[\log p(\boldsymbol{y}, \{\boldsymbol{f}_l, \boldsymbol{u}_l\}) - \log q(\{\boldsymbol{f}_l, \boldsymbol{u}_l\})\big].

Step 2. Write the ratio out and cancel.

p(y,{fl,ul})q({fl,ul})=∏np(yn∣fL,n) ∏lp(fl∣ul;fl−1) p(ul)∏lp(fl∣ul;fl−1) q(ul)=∏np(yn∣fL,n) ∏lp(ul)q(ul).\frac{p(\boldsymbol{y}, \{\boldsymbol{f}_l, \boldsymbol{u}_l\})}{q(\{\boldsymbol{f}_l, \boldsymbol{u}_l\})} = \frac{\prod_n p(y_n \mid f_{L,n})\ \prod_l p(\boldsymbol{f}_l \mid \boldsymbol{u}_l; \boldsymbol{f}_{l-1})\,p(\boldsymbol{u}_l)}{\prod_l p(\boldsymbol{f}_l \mid \boldsymbol{u}_l; \boldsymbol{f}_{l-1})\,q(\boldsymbol{u}_l)} = \prod_n p(y_n \mid f_{L,n})\ \prod_l\frac{p(\boldsymbol{u}_l)}{q(\boldsymbol{u}_l)}.

Every NN-dimensional conditional cancels, exactly as in Titsias’s derivation.

Step 3. Take logs and expectations.

L=∑nEq[log⁡p(yn∣fL,n)]+∑lEq[log⁡p(ul)q(ul)].\mathcal{L} = \sum_n\mathbb{E}_q\big[\log p(y_n \mid f_{L,n})\big] + \sum_l\mathbb{E}_q\Big[\log\frac{p(\boldsymbol{u}_l)}{q(\boldsymbol{u}_l)}\Big].

Step 4. The KL terms. Under qq, integrate out fL\boldsymbol{f}_L first: p(fL∣uL;fL−1)p(\boldsymbol{f}_L \mid \boldsymbol{u}_L; \boldsymbol{f}_{L-1}) is a normalised density in fL\boldsymbol{f}_L, so it integrates to 1. Then fL−1\boldsymbol{f}_{L-1}, and so on down to f1\boldsymbol{f}_1. What remains is ∏lq(ul)\prod_lq(\boldsymbol{u}_l): the inducing variables are independent under qq with marginals q(ul)q(\boldsymbol{u}_l). Each second term depends only on ul\boldsymbol{u}_l, so it equals Eq(ul)[log⁡p(ul)−log⁡q(ul)]=−KL[q(ul) ∥ p(ul)]\mathbb{E}_{q(\boldsymbol{u}_l)}[\log p(\boldsymbol{u}_l) - \log q(\boldsymbol{u}_l)] = -\mathrm{KL}[q(\boldsymbol{u}_l) \,\Vert\, p(\boldsymbol{u}_l)].

Step 5. Integrate out each ul\boldsymbol{u}_l. Define q(fl∣fl−1)=∫p(fl∣ul;fl−1) q(ul) dulq(\boldsymbol{f}_l \mid \boldsymbol{f}_{l-1}) = \int p(\boldsymbol{f}_l \mid \boldsymbol{u}_l; \boldsymbol{f}_{l-1})\,q(\boldsymbol{u}_l)\,d\boldsymbol{u}_l. By the one-layer proposition applied at each of the NN inputs, it is Gaussian with nn-th mean μl(fl−1,n)\mu_l(f_{l-1,n}) and nn-th variance sl2(fl−1,n)s_l^2(f_{l-1,n}). Because the ul\boldsymbol{u}_l are independent, the layers form a Markov chain under qq:

q(f1,…,fL)=∏l=1Lq(fl∣fl−1).q(\boldsymbol{f}_1, \dots, \boldsymbol{f}_L) = \prod_{l=1}^{L}q(\boldsymbol{f}_l \mid \boldsymbol{f}_{l-1}).

Step 6. The nn-th term needs one marginal. log⁡p(yn∣fL,n)\log p(y_n \mid f_{L,n}) depends only on fL,nf_{L,n}, so its expectation needs only the marginal q(fL,n)q(f_{L,n}): integrate the chain over every other coordinate.

Step 7. Integrate the top layer. In q(fL∣fL−1)q(\boldsymbol{f}_L \mid \boldsymbol{f}_{L-1}), integrate out the N−1N - 1 coordinates of fL\boldsymbol{f}_L other than fL,nf_{L,n}. The marginal of one coordinate of a Gaussian vector is Gaussian with that coordinate’s mean and variance, N(fL,n∣μL(fL−1,n),sL2(fL−1,n))\mathcal{N}\big(f_{L,n} \mid \mu_L(f_{L-1,n}), s_L^2(f_{L-1,n})\big), and this depends on fL−1\boldsymbol{f}_{L-1} only through fL−1,nf_{L-1,n}.

Step 8. Induct downwards. After Step 7, the coordinates of fL−1\boldsymbol{f}_{L-1} other than fL−1,nf_{L-1,n} appear only in q(fL−1∣fL−2)q(\boldsymbol{f}_{L-1} \mid \boldsymbol{f}_{L-2}). Integrating them out leaves N(fL−1,n∣μL−1(fL−2,n),sL−12(fL−2,n))\mathcal{N}\big(f_{L-1,n} \mid \mu_{L-1}(f_{L-2,n}), s_{L-1}^2(f_{L-2,n})\big). Repeating down to layer 1 leaves the chain in the statement.

That is the whole method. Every point travels through the layers on its own, carrying one mean and one variance per layer, and no N×NN \times N matrix is ever formed.

A forward pass by hand

Formulas are easier to trust after one pass with numbers. Take a tiny two-layer model:

  • both layers: squared-exponential kernel with σ=ℓ=1\sigma = \ell = 1, zero mean, two inducing inputs Z=(−1,1)\mathbf{Z} = (-1, 1);
  • q(u1)=N((−0.8, 0.8), 0.01 I)q(\boldsymbol{u}_1) = \mathcal{N}\big((-0.8,\ 0.8),\ 0.01\,\mathbf{I}\big) and q(u2)=N((−1, 1), 0.02 I)q(\boldsymbol{u}_2) = \mathcal{N}\big((-1,\ 1),\ 0.02\,\mathbf{I}\big);
  • one training point x=0.5x = 0.5, y=0.9y = 0.9, noise σn=0.1\sigma_n = 0.1, and one draw ε=0.5\varepsilon = 0.5.

Both layers share Kuu=[1e−2e−21]=[10.13530.13531]\mathbf{K}_{uu} = \begin{bmatrix}1 & e^{-2}\\ e^{-2} & 1\end{bmatrix} = \begin{bmatrix}1 & 0.1353\\ 0.1353 & 1\end{bmatrix}, since the two inducing inputs are 2 apart.

stepformulavalue
1. kernel to the inducing inputsku(0.5)=(e−1.52/2, e−0.52/2)\boldsymbol{k}_u(0.5) = (e^{-1.5^2/2},\ e^{-0.5^2/2})(0.3247, 0.8825)(0.3247,\ 0.8825)
2. interpolation weightsa=Kuu−1ku\boldsymbol{a} = \mathbf{K}_{uu}^{-1}\boldsymbol{k}_u(0.2090, 0.8542)(0.2090,\ 0.8542)
3. layer-1 meanμ1=a⊤m1=−0.8(0.2090)+0.8(0.8542)\mu_1 = \boldsymbol{a}^\top\boldsymbol{m}_1 = -0.8(0.2090) + 0.8(0.8542)0.51610.5161
4. what u1\boldsymbol{u}_1 cannot pin downc1=1−ku⊤ac_1 = 1 - \boldsymbol{k}_u^\top\boldsymbol{a}0.17830.1783
5. uncertainty about u1\boldsymbol{u}_1a⊤S1a=0.01(0.20902+0.85422)\boldsymbol{a}^\top\mathbf{S}_1\boldsymbol{a} = 0.01(0.2090^2 + 0.8542^2)0.00770.0077
6. layer-1 variances12=c1+a⊤S1as_1^2 = c_1 + \boldsymbol{a}^\top\mathbf{S}_1\boldsymbol{a}0.18600.1860, so s1=0.4313s_1 = 0.4313
7. sample the hidden valueh^=μ1+s1ε=0.5161+0.4313(0.5)\hat h = \mu_1 + s_1\varepsilon = 0.5161 + 0.4313(0.5)0.73180.7318
8. layer 2 at h^\hat hku(h^)=(e−1.73182/2, e−0.26822/2)\boldsymbol{k}_u(\hat h) = (e^{-1.7318^2/2},\ e^{-0.2682^2/2}), then a=Kuu−1ku\boldsymbol{a} = \mathbf{K}_{uu}^{-1}\boldsymbol{k}_u(0.2232, 0.9647)(0.2232,\ 0.9647), (0.0944, 0.9519)(0.0944,\ 0.9519)
9. layer-2 meanμ2=−1(0.0944)+1(0.9519)\mu_2 = -1(0.0944) + 1(0.9519)0.85750.8575
10. layer-2 variances22=(1−ku⊤a)+a⊤S2a=0.0607+0.0183s_2^2 = (1 - \boldsymbol{k}_u^\top\boldsymbol{a}) + \boldsymbol{a}^\top\mathbf{S}_2\boldsymbol{a} = 0.0607 + 0.01830.07900.0790
11. expected log-likelihood−12log⁡(2πσn2)−(y−μ2)22σn2−s222σn2=1.3836−0.0904−3.9482-\tfrac12\log(2\pi\sigma_n^2) - \frac{(y - \mu_2)^2}{2\sigma_n^2} - \frac{s_2^2}{2\sigma_n^2} = 1.3836 - 0.0904 - 3.9482−2.6549-2.6549

Step 11 shows what training will do. The mean is close to yy, so the data-fit term costs only 0.090.09 nats. The variance term costs 3.953.95, because the model is far less certain (s22=0.079s_2^2 = 0.079) than the noise (σn2=0.01\sigma_n^2 = 0.01). To raise the ELBO, the optimiser will make the layers more certain where the data are, and move the hidden values to where layer 2 is certain. That is how a warp gets learned.

Turning it into an algorithm

The chain has no closed form, because μl\mu_l and sl2s_l^2 are nonlinear functions of their input. But it is easy to sample, and samples can be differentiated.

Proposition 9 (The reparameterisation trick)

If ε∼N(0,1)\varepsilon \sim \mathcal{N}(0, 1), then for any differentiable gg,

∇ϕ Ef∼N(μϕ,sϕ2)[g(f)]=Eε[∇ϕ g(μϕ+sϕε)].\nabla_\phi\,\mathbb{E}_{f \sim \mathcal{N}(\mu_\phi, s_\phi^2)}\big[g(f)\big] = \mathbb{E}_{\varepsilon}\big[\nabla_\phi\,g(\mu_\phi + s_\phi\varepsilon)\big].
Proof

Step 1. Same distribution. If ε∼N(0,1)\varepsilon \sim \mathcal{N}(0, 1), then μϕ+sϕε∼N(μϕ,sϕ2)\mu_\phi + s_\phi\varepsilon \sim \mathcal{N}(\mu_\phi, s_\phi^2), an affine map of a Gaussian. So Ef[g(f)]=Eε[g(μϕ+sϕε)]=∫g(μϕ+sϕε) N(ε∣0,1) dε\mathbb{E}_f[g(f)] = \mathbb{E}_\varepsilon[g(\mu_\phi + s_\phi\varepsilon)] = \int g(\mu_\phi + s_\phi\varepsilon)\,\mathcal{N}(\varepsilon \mid 0, 1)\,d\varepsilon.

Step 2. The density no longer depends on ϕ\phi. Only the integrand does. Under the usual integrability conditions the gradient moves inside the integral, which is the statement.

Step 3. Why this matters. An average of ∇ϕg(μϕ+sϕε)\nabla_\phi g(\mu_\phi + s_\phi\varepsilon) over a few draws of ε\varepsilon is an unbiased estimate of the gradient. It uses the slope of gg, which typically makes it far less noisy than estimators that only use the values of gg.

So one training step is:

  1. pick a minibatch B\mathcal{B} of BB points and draw standard normals εl,n\varepsilon_{l,n};
  2. for each point, push a sample through the layers: f^l,n=μl(f^l−1,n)+sl(f^l−1,n) εl,n\hat f_{l,n} = \mu_l(\hat f_{l-1,n}) + s_l(\hat f_{l-1,n})\,\varepsilon_{l,n}, starting from f^0,n=xn\hat f_{0,n} = \boldsymbol{x}_n, as in steps 1 to 7 of the table;
  3. at the last layer, do the expectation in closed form instead of sampling; for a Gaussian likelihood that is step 11 of the table;
  4. estimate the ELBO by NB∑n∈B(that term)−∑lKLl\frac{N}{B}\sum_{n \in \mathcal{B}}(\text{that term}) - \sum_l\mathrm{KL}_l, and take a gradient step on everything: ml\boldsymbol{m}_l, Sl\mathbf{S}_l, Zl\mathbf{Z}_l, the kernel hyperparameters and σn2\sigma_n^2.

The estimate is unbiased twice over, for the random minibatch and for the random ε\varepsilon: hence doubly stochastic. A step costs O(SBLM2+LM3)O\big(SBLM^2 + LM^3\big) for SS samples per point, with no dependence on NN; Salimbeni and Deisenroth (2017) report data sets “ranging in size from hundreds to a billion points”. With several outputs per layer, each output dimension gets its own q(u)q(\boldsymbol{u}) and KL term, and the samples are vectors.

Three practical choices matter a lot:

  • Identity (or linear) mean functions on hidden layers, the fix from Section 3.
  • Start inner layers almost deterministic. Initialise Sl\mathbf{S}_l near zero for l<Ll < L, so training starts from a GP on almost unwarped inputs and the warp is learned only as far as the data justify. Sáez-Maldonado, Maroñas and Hernández-Lobato (2026) argue that this conditioning at initialisation, more than the identity mean itself, is what avoids posterior collapse, where the hidden layers fall back to their priors and the model explains the data as noise.
  • Predict with the mixture of Section 2: push SS samples of a test input through the layers and average the final Gaussians.

A deep GP, fitted

Here is an exact GP and a two-layer deep GP fitted to the same 150 noisy points of a step. I trained the deep GP with exactly the algorithm above: 20 whitened inducing points per layer, an identity mean on the hidden layer, 8 samples per step, 6000 Adam steps. The hyperparameters of both models were learned from the data. Move the pointer across the plot to see the predictive density p(y∣x∗)p(y \mid x^*) at that input, drawn sideways on the right:

  • The GP has to choose a short length-scale to follow the jump. It rings on both plateaus, inflates the noise standard deviation to 0.1110.111 (the truth is 0.050.05), and returns to zero within a short distance of the data.
  • The deep GP learns a warp that is steep at x=0x = 0 and flat elsewhere (Hidden layer), so its second layer can be smooth. The plateaus are flat, the noise estimate is right (0.0560.056), and beyond the data it keeps predicting the plateau with growing uncertainty, through the skewed mixture of the animation in Section 2.
  • At the jump it does not hedge. The two nearest data points are at x≈0x \approx 0 and x≈0.026x \approx 0.026. The deep GP switches from one plateau to the other inside that gap, so just outside it all its mass is on a plateau. Put the pointer at x=0.02x = 0.02: the GP’s predictive is centred at 0.150.15, between the plateaus, where no data have ever been.
  • The numbers agree. On 1000 held-out points the average log predictive density is 0.820.82 for the deep GP and 0.600.60 for the GP. The deep GP’s ELBO is 162162 nats; it is a lower bound on its log evidence, against the GP’s exact log evidence of 4747. The data prefer the deep model by a wide margin.

6. Is all this mathematics worth it?

Each piece of the machinery buys one specific thing:

piecewhat it buyswithout it
compositionnon-stationarity learned from dataone texture everywhere, or a hand-designed kernel
a GP prior on each layeruncertainty about the warp itself, and a prior that prefers simple warpsa point-estimated warp that can overfit (deep kernel learning)
the ELBO with its KL termsautomatic complexity control on small data, and model comparisonearly stopping and validation sets
the predictive mixtureskewed, heavy-tailed or multimodal uncertaintya single Gaussian, which hedges between modes
inducing points and doubly stochastic VIlinear cost in NN, minibatches, any likelihoodO(N3)O(N^3) per step, Gaussian likelihoods only

Compared with the alternatives:

learns non-stationarityuncertainty about the representationpredictive shapedata it suitsmain risk
GP, stationary kernelnonone neededGaussiansmallthe wrong texture
GP, hand-designed non-stationary kernelonly the form you designednoneGaussiansmallthe wrong design
deep kernel learningyesnone (a point estimate)Gaussianmediumoverfitting the marginal likelihood
neural-network ensemblesyesfrom the spread of the membersanylargepoor uncertainty with little data
deep GPyesyes (variational or sampled)a mixturesmall to mediumharder optimisation; VI too narrow

The costs are real. Training is slower than for a single sparse GP by roughly a factor SLSL. The optimisation has more local optima, and needs the initialisation above to avoid posterior collapse. And a variational posterior is zero-forcing: it tends to be too narrow (the sparse GP post, Section 2, proves this for the mean-field case). So the mathematics is worth it when three things matter at once: there is little data, the structure is non-stationary, and you will act on the uncertainty.

7. Where deep GPs are the right tool today

  • Surrogates of expensive simulators. A finite-element, climate or chemistry code may be run only tens to thousands of times. Its response is often non-stationary (regimes, shocks, phase changes), and the surrogate’s uncertainty drives design, calibration or the choice of the next run. This is where deep GPs are most used. Sauer, Gramacy and Higdon (2023) use them for active learning. Ming, Williamson and Guillas (2023) train them by stochastic imputation, which turns a deep GP into a chain of ordinary GPs. Booth (2025) adds gradient observations and predicts gradients, for molecular energies and forces.
  • Multi-fidelity modelling. When a cheap, coarse simulator and an expensive, accurate one are both available, each layer can be one fidelity level, and the composition captures the non-linear relation between them (Cutajar et al., 2019).
  • Spatial statistics with non-stationary fields. Deep compositions of injective warps model fields whose correlation length changes across space, for example satellite radiances (Zammit-Mangion et al., 2022).
  • Mappings between functions. Stacking linear and non-linear GP layers in function space gives calibrated operator learning (Lowery et al., 2025), the setting of the operator-kernel post.
  • Sequential decisions. Bayesian optimisation and active learning on non-stationary objectives, where better-shaped uncertainty chooses better next queries.

Where they are usually not the right tool: large data sets with plenty of compute (neural networks and ensembles), images and text (deep kernel machines, in Section 9, or neural networks), and problems where a single GP with a sensible kernel already fits.

8. What is new, 2018 to 2026

The doubly stochastic family has one weakness: each q(ul)q(\boldsymbol{u}_l) is Gaussian and independent of the other layers, so the approximate posterior is unimodal and ignores how the layers’ inducing variables co-vary. Most work since attacks that, makes inference cheaper, or takes deep GPs to new settings.

yearworkwhat it changes
2018Havasi, Hernández-Lobato and Murillo-Fuentessamples the inducing variables with stochastic-gradient HMC; the true posterior is multimodal
2019Salimbeni, Dutordoir, Hensman and Deisenrothlatent input variables and an importance-weighted bound, for multimodal outputs
2019Yu, Chen, Dai, Low and Jailletimplicit (non-Gaussian) posteriors, trained adversarially
2020Jankowiak, Pleiss and Gardnerdeep sigma point processes: a learned quadrature replaces sampling
2020Lindinger, Reeb, Lippert and Rakitschkeeps covariances between layers, still marginalising the inducing variables in closed form
2021Ober and Aitchison“global” inducing points defined at the input and propagated through the layers
2021Dutordoir et al.neural networks as point estimates of deep GPs (Section 9)
2022Zammit-Mangion, Ng, Vu and Filipponedeep compositional spatial models with injective warps
2023Sauer, Gramacy and Higdon; Sauer, Cooper and Gramacyfully Bayesian deep GP surrogates, made near-linear with the Vecchia approximation
2023Ming, Williamson and Guillastraining by stochastic imputation, through ordinary GP fits
2023–24Yang et al.; Milsom, Anson and Aitchisondeep kernel machines, including convolutional ones for images
2024Meng and Zhangamortised inference: a network maps each observation to its variational parameters
2025Lowery et al.deep GPs for mappings between functions
2025Boothgradient-enhanced deep GPs for computer experiments
2026Xu, Zhao, Paisley and Zeng (ICLR)diffusion-bridge variational inference: a diffusion started near the posterior
2026Sáez-Maldonado, Maroñas and Hernández-Lobatowhy posterior collapse happens, and an initialisation that prevents it

9. Deep GPs, neural networks and deep kernels

Width matters

A neural network with one hidden layer becomes a GP as its width goes to infinity (Neal, 1996), and so does a deep network, with a compositional kernel (Lee et al., 2018; Matthews et al., 2018). A Gaussian limit has a fixed kernel, so it cannot learn a representation. Deep GPs have the same limit.

Proposition 10 (Infinitely wide hidden layers make a deep GP shallow)

Let layer 1 have DD independent outputs f1(1),…,f1(D)∼GP(0,k1)f_1^{(1)}, \dots, f_1^{(D)} \sim \mathcal{GP}(0, k_1), and let layer 2 use a squared-exponential kernel on the scaled distance, k2(h,h′)=σ22exp⁡ ⁣(−∥h−h′∥2/(2Dℓ22))k_2(\boldsymbol{h}, \boldsymbol{h}') = \sigma_2^2\exp\!\big(-\lVert\boldsymbol{h} - \boldsymbol{h}'\rVert^2/(2D\ell_2^2)\big). As D→∞D \to \infty, k2(h(x),h(x′))k_2(\boldsymbol{h}(x), \boldsymbol{h}(x')) converges almost surely to the deterministic kernel σ22exp⁡ ⁣(−s2(x,x′)/(2ℓ22))\sigma_2^2\exp\!\big(-s^2(x, x')/(2\ell_2^2)\big), with s2s^2 as in Section 2. So the output becomes an ordinary GP.

Proof

Step 1. Write the distance as an average. 1D∥h(x)−h(x′)∥2=1D∑d=1D(f1(d)(x)−f1(d)(x′))2\frac1D\lVert\boldsymbol{h}(x) - \boldsymbol{h}(x')\rVert^2 = \frac1D\sum_{d=1}^{D}\big(f_1^{(d)}(x) - f_1^{(d)}(x')\big)^2.

Step 2. Law of large numbers. The DD terms are independent and identically distributed, each the square of a N(0,s2)\mathcal{N}(0, s^2) variable (Section 2), so each has mean s2s^2. The strong law of large numbers gives almost-sure convergence of the average to s2(x,x′)s^2(x, x').

Step 3. Continuity. t↦exp⁡(−t/(2ℓ22))t \mapsto \exp(-t/(2\ell_2^2)) is continuous, so the kernel converges to its value at t=s2t = s^2, which is not random.

Step 4. A fixed kernel means a GP. Given layer 1, the output is Gaussian with this covariance. In the limit the covariance no longer depends on layer 1, so averaging over layer 1 changes nothing, and the output is a GP with that kernel.

Finite width is what makes a deep GP deep. Deep kernel processes (Aitchison, Yang and Ober, 2021) and deep kernel machines (Yang et al., 2023; Milsom, Anson and Aitchison, 2024) change how the limit is taken, so that representation learning survives it, and obtain a deep generalisation of kernel methods that scales to images.

Neural networks as deep GPs, and the other way round

  • Neural networks as point estimates. Dutordoir et al. (2021) read activation functions as inter-domain inducing features (the inter-domain idea of the sparse post, Section 10). The posterior mean of a deep sparse GP then has the same structure as a network’s forward pass, so a deep GP can be initialised and trained like a network, and a network gains calibrated uncertainty.
  • Deep kernel learning. Wilson, Hu, Salakhutdinov and Xing (2016) use k(gθ(x),gθ(x′))k\big(g_\theta(\boldsymbol{x}), g_\theta(\boldsymbol{x}')\big) with a neural network gθg_\theta fitted by maximising the marginal likelihood: a deep GP whose inner layers are point estimates. It is fast and often accurate. But with millions of warp parameters and no posterior over them, it can overfit the marginal likelihood badly (Ober, Rasmussen and van der Wilk, 2021).

10. A checklist

  • Start simple. Fit a single GP, then one with a non-stationary kernel or warped inputs. Move to a deep GP only if the residuals or the held-out likelihood say the texture is wrong.
  • Two or three layers, identity or linear mean functions on hidden layers, 100 to 500 inducing points per layer, whitening, and inner layers initialised nearly deterministic.
  • Monitor the ELBO and a held-out log density, not only the error of the mean. If the hidden layers fall back to their priors, suspect posterior collapse and revisit the initialisation.
  • Look at predictive distributions, not only means: the benefit often shows up as uncertainty with the right shape, sharp at a jump instead of smeared across it.
  • If the posterior itself matters, as in active learning, consider sampling (Section 8): variational posteriors are unimodal and tend to be too narrow.

Questions

Question 1

A colleague says: “A deep GP is not a GP, so you cannot compute its predictive distribution.” What is wrong with that?

Answer

Each layer is a GP given the layer below, so every conditional distribution is Gaussian and computable. The predictive is the average of the last layer’s Gaussian over the hidden value, p(y∗)=Eh∗[p(y∗∣h∗)]p(y_*) = \mathbb{E}_{h_*}[p(y_* \mid h_*)], which Monte Carlo estimates without bias, with an error shrinking like 1/S1/\sqrt{S}. What is lost is a closed form, not computability.

Question 2

In the two-layer covariance, what happens as ℓ2→∞\ell_2 \to \infty, and why?

Answer

s2/ℓ22→0s^2/\ell_2^2 \to 0, so the covariance tends to σ22\sigma_2^2 for every pair of inputs: y(x)y(x) and y(x′)y(x') become perfectly correlated. Over the range of the hidden values, a GP with an enormous length-scale is essentially constant, so the composition is a single random constant.

Question 3

Every layer has a squared-exponential kernel with σl/ℓl=2\sigma_l/\ell_l = 2. Does the typical slope of a deep composition grow or shrink with depth?

Answer

Here r=2r = 2, and the mean of log⁡∣DL∣\log\lvert D_L\rvert is L(log⁡2−0.635)≈0.058LL(\log 2 - 0.635) \approx 0.058L, so the median slope grows, very slowly. Its standard deviation still grows like 1.11L1.11\sqrt{L}, so the slopes still spread out over orders of magnitude: flat in places, cliffs in others. Tuning rr moves the drift but cannot remove the spread.

Question 4

In the forward pass by hand, what would happen to the expected log-likelihood if S2\mathbf{S}_2 were ten times larger, and what does that tell you about training?

Answer

a⊤S2a\boldsymbol{a}^\top\mathbf{S}_2\boldsymbol{a} would grow from 0.01830.0183 to 0.1830.183, so s22=0.0607+0.183=0.244s_2^2 = 0.0607 + 0.183 = 0.244 and the variance term would cost 0.244/0.02=12.20.244/0.02 = 12.2 nats instead of 3.953.95. The ELBO strongly rewards certainty about the inducing values where there are data; the KL term pulls q(u2)q(\boldsymbol{u}_2) back towards the prior, and training balances the two.

Question 5

The variational distribution q(fl∣fl−1)q(\boldsymbol{f}_l \mid \boldsymbol{f}_{l-1}) is an NN-dimensional Gaussian with a full covariance. Why does doubly stochastic VI never form an N×NN \times N matrix?

Answer

The likelihood factorises over points, and Steps 6 to 8 of the theorem show that the marginal of fL,nf_{L,n} needs only the one-dimensional conditionals along point nn‘s own path. Those need μl\mu_l and sl2s_l^2 at one input, which cost O(M2)O(M^2) each. Covariances between different points never enter the objective.

Question 6

Show that with an identity mean the derivative of the composition is ∏l(1+gl)\prod_l(1 + g_l), and explain why that stops the collapse.

Answer

With hl=hl−1+fl(hl−1)h_l = h_{l-1} + f_l(h_{l-1}), the chain rule gives hl′(x)=(1+fl′(hl−1(x))) hl−1′(x)h_l'(x) = \big(1 + f_l'(h_{l-1}(x))\big)\,h_{l-1}'(x), so DL=∏l(1+gl)D_L = \prod_l(1 + g_l). When the GP part is small, each factor is close to 1 and log⁡∣1+gl∣≈gl−gl2/2\log\lvert 1 + g_l\rvert \approx g_l - g_l^2/2 has mean about −r2/2-r^2/2. The drift per layer is O(r2)O(r^2) instead of the −0.635-0.635 of a plain layer, which is why residual connections let networks and deep GPs grow deep.

References

  • A. Damianou, N. D. Lawrence. Deep Gaussian processes. AISTATS, 2013. arXiv:1211.0358
  • H. Salimbeni, M. P. Deisenroth. Doubly stochastic variational inference for deep Gaussian processes. NeurIPS, 2017. arXiv:1705.08933
  • D. Duvenaud, O. Rippel, R. P. Adams, Z. Ghahramani. Avoiding pathologies in very deep networks. AISTATS, 2014. arXiv:1402.5836
  • C. E. Rasmussen, C. K. I. Williams. Gaussian Processes for Machine Learning. MIT Press, 2006.
  • M. N. Gibbs. Bayesian Gaussian processes for regression and classification. PhD thesis, University of Cambridge, 1997.
  • P. D. Sampson, P. Guttorp. Nonparametric estimation of nonstationary spatial covariance structure. JASA, 1992.
  • J. Snoek, K. Swersky, R. Zemel, R. P. Adams. Input warping for Bayesian optimization of non-stationary functions. ICML, 2014.
  • M. Havasi, J. M. Hernández-Lobato, J. J. Murillo-Fuentes. Inference in deep Gaussian processes using stochastic gradient Hamiltonian Monte Carlo. NeurIPS, 2018.
  • H. Salimbeni, V. Dutordoir, J. Hensman, M. P. Deisenroth. Deep Gaussian processes with importance-weighted variational inference. ICML, 2019.
  • H. Yu, Y. Chen, Z. Dai, B. K. H. Low, P. Jaillet. Implicit posterior variational inference for deep Gaussian processes. NeurIPS, 2019.
  • M. Jankowiak, G. Pleiss, J. R. Gardner. Deep sigma point processes. UAI, 2020.
  • J. Lindinger, D. Reeb, C. Lippert, B. Rakitsch. Beyond the mean-field: structured deep Gaussian processes improve the predictive uncertainties. NeurIPS, 2020. arXiv:2005.11110
  • S. W. Ober, L. Aitchison. Global inducing point variational posteriors for Bayesian neural networks and deep Gaussian processes. ICML, 2021. PMLR
  • V. Dutordoir, J. Hensman, M. van der Wilk, C. H. Ek, Z. Ghahramani, N. Durrande. Deep neural networks as point estimates for deep Gaussian processes. NeurIPS, 2021. arXiv:2105.04504
  • A. Zammit-Mangion, T. L. J. Ng, Q. Vu, M. Filippone. Deep compositional spatial models. JASA, 2022.
  • A. Sauer, R. B. Gramacy, D. Higdon. Active learning for deep Gaussian process surrogates. Technometrics, 2023.
  • A. Sauer, A. Cooper, R. B. Gramacy. Vecchia-approximated deep Gaussian processes for computer experiments. JCGS, 2023. arXiv:2204.02904
  • D. Ming, D. Williamson, S. Guillas. Deep Gaussian process emulation using stochastic imputation. Technometrics, 2023. arXiv:2107.01590
  • K. Cutajar, M. Pullin, A. Damianou, N. D. Lawrence, J. González. Deep Gaussian processes for multi-fidelity modeling. 2019. arXiv:1903.07320
  • Q. Meng, Y. Zhang. Amortized variational inference for deep Gaussian processes. 2024. arXiv:2409.12301
  • M. Lowery, Z. Xu, D. Long, K. Chen, D. S. Johnson, Y. Bai, V. Shankar, S. Zhe. Deep Gaussian processes for functional maps. 2025. arXiv:2510.22068
  • A. S. Booth. Gradient-enhancement and gradient predictions for deep Gaussian process modeling of expensive computer experiments. 2025. arXiv:2512.18066
  • J. Xu, Q. Zhao, J. Paisley, D. Zeng. Diffusion bridge variational inference for deep Gaussian processes. ICLR, 2026. arXiv:2509.19078
  • F. J. Sáez-Maldonado, J. Maroñas, D. Hernández-Lobato. An analysis of posterior collapse, parameterization and initialization in variational deep Gaussian processes. 2026. arXiv:2606.25882
  • R. M. Neal. Bayesian Learning for Neural Networks. Springer, 1996.
  • J. Lee, Y. Bahri, R. Novak, S. S. Schoenholz, J. Pennington, J. Sohl-Dickstein. Deep neural networks as Gaussian processes. ICLR, 2018.
  • A. G. de G. Matthews, M. Rowland, J. Hron, R. E. Turner, Z. Ghahramani. Gaussian process behaviour in wide deep neural networks. ICLR, 2018.
  • L. Aitchison, A. X. Yang, S. W. Ober. Deep kernel processes. ICML, 2021.
  • A. X. Yang, M. Robeyns, E. Milsom, B. Anson, N. Schoots, L. Aitchison. A theory of representation learning gives a deep generalisation of kernel methods. ICML, 2023. PMLR
  • E. Milsom, B. Anson, L. Aitchison. Convolutional deep kernel machines. ICLR, 2024.
  • A. G. Wilson, Z. Hu, R. Salakhutdinov, E. P. Xing. Deep kernel learning. AISTATS, 2016.
  • S. W. Ober, C. E. Rasmussen, M. van der Wilk. The promises and pitfalls of deep kernel learning. UAI, 2021.