Random Neural Networks in the Infinite Width Limit as Gaussian Processes
Boris Hanin
Introduction
In the last decade or so neural networks, originally introduced in the 1940’s and 50’s , have become indispensable tools for machine learning tasks ranging from computer vision to natural language processing and reinforcement learning . Their empirical success has raised many new mathematical questions in approximation theory , probability (see §1.2.2 for some references), optimization/learning theory and so on. The present article concerns a fundamental probabilistic question about arguably the simplest networks, the so-called fully connected neural networks, defined as follows:
This article considers the mapping when the network’s weights and biases are chosen independently at random and the hidden layer widths are sent to infinity while the input dimension output dimension , and network depth are fixed. In this infinite width limit, akin to the large matrix limit in random matrix theory (see §1.2), neural networks with random weights and biases converge to Gaussian processes (see §1.4 for a review of prior work). Unlike prior work Theorem 1.2, our main result, is that this holds for general non-linearities and distributions of network weights (cf §1.3).
Moreover, in addition to establishing convergence of wide neural networks to a Gaussian process under weak hypotheses, the present article gives a mathematical take aimed at probabilists of some of the ideas developed in the recent monograph . This book, written in the language and style of theoretical physics by Roberts and Yaida, is based on research done jointly with the author. It represents a far-reaching development of the breakthrough work of Yaida , which was the first to systematically explain how to compute finite width corrections to infinite width Gaussian process limit of random neural networks for arbitrary depth, width, and non-linearity. Previously, such finite width (and large depth) corrections were only possible for some special observables in linear and ReLU networks . The present article deals only with the asymptotic analysis of random neural networks as the width tends to infinity, leaving to future work a probabilistic elaboration of the some aspects of the approach to finite width corrections from .
The rest of this article is organized as follows. First, in §1.2 we briefly motivate the study of neural networks with random weights. Then, in §1.3 we formulate our main result, Theorem 1.2. Before giving its proof in §2, we first indicate in §1.4 the general idea of the proof and its relation to prior work.
2 Why Random Neural Networks?
Beyond illuminating the properties of networks at the start of training, the analysis of random neural networks can reveal a great deal about networks after training as well. Indeed, on a heuristic level, just as the behavior of the level spacings of the eigenvalues of large random matrices is a surprisingly good match for emission spectra of heavy atoms , it is not unreasonable to believe that certain coarse properties of the incredibly complex networks used in practice will be similar to those of networks with random weights and biases. More rigorously, neural networks used in practice often have many more tunable parameters (weights and biases) than the number of datapoints from the training dataset. Thus, at least in certain regimes, neural network training provably proceeds by an approximate linearization around initialization, since no one parameter needs to move much to fit the data. This so-called NTK analysis shows, with several important caveats related to network size and initialization scheme, that in some cases the statistical properties of neural networks at the start of training are the key determinants of their behavior throughout training.
2.2 Motivation from Random Matrix Theory
Finally, beyond studying linear networks, random matrix theory questions naturally appear in neural network theory via non-linear analogs of the Marchenko-Pastur distribution for empirical covariance matrices of when ranges over a random dataset of inputs as well as through the spectrum of the input-output Jacobian and the NTK .
3 Main Result
We further assume the network biases are iid GaussianAs explained in §1.4 the universality results in this article are simply not true if the biases are drawn iid from a fixed non-Gaussian distribution. and independent of the weights:
for this limiting process satisfies the layerwise recursion
where the distribution of is determined via (1.3) by the distribution of weights and biases in the first layer and hence is not universal.
We prove Theorem 1.2 in §2. First, we explain the main idea and review prior work.
4 Theorem 1.2: Discussion, Main Idea, and Relation to Prior Work
At a high level, the proof of Theorem 1.2 (specifically the convergence of finite-dimensional distributions) proceeds as follows:
Conditional on the mapping , the components of the neural network output are independent sums of independent random fields (see (1.3)), and hence, when is large, are each approximately Gaussian by the CLT.
The conditional covariance in the CLT from step is random at finite widths (it depends on ). However, it has the special form of an average over of the same function applied to each component of the vector of pre-activations at the last hidden layer. We call such objects collective observables (see §2.1.2 and (1.10)).
The LLN from step 3 allows us to replace the random conditional covariance matrix from steps 1 and 2 by its expectation, asymptotically as tend to infinity.
We turn to giving a few more details on steps 1-4 and reviewing along the way the relation of the present article to prior work. The study of the infinite width limit for random neural networks dates back at least to Neal , who considered networks with one hidden layer:
where In the shallow setting of Neal if in addition , then neglecting the bias for the moment, the scalar field is a sum of iid random fields with finite moments, and hence the asymptotic normality of its finite-dimensional distributions follows immediately from the multidimensional CLT. Modulo tightness, this explains why ought to converge to a Gaussian field. Even this simple case, however, holds several useful lessons:
If the distribution of the bias is fixed independent of is and non-Gaussian, then the distribution of will not be Gaussian, even in the limit when .
If the first layer biases are drawn iid from a fixed distribution and is non-linear, then higher moments of will contribute to the variance of each neuron post-activation , causing the covariance of the Gaussian field at infinite width to be non-universal.
Unlike in deeper layers, as long as is fixed, the distribution of each neuron pre-activation in the first layer will not be Gaussian, unless the weights and biases in layer are themselves Gaussian. This explains why, in the initial condition (1.8) the distribution is non-Gaussian in the first layer.
In light of the first two points, what should one assume about the bias distribution? There are, it seems, two options. The first is to assume that the variance of the biases tends to zero as , putting them on par with the weights. The second, which we adopt in this article, is to declare all biases to be Gaussian.
The first trick in proving Theorem 1.2 for general depth and width appears already when but the output dimension is at least two.Neal states erroneously on page 38 of his thesis that and will be independent because the weights going into them are independent. This is not true at finite width but becomes true in the infinite width limit. In this case, even for a single network input , at finite values of the network width different components of the random -dimensional vector are not independent, due to their shared dependence on the vector . The key observation, which to the author’s knowledge was first presented in , is to note that the components of are independent conditional on the first layer (i.e. on ) and are approximately Gaussian when is large by the CLT. The conditional variance, which captures the main dependence on , has the following form:
This is an example of what we’ll call a collective observable, an average over all neurons in a layer of the same function applied to the pre-activations at each neuron (see §2.1.2 for the precise definition). In the shallow setting, is a sum of iid random variables with finite moments. Hence, by the LLN, it converges almost surely to its mean as . This causes the components of to become independent in the infinite width limit, since the source of their shared randomness, , can be replaced asymptotically by its expectation.
We conclude this section by pointing the reader to several other related strands of work. The first are articles such as , which quantify the magnitude of the difference
The second is the series of articles starting with the work of Yang , which develops the study not only of initialization but also certain aspects of inference with infinitely wide networks using what Yang terms tensor programs. As part of that series, the article establishes that in the infinite width limit many different architectures become Gaussian processes. However, the arguments in those articles are significantly more technical than the ones presented here since they are focused on building the foundation for the tensor program framework. At any rate, to the best of the author’s knowledge, no prior article addresses universality of the Gaussian process limit with respect to the weight distribution in deep networks (for shallow networks with this was considered by Neal in ). Finally, that random neural networks converge to Gaussian processes in the infinite width limit under various restrictions but for architectures other than fully connected is taken up in .
Proof of Theorem 1.2
Let us recall the notation. Namely, we fix a network depth , an input dimension an output dimension , hidden layer widths and a non-linearity satisfying (2.5). We further assume that the networks weights and biases are independent and random as in (1.4) and (1.6). To prove Theorem 1.2 we must show that the random fields converge weakly in distribution to a Gaussian process in the limit where tend to infinity. We start with the convergence of finite-dimensional distributions. Let us therefore fix a collection
between the entries in each row satisfies the recursion (1.7) with initial condition (1.8).
𝐿1z_{\alpha}^{(L+1)}). For every there exists so that
We continue to assume (as in the statement of Theorem 1.2) that all biases are Gaussian:
is the matrix defined by the recursion (1.7) with initial condition (1.8). Writing
where for any the conditional covariance is
Using (2.4) and the explicit form of the characteristic function of a Gaussian reveals
The crucial observation is that each entry of the conditional covariance matrix is an average over of the same fixed function applied to the vector . While are not independent at finite values of for , they are sufficiently weakly correlated that a weak law of large numbers still holds:
Fix . There exists a PSD matrix
Lemma 2.3 is a special case of Lemma 2.4 (see §2.1.2). ∎
Lemma 2.3 implies that converges in distribution to . In view of (2.6) and the definition of weak convergence this immediately implies (2.2). It therefore remains to check that satisfies the desired recursion. For this, note that at any values of we find
where the law of is determined by the distribution of weights in layer and does not depend on . This confirms the initial condition (1.8). Otherwise, if , the convergence of finite-dimensional distributions that we’ve already established yields
Since is continuous we may invoke the continuous mapping theorem to conclude that
1.2 Collective Observables with Gaussian Weights: Generalizing Lemma 2.3
Hence, we have the following convergence in probability
Hence, have finite moments since are iid Gaussian and are mean with finite higher moments. In particular, since is polynomially bounded, we find for every that
which is finite and independent of , confirming (2.7). Further, is the average of iid random variables with all moments finite. Hence, (2.8) follows by the weak law of large numbers, completing the proof of the base case.
Since the weights and biases in layer are Gaussian and independent of , we find
where is the conditional covariance defined in (2.5) and is an -dimensional standard Gaussian. The key point is that is a collective observable at layer . Hence, by the inductive hypothesis, there exists a PSD matrix such that converges in probability to as . To establish (2.7) it therefore suffices in view of (2.9) to check that
where the right hand side is finite since is polynomially bounded and all polynomial moments of are finite. To establish (2.11), let us invoke the Skorohod representation theorem to find a common probability space on which there are versions of – which by an abuse of notation we will still denote by – that converge to almost surely. Next, note that since is polynomially bounded we may repeatedly apply to find
where is a polynomial in the entries of , a polynomial in the entries of , and the polynomials don’t depend on . The continuous mapping theorem shows that
Thus, since all moments of Gaussian are finite, (2.11) follows from the generalized dominated convergence theorem. It remains to argue that (2.8) holds at layer . To do this, we write
since we already showed that (2.7) holds at layer . Next, recall that, conditional on , neurons in layer are independent. The law of total variance and Cauchy-Schwartz yield
Using (2.10) and the polynomial estimates (2.12) on , we conclude that the conditional expectation on the previous line is some polynomially bounded function of the components of . Hence, we may apply dominated convergence as above to find
1.3 Proof of Proposition 2.1 for General Weights
To check (2.15), let us define an intermediate object:
where the entries of are iid Gaussian with mean and variance . That is, we take the vector of post-activations from layer obtained by using general weights in layers and use Gaussian weights only in layer . Our first step in checking (2.15) is to show that it this relation holds when is replaced by .
This is a standard Lindeberg swapping argument. Namely, for each and define
where the first entries of each row of are iid Gaussian with mean and variance , while the remaining entries are times iid draws from the general distribution of network weights, as in (1.4) and (1.5). With this notation, we have
consider the third order Taylor expansion of around .
where . Then, Taylor expanding to third order around and, using that the first two moments of match those of , we find that
To make use of Lemma 2.5 let us consider any collective observable at layer . Recall that by (2.9) and (2.13) both the mean and variance of depend only on the distributions of finitely many components of the vector . By the inductive hypothesis we therefore find
where the right hand side means that we consider the same collective observable but for instead of , which exists by Lemma 2.4. Similarly, again using Lemma 2.4, we have
This follows from (2.17) and the inductive hypothesis. Indeed, by construction, conditional on the filtration defined by weights and biases in layers up to (see (2.3)), the -dimensional vectors are iid Gaussians:
where is the conditional covariance matrix from (2.5). The key point, as in the proof with all Gaussian weights, is that each entry of the matrix is a collective observable at layer . Moreover, since the weights and biases in the final layer are Gaussian for the conditional distribution of given is completely determined by . In particular, since is bounded and continuous, we find that
2 Tightness: Proof of Proposition 2.2
In this section, we provide a proof of Proposition 2.2. In the course of showing tightness, we will need several elementary Lemmas, which we record in the §2.2.1. We then use them in §2.2.2 to complete the proof of Proposition 2.2.
In particular, for some constant depending on , we have
The second Lemma we need is an elementary inequality.
Let be real numbers and be an integer. We have
Further, breaking into cases depending on whether or we find that
Combining (2.21) with (2.22) we see as desired that any
The next Lemma is also an elementary estimate.
Fix an integer , and suppose are non-negative random variables. There exists a positive integer such that
The proof is by induction on . For the base cases when , we may take and when we may take by Cauchy-Schwartz. Now suppose we have proved the claim for all for some . Note that . So we may use Cauchy-Schwartz and the inductive hypothesis to obtain
where . ∎
The next Lemma is an elementary result about the moments of marginals of iid random vectors.
We will use the following result of Łatała [33, Thm. 2, Cor. 2, Rmk. 2]. Suppose are independent random variables and is a positive even integer. Then
where means bounded above and below up to universal multiplicative constants. Let us fix a unit vector and apply this to . Since have mean and is even we find
Note that for each we have
Hence, using that we find
Note that for , there is a universal constant so that
Thus, there exists a constant so that
Combining this with (2.23) completes the proof. ∎
The final Lemma we need is an integrability statement for the supremum of certain non-Gaussian fields over low-dimensional sets.
The proof is a standard chaining argument. For each write for the closest point to in a net in and assume without loss of generality that the diameter of is bounded above by and that for all . We have using the usual chaining trick that
By Lemma 2.8, there exists depending only on so that for any we have
We seek to bound each expectation on the right hand side in (2.26). To do this, write
Note that the supremum is only over a finite set of cardinality at most
for some depending only . This is because, by assumption is the image of under a -Lipschtiz map and Lipschitz maps preserve covering numbers. Thus, by a union bound,
But for any and any we have
Putting this all together we find for any that
Thus, substituting this into (2.25) yields
Appealing to Lemma 2.9 completes the proof of Lemma 2.10. ∎
2.2 Proof of Proposition 2.2 Using Lemmas from §2.2.1
Fix and define
Write for the -th row of and for the -th component of . Since and is absolutely continuous, we have
Since is polynomially bounded by assumption (1.2), we find by Markov’s inequality that there exists an even integer so that for any
Our goal is now to show that the numerator in (2.30) is bounded above by a constant that depends only on . For this, let us fix any and apply Lemma 2.7 as follows:
Substituting this and the analogous estimate for into (2.30), we see that since all moments of the entries of the weights and biases exist, there exists a constant depending on so that
Substituting this into (2.31) and taking sufficiently large completes the proof of Lemma 2.6. ∎
with probability at least . Thus, the image
Proceeding in this way, with probability at least we that
Since is fixed and finite, this confirms (2.27). It remains to check the uniform boundedness condition in (2.1). For this note that for any fixed by Lemma 2.4, we have
Thus, by Markov’s inequality, is bounded above with high probability. Combined with the equi-Lipschitz condition , which we just saw holds with high probability on , we conclude that for each there exists so that