Title: FUNCTIONAL VARIATIONAL BAYESIAN NEURAL NETWORKS

Abstract: Variational Bayesian neural networks (BNNs) perform variational inference over weights, but it is difficult to specify meaningful priors and approximate posteriors in a high-dimensional weight space. We introduce functional variational Bayesian neural networks (fBNNs), which maximize an Evidence Lower BOund (ELBO) defined directly on stochastic processes, i.e. distributions over functions. We prove that the KL divergence between stochastic processes equals the supremum of marginal KL divergences over all finite sets of inputs. Based on this, we introduce a practical training objective which approximates the functional ELBO using finite measurement sets and the spectral Stein gradient estimator. With fBNNs, we can specify priors entailing rich structures, including Gaussian processes and implicit stochastic processes. Empirically, we find fBNNs extrapolate well using various structured priors, provide reliable uncertainty estimates, and scale to large datasets. * Equal contribution.
Most commonly, the prior p(w) is chosen for computational convenience; for instance, independent Gaussian or Gaussian mixture distributions. Other priors, including log-uniform priors (Kingma et al., 2015; Louizos et al., 2017) and horseshoe priors (Ghosh et al., 2018; Louizos et al., 2017), were proposed for specific purposes such as model compression and model selection. But the relationships of weight-space priors to the functions computed by networks are difficult to characterize.

1. INTRODUCTION:

Bayesian neural networks (BNNs) (Hinton & Van Camp, 1993; Neal, 1995) have the potential to combine the scalability, flexibility, and predictive performance of neural networks with principled Bayesian uncertainty modelling. However, the practical effectiveness of BNNs is limited by our ability to specify meaningful prior distributions and by the intractability of posterior inference. Choosing a meaningful prior distribution over network weights is difficult because the weights have a complicated relationship to the function computed by the network. Stochastic variational inference is appealing because the update rules resemble ordinary backprop (Graves, 2011; Blundell et al., 2015) , but fitting accurate posterior distributions is difficult due to strong and complicated posterior dependencies (Louizos & Welling, 2016; Zhang et al., 2018; Shi et al., 2018a) .

In a classic result, Neal (1995) showed that under certain assumptions, as the width of a shallow BNN was increased, the limiting distribution is a Gaussian process (GP). Lee et al. (2018) recently extended this result to deep BNNs. Deep Gaussian Processes (DGP) (Cutajar et al., 2017; Salimbeni & Deisenroth, 2017) have close connections to BNNs due to similar deep structures. However, the relationship of finite BNNs to GPs is unclear, and practical variational BNN approximations fail to match the predictions of the corresponding GP. Furthermore, because the previous analyses related specific BNN architectures to specific GP kernels, it's not clear how to design BNN architectures for a given kernel. Given the rich variety of structural assumptions that GP kernels can represent (Rasmussen & Williams, 2006; Lloyd et al., 2014; Sun et al., 2018) , there remains a significant gap in expressive power between BNNs and GPs (not to mention stochastic processes more broadly).

In this paper, we perform variational inference directly on the distribution of functions. Specifically, we introduce functional variational BNNs (fBNNs), where a BNN is trained to produce a distribution of functions with small KL divergence to the true posterior over functions. We prove that the KL divergence between stochastic processes can be expressed as the supremum of marginal KL divergences at finite sets of points. Based on this, we present functional ELBO (fELBO) training objective. Then we introduce a GAN-like minimax formulation and a sampling-based approximation for functional variational inference. To approximate the marginal KL divergence gradients, we adopt the recently proposed spectral Stein gradient estimator (SSGE) (Shi et al., 2018b) . The blue curve is the mean of final prediction, and the shaded areas represent standard derivations. We compare fBNNs and Bayes-by-Backprop (BBB). For BBB, which performs weight-space inference, varying the network size leads to drastically different predictions. For fBNNs, which perform functionspace inference, we observe consistent predictions for the larger networks. Note that the 1 × 100 factorized Gaussian fBNNs network is not expressive enough to generate diverse predictions.

Our fBNNs make it possible to specify stochastic process priors which encode richly structured dependencies between function values. This includes stochastic processes with explicit densities, such as GPs which can model various structures like smoothness and periodicity (Lloyd et al., 2014; Sun et al., 2018) . We can also use stochastic processes with implicit densities, such as distributions over piecewise linear or piecewise constant functions. Furthermore, in contrast with GPs, fBNNs efficiently yield explicit posterior samples of the function. This enables fBNNs to be used in settings that require explicit minimization of sampled functions, such as Thompson sampling (Thompson, 1933; Russo & Van Roy, 2016) or predictive entropy search (Hernández-Lobato et al., 2014; Wang & Jegelka, 2017) .

One desideratum of Bayesian models is that they behave gracefully as their capacity is increased (Rasmussen & Ghahramani, 2001) . Unfortunately, ordinary BNNs don't meet this basic requirement: unless the asymptotic regime is chosen very carefully (e.g. Neal (1995)), BNN priors may have undesirable behaviors as more units or layers are added. Furthermore, larger BNNs entail more difficult posterior inference and larger description length for the posterior, causing degeneracy for large networks, as shown in Figure 1 . In contrast, the prior of fBNNs is defined directly over the space of functions, thus the BNN can be made arbitrarily large without changing the functional variational inference problem. Hence, the predictions behave well as the capacity increases.

Empirically, we demonstrate that fBNNs generate sensible extrapolations for both explicit periodic priors and implicit piecewise priors. We show fBNNs outperform competing approaches on both small scale and large scale regression datasets. fBNNs' reliable uncertainty estimates enable state-of-art performance on the contextual bandits benchmark of Riquelme et al. (2018) .

2. BACKGROUND:



2.1. VARIATIONAL INFERENCE FOR BAYESIAN NEURAL NETWORKS:

Given a dataset D = {(x i , y i )} n i=1 , a Bayesian neural network (BNN) is defined in terms of a prior p(w) on the weights, as well as the likelihood p(D|w). Variational Bayesian methods (Hinton & Van Camp, 1993; Graves, 2011; Blundell et al., 2015) attempt to fit an approximate posterior q(w) to maximize the evidence lower bound (ELBO):

L q = E q [log p(D|w)] -KL[q(w) p(w)].

(1) The most commonly used variational BNN training method is Bayes By Backprop (BBB) (Blundell et al., 2015) , which uses a fully factorized Gaussian approximation to the posterior, i.e. q(w) = N (w; µ, diag(σ 2 )). Using the reparameterization trick (Kingma & Welling, 2013) , the gradients of ELBO towards µ, σ can be computed by backpropagation, and then be used for updates.

2.2. STOCHASTIC PROCESSES:

A stochastic process (Lamperti, 2012) F is typically defined as a collection of random variables, on a probability space (Ω, F, P ). The random variables, indexed by some set X , all take values in the same mathematical space Y . In other words, given a probability space (Ω, Σ, P ), a stochastic process can be simply written as {F (x) : x ∈ X }. For any point ω ∈ Ω, F (•, ω) is a sample function mapping index space X to space Y, which we denote as f for notational simplicity.

For any finite index set x 1:n = {x 1 , ..., x n }, we can define the finite-dimensional marginal joint distribution over function values {F (x 1 ), • • • , F (x n )}. For example, Gaussian Processes have marginal distributions as multivariate Gaussians.

The Kolmogorov Extension Theorem (Øksendal, 2003) shows that a stochastic process can be characterized by marginals over all finite index sets. Specifically, for a collection of joint distributions ρ x1:n , we can define a stochastic process F such that for all x 1:n , ρ x1:n is the marginal joint distribution of F at x 1:n , as long as ρ satisfies the following two conditions:

