D EEP N EURAL N ETWORKS AS G AUSSIAN P ROCESSES
Anonymous authors
Paper under double-blind review
A BSTRACT
A deep fully-connected neural network with an i.i.d.
prior over its parameters is equivalent to a Gaussian process (GP) in the limit of inﬁnite network width.
This correspondence enables exact Bayesian inference for neural networks on regression tasks by means of straightforward matrix computations.
For single hiddenlayer networks, the covariance function of this GP has long been known.
Recently, kernel functions for multi-layer random neural networks have been developed, but only outside of a Bayesian framework.
As such, previous work has not identiﬁed the correspondence between using these kernels as the covariance function for a GP and performing fully Bayesian prediction with a deep neural network.
In this work, we derive this correspondence and develop a computationally efﬁcient pipeline to compute the covariance functions.
We then use the resulting GP to perform Bayesian inference for deep neural networks on MNIST and CIFAR-10.
We ﬁnd that the GP-based predictions are competitive and can outperform neural networks trained with stochastic gradient descent.
We observe that the trained neural network accuracy approaches that of the corresponding GP-based computation with increasing layer width, and that the GP uncertainty is strongly correlated with prediction error.
We connect our observations to the recent development of signal propagation in random neural networks.
I NTRODUCTION
Deep neural networks have emerged in recent years as ﬂexible parametric models which can ﬁt complex patterns in data.
As a contrasting approach, Gaussian processes have long served as a traditional nonparametric tool for modeling.
In fact, a correspondence due to Neal (1994a) equates these two models in the limit of inﬁnite width.
Consider a deep fully-connected neural network with i.i.d.
random parameters.
Each scalar output of the network, an afﬁne transformation of the ﬁnal hidden layer, will be a sum of i.i.d.
terms.
In the limit of inﬁnite width, the Central Limit Theorem 1 implies that the function computed by the neural network (NN) is a function drawn from a Gaussian process (GP).
In the case of single hidden-layer networks, the form of the kernel of this GP is well known (Neal (1994a); Williams (1997)).
This correspondence implies that if we choose the hypothesis space to be the class of inﬁnitely wide neural networks, an i.i.d.
prior over weights and biases can be replaced with a corresponding
GP prior over functions.
As noted by (Williams, 1997), this substitution enables exact Bayesian inference for regression using neural networks.
The computation requires building the necessary covariance matrices over the training and test sets and straightforward linear algebra computations.
In light of the resurgence in popularity of neural networks, it is timely to revisit this line of work.
We delineate the correspondence between deep and wide neural networks and GPs and utilize it for Bayesian training of neural networks on regression tasks.
1. R ELATED W ORK
Our work touches on aspects of GPs, Bayesian learning, and compositional kernels.
The correspondence between inﬁnite neural networks and GPs was ﬁrst noted by Neal (1994a;b).
Williams
(1997) computes analytic GP kernels for single hidden-layer neural networks with error function or
Gaussian nonlinearities and noted the use of the GP prior for exact Bayesian inference in regression.
Duvenaud et al.
(2014) discusses several routes to building deep GPs and observes the degenerate form of kernels that are composed inﬁnitely many times – a point we will return to Section 3.2 – but they do not derive the form of GP kernels as we do.
Hazan & Jaakkola (2015) also discusses constructing kernels equivalent to inﬁnitely wide deep neural networks but their construction does not go beyond two hidden layers with nonlinearities.
Related work has also appeared outside of the GP context but in compositional kernel constructions.
Cho & Saul (2009) derives compositional kernels for polynomial rectiﬁed nonlinearities, which includes the Sign and ReLU nonlinearities, and can be used in GPs; our manner of composing kernels matches theirs, though the context is different.
Daniely et al.
(2016) extends the construction of compositional kernels to neural networks whose underlying directed acyclic graph (which they term a “computation skeleton”) is of general form.
They also prove, utilizing the formalism of dual activations, that compositional kernels originating from fully-connected topologies with the same nonlinearity become degenerate when composed inﬁnitely many times.
In a different context than compositional kernels, Poole et al.
; Schoenholz et al.
(2017) study the same underlying recurrence relation for the speciﬁc case of fully-connected networks and bounded nonlinearities.
They distinguish regions in hyperparameter space with different ﬁxed points and convergence behavior in the recurrence relations.
The focus in these works was to better understand the expressivity and trainability of deep networks.
Drawing inspiration from the multi-layer nature of deep neural networks, there is a line of work considering various approaches to stacking GPs, such as deep GPs (Lawrence & Moore (2007);
Damianou & Lawrence (2013); Hensman & Lawrence (2014); Duvenaud et al.
Bui et al.
(2016)), which can give rise to a richer class of probabilistic models beyond GPs.
This contrasts with our work, where we study GPs which are in direct correspondence with deep, inﬁnitely wide neural networks. Krauth et al.
(2016) has recently explored the performance of GP models with deep kernels given in Cho & Saul (2009), implemented with scalable approximations.
However, they do not discuss the equivalence between deep neural networks and GPs with compositional kernels, which constitutes a conceptual contribution of our work.
Furthermore, we note that the GP kernels in our work are more general than the compositional kernel construction outlined in Cho & Saul (2009) in two respects: (i) we are not limited to rectiﬁed polynomials but can deal with general nonlinearities, and (ii) we consider two additional hyperparameters in the kernels, which would correspond to the weight and bias parameter variances in a neural network.
Finally, Gal & Ghahramani (2016) connects dropout in deep neural networks with approximate Bayesian inference in deep GPs. Another series of recent works (Wilson et al. (2016b;a);
Al-Shedivat et al.
(2017)), termed deep kernel learning , utilize GPs with base kernels which take in features produced by a deep multilayer neural network; the model is trained end-to-end. Our work differs from these in that we do not learn properties of the kernel – in particular, the many free parameters of a neural network which provides an embedding – but rather use ﬁxed basis functions. Furthermore, our GP corresponds to a multilayer neural network with all layers inﬁnitely wide. We do perform a grid search over a few kernel hyperparameters, which could be learned by maximizing the marginal likelihood of the GP.
1. S UMMARY OF C ONTRIBUTIONS
We begin by specifying the form of a GP which corresponds to a deep, inﬁnitely wide neural network – hereafter referred to as the Neural Network GP (NNGP) – in terms of a recursive, deterministic computation of the kernel function.
The prescription is valid for generic pointwise nonlinearities in fully-connected feedforward networks.
We develop a computationally efﬁcient method (Section 2.5) to compute the covariance function corresponding to deep neural networks with ﬁxed hyperparameters.
In this work, as a ﬁrst proof of concept of our NNGP construction, we focus on exact Bayesian inference for regression tasks, treating classiﬁcation as regression on class labels.
While less principled, least-squares classiﬁcation performs well (Rifkin et al., 2003) and allows us to compare exact inference via a GP to prediction by a trained neural network on well-studied tasks (MNIST and CIFAR-10 classiﬁcation).
Note that it is possible to extend GPs to softmax classiﬁcation with cross entropy loss (Williams & Barber (1998); Rasmussen & Williams (2006)), which we aim to investigate in future work.
We conduct experiments making Bayesian predictions on MNIST and CIFAR-10 (Section 3) and compare against NNs trained with standard gradient-based approaches.
The experiments explore different hyperparameter settings of the Bayesian training including network depth, nonlinearity, training set size (up to and including the full dataset consisting of tens of thousands of images), and weight and bias variance.
Our experiments reveal that the best NNGP performance is consistently competitive against that of NNs trained with gradient-based techniques, and the best NNGP setting, chosen across hyperparameters, often surpasses that of conventional training (Section 3, Table 1).
We further observe that, with increasing network width, the performance of neural networks with gradient-based training approaches that of the NNGP computation, and that the GP uncertainty is strongly correlated with prediction error.
Furthermore, the performance of the NNGP depends on the structure of the kernel, which can be connected to recent work on signal propagation in networks with random parameters (Schoenholz et al., 2017).
D EEP , INFINITELY WIDE N EURAL N ETWORKS ARE DRAWN FROM GP S
We begin by specifying the correspondence between GPs and deep, inﬁnitely wide neural networks, which hinges crucially on application of the Central Limit Theorem.
We review the single-hidden layer case (Section 2.2) before moving to the multi-layer case (Section 2.3).
2. N OTATION
Consider an L -hidden-layer fully-connected neural network with hidden layers of width N l (for layer l ) and pointwise nonlinearities φ .
Let x ∈ R d in denote the input to the network, and let z L ∈ R d out denote its output.
The i th component of the activations in the l th layer, post-nonlinearity and postafﬁne transformation, are denoted x li and z li respectively.
We will refer to these as the post- and pre-activations.
(We let x
i ≡ x i for the input, dropping the Arabic numeral superscript, and instead use a Greek superscript x α to denote a particular input α ).
Weight and bias parameters for the l th layer have components W lij , b li , which are independent and randomly drawn, and we take them all to have zero mean and variances σ 2 w /N l and σ 2 b , respectively.
GP ( µ, K ) denotes a Gaussian process with mean and covariance functions µ ( · ) , K ( · , · ) , respectively.
2. R EVIEW OF G AUSSIAN P ROCESSES AND S INGLE - LAYER N EURAL N ETWORKS
We brieﬂy review the correspondence between single-hidden layer neural networks and GPs (Neal (1994a;b); Williams (1997)).
The i th component of the network output, z 1 i , is computed as,
[Equation]
where we have emphasized the dependence on input x .
Because the weight and bias parameters are taken to be i.i.d., the post-activations x 1 j , x 1 j (cid:48) are independent for j (cid:54) =
j (cid:48) .
Moreover, since z 1 i ( x ) is a sum of i.i.d terms, it follows from the Central Limit Theorem that in the limit of inﬁnite width N 1 → ∞ , z 1 i ( x ) will be Gaussian distributed.
Likewise, from the multidimensional Central Limit
Theorem, any ﬁnite collection of { z 1 i ( x α =1 ) , ..., z 1 i ( x α = k ) } will have a joint multivariate Gaussian distribution, which is exactly the deﬁnition of a Gaussian process.
Therefore we conclude that z 1 i ∼ GP ( µ 1 , K 1 ) , a GP with mean µ 1 and covariance K 1 , which are themselves independent of i .
Because the parameters have zero mean, we have that µ 1 ( x ) =
E (cid:2)
z 1 i ( x ) (cid:3) = 0 and,
[Equation]
where we have introduced C ( x, x (cid:48) ) as in Neal (1994a); it is obtained by integrating against the distribution of W 0 , b 0 . Note that, as any two z 1 i , z 1 j for i (cid:54) =
j are joint Gaussian and have zero covariance, they are guaranteed to be independent despite utilizing the same features produced by the hidden layer.
2. G AUSSIAN P ROCESSES AND D EEP N EURAL N ETWORKS
The arguments of the previous section can be extended to deeper layers by induction.
We proceed by taking the hidden layer widths to be inﬁnite in succession ( N 1 → ∞ , N 2 → ∞ , etc.)
as we continue with the induction, to guarantee that the input to the layer under consideration is already governed by a GP.
We anticipate the correspondence will hold in the limit in which all widths N l → ∞ simultaneously.
Suppose that z l − 1 j is a GP, identical and independent for every j (and hence x lj ( x ) are independent and identically distributed).
After l − 1 steps, the network computes
[Equation]
As before, z li ( x ) is a sum of i.i.d.
random terms so that, as N l → ∞ , any ﬁnite collection { z 1 i ( x α =1 ) , ..., z 1 i ( x α = k ) } will have joint multivariate Gaussian distribution and z li ∼ GP (0 , K l ) .
The covariance is
[Equation]
By induction, the expectation in Equation (4) is over the GP governing z l − 1 i , but this is equivalent to integrating against the joint distribution of only z l − 1 i ( x ) and z l − 1 i ( x (cid:48) ) .
The latter is described by a zero mean, two-dimensional Gaussian whose covariance matrix has distinct entries K l − 1 ( x, x (cid:48) ) ,
K l − 1 ( x, x ) , and K l − 1 ( x (cid:48) , x (cid:48) ) .
As such, these are the only three quantities that appear in the result.
We introduce the shorthand
[Equation]
to emphasize the recursive relationship between K l and K l − 1 via a deterministic function F whose form depends only on the nonlinearity φ .
This gives an iterative series of computations which can be performed to obtain K L for the GP describing the network’s ﬁnal output.
In Appendix C, we provide an alternative derivation of this GP correspondence, in terms of marginalization over the intermediate layers.
For the base case K 0 , suppose W 0 ij ∼ N (0 , σ 2 w /d in ) , b
j ∼ N (0 , σ 2 b ) ; we can utilize the recursion relating K 1 and K 0 , where
[Equation]
In fact, these recurrence relations have appeared in other contexts.
They are exactly the relations derived in the mean ﬁeld theory of signal propagation in fully-connected random neural networks (Poole et al.
; Schoenholz et al.
and also appear in the literature on compositional kernels (Cho & Saul (2009); Daniely et al.
For certain activation functions, Equation (5) can be computed analytically (Cho & Saul (2009); Daniely et al. (2016)).
In the case of the ReLU nonlinearity, it yields the well-known arccosine kernel (Cho & Saul (2009)) whose form we reproduce in Appendix B.
When no analytic form exists, it can instead be efﬁciently computed numerically, as described in Section 2.5.
2. B AYESIAN T RAINING OF N EURAL N ETWORKS USING G AUSSIAN P ROCESS P RIORS
Here we provide a short review of how a GP prior over functions can be used to do Bayesian inference; see e.g. (Rasmussen & Williams, 2006) for a comprehensive review of GPs.
Given a dataset
D = { ( x 1 , t 1 ) , ..., ( x n , t n ) } consisting of input-target pairs ( x, t ) , we wish to make a Bayesian prediction at test point x ∗ using a distribution over functions z ( x ) .
This distribution is constrained to take values z ≡ ( z 1 , ..., z n ) on the training inputs x ≡ ( x 1 , ..., x n ) and,
[Equation]
where t = ( t 1 , ..., t n ) T are the targets on the training set, and P ( t | z ) corresponds to observation noise.
We will assume a noise model consisting of a Gaussian with variance σ 2 (cid:15) centered at z .
If the conditions of Section 2.2 or 2.3 apply, our choice of prior over functions implies that z 1 , ..., z n , z ∗ are n + 1 draws from a GP and z ∗ , z | x ∗ , x ∼ N (0 , K ) is a multivariate Gaussian whose covariance matrix has the form
[Equation]
where the block structure corresponds to the division between the training set and the test point.
That is, K D , D is an n × n matrix whose ( i, j ) th element is K ( x i , x j ) with x i , x j ∈ D , while e.g. the i th element of K x ∗ , D is K ( x ∗ , x i ) , x i ∈ D .
As is standard in GPs, the integral in Equation 7 can be done exactly, resulting in z ∗ |D , x ∗ ∼ N (¯ µ, ¯ K ) with
[Equation]
[Equation]
) where I n is the n × n identity.
The predicted distribution for z ∗ |D , x ∗ is hence determined from straightforward matrix computations, yet nonetheless corresponds to fully Bayesian training of the deep neural network.
The form of the covariance function used is determined by the choice of GP prior, i.e. the neural network model class, which depends on depth, nonlinearity, and weight and bias variances.
We henceforth resume placing a superscript L as in K L to emphasize the choice of depth for the compositional kernel.
2. E FFICIENT I MPLEMENTATION OF THE GP K ERNEL
Given an L -layer deep neural network with ﬁxed hyperparameters, constructing the covariance matrix K L for the equivalent GP involves computing the Gaussian integral in Equation (4) for all pairs of training-training and training-test points, recursively for all layers.
For some nonlinearities, such as ReLU, this integration can be done analytically.
However, to compute the kernel corresponding to arbitrary nonlinearities, the integral must be performed numerically.
Figure 5 illustrates close agreement between the kernel function computed numerically (as described below) and analytically, for the ReLU nonlinearity.
It also illustrates the angular dependence of the kernel and its evolution with increasing depth.
The most direct implementation of a numerical algorithm for K L would be to compute integrals independently for each pair of datapoints and each layer.
This is prohibitively expensive and costs
O (cid:0) n 2 g L ( n 2 train + n train n test ) (cid:1) , where n 2 g is the sampling density for the pair of Gaussian random variables in the 2D integral and n train , n test are the training and test set sizes, respectively.
However, by careful pipelining, and by preprocessing all inputs to have identical norm, we can improve this cost to O (cid:0) n 2 g n v n c + L ( n 2 train + n train n test ) (cid:1) , where n v and n c are sampling densities for a variance and correlation grid, as described below.
In order to achieve this, we break the process into several steps:
Generate: pre-activations u
=
[ − u max , · · · , u max ] consisting of n g elements linearly spaced between − u max and u max ; variances s =
[0 , · · · , s max ] with n v linearly spaced elements, where s max < u 2max ; and correlations c = ( − 1 , · · · , 1) with n c linearly spaced elements.
Note that we are using ﬁxed, rather than adaptive, sampling grids to allow operations to be parallelized and reused across datapoints and layers.
Populate a matrix F containing a lookup table for the function F φ in Equation (5).
This involves numerically approximating a Gaussian integral, in terms of the marginal variances s and covariances c .
We guarantee that the marginal variance is identical for each datapoint, by preprocessing all datapoints to have identical norm at the input layer, so the number of entries in the lookup table need only be n v n c .
These entries are computed as 3 :
[Equation]
For every pair of datapoints x and x (cid:48) in layer l , compute K l ( x, x (cid:48) ) using Equation (5).
Approximate the function F φ (cid:18) K l − 1 ( x, x (cid:48) ); K l − 1 ( x, x ); K l − 1 ( x (cid:48) , x (cid:48) )
(cid:19) by bilinear interpolation into the matrix F from Step 2, where we interpolate into s using the value of K l − 1 ( x, x ) , and interpolate into c using (cid:0) K l − 1 ( x, x (cid:48) )
/K
l − 1 ( x, x ) (cid:1) .
Remember that K l − 1 ( x, x ) =
K l − 1 ( x (cid:48) , x (cid:48) ) , due to data preprocessing to guarantee constant norm.
Repeat the previous step recursively for all layers.
Bilinear interpolation has constant cost, so this has cost O (cid:0) L ( n 2 train + n train n test ) (cid:1) .
This computational recipe allows us to compute the covariance matrix for the NNGP corresponding to any well-behaved nonlinearity φ .
All computational steps above can be implemented using accelerated tensor operations, and computation of K L is typically faster than solving the system of linear equations in Equation (8)-(9).
Finally, note that the full computational pipeline is deterministic and differentiable .
The shape and properties of a deep network kernel are purely determined by hyperparameters of the deep neural network.
Since GPs give exact marginal likelihood estimates, this kernel construction may allow principled hyperparameter selection, or nonlinearity design, e.g. by gradient ascent on the log likelihood w.r.t.
the hyperparameters.
Although this is not the focus of current work, we hope to return to this topic in follow-up work.
We plan to release an open source implementation of the algorithm after paper de-anonymization.
E XPERIMENTAL R ESULTS 3. D ESCRIPTION
We compare NNGPs with SGD 4 trained neural networks on the permutation invariant MNIST and
CIFAR-10 datasets.
The baseline neural network is a fully-connected network with identical width at each hidden layer.
Training is on the mean squared error (MSE) loss, chosen so as to allow direct comparison to GP predictions.
Formulating classiﬁcation as regression often leads to good results (Rifkin & Klautau, 2004).
Future work may involve evaluating the NNGP on a cross entropy loss using the approach in (Williams & Barber, 1998; Rasmussen & Williams, 2006).
Training used the Adam optimizer (Kingma & Ba (2014)) with learning rate and initial weight/bias variances optimized over validation error using the Vizier hyperparameter tuner (Golovin et al., 2017).
Dropout was not used.
In future work, it would be interesting to incorporate dropout into the NNGP covariance matrix using an approach like that in (Schoenholz et al., 2017).
For the study, nonlinearities were chosen to be either rectiﬁed linear units (ReLU) or hyperbolic tangent (Tanh).
Class labels were encoded as a one-hot, zero-mean, regression target (i.e., entries of -0.1 for the incorrect class and 0.9 for the correct class).
We constructed the covariance kernel numerically for ReLU and Tanh nonlinearities following the method described in Section 2.5.
Performance :
We ﬁnd that the NNGP often outperforms trained ﬁnite width networks, and that trained neural network performance becomes more similar to that of the NNGP with increasing width.
See Table 1 and Figure 1.
Uncertainty : One beneﬁt in using a GP is that, due to its Bayesian nature, all predictions have uncertainty estimates (Equation (9)).
For conventional neural networks, capturing the uncertainty in a model’s predictions is challenging (Gal, 2016).
In the NNGP, every test point has an explicit estimate of prediction variance associated with it (Equation 9).
In our experiments, we observe that the NNGP uncertainty estimate is highly correlated with prediction error (Figure 2).
3. R ELATIONSHIP TO D EEP S IGNAL P ROPAGATION
Several prior works (Poole et al.
; Schoenholz et al.
Daniely et al. (2016); Duvenaud et al.
(2014)) have noted the recurrence relations Equation (5) commonly approach a functionally uninteresting ﬁxed point with depth l → ∞ , in that K ∞ ( x, x (cid:48) ) becomes a constant or piecewise
[Figure]
closely resembles NNGP performance with increasing
[Figure]
constant map.
We now brieﬂy relate our ability to train NNGPs with the convergence of K l ( x, x (cid:48) ) to the ﬁxed-point kernel.
We will be particularly interested in contextualizing our results in relation to Poole et al.
Schoenholz et al.
(2017) which analyzed the ﬁxed points and the approach to them in detail for bounded nonlinearities.
To brieﬂy recapitulate: there are regions of hyperparameter space (called phases) where K ∞ ( x, x (cid:48) ) changes only quantitatively with σ 2 w and σ 2 b .
However, there are low dimensional boundaries that separate different phases and between them the nature of K ∞ ( x, x (cid:48) ) changes qualitatively.
For the Tanh nonlinearity, there are two distinct phases respectively called the “ordered” phase and the “chaotic” phase that can be understood as a competition between the weights and the biases of the network.
A diagram showing these phases and the boundary between them is shown in Figure 3a.
In the ordered phase, the features obtained by propagating an input through the each layer of the recursion become similar for dissimilar inputs.
Fundamentally, this occurs because the different inputs share common bias vectors and so all inputs end up just approaching the random bias.
In this [Table] case the covariance K l ( x, x (cid:48) )
→ q ∗ for every pair of inputs x, x (cid:48) , where q ∗ is a constant that depends only on σ 2 w and σ 2 b .
All inputs have unit correlation asymptotically with depth.
By contrast in the chaotic phase the weight variance σ 2 w dominates and similar inputs become dissimilar with depth as they are randomly projected by the weight matrices.
In this case, the covariance K l ( x, x (cid:48) )
→ q ∗ for x = x (cid:48) but q ∗ c ∗ for x (cid:54) =
x (cid:48) .
Here c ∗ < 1 is the ﬁxed point correlation.
In each of these regimes, there is also a ﬁnite depth-scale ξ which describes the characteristic number of layers over which the covariance function decays exponentially towards its ﬁxed point form.
Exactly at the boundary between these two regimes is a line in ( σ 2 w , σ 2 b ) -space where the decay K l ( x, x (cid:48) ) towards its ﬁxed point is signiﬁcantly slower and non-exponential.
It was noted in Schoenholz et al.
(2017) that this approach to the ﬁxed-point covariance fundamentally bounded whether or not neural networks could successfully be trained.
It was shown that initializing networks on this line allowed for signiﬁcantly deeper neural networks to be trained.
For ReLU networks a similar picture emerges, however there are some subtleties due to the unbounded nature of the nonlinearity.
In this case for all σ 2 w and σ 2 b , K ∞ ( x, x (cid:48) )
=
q ∗ for all x, x (cid:48) and every point becomes asymptotically correlated.
Despite this, there are again two phases: a “bounded” phase in which q ∗ is ﬁnite (and nonzero) and an unbounded phase in which q ∗ is either inﬁnite or zero.
As in the Tanh case there are depth scales that control the rate of convergence to these ﬁxed points and therefore limit the maximum trainable depth.
The phase diagram for the ReLU nonlinearity is also shown in Figure 3b.
In a striking analogy with the trainability of neural networks, we observe that the performance of the
NNGP appears to closely track the structure from the phase diagram, clearly illustrated in Figure 3.
Indeed, we see that as for hyperparameter settings that are far from criticality, the GP is unable to train and we encounter poor test set performance.
By contrast, near criticality we observe that our models display high accuracy.
Moreover, we ﬁnd that the accuracy appears to drop more quickly away from the phase boundary with increase in depth L of the GP kernel, K L .
To understand this effect we note that information about data will be available to our model only through the difference
K L ( x, x (cid:48) )
− K ∞ ( x, x (cid:48) ) .
However, as the depth gets larger, this difference becomes increasingly small and at some point can no longer be represented due to numerical precision.
At this point our test accuracy begins to quickly degrade to random chance.
C ONCLUSION AND F UTURE D IRECTIONS
By harnessing the limit of inﬁnite width, we have speciﬁed a correspondence between priors on deep neural networks and Gaussian processes whose kernel function is constructed in a compositional, but fully deterministic and differentiable, manner.
Use of a GP prior on functions enables exact Bayesian inference for regression from matrix computations, and hence we are able to obtain predictions and [Figure] -based training.
The performance is competitive with the best neural networks (within speciﬁed class of fully-connected models) trained on the same regression task under similar hyperparameter settings.
While we were able to run experiments for somewhat large datasets (sizes of 50k), we intend to look into scalability for larger learning tasks, possibly harnessing recent progress in scalable GPs (Qui ˜ nonero-Candela & Rasmussen (2005); Hensman et al.
We suggest a few additional interesting directions to pursue, among those already mentioned.
In our experiments, we observed the performance of the optimized neural network appears to approach that of the GP computation with increasing width.
Whether gradient-based stochastic optimization implements an approximate Bayesian computation is an interesting question for further investigation.
Recent work (Mandt et al.
(2017)) has suggested that SGD can be made to approximately sample from a Bayesian posterior.
Further study is needed to determine if SGD does approximately implement Bayesian inference under the conditions typically employed in practice.
Additionally, the NNGP provides explicit estimates of uncertainty.
This may be useful in predicting model failure in critical applications of deep learning, or for active learning tasks where it can be used to identify the best datapoints to hand label.
A D RAWS FROM AN NNGP PRIOR
Figure 4 illustrates the nature of the GP prior for the ReLU nonlinearity by depicting samples of 1D functions z ( x ) drawn from a ReLU GP, GP (0 , K L ) , with ﬁxed depth L = 10 and ( σ 2 w , σ 2 b ) = [Figure] t i o n v [Figure]
l [Figure] B A NALYTIC F ORM FOR K ERNEL AND C OMPARISON
[Figure] In the main text [Figure] we noted that the recurrence relation Equation 5 can be computed analytically for certain nonlinearities.
In particular, this was computed in Cho & Saul (2009) for polynomial rectiﬁed nonlinearities.
For ReLU, the result including the weight and bias variance is
[Equation]
To illustrate the angular form of K l ( x, x (cid:48) ) and its evolution with l , in Figure 5 we plot K l ( θ ) for the
ReLU nonlinearity, where θ is the angle between x and x (cid:48) with norms such that || x
|| 2 =
|| x (cid:48)
||
2 =
d in .
We observe a ﬂattening of the angular structure with increase in depth l , as predicted from the understanding in Section 3.2.
Simultaneously, the ﬁgure also illustrates the good agreement between the kernel computed using the numerical implementation of Section 2.5 (blue, starred) and the analytic arccosine kernel, Equation 11 (red), for a particular choice of hyperparameters ( σ 2 w , σ 2 b ) .
C M ARGINALIZATION OVER INTERMEDIATE LAYERS
In this section, we present an alternate derivation of the equivalence between inﬁnitely wide deep neural networks and Gaussian process by marginalization over intermediate layers.
For this derivation, we take the weight and bias parameters to be drawn from independent Gaussians, with zero mean and appropriately scaled variance.
We are interested in ﬁnding the distribution p ( z L | x ) over network outputs z L ∈ R d out × B , conditioned on network inputs x ∈ R d in × B , for input dimensionality d in , output dimensionality d out , and dataset size B .
Intervening layers will have width N l , z l ∈ R N l +1 × B for L > l > 0 .
We deﬁne the second moment matrix (post-nonlinearity) for each layer l to be
[Equation]
Our approach is to think of intermediate random variables corresponding to these second moments deﬁned above.
By deﬁnition, K l only depends on z l − 1 .
In turn, the pre-activations z l are described by a Gaussian process conditioned on the second moment matrix K l ,
[Equation]
where
[Equation]
[Equation]
This correspondence of each layer to a GP, conditioned on the layer’s second moment matrix, is exact even for ﬁnite width N l because the parameters are drawn from a Gaussian.
Altogether, this justiﬁes the graphical model depicted in Figure 6.
We will write p ( z L | x ) as an integral over all the intervening second moment matrices K l ,
[Equation]
[Equation]
This joint distribution can be decomposed as
[Equation]
The directed decomposition in Equation (16) holds because K L is a function only of z L − 1 (see
Equation (12)), z L − 1 depends only on K L − 1 (see Equation (13)), K L − 1 is a function only of z L − 2 , etc.
[Figure]
The sum in Equation (12) for l > 0 is a sum over i.i.d.
terms.
As N l grows large, the Central
Limit Theorem applies, and p (cid:0) K l | K l − 1 (cid:1) converges to a Gaussian with variance that shrinks as 1 N l .
Further, in the inﬁnite width limit it will go to a delta function,
[Equation]
1 (cid:1)(cid:1) , (17) with F ( · ) deﬁned as in Equation (5).
Similarly, the dependence of K 0 on x can be expressed as a delta function,
[Equation]
Substituting p ( z L | K L ) , p (cid:0) K l | K l − 1 (cid:1) and p (cid:0) K 0 | x (cid:1) into Equation (16), we get
[Equation]
..,N
[Equation]
So, in the limit of inﬁnite width, z L | x is a multivariate Normal with kernel (cid:16) G ◦ ( F ◦ G ) L (cid:17)
[Equation]
K
[Equation]
D D ETAILS OF THE E XPERIMENTS
We outline details of the experiments for Section 3.
For MNIST we use a 50k/10k/10k split of the training/validation/test dataset.
For CIFAR-10, we used a 45k/5k/10k split.
The validation set was used for choosing the best hyperparameters and evaluation on the test set is reported.
For training neural networks hyperparameters were optimized via random search on averagetrials for each choice of ( n train , depth, width, nonlinearity).
Random search range : Learning rate was sampled within (10 − 4 , 0 . 2) in log-scale, weight decay constant was sampled from (10 − 8 , 1 . 0) in log-scale, σ w ∈ [0 . 01 , 2 . 5] , σ b ∈ [0 , 1 . 5] was uniformly sampled and mini-batch size was chosen equally among [16 , 32 , 64 , 128 , 256] .
For the GP with given depth and nonlinearity, a grid of 30 points evenly spaced from 0.1 to 5.0 (for σ 2 w ) and 30 points evenly spaced from 0 to 2.0 (for σ 2 b ) was evaluated to generate the heatmap.
The best GP run was chosen among the 900 evaluations in the σ 2 w - σ 2 b grid.
Computation time : We report computation times for NNGP experiments.
The grid generation with took 440-460s with 6 CPUs for n g = 501 , n v = 501 , n c = 500 , which was amortized over all the experiments.
For full (50k) MNIST, constructing K DD for each layer took 90-140s (depending on CPU generation) running on 64 CPUs. Solving linear equations via Cholesky decomposition took 180-220s for 1000 test points. Details of NNGP implementaion : For all the experiments we used pre-computed lookup tables F with n g = 501 , n v = 501 , n c = 500 , and s max = 100 .
Default value for the target noise σ 2 (cid:15) was set to 10 − 10 and was increased by factor of 10 when Cholesky decomposition failed while solving
Equation (8) and (9).
We refer to Rasmussen & Williams (2006) for standard numerically stable implementation of GP regression.
E F URTHER RESULTS
Here we include more results from experiments described in Section 3.
Uncertainty : Relationship between the target MSE and the GP’s uncertainty estimate for smaller training set size is shown in Figure 7.
Performance : Performance of grid points of σ 2 w - σ 2 b for varying depth is shown in Figure 8.
The best performing NNGP’s hyperparameters are distributed near the critical line (Figure 9) where the phase changes as described in Section 3.2. [Figure] [Figure] [Table]
[Figure]
[Figure]
[Table]
CIFAR:
NN-1-100-1.26-0.
NN-1-2000-0.11-0.
GP-20-1.79-0.
GP-7-3.65-0.
CIFAR:1k
NN-5-500-1.29-0.
NN-1-200-1.45-0.
GP-7-1.28-0.
GP-50-2.97-0.
CIFAR:2k
NN-3-5000-5.59-0.
NN-5-1000-0.86-1.
GP-3-4.16-1.
GP-5-4.66-1.
CIFAR:5k
NN-5-2000-5.26-1.
NN-1-5000-0.07-0.
GP-3-4.66-1.
GP-10-3.65-1.
CIFAR:10k
NN-5-2000-1.60-1.
NN-1-500-1.48-1.
GP-5-2.97-0.
GP-7-3.48-2.
CIFAR:20k
NN-3-5000-4.18-0.
NN-2-5000-0.02-1.
GP-3-5.00-0.
GP-7-3.14-1.
CIFAR:45k
NN-3-5000-0.53-0.
[Table]