Year: 2020

Abstract:
We derive the optimal approximate posterior over the top-layer weights in a Bayesian neural network for regression, and show that it exhibits strong dependencies on the lower-layer weights. We adapt this result to develop a correlated approximate posterior over the weights at all layers in a Bayesian neural network. We extend this approach to deep Gaussian processes, unifying inference in the two model classes. Our approximate posterior uses learned “global” inducing points, which are defined only at the input layer and propagated through the network to obtain inducing inputs at subsequent layers. By contrast, standard, “local”, inducing point methods from the deep Gaussian process literature optimise a separate set of inducing inputs at every layer, and thus do not model correlations across layers. Our method gives state-of-the-art performance for a variational Bayesian method, without data augmentation or tempering, on CIFAR-10 of 86.7%.

heading: 1 INTRODUCTION
text: Deep models, formed by stacking together many simple layers, give rise to extremely powerful machine learning algorithms, from deep neural networks (DNNs) to deep Gaussian processes (DGPs) (Damianou & Lawrence, 2013). One approach to reason about uncertainty in these models is to use variational inference (VI) (Jordan et al., 1999). VI in Bayesian neural networks (BNNs) requires the user to specify a family of approximate posteriors over the weights, with the classical approach being independent Gaussian distributions over each individual weight (Hinton & Van Camp, 1993; Graves, 2011; Blundell et al., 2015). Later work has considered more complex approximate posteriors, for instance using a Matrix-Normal distribution as the approximate posterior for a full weight-matrix (Louizos & Welling, 2016; Ritter et al., 2018). By contrast, DGPs use an approximate posterior defined over functions — the standard approach is to specify the inputs and outputs at a finite number of “inducing” points (Damianou & Lawrence, 2013; Salimbeni & Deisenroth, 2017).
Critically, these classical BNN and DGP approaches define approximate posteriors over functions that are independent across layers. An approximate posterior that factorises across layers is problematic, because what matters for a deep model is the overall input-output transformation for the full model, not the input-output transformation for individual layers. This raises the question of what family of approximate posteriors should be used to capture correlations across layers. One approach for BNNs would be to introduce a flexible “hypernetwork”, used to generate the weights (Krueger et al., 2017; Pawlowski et al., 2017). However, this approach is likely to be suboptimal as it does not sufficiently exploit the rich structure in the underlying neural network. For guidance, we consider the optimal approximate posterior over the top-layer units in a deep network for regression. Remarkably, the optimal approximate posterior for the last-layer weights given the earlier weights can be obtained in closed form without choosing a restrictive family of distributions. In particular, the optimal approximate posterior is given by propagating the training inputs through lower layers to compute the top-layer representation, then using Bayesian linear regression to map from the top-layer representation to the outputs.
Inspired by this result, we use Bayesian linear regression to define a generic family of approximate posteriors for BNNs. In particular, we introduce learned “pseudo-data” at every layer, and compute the posterior over the weights by performing linear regression from the inputs (propagated from
lower layers) onto the pseudo-data. We reduce the burden of working with many training inputs by summarising the posterior using a small number of “inducing” points. We find that these approximate posteriors give excellent performance in the non-tempered, no-data-augmentation regime, with performance on datasets such as CIFAR-10 reaching 86.7%, comparable to SGMCMC (Wenzel et al., 2020). Our approach can be extended to DGPs, and we explore connections to the inducing point GP literature, showing that inference in the two classes of models can be unified.