Exchangeability. For any permutation π of {1, • • • , n}, ρ π(x1:n) (π(y 1:n )) = ρ x1:n (y 1:n ).

Consistency. For any 1 ≤ m ≤ n, ρ x1:m (y 1:m ) = ρ x1:n (y 1:n )dy m+1:n .

2.3. SPECTRAL STEIN GRADIENT ESTIMATOR (SSGE):

When applying Bayesian methods to modern probabilistic models, especially those with neural networks as components (e.g., BNNs and deep generative models), it is often the case that we have to deal with intractable densities. Examples include the marginal distribution of a non-conjugate model (e.g., the output distribution of a BNN), and neural samplers such as GANs (Goodfellow et al., 2014) . A shared property of these distributions is that they are defined through a tractable sampling process, despite the intractable density. Such distributions are called implicit distributions (Huszár, 2017) .

The Spectral Stein Gradient Estimator (SSGE) (Shi et al., 2018b ) is a recently proposed method for estimating the log density derivative function of an implicit distribution, only requiring samples from the distribution. Specifically, given a continuous differentiable density q(x), and a positive definite kernel k(x, x ) in the Stein class (Liu et al., 2016) of q, they show

EQUATION

where {ψ j } j≥1 is a series of eigenfunctions of k given by Mercer's theorem: k(x, x ) = j µ j ψ j (x)ψ j (x ). The Nyström method (Baker, 1997; Williams & Seeger, 2001 ) is used to approximate the eigenfunctions ψ j (x) and their derivatives. The final estimator is given by truncating the sum in Equation ( 2) and replacing the expectation by Monte Carlo estimates.

3. FUNCTIONAL VARIATIONAL BAYESIAN NEURAL NETWORKS:



3.1. FUNCTIONAL EVIDENCE LOWER BOUND (fELBO):

We introduce function space variational inference analogously to weight space variational inference (see Section 2.1), except that the distributions are over functions rather than weights. We assume a stochastic process prior p over functions f : X → Y. This could be a GP, but we also allow stochastic processes without closed-form marginal densities, such as distributions over piecewise linear functions. For the variational posterior q φ ∈ Q, we consider a neural network architecture with stochastic weights and/or stochastic inputs. Specifically, we sample a function from q by sampling a random noise vector ξ and defining f (x) = g φ (x, ξ) for some function g φ . For example, standard weight space BNNs with factorial Gaussian posteriors can be viewed this way using the reparameterization trick (Kingma & Welling, 2013; Blundell et al., 2015) . (In this case, φ corresponds to the means and variances of all the weights.) Note that because a single vector ξ is shared among all input locations, it corresponds to randomness in the function, rather than observation noise; hence, the sampling of ξ corresponds to epistemic, rather than aleatoric, uncertainty (Depeweg et al., 2017) .

Functional variational inference maximizes the functional ELBO (fELBO), akin to the weight space ELBO in Equation (1), except that the distributions are over functions rather than weights.

L(q) := E q [log p(D|f )] -KL[q||p].

(3)

Here KL[q p] is the KL divergence between two stochastic processes. As pointed out in Matthews et al. (2016) , it does not have a convenient form as log q(f ) p(f ) q(f )df due to there is no infinitedimensional Lebesgue measure (Eldredge, 2016) . Since the KL divergence between stochastic processes is difficult to work with, we reduce it to a more familiar object: KL divergence between the marginal distributions of function values at finite sets of points, which we term measurement sets. Specifically, let X ∈ X n denote a finite measurement set and P X the marginal distribution of function values at X. We equate the function space KL divergence to the supremum of marginal KL divergences over all finite measurement sets: Theorem 1. For two stochastic processes P and Q,

EQUATION

Roughly speaking, this result follows because the σ-algebra constructed with the Kolmogorov Extension Theorem (Section 2.2) is generated by cylinder sets which depend only on finite sets of points. A full proof is given in Appendix A.

fELBO. Using this characterization of the functional KL divergence, we rewrite the fELBO:

L(q) = E q [log p(D|f )] - sup n∈N,X∈X n KL[q(f X )||p(f X )] = inf n∈N,X∈X n (xi,yi)∈D E q [log p(y i |f (x i ))] -KL[q(f X )||p(f X )] := inf n∈N,X∈X n L X (q).

(5)

We also denote L n (q) := inf X∈X n L X (q) for the restriction to sets of n points. This casts maximizing the fELBO as a two-player zero-sum game analogous to a generative adversarial network (GAN) (Goodfellow et al., 2014) : one player chooses the stochastic network, and the adversary chooses the measurement set. Note that the infimum may not be attainable, because the size of the measurement sets is unbounded. In fact, the function space KL divergence may be infinite, for instance if the prior assigns measure zero to the set of functions representable by a neural network (Arjovsky & Bottou, 2017) . Observe that GANs face the same issue: because a generator network is typically limited to a submanifold of the input domain, an ideal discriminator could discriminate real and fake images perfectly. However, by limiting the capacity of the discriminator, one obtains a useful training objective. By analogy, we obtain a well-defined and practically useful training objective by restricting the measurement sets to a fixed finite size. This is discussed further in the next section.

3.2. CHOOSING THE MEASUREMENT SET:

As discussed above, we approximate the fELBO using finite measurement sets to have a well-defined and practical optimization objective. We now discuss how to choose the measurement sets.

Adversarial Measurement Sets. The minimax formulation of the fELBO naturally suggests a two-player zero-sum game, analogous to GANs, whereby one player chooses the stochastic network representing the posterior, and the adversary chooses the measurement set.

EQUATION

We adopt concurrent optimization akin to GANs (Goodfellow et al., 2014) . In the inner loop, we minimize L X (q) with respect to X; in the outer loop, we maximize L X (q) with respect to q.

Unfortunately, this approach did not perform well in terms of generalization. The measurement set which maximizes the KL term is likely to be close to the training data, since these are the points where one has the most information about the function. But the KL term is the only part of the fELBO encouraging the network to match the prior structure. Hence, if the measurement set is close to the training data, then nothing will encourage the network to exploit the structured prior for extrapolation.

Sampling-Based Measurement Sets. Instead, we adopt a sampling-based approach. In order to use a structured prior for extrapolation, the network needs to match the prior structure both near the training data and in the regions where it must make predictions. Therefore, we sample measurement sets which include both (a) random training inputs, and (b) random points from the domain where one is interested in making predictions. We replace the minimization in Equation ( 6) with a sampling distribution c, and then maximize the expected L X (q): max

EQUATION

)

where X M are M points independently drawn from c.

Consistency. With the restriction to finite measurement sets, one only has an upper bound on the true fELBO. Unfortunately, this means the approximation is not a lower bound on the log marginal likelihood (log-ML) log p(D). Interestingly, if the measurement set is chosen to include all of the training inputs, then L(q) is in fact a log-ML lower bound: Theorem 2 (Lower Bound). If the measurement set X contains all the training inputs X D , then

EQUATION

)

The proof is given in Appendix B.1.

To better understand the relationship between adversarial and sampling-based inference, we consider the idealized scenario where the measurement points in both approaches include all training locations, i.e.,

X = {X D , X M }. Let f M , f D be the function values at X M , X D , respectively. By Theorem 2, L X M ,X D (q) = log p(D) -KL[q(f M , f D ) p(f M , f D |D)]. (9) So maximizing L X M ,X D (q) is

equivalent to minimizing the KL divergence from the true posterior on points X M , X D . Based on this, we have the following consistency theorem that helps justify the use of adversarial and sampling-based objectives with finite measurement points. Corollary 3 (Consistency under finite measurement points). Assume that the true posterior p(f |D) is a Gaussian process and the variational family Q is all Gaussian processes. We have the following results if M > 1 and supp(c) = X :

EQUATION

)

The proof is given in Appendix B.2. While it is usually impractical for the measurement set to contain all the training inputs, it is still reassuring that a proper lower bound can be obtained with a finite measurement set.

3.3. KL DIVERGENCE GRADIENTS:

While the likelihood term of the fELBO is tractable, the KL divergence term remains intractable because we don't have an explicit formula for the variational posterior density q φ (f X ). (Even if q φ is chosen to have a tractable density in weight space (Louizos & Welling, 2017) , the marginal distribution over f X is likely intractable.) To derive an approximation, we first observe that

∇ φ KL[q φ (f X ) p(f X )] = E q ∇ φ log q φ (f X ) + E ξ ∇ φ f X (∇ f log q(f X ) -∇ f log p(f X )) .

(11) The first term (expected score function) in Equation ( 11) is zero, so we discard it. 1 The Jacobian ∇ φ f X can be exactly multiplied by a vector using backpropagation. Therefore, it remains to estimate the log-density derivatives ∇ f log q(f X ) and ∇ f log p(f X ).

The entropy derivative ∇ f log q(f X ) is generally intractable. For priors with tractable marginal densities such as GPs (Rasmussen & Williams, 2006) 2 and Student-t Processes (Shah et al., 2014) , ∇ f log p(f X ) is tractable. However, we are also interested in implicit stochastic process priors, i.e. ∇ f log p(f X ) is also intractable. Because the SSGE (see Section 2.3) can estimate score functions for both in-distribution and out-of-distribution samples, we use it to estimate both derivative terms in all our experiments. (We compute ∇ f log p(f X ) exactly whenever it is tractable.)

Algorithm 1 Functional Variational Bayesian Neural Networks (fBNNs):

Require: Dataset D, variational posterior g(•), prior p (explicit or implicit), KL weight λ. Require: Sampling distribution c for random measurement points.

1: while φ not converged do 2:

X M ∼ c; D S ⊂ D sample measurement points 3:

f i = g([X M , X D S ], ξ i ; φ), i = 1 • • • k. sample k function values 4: ∆ 1 = 1 k 1 |Ds| i (x,y) ∇ φ log p(y|f i (x))

compute log likelihood gradients 5:

∆ 2 = SSGE(p, f 1:k ) estimate KL gradients 6: φ ← Optimizer(φ, ∆ 1 -λ∆ 2 )

update the parameters 7: end while

3.4. THE ALGORITHM:

Now we present the whole algorithm for fBNNs in Algorithm 1. In each iteration, our measurement points include a mini-batch D s from the training data and random points X M from a distribution c. We forward X Ds and X M together through the network g(•; φ) which defines the variational posterior q φ . Then we try to maximize the following objective corresponding to fELBO:

EQUATION

)

Here λ is a regularization hyperparameter. In principle, λ should be set as 1 |D| to match fELBO in Equation ( 5). However, because the KL in Equation ( 12) uses a restricted number of measurement points, it only terms a lower bound of the functional KL divergence KL[q(f ) p(f )], thus bigger λ is favored to control overfitting. We used λ = 1 |Ds| in practice, in which case Equation ( 12) is a proper lower bound of log p(D s ), as shown in Theorem 2. Moreover, when using GP priors, we injected Gaussian noise on the function outputs for stability consideration (see Appendix D.1 for details).

4. RELATED WORK:

Bayesian neural networks. Variational inference was first applied to neural networks by Peterson (1987) and Hinton & Van Camp (1993) . More recently, Graves (2011) proposed a practical method for variational inference with fully factorized Gaussian posteriors which used a simple (but biased) gradient estimator. Improving on that work, Blundell et al. (2015) proposed an unbiased gradient estimator using the reparameterization trick of Kingma & Welling (2013). There has also been much work (Louizos & Welling, 2016; Sun et al., 2017; Zhang et al., 2018; Bae et al., 2018) on modelling the correlations between weights using more complex Gaussian variational posteriors. Some non-Gaussian variational posteriors have been proposed, such as multiplicative normalizing flows (Louizos & Welling, 2017) and implicit distributions (Shi et al., 2018a) . Neural networks with dropout were also interpreted as BNNs (Gal & Ghahramani, 2016; Gal et al., 2017) . Local reparameterization trick (Kingma et al., 2015) and Flipout (Wen et al., 2018) try to decorrelate the gradients within a mini-batch for reducing variances during training. However, all these methods place priors over the network parameters. Often, spherical Gaussian priors are placed over the weights for convenience. Other priors, including log-uniform priors (Kingma et al., 2015; Louizos et al., 2017) and horseshoe priors (Ghosh et al., 2018; Louizos et al., 2017) , were proposed for specific purposes such as model compression and model selection. But the relationships of weight-space priors to the functions computed by networks are difficult to characterize.

Functional Priors. There have been other recent attempts to train BNNs in the spirit of functional priors. Flam-Shepherd et al. (2017) trained a BNN prior to mimic a GP prior, but they still required variational inference in weight space. Noise Contrastive Priors (Hafner et al., 2018) are somewhat similar in spirit to our work in that they use a random noise prior in the function space. The prior is incorporated by adding a regularization term to the weight-space ELBO, and is not rich enough to encourage extrapolation and pattern discovery. Neural Processes (NP) (Garnelo et al., 2018) try to model any conditional distribution given arbitrary data points, whose prior is specified implicitly by prior samples. However, in high dimensional spaces, conditional distributions become increasingly The green and blue lines represent ground truth and mean prediction, respectively. Shaded areas correspond to standard deviations. We considered GP priors with two kernels: RBF (which does not model the periodic structure), and PER + RBF (which does). In each case, the fBNN makes similar predictions to the exact GP. In contrast, the standard BBB (BBB-1) cannot even fit the training data, while BBB with scaling down KL by 0.001 (BBB-0.001) manages to fit training data, but fails to provide sensible extrapolations. complicated to model. Variational Implicit Processes (VIP) (Ma et al., 2018) are, in a sense, the reverse of fBNNs: they specify BNN priors and use GPs to approximate the posterior. But the use of BNN priors means they can't exploit richly structured GP priors or other stochastic processes.

Scalable Gaussian Processes. Gaussian processes are difficult to apply exactly to large datasets since the computational requirements scale as O(N3 ) time, and as O(N 2 ) memory, where N is the number of training cases. Multiple approaches have been proposed to reduce the computational complexity. However, sparse GP methods (Lázaro-Gredilla et al., 2010; Snelson & Ghahramani, 2006; Titsias, 2009; Hensman et al., 2013; 2015; Krauth et al., 2016) still suffer for very large dataset, while random feature methods (Rahimi & Recht, 2008; Le et al., 2013) and KISS-GP (Wilson & Nickisch, 2015; Izmailov et al., 2017) must be hand-tailored to a given kernel.

5. EXPERIMENTS:

Our experiments had two main aims: (1) to test the ability of fBNNs to extrapolate using various structural motifs, including both implicit and explicit priors, and (2) to test if they perform competitively with other BNNs on standard benchmark tasks such as regression and contextual bandits.

In all of our experiments, the variational posterior is represented as a stochastic neural network with independent Gaussian distributions over the weights, i.e. q(w) = N (w; µ, diag(σ 2 )). 3 We always used the ReLU activation function unless otherwise specified. Measurement points were sampled uniformly from a rectangle containing the training inputs. More precisely, each coordinate was sampled from the interval

[x min -d 2 , x max + d 2 ]