heading: 2 METHODS
text: We consider neural networks with lower-layer weights {W`}L`=1, W` ∈ RN`−1×N` , and top-layer weights, WL+1 ∈ RNL×NL+1 , where the activity, F`, at layer ` is given by,
F1 = XW1, F` = φ (F`−1) W` for ` ∈ {2, . . . , L} , (1)
where φ(·) is an elementwise nonlinearity. The outputs, Y ∈ RP×NL+1 , depend on the top-level activity, FL, and the output weights, WL+1, according to a likelihood, P (Y|WL+1,FL). In the following derivations, we will focus on ` > 1; corresponding expressions for the input layer can be obtained by replacing φ(F0) with the inputs, X ∈ RP×N0 . The prior over weights is independent across layers and output units (see Sec. 2.3 for the form of S`),
P (W`) = ∏N` λ=1 P ( w`λ ) , P ( w`λ ) = N ( w`λ ∣∣∣0, 1N`−1 S`) , (2) where w`λ is a column of W`, i.e. all the input weights to unit λ in layer `. To fit the parameters of the approximate posterior, Q ( {W}L+1`=1 ) , we maximise the evidence lower bound (ELBO),
L = EQ({W}L+1`=1 ) [ log P ( Y, {W}L+1`=1 |X ) − log Q ( {W}L+1`=1 )] . (3)
To build intuition about how to parameterise Q ( {W}L+1`=1 ) , we consider the optimal
Q ( WL+1|{W`}L`=1 ) for any given Q ( {W`}L`=1 ) . We begin by simplifying the ELBO by incorporating terms that do not depend on WL+1 into a constant, c,
L = EQ({W`}L+1`=1 ) [ log P ( Y,WL+1|X, {W`}L`=1 ) − log Q ( WL+1| {W`}L`=1 ) + c ] . (4)
Rearranging these terms, we find that all WL+1 dependence can be written in terms of the KL divergence between the approximate posterior of interest and the true posterior,
L = EQ({W`}L`=1) [ log P ( Y|X, {W`}L`=1 ) − DKL ( Q ( WL+1|{W`}L`=1 ) ||P ( WL+1|Y,X, {W`}L`=1 )) + c ] . (5)
Thus, the optimal approximate posterior is, Q ( WL+1|{W`}L`=1 ) = P ( WL+1|Y,X, {W`}L`=1 ) ∝ P (Y|WL+1,FL) P (WL+1) , (6)
and where the final proportionality comes by applying Bayes theorem and exploiting the model’s conditional independencies. For regression, the likelihood is Gaussian,
P (Y|WL+1,FL) = ∏NL+1 λ=1 N ( yλ;φ (FL) w L+1 λ ,Λ −1 L+1 ) , (7)
where yλ is the value of a single output channel for all training inputs, and ΛL+1 is a precision matrix. Thus, the posterior is given in closed form by Bayesian linear regression (Rasmussen & Williams, 2006).

heading: 2.1 DEFINING THE FULL APPROXIMATE POSTERIOR WITH GLOBAL INDUCING POINTS AND PSEUDO-DATA
text: We adapt the optimal scheme above to give a scalable approximate posterior over the weights at all layers. To avoid propagating all training inputs through the network, which is intractable for large datasets, we instead propagate M global inducing locations, U0,
U1 = U0W1, U` = φ (U`−1) W` for ` = 2, . . . , L+ 1. (8)
Next, the optimal posterior requires outputs, Y. However, no outputs are available at inducing locations for the output layer, let alone for intermediate layers. We thus introduce learned variational parameters to mimic the form of the optimal posterior. In particular, we use the product of the prior over weights and a “pseudo-likelihood”,N ( v`λ; u ` λ,Λ −1 ` ) , representing noisy “pseudo-observations” of the outputs of the linear layer at the inducing locations, u`λ = φ (U`−1) w ` λ. Substituting u ` λ into the pseudo-likelihood the approximate posterior becomes,
Q ( W`| {W`′}`−1`′=1 ) ∝ ∏N` λ=1N ( v`λ;φ (U`−1) w ` λ,Λ −1 ` ) P ( w`λ ) ,
Q ( W` ∣∣∣{W`′}`−1`′=1) = ∏N`λ=1N (w`λ∣∣∣Σw` φ (U`−1)T Λ`v`λ,Σw` ) , Σw` = ( N`−1S −1 ` + φ (U`−1) T Λ`φ (U`−1) )−1 . (9)
where v`λ and Λ` are variational parameters. Therefore, our full approximate posterior factorises as
Q ( {W`}L+1`=1 ) = L+1∏ `=1 Q ( W` ∣∣∣{W`′}`−1`′=1) . (10) Thus, the full ELBO can be written,
L = EQ({W}L+1`=1 ) [ log P ( Y|X, {W}L+1`=1 ) + log P ( {W`}L+1`=1 ) − log Q ( {W`}L+1`=1 )] (11)
= EQ({W}L+1`=1 ) log P (Y, |X, {W}L+1`=1 )+ L+1∑ `=1 log P (W`) Q ( W`| {W`}`−1`=1 )  . (12)
The forms of the ELBO and approximate posterior suggest a sequential procedure to evaluate and subsequently optimise it: we alternate between sampling the weights using Eq. (9) and propagating the data and inducing locations using Eq. (8) (see Alg. 1). In summary, the parameters of the approximate posterior are the global inducing inputs, U0, and the pseudo-data and precisions at all layers, {V`,Λ`}L+1`=1 . As each factor Q ( W`
∣∣∣{W`′}`−1`′=1) is a Gaussian, these parameters can be optimised using standard reparameterised variational inference (Kingma & Welling, 2013; Rezende et al., 2014) in combination with the Adam optimiser (Kingma & Ba, 2014) (Appendix A). Importantly, by placing inducing inputs on the training data (i.e. U0 = X), and setting v`λ = yλ this approximate posterior matches the optimal top-layer posterior (Eq. 6). Finally, we note that while this posterior is conditionally Gaussian, the full posterior over all {W`}L+1`=1 is non-Gaussian, and is thus potentially more flexible than a full-covariance Gaussian over all weights.
Algorithm 1: Global inducing points for neural networks Parameters: inducing inputs, U0, inducing outputs and precisions, {V`,Λ`}L`=1, at all layers. Neural network inputs: (e.g. MNIST digits) F0 Neural network outputs: (e.g. classification logits) FL+1 L+∞← 0 for ` ∈ {1, . . . , L+ 1} do
Compute the mean and covariance over the weights at this layer Σw` = ( N`−1S −1 ` + φ (U`−1) T Λ`φ (U`−1) )−1 M` = Σ w ` φ (U`−1) T Λ`V` Sample the weights and compute the ELBO
W` ∼ N (M`,Σw` ) = Q ( W` ∣∣∣{W`′}`−1`′=1) L ← L+ log P (W`)− logN (W`|M`,Σw` ) Propagate the inputs and inducing points using the sampled weights, U` = φ (U`−1) W` F` = φ (F`−1) W`
L ← L+ log P (Y|FL+1)

heading: 2.2 EFFICIENT CONVOLUTIONAL BAYESIAN LINEAR REGRESSION
text: The previous sections were valid for a fully connected network. The extension to convolutional networks is straightforward in principle: we transform the convolution into a matrix multiplication by treating each patch as a separate input feature-vector, flattening the spatial and channel dimensions together into a single vector. Thus, the feature-vectors have length in_channels × kernel_width × kernel_height, and the matrix U` contains patches_per_image × minibatch patches. Likewise, we now have inducing outputs, v`λ, at each location in all the inducing images, so this again has length patches_per_image × minibatch. After explicitly extracting the patches, we can straightforwardly apply standard Bayesian linear regression.
However, explicitly extracting image patches is very memory intensive in a DNN. If we consider a standard convolution with a 3× 3 convolutional kernel, then there is a 3× 3 patch centred at each pixel in the input image, meaning a factor of 9 increase in memory consumption. Instead, we note that computing the matrices required for linear regression, φ (U`−1) T Λ`φ (U`−1) and φ (U`) T Λ`V`, does not require explicit extraction of image-patches. Instead, these matrices can be computed by taking the autocorrelation of the image/feature map, i.e. a convolution operation where we treat the image/feature map, as both the inputs and the weights (Appendix B for details).

heading: 2.3 PRIORS
text: We consider four priors in this work, which we refer to using the class names in the BNN library published with this paper. We are careful to ensure that all parameters in the model have a prior and approximate posterior, which is necessary to ensure that ELBOs are comparable across models.
First, we consider a Gaussian prior with fixed scale, NealPrior, so named because it is necessary to obtain meaningful results when considering infinite networks (Neal, 1996),
S` = I, (13)
though it bears strong similarities to the “He” initialisation (He et al., 2015). NealPrior is defined so as to ensure that the activations retain a sensible scale as they propagate through the network. We compare this to the standard N (0, 1) (StandardPrior), which causes the activations to increase exponentially as they propagate through network layers (see Eq. 2):
S` = N`−1I. (14)
Next, we consider ScalePrior, which defines a prior and approximate posterior over the scale,
S` = 1 s` I P (s`) = Gamma (s`; 2, 2) Q (s`) = Gamma (s`; 2 + α`, 2 + β`) (15)
where here we parameterise the Gamma distribution with the shape and rate parameters, and α` and β` are non-negative learned parameters of the approximate posterior over s`. Finally, we consider SpatialIWPrior, which allows for spatial correlations in the weights. In particular, we take the covariance to be the Kronecker product of an identity matrix over channel dimensions, and a Wishart-distributed matrix, L−1` , over the spatial dimensions,
S` = I⊗ L−1` P (L`) = InverseWishart (L`; (N`−1 + 1) I , N`−1 + 1) Q (L`) = InverseWishart (L`; (N`−1 + 1) I + Ψ, N`−1 + 1 + ν) (16)
where the non-negative real number, ν, and the positive definite matrix, Ψ, are learned parameters of the approximate posterior (see Appendix C).

heading: 3 EXTENSION TO DGPS
text: It is a remarkable but underappreciated fact that BNNs are special cases of DGPs, with a particular choice of kernel (Louizos & Welling, 2016; Aitchison, 2019). Combining Eqs. (1) and (2),
P (F`|F`−1) = ∏N` λ=1N ( f `λ ∣∣0,K (F`−1)) , K (F`−1) = 1
N`−1 φ (F`−1) S`φ (F`−1)
T . (17)
Here, we generalise our approximate posterior to the DGP case and link to the DGP literature. In a DGP there are no weights; instead we work directly with inducing outputs {U`}L+1`=1 ,
P (U`|U`−1) = ∏N` λ=1N ( u`λ ∣∣0,K (U`−1)) , (18)
Note that here, we take the “global” inducing approach of using the inducing outputs from the previous layer, U`−1 as the inducing inputs for the next layer. In this case, we need only learn the original inducing inputs, U0. This contrasts with the standard “local” inducing formulation, (as in Salimbeni & Deisenroth, 2017), which learns separate inducing inputs at every layer, Z`−1, giving P (U`|Z`−1) = ∏N` λ=1N ( u`λ ∣∣0,K (Z`−1)).
As usual in DGPs (Salimbeni & Deisenroth, 2017), the approximate posterior over U` induces an approximate posterior on F` through the prior correlations. However, it is important to remember that underneath the tractable distributions in Eqs. (17) and (18), there is an infinite dimensional GP-distributed function, F`, such that F` = F`(F`−1). Standard local inducing point methods specify a factorised approximate posterior over F` by specifying the function’s inducing outputs, U` = F` (Z`−1), at a finite number of inducing input locations, Z`−1. Importantly, the approximate posterior over a function, F`, depends only on Z`−1, and U`. Thus, standard, local inducing, DGP approaches (e.g. Salimbeni & Deisenroth, 2017), give a layerwise-independent approximate posterior over {F`}L+1`=1 , as they treat the inducing inputs, {Z`−1} L+1 `=1 , as fixed, learned parameters and use a layerwise-independent approximate posterior over {U`}L+1`=1 (Appendix F).
Next, we need to choose the approximate posterior on {U`}L+1`=1 . However, if our goal is to introduce dependence across layers, it seems inappropriate to use the standard layerwise-independent approximate posterior over {U`}L+1`=1 . Indeed, in Appendix F, we show that such a posterior implies functions in non-adjacent layers (e.g. F` and F`+2) are marginally independent, even with global inducing points.
To obtain more appropriate approximate posteriors, we derive the optimal top-layer posterior for DGPs, which involves GP regression from activations propagated from lower layers onto the output data (Appendix E). Inspired by the form of the optimal posterior we again define an approximate posterior by taking the product of the prior and a “pseudo-likelihood”,
Q (U`|U`−1) ∝ ∏N` λ=1 Q ( u`λ ) N ( v`λ ∣∣u`λ,Λ−1` )
Q (U`|U`−1) = ∏N` λ=1N ( u`λ ∣∣Σu` Λ`v`λ,Σu` ) , Σu` = (K−1 (U`−1) + Λ`)−1 , (19)
where v`λ and Λ −1 ` are learned parameters, and in our global inducing method, the inducing inputs, U`−1, are propagated from lower layers (Eq. 18). Importantly, setting the inducing inputs to the training data and vL+1λ = yλ, the approximate posterior captures the optimal top-layer posterior for regression (Appendix E). Under this approximate posterior, dependencies in U` naturally arise across all layers, and hence there are dependencies between functions F` at all layers (Appendix F).
In summary, we propose an approximate posterior over inducing outputs that takes the form
Q ( {U`}L+1`=1 ) = L+1∏ l=1 Q (U`|U`−1) . (20)
As before, the parameters of this approximate posterior are the global inducing inputs, U0, and the pseudo-data and precisions at all layers, {V`,Λ`}L+1`=1 . Our ELBO, which we derive in D, takes the form
L = EQ({F`,U`}L+1`=1 |X,U0)
[ log P (Y|FL+1) +
L+1∑ `=1 log P (U`|U`−1) Q (U`|U`−1)
] . (21)
We provide a full description of our method as applied to DGPs in Appendix D. In concluding our discussion of our proposed method, we note that we provide an analysis of the asymptotic complexity in Appendix L.

heading: 4 RESULTS
text: We describe our experiments and results to assess the performance of global inducing points (‘gi’) against local inducing points (‘li’) and the fully factorised (‘fac’) approximation family. We additionally consider models where we use one method up to the last layer and another for the last layer, which may have computational advantages; we denote such models ‘method1→ method2’.

heading: 4.1 UNCERTAINTY IN 1D REGRESSION
text: We demonstrate the use of local and global inducing point methods in a toy 1-D regression problem, comparing it with fully factorised VI and Hamiltonian Monte Carlo (HMC; (Neal et al., 2011)). Following Hernández-Lobato & Adams (2015), we generate 40 input-output pairs (x, y) with the inputs x sampled i.i.d. from U([−4,−2] ∪ [2, 4]) and the outputs generated by y = x3 + , where ∼ N (0, 32). We then normalised the inputs and outputs. Note that we have introduced a ‘gap’ in the inputs, following recent work (Foong et al., 2019b; Yao et al., 2019; Foong et al., 2019a) that identifies the ability to express ‘in-between’ uncertainty as an important quality of approximate inference algorithms. We evaluated the inference algorithms using fully-connected BNNs with 2 hidden layers of 50 ReLU hidden units, using the NealPrior. For the inducing point methods, we used 100 inducing points per layer.
The predictive distributions for the toy experiment can be seen in Fig. 1. We observe that of the variational methods, the global inducing method produces predictive distributions closest to HMC, with good uncertainty in the gap. Meanwhile, factorised and local inducing fit the training data, but do not produce reasonable error bars: this demonstrates an important limitation of methods lacking correlation structure between layers.
We provide additional experiments looking at the effect of the number of inducing points in Appendix H, and experiments looking at compositional uncertainty (Ustyuzhaninov et al., 2020) in both BNNs and DGPs for 1D regression in Appendix I.

heading: 4.2 DEPTH-DEPENDENCE IN DEEP LINEAR NETWORKS
text: The lack of correlations between layers might be expected to become more problematic in deeper networks. To isolate the effect of depth on different approximate posteriors, we considered deep linear networks trained on data generated from a toy linear model: 5 input features were mapped to 1 output feature, where the 1000 training and 100 test inputs are drawn IID from a standard Gaussian, and the true outputs are drawn using a weight-vector drawn IID from a Gaussian with variance 1/5, and with noise variance of 0.1. We could evaluate the model evidence under the true data generating process which forms an upper bound (in expectation) on the model evidence and ELBO for all models.
We found that the ELBO for methods that factorise across layers — factorised and local inducing — drops rapidly as networks get deeper and wider (Fig. 2). This is undesirable behaviour, as we know that wide, deep networks are necessary for good performance on difficult machine learning tasks. In contrast, we found that methods with global inducing points at the last layer decay much more slowly with depth, and perform better as networks get wider. Remarkably, global-inducing points gave good performance even with lower-layer weights drawn at random from the prior, which is not possible for any method that factorises across layers. We believe that fac→ gi performed poorly at width = 250 due to optimisation issues as rand→ gi performs better yet is a special case of fac→ gi.

heading: 4.3 REGRESSION BENCHMARK: UCI
text: We benchmark our methods on the UCI datasets in Hernández-Lobato & Adams (2015), popular benchmark regression datasets for BNNs and DGPs. Following the standard approach (Gal & Ghahramani, 2015), each dataset uses 20 train-test ‘splits’ (except for protein with 5 splits) and the inputs and outputs are normalised to have zero mean and unit standard deviation. We focus on the five smallest datasets, as we expect Bayesian methods to be most relevant in small-data settings (see App. J andM for all datasets). We consider two-layer fully-connected ReLU networks, using fully factorised and global inducing approximating families, as well as two- and five-layer DGPs with
doubly-stochastic variational inference (DSVI) (Salimbeni & Deisenroth, 2017) and global inducing. For the BNNs, we consider the standard N (0, 1) prior and ScalePrior. We display ELBOs and average test log likelihoods for the un-normalised data in Fig. 3, where the dots and error bars represent the means and standard errors over the test splits, respectively. We observe that global inducing obtains better ELBOs than factorised and DSVI in every case, indicating that it does indeed approximate the true posterior better (since the ELBO is the marginal likelihood minus the KL to the posterior). While this is the case for the ELBOs, this does not always translate to a better test log likelihood due to model misspecification, as we see that occasionally DSVI outperforms global inducing by a very small margin. The very poor results for factorised on ScalePrior indicate that it has difficulty learning useful prior hyperparameters for prediction, which is due to the looseness of its bound to the marginal likelihood. We provide experimental details, as well as additional results with additional architectures, priors, datasets, and RMSEs, in Appendices J and M, for BNNs and DGPs, respectively.

heading: 4.4 CONVOLUTIONAL BENCHMARK: CIFAR-10
text: For CIFAR-10, we considered a ResNet-inspired model consisting of conv2d-relu-block-avgpool2block-avgpool2-block-avgpool-linear, where the ResNet blocks consisted of a shortcut connection in parallel with conv2d-relu-conv2d-relu, using 32 channels in all layers. In all our experiments, we used no data augmentation and 500 inducing points. Our training scheme (see App. O) ensured that our results did not reflect a ‘cold posterior’ (Wenzel et al., 2020). Our results are shown in Table 1. We achieved remarkable performance of 86.7% predictive accuracy, with global inducing points used for all layers, and with a spatial inverse Wishart prior on the weights. These results compare very favourably with comparable Bayesian approaches, i.e. those without data augmentation or posterior sharpening: past work with deep GPs obtained 80.3% (Shi et al., 2019), and work using infinite-width neural networks to define a GP obtained 81.4% accuracy (Li et al., 2019). Remarkably, with only 500 inducing points we are approaching the accuracy of sampling-based methods (Wenzel et al., 2020), which are in principle able to more closely approximate the true posterior. Furthermore, we see that global inducing performs the best in terms of ELBO (per datapoint) by a wide margin, demonstrating that it gets far closer to the true posterior than the other methods. We provide additional results on uncertainty calibration in Appendix K.

heading: 5 RELATED WORK
text: Louizos & Welling (2016) attempted to use pseudo-data along with matrix variate Gaussians to form an approximate posterior for BNNs; however, they restricted their analysis to BNNs, and it is not clear how their method can be applied to DGPs. Their approach factorises across layers, thus
missing the important layerwise correlations that we obtain. Moreover, they encountered an important limitation: the BNN prior implies that U` is low-rank and it is difficult to design an approximate posterior capturing this constraint. As such, they were forced to use M < N` inducing points, which is particularly problematic in the convolutional, global-inducing case where there are many patches (points) in each inducing image input.
Note that some work on BNNs reports better performance on datasets such as CIFAR-10. However, to the best of our knowledge, no variational Bayesian method outperforms ours without modifying the BNN model or some form of posterior tempering (Wenzel et al., 2020), where the KL term in the ELBO is down-weighted relative to the likelihood (Zhang et al., 2017; Bae et al., 2018; Osawa et al., 2019; Ashukha et al., 2020), which often increases the test accuracy. However, tempering clouds the Bayesian perspective, as the KL to the posterior is no longer minimised and the resulting objective is no longer a lower bound on the marginal likelihood. By contrast, we use the untempered ELBO, thereby retaining the full Bayesian perspective. Dusenberry et al. (2020) report better performance on CIFAR-10 without tempering, but only perform variational inference over a rank-1 perturbation to the weights, and maximise over all the other parameters. Our approach retains a full-rank parameterisation of the weight matrices.
Ustyuzhaninov et al. (2020) attempted to introduce dependence across layers in a deep GP by coupling inducing inputs to pseudo-outputs, which they term “inducing points as inducing locations”. However, as described above, the choice of approximate posterior over U` is also critical. They used the standard approximate posterior that is independent across layers, meaning that while functions in adjacent layers were marginally dependent, the functions for non-adjacent layers were independent (Appendix F). By contrast, our approximate posteriors have marginal dependencies across U` and functions at all layers, and are capable of capturing the optimal top-layer posterior.

heading: 6 CONCLUSIONS
text: We derived optimal top-layer variational approximate posteriors for BNNs and deep GPs, and used them to develop generic, scalable approximate posteriors. These posteriors make use of global inducing points, which are learned only at the bottom layer and are propagated through the network. This leads to extremely flexible posteriors, which even allow the lower-layer weights to be drawn from the prior. We showed that these global inducing variational posteriors lead to improved performance with better ELBOs, and state-of-the-art performance for variational BNNs on CIFAR-10.

heading: A REPARAMETERISED VARIATIONAL INFERENCE
text: In variational inference, the ELBO objective takes the form, L(φ) = EQφ(w) [ log P (Y|X,w) + log P (w)
Qφ (w)
] (22)
where w is a vector containing all of the elements of the weight matrices in the full network, {W`}L+1`=1 , and φ = (U0, {V`,Λ`} L+1 `=1 ) are the parameters of the approximate posterior. This objective is difficult to differentiate wrt φ, because φ parameterises the distribution over which the expectation is taken. Following Kingma & Welling (2013) and Rezende et al. (2014), we sample from a simple, fixed distribution (e.g. IID Gaussian), and transform them to give samples from Q (w),
w( ;φ) ∼ Qφ (w) . (23)
Thus, the ELBO can be written, L(φ) = E [ log P (Y|X,w( ;φ)) + log P (w( ;φ))
Qφ (w( ;φ))
] (24)
As the distribution over which the expectation is taken is now independent of φ, we can form unbiased estimates of the gradient of L(φ) by drawing one or a few samples of .

heading: B EFFICIENT CONVOLUTIONAL LINEAR REGRESSION
text: Working in one dimension for simplicity, the standard form for a convolution in deep learning is Yiu,c = ∑ c′δ Xi(u+δ)c′Wδc′,c. (25)
where X is the input image/feature-map, Y is the output feature-map, W is the convolutional weights, i indexes images, c and c′ index channels, u indexes the location within the image, and δ indexes the location within the convolutional patch. Later, we will swap the identity of the “patch location” and the “image location” and to facilitate this, we define them both to be centred on zero,
u ∈ {−(W − 1)/2, . . . , (W − 1)/2} δ ∈ {−(S − 1)/2, . . . , (S − 1)/2} (26)
where W is the size of an image and S is the size of a patch, such that, for example for a size 3 kernel, δ ∈ {−1, 0, 1}. To use the expressions for the fully-connected case, we can form a new input, X ′ by cutting out each image patch,
X ′iu,δc = Xi(u+δ)c, (27)
leading to
Yiu,c = ∑ δc′ X ′iu,δc′Wδc′,c. (28)
Note that we have used commas to group pairs of indices (iu and δc′) that may be combined into a single index (e.g. using a reshape operation). Indeed, combining i and u into a single index and combining δ and c′ into a single index, this expression can be viewed as standard matrix multiplication,
Y = X′W. (29)
This means that we can directly apply the approximate posterior we derived for the fully-connected case in Eq. (9) to the convolutional case. To allow for this, we take
X′ = Λ1/2` φ (U`−1) , Y = Λ 1/2 ` V`. (30)
While we can explicitly compute X′ by extracting image patches, this imposes a very large memory cost (a factor of 9 for a 3×3 kernel, with stride 1, because there are roughly as many patches as pixels in the image, and a 3× 3 patch requires 9 times the storage of a pixel. To implement convolutional linear regression with a more manageable memory cost, we instead compute the matrices required
for linear regression directly as convolutions of the input feature-maps, X with themselves, and as convolutions of the X with the output feature maps, Y, which we describe here.
For linear regression (Eq. 9), we first need to compute,( φ (U`−1) T Λ`V` ) δc,c′ = ( X ′TY ) δc,c′ = ∑ iu X ′iu,δcYiu,c′ . (31)
Rewriting this in terms of X (i.e. without explicitly cutting out image patches), we obtain,( X ′TY ) δc,c′ = ∑ iu Xi(u+δ)cYiu,c′ . (32)
This can be directly viewed as the convolution of X and Y , where we treat Y as the “convolutional weights”, u as the location within the now very large (size W ) “convolutional patch”, and δ as the location in the resulting output. Once we realise that the computation is a spatial convolution, it is possible to fit it into standard convolution functions provided by deep-learning frameworks (albeit with some rearrangement of the tensors).
Next, we need to compute,( φ (U`−1) T Λ`φ (U`−1) ) = ( X ′TX′ ) δc,δ′c′ = ∑ iu X ′iu,δcX ′ iu,δ′c′ . (33)
Again, rewriting this in terms of X (i.e. without explicitly cutting out image patches), we obtain,( X ′TX′ ) δc,δ′c′ = ∑ iu Xi(u+δ)cXi(u+δ′)c′ . (34)
To treat this as a convolution, we first need exact translational invariance, which can be achieved by using circular boundary conditions. Note that circular boundary conditions are not typically used in neural networks for images, and we therefore only use circular boundary conditions to define the approximate posterior over weights. The variational framework does not restrict us to also using circular boundary conditions within our feedforward network, and as such, we use standard zero-padding. With exact translational invariance, we can write this expression directly as a convolution, (
X ′TX′ ) δc,δ′c′ = ∑ iu XiucXi(u+δ′−δ)c′ (35)
where
(δ′ − δ) ∈ {−(S − 1), . . . , (S − 1)} (36) i.e. for a size 3 kernel, (δ′ − δ) ∈ {−2,−1, 0, 1, 2}, where we treat Xiuc as the “convolutional weights”, u as the location within the “convolutional patch”, and δ′− δ as the location in the resulting output “feature-map”.
Finally, note that this form offers considerable benefits in terms of memory consumption. In particular, the output matrices are usually quite small — the number of channels is typically 32 or 64, and the number of locations within a patch is typically 9, giving a very manageable total size that is typically smaller than 1000× 1000.

heading: C WISHART DISTRIBUTIONS WITH REAL-VALUED DEGREES OF FREEDOM
text: The classical description of the Wishart distribution,
Σ ∼Wishart (I, ν) , (37) where Σ is a P × P matrix, states that P ≥ ν is an integer and we can generate Σ by taking the product of matrices, X ∈ Rν×P , generated IID from a standard Gaussian,
Σ = XTX, Xij ∼ N (0, 1) . (38) However, for the purposes of defining learnable approximate posteriors, we need to be able to sample and evaluate the probability density when ν is positive real.
To do this, consider the alternative, much more efficient means of sampling from a Wishart distribution, using the Bartlett decomposition (Bartlett, 1933). The Bartlett decomposition gives the probability density for the Cholesky of a Wishart sample. In particular,
T = T11 . . . T1m... . . . ... 0 . . . Tmm  , (39) P ( T 2jj ) = Gamma ( T 2jj ; ν−j+1 2 , 1 2 ) , (40) P (Tj<k) = N (Tjk; 0, 1) . (41)
Here, Tjj is usually considered to be sampled from a χ2 distribution, but we have generalised this slightly using the equivalent Gamma distribution to allow for real-valued ν. Following Chafaï (2015), We need to change variables to Tjj rather than T 2jj ,
P (Tjj) = P ( T 2jj ) ∣∣∣∣∣∂T 2jj∂Tjj ∣∣∣∣∣ , (42) = Gamma ( T 2jj ; ν−j+1 2 , 1 2 ) 2Tjj , (43)
=
( T 2jj )(ν−j+1)/2−1 e−T 2 jj/2
2(ν−j+1)/2Γ ( ν−j+1
2 ) 2Tjj , (44) = T ν−jjj e −T 2jj/2
2(ν−j−1)/2Γ ( ν−j+1
2 ) . (45) Thus, the probability density for T under the Bartlett sampling operation is
P (T) = ∏ j T ν−jjj e −T 2jj/2 2 ν−j−1 2 Γ ( ν−j+1
2 )︸ ︷︷ ︸ on-diagonals
∏ k∈{j+1,...,m} 1√ 2π e−T 2 jk/2
︸ ︷︷ ︸ off-diagonals
. (46)
(47)
To convert this to a distribution on Σ, we need the volume element for the transformation from T to Σ,
dΣ = 2m m∏ j=1 Tm−j+1jj dT, (48)
which can be obtained directly by computing the log-determinant of the Jacobian for the transformation from T to Σ, or by taking the ratio of Eq. (46) and the usual Wishart probability density (with integral ν). Thus,
P (Σ) = P (T) 2m m∏ j=1 Tm−j+1jj −1 (49) = ∏ j T ν−m−1jj e −T 2jj/2 2 ν−j+1 2 Γ ( ν−j+1
2
) . ∏ k∈{j+1,...,m} 1√ 2π e−T 2 jk/2. (50)
Breaking this down into separate components and performing straightforward algebraic manipulations, ∏
j
T ν−m−1jj = |T| ν−m−1 = |Σ|(ν−m−1)/2 , (51)
P (Σ) = ∏ j e−T 2 jj/2 ∏ k∈{j+1,...,m} e−T 2 jk/2 (52)
= e− ∑ jk T
2 jk/2 = e−Tr(Σ)/2, (53)∏
j
1 2(ν−j−1)/2 ∏
k∈{j+1,...,m}
1√ 2 = ∏ j
1
2(ν−j−1)/2 ∏ j
1
2(m−j−1)/2  (54) =
∏ j
1
2(ν−j+1)/2 ∏ j
1
2(j−1)/2  (55) = ∏ j 1 2(ν−m)/2 = 2−mν/2, (56)
where the second-to-last line was obtained by noting that j − 1 covers the same range of integers as m− j − 1 under the product. Finally, using the definition of the multivariate Gamma function,∏
j
Γ ( ν−j+1
2 ) ∏ k∈{j+1,...,m} √ π = πm(m−1)/4 ∏ j Γ ( ν−j+1 2 ) = Γm ( ν 2 ) . (57)
We thereby re-obtain the probability density for the standard Wishart distribution,
P (Σ) = |Σ|(ν−m−1)/2 e−Tr(Σ)/2 2mν/2Γm ( ν 2 ) . (58)

heading: D FULL DESCRIPTION OF OUR METHOD FOR DEEP GAUSSIAN PROCESS
text: Here we give the full derivation for our doubly-stochastic variational deep GPs, following Salimbeni & Deisenroth (2017). A deep Gaussian process (DGP; (Damianou & Lawrence, 2013; Salimbeni & Deisenroth, 2017)) defines a prior over function values, F` ∈ RP×N` , where ` is the layer, P is the number of input points, and N` is the “width” of this layer, by stacking L+ 1 layers of standard Gaussian processes (we use L+ 1 layers instead of the typical L layers to retain consistency with how we define BNNs):
P ( Y, {F`}L+1`=1 ∣∣X) = P (Y|FL)∏L+1`=1 P (F`|F`−1) . (59) Here, the input is F0 = X, and the output is Y (which could be continuous values for regression, or class labels for classification), and the distribution over F` ∈ RP×N` factorises into independent multivariate Gaussian distributions over each function,
P (F`|F`−1) = ∏N` λ=1 P ( f `λ ∣∣F`−1) = ∏N`λ=1N (f `λ∣∣0,K (F`−1)) , (60)
where f `λ is the λth column of F`, giving the activation of all datapoints for the λth feature, and K (·) is a function that computes the kernel-matrix from the features in the previous layer.
To define a variational approximate posterior, we augment {F`}L+1`=1 with inducing points consisting of the function values {U`}L+1`=1 ,
P ( Y, {F`,U`}L+1`=1 |X,U0 ) = P (Y|FL+1) ∏L+1 `=1 P (F`,U`|F`−1,U`−1) (61)
and because F` and U` are the function outputs corresponding to different inputs (F`−1 and U`−1), they form a joint multivariate Gaussian distribution, analogous to Eq. (60),
P (F`,U`|F`−1,U`−1) = Nl∏ λ=1 N (( f `λ u`λ )∣∣∣∣0,K((F`−1U`−1 ))) . (62)
Following Salimbeni & Deisenroth (2017) we form an approximate posterior by conditioning the function values, F` on the inducing outputs, U`,
Q ( {F`,U`}L+1`=1 ∣∣X,U0) = ∏L+1`=1 Q (F`,U`|F`−1,U`−1) = ∏L+1 `=1 P (F`|U`,U`−1,F`−1) Q (U`|U`−1) , (63)
where Q (U`|U`−1) is given by Eq. (19), i.e.
Q (U`|U`−1) = ∏N` λ=1N ( u`λ ∣∣Σu` Λ`v`λ,Σu` ) , Σu` = (K−1 (U`−1) + Λ`)−1 , (64)
and P (F`|U`,U`−1,F`−1) is given by standard manipulations of Eq. (62). Importantly, the prior can be factorised in an analogous fashion,
P (F`,U`|F`−1,U`−1) = P (F`|U`,U`−1,F`−1) P (U`|U`−1) . (65)
The full ELBO can be written as
L = EQ({F`,U`}L+1`=1 |X,U0)
[ log P ( Y, {F`,U`}L+1`=1 ∣∣X,U0) Q ( {F`,U`}L+1`=1 ∣∣X,U0) ] . (66)
Substituting Eqs. (61), (63) and (65) into Eq. (66), the P (F`|U`,U`−1,F`−1) terms cancel and we obtain,
L = EQ({F`,U`}L+1`=1 |X,U0)
[ log P (Y|FL+1) +
L+1∑ `=1 log P (U`|U`−1) Q (U`|U`−1)
] . (67)
Analogous to the BNN case, we evaluate the ELBO by alternatively sampling the inducing function values U` given U`−1 and propagating the data by sampling from P (F`|U`,U`−1,F`−1) (see Alg. 2). As in Salimbeni & Deisenroth (2017), since all likelihoods we use factorise across datapoints, we only need to sample from the marginals of the latter distribution to sample the propagated function values. As in the BNN case, the parameters of the approximate posterior are the global inducing inputs, U0, and the pseudo-data and precisions at all layers, {V`,Λ`}L`=1. We can similarly use standard reparameterised variational inference (Kingma & Welling, 2013; Rezende et al., 2014) to optimise these variational parameters, as Q (U`|U`−1) is Gaussian. We use Adam (Kingma & Ba, 2014) to optimise the parameters.
Algorithm 2: Global inducing points for deep Gaussian processes Parameters: inducing inputs, U0, inducing outputs and precisions, {V`,Λ`}L`=1, at all layers. DGP inputs: (e.g. MNIST digits) F0 DGP outputs: (e.g. classification logits) FL+1 L ← 0 for ` ∈ {1, . . . , L+ 1} do
Compute the mean and covariance over the inducing outputs at this layer Σu` = ( K−1 (U`−1) + Λ` )−1 M` = Σ u ` Λ`V` Sample the inducing outputs and compute the ELBO U` ∼ N (M`,Σu` ) = Q (U`|U`−1) L ← L+ log P (U`|U`−1)− logN (U`|M`,Σu` ) Propagate the inputs using the sampled inducing outputs, F` ∼ P (F`|U`,U`−1,F`−1)
L ← L+ log P (Y|FL+1)

heading: E MOTIVATING THE APPROXIMATE POSTERIOR FOR DEEP GPS
text: Our original motivation for the approximate posterior was for the BNN case, which we then extended to deep GPs. Here, we show how the same approximate posterior can be motivated from a deep GP
perspective. As with the BNN case, we first derive the form of the optimal approximate posterior for the last layer, in the regression case. Without inducing points, the ELBO becomes
L = EQ({F`}L+1`=1 )
[ log P ( Y, {F`}L+1`=1 ) Q ( {F`}L+1`=1 ) ] , (68) where we have defined a generic variational posterior Q ( {F`}L+1`=1 ) . Since we are interested in the
form of Q ( FL+1 ∣∣{F`}L`=1), we rearrange the ELBO so that all terms that do not depend on FL+1 are absorbed into a constant, c:
L = EQ({F`}L+1`=1 ) [ log P ( Y,FL+1 ∣∣{F`}L`=1)− log Q (FL+1) + c] . (69) Some straightforward rearrangements lead to a similar form to before,
L = EQ({F`}L`=1) [ log P ( Y| {F`}L`=1 ) −DKL ( Q ( FL+1|{F`}L`=1 ) ||P ( FL+1|Y, {F`}L`=1 )) + c ] , (70)
from which we see that the optimal conditional posterior is given by Q ( FL+1|{F`}L`=1 ) = Q (FL+1|FL) = P (FL+1|Y,FL), which has a closed form for regression: it is simply the standard GP posterior given by training data Y at inputs FL. In particular, for likelihood
P (Y|FL+1,ΛL+1) = ∏NL+1 λ=1 N ( yL+1λ ∣∣fL+1λ ,Λ−1L+1) , (71) where ΛL+1 is the precision,
Q (FL+1|FL) = ∏NL+1 λ=1 N ( fL+1λ ∣∣ΣfL+1ΛL+1yL+1λ ,ΣfL+1) , (72) ΣfL+1 = (K −1 (FL) + ΛL+1) −1. (73)
Finally, as is usual in GPs (Rasmussen & Williams, 2006), the predictive distribution for test points can be obtained by conditioning using this approximate posterior.

heading: F COMPARING OUR DEEP GP APPROXIMATE POSTERIOR TO PREVIOUS WORK
text: The standard approach to inference in deep GPs (e.g. Salimbeni & Deisenroth, 2017) involves local inducing points and an approximate posterior over {U`}L+1`=1 that is factorised across layers,
Q ( {U`}L+1`=1 ) = ∏L+1 l=1 ∏N` λ=1N ( u`λ; m ` λ,Σ ` λ ) . (74)
This approximate posterior induces an approximate posterior over the underlying infinite-dimensional functions F` at each layer, which are implicitly used to propagate the data through the network via F` = F`(F`−1). We show a graphical model summarising the standard approach in Fig. A1a. While, as Salimbeni & Deisenroth (2017) point out, the function values {F`}L+1`=1 are correlated, the functions {F`}L+1`=1 themselves are independent across layers. We note that for BNNs, this is equivalent to having a posterior over weights that factorises across layers.
One approach to introduce dependencies across layers for the functions would be to introduce the notion of global inducing points, propagating the initial U0 through the model. In fact, as we note in the Related Work section, Ustyuzhaninov et al. (2020) independently proposed this approach to introducing dependencies, using a toy problem to motivate the approach. However, they kept the form of the approximate posterior the same as the standard approach (Eq. 18); we show the corresponding graphical model in Fig. A1b. The graphical model shows that as adjacent functions F` and F`+1 share the parent node U`, they are in fact dependent. However, non-adjacent functions do not share any parent nodes, and so are independent; this can be seen by considering the d-separation criterion (Pearl, 1988) for F`−1 and F`+1, which have parents (U`−2,U`−1) and (U`,U`+1) respectively. Our approach, by contrast, determines the form of the approximate posterior over U` by performing Bayesian regression using U`−1 as input to that layer’s GP, where the output data is V`. This results in a posterior that depends on the previous layer, Q (U`|U`−1). We show the corresponding graphical model in Fig. A1c. From this graphical model it is straightforward to see that our approach results in a posterior over functions that are correlated across all layers.
F` F`+1F`−1
F`
U`
F`+1
U`+1
F`−1
U`−1
(a) Graphical model illustrating the approach of Salimbeni & Deisenroth (2017). The inducing inputs, {U`−1}L+1`=1 are treated as learned parameters and are therefore omitted from the model.
F` F`+1F`−1
F`
U`
F`+1
U`+1
F`−1
U`−1
(b) Graphical model illustrating the approach of Ustyuzhaninov et al. (2020). The inducing inputs are given by the inducing outputs at the previous layer.
F` F`+1F`−1
F`
U`
F`+1
U`+1
F`−1
U`−1
(c) Graphical model illustrating our approach.
Figure A1: Comparison of the graphical models for three approaches to inference in deep GPs: Salimbeni & Deisenroth (2017), Ustyuzhaninov et al. (2020), and ours.

heading: G PARAMETER SCALING FOR ADAM
text: The standard optimiser for variational BNNs is ADAM (Kingma & Ba, 2014), which we also use. Considering similar RMSprop updates for simplicity (Tieleman & Hinton, 2012),
∆w = η g√ E [g2]
(75)
where the expectation over g2 is approximated using a moving-average of past gradients. Thus, absolute parameter changes are going to be of order η. This is fine if all the parameters have roughly
−1 0 1 x
−2
0
2
y
2 points ELBO: -2.244
True Predicted
−1 0 1 x
−2
0
2
y
10 points ELBO: 2.055
−1 0 1 x
−2
0
2
y
20 points ELBO: 2.125
−1 0 1 x
−2
0
2
y
40 points ELBO: 2.179
Figure A2: Predictive distributions on the toy dataset as the number of inducing points changes.
the same order of magnitude, but becomes a serious problem if some of the parameters are very large and others are very small. For instance, if a parameter is around 10−4 and η = 10−4, then a single ADAM step can easily double the parameter estimate, or change it from positive to negative. In contrast, if a parameter is around 1, then ADAM, with η−4 can make proportionally much smaller changes to this parameter, (around 0.01%). Thus, we need to ensure that all of our parameters have the same scale, especially as we mix methods, such as combining factorised and global inducing points. We thus design all our new approximate posteriors (i.e. the inducing inputs and outputs) such that the parameters have a scale of around 1. The key issue is that the mean weights in factorised methods tend to be quite small — they have scale around 1/ √ fan-in. To resolve this issue, we store scaled weights, and we divide these stored, scaled mean parameters by the fan-in as part of the forward pass,
weights = scaled weights√
fan-in . (76)
This scaling forces us to use larger learning rates than are typically used.

heading: H EXPLORING THE EFFECT OF THE NUMBER OF INDUCING POINTS
text: In this section, we briefly consider the effect of changing the number of inducing points, M , used in global inducing. We reconsider the toy problem from Sec. 4.1, and plot predictive posteriors obtained with global inducing as the number of inducing points increases from 2 to 40 (noting that in Fig. 1 we used 100 inducing points).
We plot the results of our experiment in Fig. A2. While two inducing points are clearly not sufficient, we observe that there is remarkably very little difference between the predictive posteriors for 10 or more inducing points. This observation is reflected in the ELBOs per datapoint (listed above each plot), which show that adding more points beyond 10 gains very little in terms of closeness to the true posterior.
However, we note that this is a very simple dataset: it consists of only two clusters of close points with a very clear trend. Therefore, we would expect that for more complex datasets more inducing points would be necessary. We leave a full investigation of how many inducing points are required to obtain a suitable approximate posterior, such as that found in Burt et al. (2020) for sparse GP regression, to future work.

heading: I UNDERSTANDING COMPOSITIONAL UNCERTAINTY
text: In this section, we take inspiration from the experiments of Ustyuzhaninov et al. (2020) which investigate the compositional uncertainty obtained by different approximate posteriors for DGPs. They noted that methods which factorise over layers have a tendency to cause the posterior distribution for each layer to collapse to a (nearly) deterministic function, resulting in worse uncertainty quantification within layers and worse ELBOs. In contrast, they found that allowing the approximate posterior to have correlations between layers allows those layers to capture more uncertainty, resulting in better
0
2
lo ca
l in
d u
ci n g E L B O : 4 .9 2 1
F1(x)
−1
0
1
F2(x)
−1
0
1
y
−1 0 1 x
−2
0
2
g lo
b a
l in
d u
ci n g E L B O : 7 .4 8 3
−1 0 1 x
−1
0
1
−1 0 1 x
0
2
Figure A3: Posterior distributions for 2-layer DGPs with local inducing and global inducing. The first two columns show the predictive distributions for each layer taken individually, while the last column shows the predictive distribution of the output y.
ELBOs and therefore a closer approximation to the true posterior. They argue that this then allows the model to better discover compositional structure in the data.
We first consider a toy problem consisting of 100 datapoints generated by sampling from a two-layer DGP of width one, with squared-exponential kernels in each layer. We then fit two two-layer DGPs to this data - one using local inducing, the other using global inducing. The results of this experiment can be seen in Fig. A3, which show the final fit, along with the learned posteriors over intermediate functions F1 and F2. These results mirror those observed by Ustyuzhaninov et al. (2020) on a similar experiment: local inducing, which factorises over layers, collapses to a nearly deterministic posterior over the intermediate functions, whereas global inducing provides a much broader distribution over functions for the two layers. Therefore, global inducing leads to a wider range of plausible functions that could explain the data via composition, which can be important in understanding the data. We observe that this behaviour directly leads to better uncertainty quantification for the out-of-distribution region, as well as better ELBOs.
To illustrate a similar phenomenon in BNNs, we reconsider the toy problem of Sec. 4.1. As it is not meaningful to consider neural networks with only one hidden unit per layer, instead of plotting intermediate functions we instead look at the mean variance of the functions at random input points, following roughly the experiment Dutordoir et al. (2019) in Table 1. For each layer, we consider the quantity
Ex
[ 1
N` N∑̀ λ=1 V[f lλ(x)]
] , (77)
-1.44 -0.69
N (0, 1)
Neal
Scale
E LB
O s
boston N=506, D=13
-1.36 -0.66
concrete N=1030, D=8
0.30 0.88
energy N=768, D=8
-0.48 -0.29
kin8nm N=8192, D=8
2.11 2.82
naval N=11934, D=16
-0.11 -0.02
power N=9568, D=4
-1.13 -1.06
protein N=45730, D=9
-1.45 -1.25
wine N=1599, D=11
-0.85 0.58
yacht N=308, D=6
-2.80 -2.50
N (0, 1)
Neal
Scale
LL s
factorised local inducing global inducing fac→ gi -3.87 -3.18 -0.79 -0.67 1.08 1.27 6.70 7.41 -2.84 -2.79 -2.92 -2.81 -1.21 -0.98 -2.23 -0.86
Figure A4: ELBOs per datapoint and average test log likelihoods for BNNs on UCI datasets.
where the expectation is over random input points, which we sample from a standard normal. We expect that for methods which introduce correlations across layers, this quantity will be higher, as there will be a wider range of intermediate functions that could plausibly explain the data. We confirm this in Table 2, which indicates that global inducing leads to many more compositions of functions being considered as plausible explanations of the data. This is additionally reflected in the ELBO, which is far better for global inducing than the other, factorised methods. However, we note that the variances are far closer than we might otherwise expect for the second layer. We hypothesise that this is due to the pruning effects described in Trippe & Turner (2018), where a layer has many weights that are close to the prior that are then pruned out by the following layer by having the outgoing weights collapse to zero. In fact, we note that the variances in the last layer are small for the factorised methods, which supports this hypothesis. By contrast, global inducing leads to high variances across all layers.
We believe that understanding the role of compositional uncertainty in variational inference for deep Bayesian models can lead to important conclusions about both the models being used and the compositional structure underlying the data being modelled, and is therefore an important direction for future work to consider.

heading: J UCI RESULTS WITH BAYESIAN NEURAL NETWORKS
text: For this Appendix, we consider all of the UCI datasets from Hernández-Lobato & Adams (2015), along with four approximation families: factorised (i.e. mean-field), local inducing, global inducing, and fac→gi, which may offer some computational advantages to global inducing. We also considered three priors: the standard N (0, 1) prior, NealPrior, and ScalePrior. The test LLs and ELBOs for BNNs applied to UCI datasets are given in Fig. A4. Note that the ELBOs for the global inducing methods (both global inducing and fac→gi) are almost always better than those for baseline methods, often by a very large margin. However, as noted earlier, this does not necessarily correspond to better test log likelihoods due to model misspecification: there is not a straightforward relationship between the ELBO and the predictive performance, and so it is possible to obtain better test log likelihoods with worse inference. We present all the results, including for the test RMSEs, in tabulated form in Appendix P.
0.0 0.2 0.4 0.6 0.8 1.0
confidence
0.0
0.2
0.4
0.6
0.8
1.0
ac cu
ra cy
factorised
SpatialIW Scale
0.0 0.2 0.4 0.6 0.8 1.0
confidence
0.0
0.2
0.4
0.6
0.8
1.0 local inducing
0.0 0.2 0.4 0.6 0.8 1.0
confidence
0.0
0.2
0.4
0.6
0.8
1.0 fac→ gi
0.0 0.2 0.4 0.6 0.8 1.0
confidence
0.0
0.2
0.4
0.6
0.8
1.0 global inducing
Figure A5: Calibration curves for CIFAR-10
J.1 EXPERIMENTAL DETAILS
The architecture we considered for all BNN UCI experiments were fully-connected ReLU networks with 2 hidden layers of 50 hidden units each. We performed a grid search to select the learning rate and minibatch size. For the fully factorised approximation, we selected the learning rate from {3e-4, 1e-3, 3e-3, 1e-2} and the minibatch size from {32, 100, 500}, optimising for 25000 gradient steps; for the other methods we selected the learning rate from {3e-3, 1e-2} and fixed the minibatch size to 10000 (as in Salimbeni & Deisenroth (2017)), optimising for 10000 gradient steps. For all methods we selected the hyperparameters that gave the best ELBO. We trained the models using 10 samples from the approximate posterior, while using 100 for evaluation. For the inducing point methods, we used the selected batch size for the number of inducing points per layer. For all methods, we initialised the log noise variance at -3, but use the scaling trick in Appendix G to accelerate convergence, scaling by a factor of 10. Note that for the fully factorised method we used the local reparameterisation trick (Kingma et al., 2015); however, for fac→ gi we cannot do so because the inducing point methods require that covariances be propagated through the network correctly. For the inducing point methods, we additionally use output channel-specific precisions, Λl,λ, which effectively allows the network to prune unnecessary neurons if that benefits the ELBO. However, we only parameterise the diagonal of these precision matrices to save on computational and memory cost.

heading: K UNCERTAINTY CALIBRATION FOR CIFAR-10
text: To assess how well our methods capture uncertainty, we consider calibration. Calibration is assessed by comparing the model’s probabilistic assessment of its confidence with its accuracy — the proportion of the time that it is actually correct. For instance, gathering model predictions with some confidence (e.g. softmax probabilities in the range 0.9 to 0.95), and looking at the accuracy of these predictions, we would expect the model to be correct with probability 0.925; a higher or lower value would represent miscalibration.
We begin by plotting calibration curves in Fig. A5, obtained by binning the predictions in 20 equal bins and assessing the mean accuracy of the binned predictions. For well-calibrated models, we expect the line to lie on the diagonal. A line above the diagonal indicates the model is underconfident (the model is performing better than it expects), whereas a line below the diagonal indicates it is overconfident (it is performing worse than it expects). While it is difficult to draw strong conclusions from these plots, it appears generally that factorised is poorly calibrated for both priors, that SpatialIWPrior generally improves calibration over ScalePrior, and that local inducing with SpatialIWPrior performs very well.
To come to more quantitative conclusions, we use expected calibration error (ECE; (Naeini et al., 2015; Guo et al., 2017)), which measures the expected absolute difference between the model’s confidence and accuracy. Confirming the results from the plots (Fig. A5), we find that using the more sophisticated SpatialIWPrior gave considerable improvements in calibration. While, as expected, we find that our most accurate prior, SpatialIWPrior, in combination with global inducing points did very well (ECE of 0.021), the model with the best ECE is actually local inducing with SpatialIWPrior, albeit by a very small margin. We leave investigation of exactly why this is to future work. Finally, note our final ECE value of 0.021 is a considerable improvement over those for uncalibrated models
in Guo et al. (2017) (Table 1), which are in the region of 0.03-0.045 (although considerably better calibration can be achieved by post-hoc scaling of the model’s confidence).

heading: L ASYMPTOTIC COMPLEXITY
text: In the deep GP case, the complexity for global inducing is exactly that of standard inducing point Gaussian processes, i.e. O(M3 + PM2) where M is the number of inducing points, and P can be taken to be the number of training inputs, or the size of a minibatch, as appropriate. The first term, M3, comes from computing and sampling the posterior over U` based on the inducing points (e.g. inverting the covariance). The second term, and PM2 comes from computing the implied distribution over F`.
In the fully-connected BNN case, we have three terms, O(N3 +MN2 + PN2). The first term, N3, where N corresponds to the width of the network, arises from taking the inverse of the covariance matrix in Eq. (9), but is also the complexity e.g. for propagating the inducing points from layer to the next (Eq. 8). The second term, MN2, comes from computing that covariance in Eq. (9), by taking the product of input features with themselves. The third term PN2 comes from multiplying the training inputs/minibatch by the sampled inputs (Eq. 1).

heading: M UCI RESULTS WITH DEEP GAUSSIAN PROCESSES
text: In this appendix, we again consider all of the UCI datasets from Hernández-Lobato & Adams (2015) for DGPs with depths ranging from two to five layers. We compare DSVI (Salimbeni & Deisenroth, 2017), local inducing, and global inducing. While local inducing uses the same inducing-point architecture as Salimbeni & Deisenroth (2017), the actual implementation and parameterisation is very different and in addition they used a complex architecture involving skip connections that we may not have matched exactly. As such, we do expect to see differences between local inducing and Salimbeni & Deisenroth (2017).
We show our results in Fig. A6. Here, the results are not as clear-cut as in the BNN case. For the smaller datasets (i.e. boston, concrete, energy, wine, yacht), global inducing generally outperforms both local inducing and DSVI, as noted in the main text, especially when considering the ELBOs. We do however observe that for power, protein, and one model for kin8nm, the local approaches sometimes outperform global inducing, even for the ELBOs. We believe this is due to the fact that relatively few inducing points were used (100), in combination with the fact that global inducing has far fewer variational parameters than the local approaches. This may make optimisation harder in the global inducing case, especially for larger datasets where the model uncertainty does not matter as much, as the posterior concentration will be stronger. Importantly, however, our results on CIFAR-10 indicate that these issues do not arise in very large-scale, high-dimensional datasets, which are of most interest for future work.
We provide tabulated results, including for RMSEs, in Appendix P.
M.1 EXPERIMENTAL DETAILS
Here, we matched the experimental setup in Salimbeni & Deisenroth (2017) as closely as possible. In particular, we used 100 inducing points, and full-covariance observation noise. However, our parameterisation is still somewhat different from theirs, in part because our approximate posterior is defined in terms of noisy function-values, while their approximate posterior was defined in terms of the function-values themselves.
-0.50 -0.31
2
3
4
5
EL BO
s
boston N=506, D=13
-0.60 -0.41
concrete N=1030, D=8
0.81 1.39
energy N=768, D=8
-0.19 -0.16
kin8nm N=8192, D=8
2.41 3.50
naval N=11934, D=16
0.02 0.05
power N=9568, D=4
-1.07 -1.01
protein N=45730, D=9
-1.20 -1.17
wine N=1599, D=11
1.16 1.83
yacht N=308, D=6
-2.53 -2.33
2
3
4
5
LL s
DSVI local inducing global inducing -3.15 -3.10 -0.87 -0.69 1.34 1.38 6.80 7.90 -2.78 -2.72 -2.81 -2.71 -0.97 -0.94 -0.48 -0.20
Figure A6: ELBOs per datapoint and average test log likelihoods for DGPs on UCI datasets. The numbers indicate the depths of the models.
As the original results in Salimbeni & Deisenroth (2017) used different UCI splits, and did not provide the ELBO, we reran their code https://github.com/ICL-SML/Doubly-Stochastic-DGP (changing the number of epochs and noise variance to reflect the values in the paper), which gave very similar log likelihoods to those in the paper.

heading: N MNIST 500
text: For MNIST, we considered a LeNet-inspired model consisting of two conv2d-relu-maxpool blocks, followed by conv2d-relu-linear, where the convolutions all have 3× 3 kernels with 64 channels. We trained all models using a learning rate of 10−3.
When training on very small datasets, such as the first 500 training examples in MNIST, we can see a variety of pathologies emerge with standard methods. To help build intuition for these pathologies, we introduce a sanity check for the ELBO. In particular, we could imagine a model that sets the distribution over all lower-layer parameters equal to the prior, and sets the top-layer parameters so as to ensure that the predictions are uniform. With 10 classes, this results in an average test log likelihood of −2.30 ≈ log(1/10), and an ELBO (per datapoint) of approximately −2.30. We found that many combinations of the approximate posterior/prior converged to ELBOs near this baseline. Indeed, the only approximate posterior to escape this baseline for ScalePrior and SpatialIWPrior is global inducing points. This is because ScalePrior and SpatialIWPrior both offer the flexibility to shrink the prior variance, and hence shrink the weights towards zero, giving uniform predictions, and potentially zero KL divergence. In contrast, NealPrior and StandardPrior do not offer this flexibility: you always have to pay something in KL divergence in order to give uniform predictions. We believe that this is the reason that factorised performs better than expected with NealPrior, despite having an ELBO that is close to the baseline. Furthermore, it is unclear why local inducing gives very test log likelihood and performance, despite having an ELBO that is similar to factorised. For StandardPrior, all the ELBOs are far lower than the baseline, and far lower than for any other priors. Despite this, factorised and fac→ gi in combination with StandardPrior appear to transiently perform better in terms of predictive accuracy than any other method. These results should sound a note of caution
−7.5
−5.0
−2.5 0.0 EL BO
NealPrior
factorised local inducing fac → gi global inducing
StandardPrior ScalePrior SpatialIWPrior
−2
−1
0
te st log
-lik eli ho od
0 20 40 thousand epochs
0.6
0.8
1.0
te st pr ob
co rre
ct
0 20 40 thousand epochs 0 20 40 thousand epochs 0 20 40 thousand epochs
Figure A7: The ELBO, test log likelihoods and classification accuracy with different priors and approximate posteriors on a reduced MNIST dataset consisting of only the first 500 training examples.
whenever we try to use factorised approximate posteriors with fixed prior covariances (e.g. Blundell et al., 2015; Farquhar et al., 2020). We leave a full investigation of these effects for future work.

heading: O ADDITIONAL EXPERIMENTAL DETAILS
text: All the methods were implemented in PyTorch. We ran the toy experiments on CPU, with the UCI experiments being run on a mixture of CPU and GPU. The remaining experiments – linear, CIFAR-10, and MNIST 500 – were run on various GPUs. For CIFAR-10, the most intensive of our experiments, we trained the models on one NVIDIA Tesla P100-PCIE-16GB. We optimised using ADAM (Kingma & Ba, 2014) throughout.
Factorised We initialise the posterior weight means to follow the Neal scaling (i.e. drawn from NealPrior); however, we use the scaling described in Appendix G to accelerate training. We initialise the weight variances to 1e-3/ √ N`−1 for each layer.
Inducing point methods For global inducing, we initialise the inducing inputs, U0, and pseudodata for the last layer, VL+1, using the first batch of data, except for the toy experiment, where we initialise using samples from N (0, 1) (since we used more inducing points than datapoints). For the remaining layers, we initialise the pseudo-data by sampling from N (0, 1). We initialise the log precision to −4, except for the last layer, where we initialise it to 0. We additionally use a scaling factor of 3 as described in Appendix G. For local inducing, the initialisation is largely the same, except we initialise the pseudo-data for every layer by sampling from N (0, 1). We additionally sample the inducing inputs for every layer from N (0, 1).
Toy experiment For each variational method, we optimise the ELBO over 5000 epochs, using full batches for the gradient descent. We use a learning rate of 1e-2. We fix the noise variance at its
true value, to help assess the differences between each method more clearly. We use 10 samples from the variational posterior for training, using 100 for testing. For HMC, we use 10000 samples to burn in, and 10000 samples for evaluation, which we subsequently thin by a factor of 10. We initialise the samples from a standard normal distribution, and use 20 leapfrog steps for each sample. We hand-tune the leapfrog step sizes to be 0.0007 and 0.003 for the burn-in and sampling phases, respectively.
Deep linear network We use 10 inducing points for the inducing point methods. We use 1 sample from the approximate posterior for training and 10 for testing, training for 40 periods of 1000 gradient steps, using full batches for each step, with a learning rate of 1e-2.
UCI experiments The splits that we used for the UCI datasets can be found at https://github. com/yaringal/DropoutUncertaintyExps.
CIFAR-10 The CIFAR-10 dataset (https://www.cs.toronto.edu/~kriz/cifar. html; (Krizhevsky et al., 2009)) is a 10-class dataset comprising RGB, 32 × 32 images. It is divided in two sets: a training set of 50,000 examples, and a validation set of 10,000 examples. For the purposes of this paper, we use the validation set as our test set and refer to it as such, as is commonly done in the literature. We use a batch size of 500, with one sample from the approximate posterior for training and 10 for testing. For pre-processing, we normalise the data using the training dataset’s mean and standard deviation. Finally, we train for 1000 epochs with a learning rate of 1e−2 (see App. G for an explanation of why our learning rate is higher than might be expected), and we use a tempering scheme for the first 100 epochs, slowly increasing the influence of the KL divergence to the prior by multiplying it by a factor that increases from 0 to 1. In our scheme, we increase the factor in a step-wise manner, meaning that for the first ten epochs it is 0, then 0.1 for the next ten, 0.2 for the following ten, and so on. Importantly, we still have 900 epochs of training where the standard, untempered ELBO is used, meaning that our results reflect that ELBO. Finally, we note that we share the precisions Λ` within layers instead of using a separate precision for each output channel as was done in the UCI case. This saves memory and computational cost although possibly at the expense of predictive performance.
MNIST 500 The MNIST dataset (http://yann.lecun.com/exdb/mnist/) is a dataset of grayscale handwritten digits, each 28× 28 pixels, with 10 classes. It comprises 60,000 training images and 10,000 test images. For the MNIST 500 experiments, we trained using the first 500 images from the training dataset and discarded the rest. We normalised the images using the full training dataset’s statistics.
Deep GPs As mentioned, we largely follow the approach of Salimbeni & Deisenroth (2017) for hyperparameters. For global inducing, we initialise the inducing inputs to the first batch of training inputs, and we initialise the pseudo-outputs for the last layer to the respective training outputs. For the remaining layers, we initialise the pseudo-outputs by sampling from a standard normal distribution. We initialise the precision matrix to be diagonal with log precision zero for the output layer, and log precision -4 for the remaining layers. For local inducing, we initialise inducing inputs and pseudo data by sampling from a standard normal for every layer, and initialise the precision matrices to be diagonal with log precision zero.

heading: P TABLES OF UCI RESULTS

Review summaries:
The paper proposed a new way of doing Bayesian deep learning in which the optimal conditional posterior for the last layer weights could be reached if the inducing input $Z_0$ is chosen to be the input data $X$ and the pseudo-observation for the last layer $V^L$ is the observation $Y$. Instead of factorizing the inducing points The global inducing input $Z_0$ is propagated through the network to ensure posterior dependencies across layers. The authors also extend this idea to deep Gaussian processes so that the latent functions across layers are correlated. Experiments show better performance than previous methods on both synthetic and real datasets, without the need to anneal the weights for the KL term in ELBO.

This paper proposes a posterior approximation for BNN that models correlations between the layers weights. The paper begins by pointing out that, for any posterior distribution approximation, the optimal conditional posterior distribution over the top-layer weights given the weights of the previous layers has a closed-form in the case of Gaussian likelihood, which, due to Bayes rule, turns out to be product of the likelihood and the top-layer prior. Based on this insight the paper proposes to model each conditional posterior distribution over intermediate layers weights given previous layers weights following the same structure, that is, as a product of a 'pseudo-likelihood' over unobserved noisy activations and the prior for that layer. In order to make inference tractable, the paper proposes the use of global inducing points as well as noisy pseudo-observations of the activations of intermediate layers which are treated as variational parameters.  The paper also describes how such procedure applies to convolutional neural networks and how it can be applied for DGPs as well.