, where x min and x max are the minimum and maximum input values along that coordinate, and d = x max -x min . For experiments where we used GP priors, we first fit the GP hyperparameters to maximize the marginal likelihood on subsets of the training examples, and then fixed those hyperparameters to obtain the prior for the fBNNs.

5.1. EXTRAPOLATION USING STRUCTURED PRIORS:

Making sensible predictions outside the range of the observed data requires exploiting the underlying structure. In this section, we consider some illustrative examples where fBNNs are able to use structured priors to make sensible extrapolations. Appendix C.2 also shows the extrapolation of fBNNs for a time-series problem.

5.1.1. LEARNING PERIODIC STRUCTURES:

Gaussian processes can model periodic structure using a periodic kernel plus a RBF kernel:

EQUATION

)

where p is the period. In this experiment, we consider 20 inputs randomly sampled from the interval [-2, -0.5] ∪ [0.5, 2], and targets y which are noisy observations of a periodic function: y = 2 * sin(4x) + with ∼ N (0, 0.04). We compared our method with Bayes By Backprop (BBB) (Blundell et al., 2015) (with a spherical Gaussian prior on w) and Gaussian Processes. For fBNNs and GPs, we considered both a single RBF kernel (which does not capture the periodic structure) and PER + RBF as in eq. ( 13) (which does).4 

As shown in Fig. 2 , BBB failed to fit the training data, let alone recover the periodic pattern (since its prior does not encode any periodic structure). For this example, we view the GP with PER + RBF as the gold standard, since its kernel structure is designed to model periodic functions. Reassuringly, the fBNNs made very similar predictions to the GPs with the corresponding kernels, though they predicted slightly smaller uncertainty. We emphasize that the extrapolation results from the functional prior, rather than the network architecture, which does not encode periodicity, and which is not well suited to model smooth functions due to the ReLU activation function.

5.1.2. IMPLICIT PRIORS:

Because the KL term in the fELBO is estimated using the SSGE, an implicit variational inference algorithm (as discussed in Section 2.3), the functional prior need not have a tractable marginal density.

In this section, we examine approximate posterior samples and marginals for two implicit priors: a distribution over piecewise constant functions, and a distribution over piecewise linear functions.

Prior samples are shown in Figure 3 ; see Appendix D.2 for the precise definitions. In each run of the experiment, we first sampled a random function from the prior, and then sampled 20 points from [0, 0.2] and another 20 points from [0.8, 1], giving a training set of 40 data points. To make the task more difficult for the fBNN, we used the tanh activation function, which is not well suited for piecewise constant or piecewise linear functions. 5

Posterior predictive samples and marginals are shown for three different runs in Figure 3 . We observe that fBNNs made predictions with roughly piecewise constant or piecewise linear structure, although their posterior samples did not seem to capture the full diversity of possible explanations of the data. Even though the tanh activation function encourages smoothness, the network learned to generate functions with sharp transitions.

5.2. PREDICTIVE PERFORMANCE:



5.2.1. SMALL SCALE DATASETS:

Following previous work (Hernández-Lobato & Adams, 2015), we then experimented with standard regression benchmark datasets from the UCI collection (Asuncion & Newman, 2007) . In particular, we only used the datasets with less than 2000 data points so that we could fit GP hyperparameters by maximizing marginal likelihood exactly. Each dataset was randomly split into training and test sets, comprising 90% and 10% of the data respectively. This splitting process was repeated 10 times to reduce variability. 6 We compared our fBNNs with Bayes By Backprop (BBB) (Blundell et al., 2015) and Noisy K-FAC (Zhang et al., 2018) . In accordance with Zhang et al. (2018) , we report root mean square error (RMSE) and test log-likelihood. The results are shown in Table 1 . On most datasets, our fBNNs outperformed both BBB and NNG, sometimes by a significant margin.

5.2.2. LARGE SCALE DATASETS:

Observe that fBNNs are naturally scalable to large datasets because they access the data only through the expected log-likelihood term, which can be estimated stochastically. In this section, we verify this experimentally. We compared fBNNs and BBB with large scale UCI datasets, including Naval, Protein Structures, Video Transcoding (Memory, Time) and GPU kernel performance. We randomly split the datasets into 80% training, 10% validation, and 10% test. We used the validating set to select the hyperparameters and performed early stopping. Both methods were trained for 80,000 iterations. 7 We used 1 hidden layer with 100 hidden units for all datasets. For the prior of fBNNs, we used a GP with Neural Kernel Network (NKN) kernels as used in Sun et al. (2018) . We note that GP hyperparameters were fit using mini-batches of size 1000 with 10000 iterations. In each iteration, measurement sets consist of 500 training samples and 5 or 50 points from the sampling distribution c, tuned by validation performance. We ran each experiment 5 times, and report the mean and standard deviation in Table 2 . More large scale regression results with bigger networks can be found at Appendix C.4 and Appendix C.5.

5.3. CONTEXTUAL BANDITS:

One of the most important applications of uncertainty modelling is to guide exploration in settings such as bandits, Bayesian optimization (BO), and reinforcement learning. In this section, we evaluate fBNNs on a recently introduced contextual bandits benchmark (Riquelme et al., 2018) . In contextual bandits problems, the agent tries to select the action with highest reward given some input context. Because the agent learns about the model gradually, it should balance between exploration 6 Details: For all datasets, we used networks with one hidden layer of 50 hidden units. We first fit GP hyper-parameters using marginal likelihood with a budget of 10,000 iterations. We then trained the observation variance and kept it lower bounded by GP observation variance. FBNNs were trained for 2,000 epochs. And in each iteration, measurement points included 20 training examples, plus 5 points randomly sampled. 7 We tune the learning rate from [0.001, 0.01]. We tuned between not annealing the learning rate or annealing it by 0.1 at 40000 iterations. We evaluated the validating set in each epoch, and selected the epoch for testing based on the validation performance. To control overfitting, we used Gamma(6., 6.) prior following (Hernández-Lobato & Adams, 2015) for modelling observation precision and perform inference. and exploitation to maximize the cumulative reward. Thompson sampling (Thompson, 1933) is one promising approach which repeatedly samples from the posterior distribution over parameters, choosing the optimal action according to the posterior sample.

We compared our fBNNs with the algorithms benchmarked in (Riquelme et al., 2018) . We ran the experiments for all algorithms and tasks using the default settings open sourced by Riquelme et al. (2018) . For fBNNs, we kept the same settings, including batchsize (512), training epochs (100) and training frequency (50). For the prior, we use the multi-task GP of Riquelme et al. (2018) . Measurement sets consisted of training batches, combined with 10 points sampled from data regions. We ran each experiment 10 times; the mean and standard derivation are reported in Table 3 (Appendix C.1 has the full results for all experiments.). Similarly to Riquelme et al. (2018) , we also report the mean rank and mean regret.

As shown in Table 3 , fBNNs outperformed other methods by a wide margin. Additionally, fBNNs maintained consistent performance even with deeper and wider networks. By comparison, BBB suffered significant performance degradation when the hidden size was increased from 50 to 500. This is consistent with our hypothesis that functional variational inference can gracefully handle networks with high capacity.

5.4. BAYESIAN OPTIMIZATION:

Another domain where efficient exploration requires accurate uncertainty modeling is Bayesian optimization. Our experiments with Bayesian optimization are described in App C.3. We compared BBB, RBF Random Feature (Rahimi & Recht, 2008) and our fBNNs in the context of Max-value Entropy Search (MES) (Wang & Jegelka, 2017) , which requires explicit function samples for Bayesian Optimization. We performed BO over functions sampled from Gaussian Processes corresponding to RBF, Matern12 and ArcCosine kernels, and found our fBNNs achieved comparable or better performance than RBF Random Feature.

6. CONCLUSIONS:

In this paper we investigated variational inference between stochastic processes. We proved that the KL divergence between stochastic processes equals the supremum of KL divergence for marginal distributions over all finite measurement sets. Then we presented two practical functional variational inference approaches: adversarial and sampling-based. Adopting BNNs as the variational posterior yields our functional variational Bayesian neural networks. Empirically, we demonstrated that fBNNs extrapolate well over various structures, estimate reliable uncertainties, and scale to large datasets.

A FUNCTIONAL KL DIVERGENCE:

A.1 BACKGROUND

We begin with some basic terminology and classical results. See Gray (2011) and Folland (2013) for more details. Definition 1 (KL divergence). Given a probability measure space (Ω, F, P ) and another probability measure M on the smae space, the KL divergence of P with respect to M is defined as

EQUATION

)

where the supremum is taken over all finite measurable partitions Q = {Q i } n i=1 of Ω, and P Q , M Q represent the discrete measures over the partition Q, respectively. Definition 2 (Pushforward measure). Given probability spaces (X, F X , µ) and (Y, F Y , ν), we say that measure ν is a pushforward of µ if ν(A) = µ(f -1 (A)) for a measurable f : X → Y and any A ∈ F Y . This relationship is denoted by ν = µ • f -1 . Definition 3 (Canonical projection map). Let T be an arbitrary index set, and {(Ω t , F t )} t∈T be some collection of measurable spaces. For each subset J ⊂ I ⊂ T , define Ω J = t∈J Ω t . We call π I→J the canonical projection map from I to J if

EQUATION

)

Where w| J is defined as, if w = (w i ) i∈I , then w| J = (w i ) i∈J . Definition 4 (Cylindrical σ-algebra). Let T be an arbitrary index set, (Ω, F) be a measurable space.

Suppose

EQUATION

) is the set of Ω-valued functions. A cylinder subset is a finitely restricted set defined as

EQUATION

Let

EQUATION

We call the σ-algebra F T := σ(G Ω T ) as the cylindrical σ-algebra of Ω T , and (Ω T , F T ) the cylindrical measurable space.

The Kolmogorov Extension Theorem is the foundational result used to construct many stochastic processes, such as Gaussian processes. A particularly relevant fact for our purposes is that this theorem defines a measure on a cylindrical measurable space, using only canonical projection measures on finite sets of points.

Theorem 4 (Kolmogorov extension theorem (Øksendal, 2003) ). Let T be an arbitrary index set.

(Ω, F) is a standard measurable space, whose cylindrical measurable space on T is (Ω T , F T ).

Suppose that for each finite subset I ⊂ T , we have a probability measure µ I on Ω I , and these measures satisfy the following compatibility relationship: for each subset J ⊂ I, we have

EQUATION

)

Then there exists a unique probability measure µ on Ω T such that for all finite subsets I ⊂ T ,

EQUATION

In the context of Gaussian processes, µ is a Gaussian measure on a separable Banach space, and the µ I are marginal Gaussian measures at finite sets of input positions (Mallasto & Feragen, 2017) . Theorem 5. Suppose that M and P are measures on the sequence space corresponding to outcomes of a sequence of random variables

X 0 , X 1 , • • • with alphabet A. Let F n = σ(X 0 , • • • , X n-1

), which asymptotically generates the σ-algebra σ(X 0 , X 1 , • • • ). Then

EQUATION

Where P Fn , M Fn denote the pushforward measures with f : f

(X 0 , X 1 , • • • ) = f (X 0 , • • • , X n-1 ), respectively.

A.2 FUNCTIONAL KL DIVERGENCE:

Here we clarify what it means for the measurable sets to only depend on the values at a countable set of points. To begin with, we firstly introduce some definitions. Definition 5 (Replacing function). For f ∈ Ω T , t 0 ∈ T, v ∈ Ω, a replacing function f r t0,v is,

EQUATION

)

Definition 6 (Restricted Indices). For H ∈ F T , we define the free indices τ c (H):

EQUATION

The complement τ (H) = T \τ c (H) is the set of restricted indices. For example, for the set

EQUATION

1) ∈ (0, 1)}, the restricted indices are τ (H) = {0, 1}.

Restricted index sets satisfy the following properties:

• for any H ∈ F T , τ (H) = τ (H c ).

• for any indices set I and measureable sets {H i ;

H i ∈ F T } i∈I , τ ( ∪ i∈I H i ) ⊆ ∪ i∈I τ (H i ).

Having defined restricted indices, a key step in our proof is to show that, for any measureable set H in a cylindrical measureable space (Ω T , F T ), its set of restricted indices τ (H) is countable. Lemma 6. Given a cylindrical measureable space (Ω T , F T ), for any

H ∈ F T , τ (H) is countable. Proof. Define H = {H|H ∈ F T , τ (H) is countable}, H ⊆ F T .

By the two properties of restricted indices in Definition 6, H is a σ-algebra on Ω T .

On the other hand,

F T = σ(G Ω T ). Because any set in G Ω T has finite restricted indices, G Ω T ⊆ H. Therefore H is a σ-algebra containing G Ω T . Thus H ⊇ σ(G Ω T ) = F T .

Overall, we conclude H = F T . For any H ∈ F T , τ (H) is countable.

Theorem 7. For two stochastic processes P, M on a cylindrical measurable space (Ω T , F T ), the KL divergence of P with respect to M satisfies,

KL[P M ] = sup T d KL[P T d M T d ],

where the supremum is over all finite indices subsets T d ⊆ T , and P T d , M T d represent the canonical projection maps π T →T d of P, M , respectively.

Proof. Recall that stochastic processes are defined over a cylindrical σ-algebra F T . By Lemma 6, for every set H ∈ F T , the restricted index set τ (H) is countable. Our proof proceeds in two steps:

1. Any finite measurable partition of Ω T corresponds to a finite measurable partition over some Ω Tc , where T c is a countable index set.

2. Correspondence between partitions implies correspondence between KL divergences.

3. KL divergences over a countable indices set can be represented as supremum of KL divergences over finite indices sets.

Step 1. By Definition 1,

KL[P M ] = sup Q Ω T KL[P Q Ω T M Q Ω T ],

where the sup is over all finite measurable partitions of the function space Ω T , denoted by Q Ω T :

Q Ω T = {Q (1) Ω T , . . . , Q (k) Ω T | k i=1 Q (i) Ω T = Ω T , Q (i) Ω T ∈ F T are disjoint sets, k ∈ N + }.

By Lemma 6, each τ (Q

(i) Ω T ) is countable. So the combined restricted index set T c := k i=1 τ (Q (i) Ω T ) is countable.

Consider the canonical projection mapping π T →Tc , which induces a partition on Ω Tc , denoted by Q Ω Tc :

Q (i) Ω Tc = π T →Tc (Q (i)

Ω T ). The pushforward measure defined by this mapping is

P Tc = P • π -1 T →Tc , M Tc = M • π -1 T →Tc .

Step 2. Then we have

EQUATION

= sup

EQUATION

Step 

We are left with the last question: whether each T d is contained in some D(T c ) ?

For any finite indices set T d , we build a finite measureable partition

Q. Let Ω = Ω 0 ∪Ω 1 , Ω 0 ∩Ω 1 = ∅. Assume |T d | = K, T d = {T d (k)} k=1:K , let I = {I i |I i = (I i 1 , I i 2 , • • • I i K )} i=1:2 K to

be all K-length binary vectors. We define the partition,

EQUATION

EQUATION

)

Through this settting, Q is a finite parition of Ω T , and T c (Q) = T d . Therefore T d in Equation ( 28) can range over all finite index sets, and we have proven the theorem.

KL[P:

EQUATION

A.3 KL DIVERGENCE BETWEEN CONDITIONAL STOCHASTIC PROCESSES

In this section, we give an example of computing the KL divergence between two conditional stochastic processes. Consider two datasets D 1 , D 2 , the KL divergence between two conditional stochastic processes is

EQUATION

Therefore, the KL divergence between these two stochastic processes equals to the marginal KL divergence on the observed locations. When D 2 = ∅, p(f |D 2 ) = p(f ), this shows the KL divergence between posterior process and prior process are the marginal KL divergence on observed locations.

This also justifies our usage of M measurement points in the adversarial functional VI and samplingbased functional VI of Section 3.

B ADDITIONAL PROOFS B.1 PROOF FOR EVIDENCE LOWER BOUND:

This section provides proof for Theorem 2.

Proof of Theorem 2. Let X M = X\X D be measurement points which aren't in the training data.

EQUATION

B.2 CONSISTENCY FOR GAUSSIAN PROCESSES:

This section provides proof for consistency in Corollary 3.

Proof of Corollary 3. By the assumption that both q(D) and p(f |D) are Gaussian processes:

EQUATION

where m and k denote the mean and covariance functions, respectively.

In this theorem, we also assume the measurement points cover all training locations as in Equation ( 9), where we have (based on Theorem 2):

EQUATION

Therefore, when the variational posterior process is sufficiently expressive and reaches its optimum, we must have KL

EQUATION

As seen from Figure 5 , fBNN and Random feature outperform BBB by a large margin on all three functions. We also observe fBNN performs slightly worse than random feature in terms of RBF priors. Because random feature method is exactly a GP with RBF kernel asymptotically, it sets a high standard for the parametric approaches. In contrast, fBNN outperforms random feature for both ArcCosine and Matern12 functions. This is because of the big discrepancy between such kernels and RBF random features. Because fBNN use true kernels, it models the function structures better. This experiment highlights a key advantage of fBNN, that fBNN can learn parametric function posteriors for various priors.

C.4 VARYING DEPTH To compare with Variational Free Energy (VFE) (Titsias, 2009) , we experimented with two mediumsize datasets so that we can afford to use VFE with full batch. For VFE, we used 1000 inducing points initialized by k-means of training point. For BBB and FBNNs, we used batch size 500 with a budget of 2000 epochs. As shown in Table 5 , FBNNs performed slightly worse than VFE, but the gap became smaller as we used larger networks. By contrast, BBB totally failed with large networks (5 hidden layers with 500 hidden units each layer). Finally, we note that the gap between FBNNs and VFE diminishes if we use fewer inducing points (e.g., 300 inducing points). In this section we experimented on large scale regression datasets with deeper networks. For BBB and fBNNs, we used a network with 5 hidden layers of 100 units, and kept all other settings the same as Section 5.2.2. We also compared with the stochastic variational Gaussian processes (SVGP) (Hensman et al., 2013) , which provides a principled mini-batch training for sparse GP methods, thus enabling GP to scale up to large scale datasets. For SVGP, we used 1000 inducing points initialized by k-means of training points (Note we cannot afford larger size of inducing points because of the cubic computational cost). We used batch size 2000 and iterations 60000 to match the training time with fBNNs. Likewise for BNNs, we used validation set to tune the learning rate from {0.01, 0.001}. We also tuned between not annealing the learning rate or annealing it by 0.1 at 30000 iterations. We evaluated the validating set in each epoch, and selected the epoch for testing based on the validation performance. The averaged results over 5 runs are shown in Table 6 .

C.5 LARGE SCALE REGRESSION WITH DEEPER NETWORKS:

As shown in Table 6 , SVGP performs better than BBB and fBNNs in terms of the smallest naval dataset. However, with dataset size increasing, SVGP performs worse than BBB and fBNNs by a large margin. This stems from the limited capacity of 1000 inducing points, which fails to act as sufficient statistics for large datasets. In contrast, BNNs including BBB and fBNNs can use larger networks freely without the intractable computational cost.

D IMPLEMENTATION DETAILS D.1 INJECTED NOISES FOR GAUSSIAN PROCESS PRIORS:

For Gaussian process priors, p(f X ) is a multivariate Gaussian distribution, which has an explicit density. Therefore, we can compute the gradients ∇ f log p φ (f X ) analytically.

In practice, we found that the GP kernel matrix suffers from stability issues. To stabilize the gradient computation, we propose to inject a small amount of Gaussian noise on the function values, i.e., to instead estimate the gradients of ∇ φ KL[q φ * p γ p * p γ ], where p γ = N (0, γ 2 ) is the noise distribution. This is like the instance-noise trick that is commonly used for stabilizing GAN training (Sønderby et al., 2016) . Note that injecting the noise on the GP prior is equivalent to have a kernel matrix K + γ 2 I. Beyond that, injecting the noise on the parametric variational posterior does not affect the reparameterization trick either. Therefore all the previous estimation formulas still apply.

D.2 IMPLICIT PRIORS:

Our method is applicable to implicit priors. We experiment with piecewise constant prior and piecewise linear prior. Concretely, we randomly generate a function f : [0, 1] → R with the specific structure. To sample piecewise functions, we first sample n ∼ Poisson(3.), then we have n + 1 pieces within [0, 1]. We uniformly sample n locations from [0, 1] as the changing points. For piecewise constant functions, we uniformly sample n + 1 values from [0, 1] as the function values in each piece; For piecewise linear functions, we uniformly sample n + 1 values for the values at first n + 1 locations, we force f (1) = 0.. Then we connect together each piece by a straight line.

:

But note that it may be useful as a control variate(Roeder et al.,

2017).2 Appendix D.1 introduces an additional fix to deal with the GP kernel matrix stability issue.

One could also use stochastic activations, but we did not find that this gave any improvement.

Details: we used a BNN with five hidden layers, each with

units. The inputs and targets were normalized to have zero mean and unit variance. For all methods, the observation noise variance was set to the true value. We used the trained GP as the prior of our fBNNs. In each iteration, measurement points included all training examples, plus 40 points randomly sampled from[-5, 5]. We used a training budget of 80,000 iterations, and annealed the weighting factor of the KL term linearly from 0 to 1 for the first 50,000 iterations.5 Details: the standard deviation of observation noise was chosen to be 0.02. In each iteration, we took all training examples, together with 40 points randomly sampled from [0, 1]]. We used a fully connected network with 2 hidden layers of 100 units, and tanh activations. The network was trained for 20,000 iterations.

Figures and Tables:

Figure 1: Predictions on the toy funcction y = x 3 . Here a × b represents a hidden layers of b units. Red dots are 20 training points.The blue curve is the mean of final prediction, and the shaded areas represent standard derivations. We compare fBNNs and Bayes-by-Backprop (BBB). For BBB, which performs weight-space inference, varying the network size leads to drastically different predictions. For fBNNs, which perform functionspace inference, we observe consistent predictions for the larger networks. Note that the 1 × 100 factorized Gaussian fBNNs network is not expressive enough to generate diverse predictions.

Figure2: Extrapolating periodic structure. Red dots denote 20 training points. The green and blue lines represent ground truth and mean prediction, respectively. Shaded areas correspond to standard deviations. We considered GP priors with two kernels: RBF (which does not model the periodic structure), and PER + RBF (which does). In each case, the fBNN makes similar predictions to the exact GP. In contrast, the standard BBB (BBB-1) cannot even fit the training data, while BBB with scaling down KL by 0.001 (BBB-0.001) manages to fit training data, but fails to provide sensible extrapolations.

Figure 3: Implicit function priors and fBNN approximate posteriors. The leftmost column shows 3 prior samples. The other three columns show independent runs of the experiment. The red dots denote 40 training samples. We plot 4 posterior samples and show multiples of the predictive standard derivation as shaded areas.

3. Denote D(T c ) as the collection of all finite subsets of T c . For any finite set T d ∈ D(T c ), we denote P T d as the pushforward measure of P Tc on Ω T d . From the Kolmogorov Extension Theorem (Theorem 4), we know that P T d corresponds to the finite marginals of P at Ω T d . Because T c is countable, based on Theorem 5, we have, T d M T d ].

Averaged test RMSE and log-likelihood for the regression benchmarks.

Table content: <table><tr><td/><td/><td>Test RMSE</td><td/><td/><td>Test log-likelihood</td><td/></tr><tr><td>Dataset</td><td>BBB</td><td>Noisy K-FAC</td><td>FBNN</td><td>BBB</td><td>Noisy K-FAC</td><td>FBNN</td></tr><tr><td>Boston</td><td colspan="6">3.171±0.149 2.742±0.125 2.378±0.104 -2.602±0.031 -2.446±0.029 -2.301±0.038</td></tr><tr><td colspan="7">Concrete 5.678±0.087 5.019±0.127 4.935±0.180 -3.149±0.018 -3.039±0.025 -3.096±0.016</td></tr><tr><td>Energy</td><td colspan="6">0.565±0.018 0.485±0.023 0.412±0.017 -1.500±0.006 -1.421±0.005 -0.684±0.020</td></tr><tr><td>Wine</td><td colspan="6">0.643±0.012 0.637±0.011 0.673±0.014 -0.977±0.017 -0.969±0.014 -1.040±0.013</td></tr><tr><td>Yacht</td><td colspan="6">1.174±0.086 0.979±0.077 0.607±0.068 -2.408±0.007 -2.316±0.006 -1.033±0.033</td></tr></table>

Averaged test RMSE and log-likelihood for the regression benchmarks.

Table content: <table><tr><td/><td/><td colspan="2">Test RMSE</td><td colspan="2">Test log-likelihood</td></tr><tr><td>Dataset</td><td>N</td><td>BBB</td><td>FBNN</td><td>BBB</td><td>FBNN</td></tr><tr><td>Naval</td><td>11934</td><td colspan="3">1.6E-4±0.000 1.2E-4±0.000 6.950±0.052</td><td>7.130±0.024</td></tr><tr><td>Protein</td><td>45730</td><td>4.331±0.033</td><td>4.326±0.019</td><td colspan="2">-2.892±0.007 -2.892±0.004</td></tr><tr><td>Video Memory</td><td>68784</td><td>1.879±0.265</td><td>1.858±0.036</td><td colspan="2">-1.999±0.054 -2.038±0.021</td></tr><tr><td>Video Time</td><td>68784</td><td>3.632±1.974</td><td>3.007±0.127</td><td colspan="2">-2.390±0.040 -2.471±0.018</td></tr><tr><td>GPU</td><td colspan="2">241600 21.886±0.673</td><td>19.50±0.171</td><td colspan="2">-4.505±0.031 -4.400±0.009</td></tr></table>

Contextual bandits regret. Results are relative to the cumulative regret of the Uniform algorithm. Numbers after the algorithm are the network sizes. We report the mean and standard derivation over 10 trials.

Table content: <table><tr><td/><td colspan="3">M. RANK M. VALUE MUSHROOM</td><td>STATLOG</td><td>COVERTYPE</td><td>FINANCIAL</td><td>JESTER</td><td>ADULT</td></tr><tr><td>FBNN 1 × 50</td><td>4.7</td><td>41.9</td><td>21.38 ± 7.00</td><td>8.85 ± 4.55</td><td colspan="2">47.16 ± 2.39 9.90 ± 2.40</td><td colspan="2">75.55 ± 5.51 88.43 ± 1.95</td></tr><tr><td>FBNN 2 × 50</td><td>6.5</td><td>43.0</td><td colspan="2">24.57 ± 10.81 10.08 ± 5.66</td><td colspan="2">49.04 ± 3.75 11.83 ± 2.95</td><td colspan="2">73.85 ± 6.82 88.81 ± 3.29</td></tr><tr><td>FBNN 3 × 50</td><td>7</td><td>45.0</td><td colspan="2">34.03 ± 13.95 7.73 ± 4.37</td><td colspan="2">50.14 ± 3.13 14.14 ± 1.99</td><td colspan="2">74.27 ± 6.54 89.68 ± 1.66</td></tr><tr><td>FBNN 1 × 500</td><td>3.8</td><td>41.3</td><td>21.90 ± 9.95</td><td>6.50 ± 2.97</td><td colspan="2">47.45 ± 1.86 7.83 ± 0.77</td><td colspan="2">74.81 ± 5.57 89.03 ± 1.78</td></tr><tr><td>FBNN 2 × 500</td><td>4.2</td><td>41.2</td><td colspan="2">23.93 ± 11.59 7.98 ± 3.08</td><td colspan="2">46.00 ± 2.01 10.67 ± 3.52</td><td colspan="2">68.88 ± 7.09 89.70 ± 2.01</td></tr><tr><td>FBNN 3 × 500</td><td>4.2</td><td>40.9</td><td>19.07 ± 4.97</td><td>10.04 ± 5.09</td><td colspan="2">45.24 ± 2.11 11.48 ± 2.20</td><td colspan="2">69.42 ± 7.56 90.01 ± 1.70</td></tr><tr><td>MULTITASKGP</td><td>4.3</td><td>41.7</td><td>20.75 ± 2.08</td><td>7.25 ± 1.80</td><td colspan="2">48.37 ± 3.50 8.07 ± 1.13</td><td colspan="2">76.99 ± 6.01 88.64 ± 3.20</td></tr><tr><td>BBB 1 × 50</td><td>10.8</td><td>52.7</td><td>24.41 ± 6.70</td><td>25.67 ± 3.46</td><td colspan="4">58.25 ± 5.00 37.69 ± 15.34 75.39 ± 6.32 95.07 ± 1.57</td></tr><tr><td>BBB 1 × 500</td><td>13.7</td><td>66.2</td><td>26.41 ± 8.71</td><td colspan="3">51.29 ± 11.27 83.91 ± 4.62 57.20 ± 7.19</td><td colspan="2">78.94 ± 4.98 99.21 ± 0.79</td></tr><tr><td>BBALPHADIV</td><td>15</td><td>83.8</td><td>61.00 ± 6.47</td><td colspan="3">70.91 ± 10.22 97.63 ± 3.21 85.94 ± 4.88</td><td colspan="2">87.80 ± 5.08 99.60 ± 1.06</td></tr><tr><td>PARAMNOISE</td><td>10</td><td>47.9</td><td colspan="2">20.33 ± 13.12 13.27 ± 2.85</td><td colspan="2">65.07 ± 3.47 17.63 ± 4.27</td><td colspan="2">74.94 ± 7.24 95.90 ± 2.20</td></tr><tr><td colspan="2">NEURALLINEAR 10.8</td><td>48.8</td><td colspan="2">16.56 ± 11.60 13.96 ± 1.51</td><td colspan="2">64.96 ± 2.54 18.57 ± 2.02</td><td colspan="2">82.14 ± 3.64 96.87 ± 0.92</td></tr><tr><td>LINFULLPOST</td><td>8.3</td><td>46.0</td><td>14.71 ± 0.67</td><td>19.24 ± 0.77</td><td colspan="2">58.69 ± 1.17 10.69 ± 0.92</td><td colspan="2">77.76 ± 5.67 95.00 ± 1.26</td></tr><tr><td>DROPOUT</td><td>5.5</td><td>41.7</td><td>12.53 ± 1.82</td><td>12.01 ± 6.11</td><td colspan="2">48.95 ± 2.19 14.64 ± 3.95</td><td colspan="2">71.38 ± 7.11 90.62 ± 2.21</td></tr><tr><td>RMS</td><td>6.5</td><td>43.9</td><td>15.29 ± 3.06</td><td>11.38 ± 5.63</td><td colspan="2">58.96 ± 4.97 10.46 ± 1.61</td><td colspan="2">72.09 ± 6.98 95.29 ± 1.50</td></tr><tr><td>BOOTRMS</td><td>4.7</td><td>42.6</td><td colspan="2">18.05 ± 11.20 6.13 ± 1.03</td><td colspan="2">53.63 ± 2.15 8.69 ± 1.30</td><td colspan="2">74.71 ± 6.00 94.18 ± 1.94</td></tr><tr><td>UNIFORM</td><td>16</td><td>100</td><td>100.0 ± 0.0</td><td>100.0 ± 0.0</td><td>100.0 ± 0.0</td><td>100.0 ± 0.0</td><td>100.0 ± 0.0</td><td>100.0 ± 0.0</td></tr></table>

Averaged test RMSE and log-likelihood for the regression benchmarks. We compared BBB, fBNNs and VFE. The numbers a × b represent networks with a hidden layers of b units.

Table content: <table><tr><td/><td/><td/><td>Test RMSE</td><td/><td/><td>Test log-likelihood</td><td/></tr><tr><td>Dataset</td><td>N</td><td>BBB</td><td>FBNN</td><td>VFE</td><td>BBB</td><td>FBNN</td><td>VFE</td></tr><tr><td>Kin8nm (1×100)</td><td>8192</td><td>0.082±0.001</td><td colspan="3">0.079±0.001 0.071±0.001 1.082±0.008</td><td>1.112±0.007</td><td>1.241±0.005</td></tr><tr><td>Kin8nm (2×100)</td><td>8192</td><td>0.074±0.001</td><td colspan="2">0.075±0.001 0.071±0.001</td><td>1.191±0.006</td><td>1.151±0.007</td><td>1.241±0.005</td></tr><tr><td>Kin8nm (5×500)</td><td>8192</td><td>0.266±0.003</td><td colspan="4">0.076±0.001 0.071±0.001 -0.279±0.007 1.144±0.008</td><td>1.241±0.005</td></tr><tr><td colspan="2">Power Plant (1×100) 9568</td><td>4.127±0.057</td><td colspan="5">4.099±0.051 3.092±0.052 -2.837±0.013 -2.833±0.012 -2.531±0.018</td></tr><tr><td colspan="2">Power Plant (2×100) 9568</td><td>4.081±0.054</td><td colspan="5">3.830±0.055 3.092±0.052 -2.826±0.013 -2.763±0.013 -2.531±0.018</td></tr><tr><td colspan="8">Power Plant (5×500) 9568 17.166±0.099 3.542±0.054 3.092±0.052 -4.286±0.007 -2.691±0.016 -2.531±0.018</td></tr></table>

Large scale regression. BBB and FBNN used networks with 5 hidden layers of 100 units.

Table content: <table><tr><td/><td/><td/><td>Test RMSE</td><td/><td/><td>Test log-likelihood</td><td/></tr><tr><td>Dataset</td><td>N</td><td>BBB</td><td>FBNN</td><td>SVGP</td><td>BBB</td><td>FBNN</td><td>SVGP</td></tr><tr><td>Naval</td><td>11934</td><td colspan="3">1.3E-4±0.000 0.7E-4±0.000 0.3E-4±0.000</td><td>6.968±0.014</td><td>7.237±0.009</td><td>8.523±0.06</td></tr><tr><td>Protein</td><td>45730</td><td>3.684±0.041</td><td>3.659±0.026</td><td>3.740±0.015</td><td colspan="3">-2.715±0.012 -2.721±0.010 -2.736±0.003</td></tr><tr><td>Video Memory</td><td>68784</td><td>0.984±0.074</td><td>0.967±0.040</td><td>1.417±0.234</td><td colspan="3">-1.231±0.078 -1.337±0.058 -1.723±0.179</td></tr><tr><td>Video Time</td><td>68784</td><td>1.056±.0.178</td><td>1.083±0.288</td><td>3.216±1.154</td><td colspan="3">-1.180±0.070 -1.468±0.279 -2.475±0.409</td></tr><tr><td>GPU</td><td>241600</td><td>5.136±0.087</td><td>4.806±0.116</td><td colspan="4">21.287±0.571 -2.992±0.013 -2.973±0.019 -4.557±0.021</td></tr></table>

Peer review (iclr2019):
 Overall Thoughts: I found this paper to be very interesting and to address a topic that I think will be of interest to the community. The gap between theoretically advantageous stochastic processes like the GP and the computational efficiency of finite BNNs is a topic not yet fully understood and I believe this paper has some useful points to make. I would be very interested and grateful to hear the authors’ thoughts on the comments/questions below. Specific Comments/Questions: I would prefix this discussion with the fact that this is quite a dense (and long) paper on a number of topics so while I hope that I have understood the essence of the approach I apologise if I have missed something and hope the authors will be able to correct me. I follow the point that it is less clear how finite variational deep BNNs relate to GPs and would agree that finding such an agreement would be a topic of interest. Is the approach taken in the paper not quite close conceptually to the variational sparse GP of Titsias? In that paper, effectively a functional bound is also being taken (i.e. an approximation of a full GP with another GP). So a stochastic process is approximating a full GP. In addition, the approximating GP is defined by a set of samples (the pseudo-input locations) that are optimised as variational parameters. The variational bound is defined in the function domain. There is also alignment with the Stein gradient estimation - the pseudo-input locations are used to define a Nystrom approximation to the full GP kernel. This would seem equivalent to the approximation being performed in (2) as long as the kernel used for the eigenfunctions is the same as that of the full GP. Following from the above, I would be very interested to directly contrast the differences to the Titsias approach - would it be possible to add it as a baseline to the experiments? In particular, there are potentially differences due to differences between the Stein kernel and the full GP kernel (it might be best to have both kernels the same if they are not already the same in all experiments - sorry, I couldn’t tell). In the variational-GP, the pseudo-input locations are optimised directly under the bound and so whilst they are sensitive to initialisation, the optimisation is stable and guaranteed to converge to a local optimum. It is unclear to me how stable the adversarial problem in Sec3.2 is. In the proposed sampling variant, it isn’t clear to me that it is a safe procedure to follow - taking a random subset from the training data and weights on c seems rather heuristic - are there any guarantees? There would also seem to be some connections with the recent approaches on (conditional) neural processes - perhaps the authors might like to comment on this? For a number of the GP priors in the experiments, it might be quite hard for a BNN with ReLu activations to match the posteriors? Would it be worth trying with other (more smooth) activation functions? Overall the results are interesting - would it be possible to include comparisons to the variational-GP (at least for the small-scale experiments)? It would be interesting to contrast their complexity as well if they get stuck on the large-scale ones. For some of the experiments would it be possible to include histograms rather than just error bars to check that the error distributions are similar? For the appendix BayesOpt experiment - would it be possible to use Thompson sampling as the acquisition function? To my mind this would evaluate the predictive density more directly since it mitigates the effect of a particular choice of acquisition function on the performance. Also would a comparison with the full GP not be appropriate?