Limitations of Lazy Training of Two-layers Neural Networks
Behrooz Ghorbani, Song Mei, Theodor Misiakiewicz, Andrea Montanari
Introduction
The function class of two-layers neural networks (with neurons) is defined by:
These facts lead to the following central question in neural network theory:
Here ‘efficiently’ can be formalized in multiple ways: in this paper we will focus on learning via stochastic gradient descent.
Significant amount of work has been devoted to two subclasses of which we will refer to as the random feature model () [RR08], and the neural tangent model () [JGH18]:
We can think of and as tractable inner bounds of the class of neural networks :
Tractable. Both , are finite-dimensional linear spaces, and minimizing the empirical risk over these classes can be performed efficiently.
Inner bounds. Indeed : the random feature model is simply obtained by fixing all the first layer weights. Further (the closure of the class of neural networks with neurons). This follows from as .
It is possible to show that the class of neural networks is significantly more expressive than the two linearization , , see e.g. [YS19, GMMM19]. In particular, [GMMM19] shows that, if the feature vectors are uniformly random over the -dimensional sphere, and are large with , then can only capture linear functions, while can only capture quadratic functions.
In this paper we explore systematically the gap between , and , by considering two specific data distributions:
Quadratic functions: feature vectors are distributed according to and responses are quadratic functions with .
Mixture of Gaussians: with equal probability , and , .
Let us emphasize that the choice of quadratic functions in model qf is not arbitrary: in a sense, it is the most favorable case for training. Indeed [GMMM19] proves thatNote that [GMMM19] considers feature vectors uniformly random over the sphere rather than Gaussian. However, the results of [GMMM19] can be generalized, with certain modifications, to the Gaussian case. Roughly speaking, for Gaussian features, with neurons can represent quadratic functions, and a low-dimensional subspace of higher order polynomials. (when ): Third- and higher-order polynomials cannot be approximated nontrivially by ; Linear functions are already well approximated within .
For clarity, we will first summarize our result for the model qf, and then discuss generalizations to mg. The prediction risk achieved within any of the regimes , , is defined by
Our results are summarized by Figure 1, which compares the risk achieved by the three approaches above in the population limit , using quadratic activations . We consider the large-network, high-dimensional regime , with . Figure 1 reports the risk achieved by various approaches in numerical simulations, and compares them with our theoretical predictions for each of three regimes , , and , which are detailed in the next sections.
The agreement between analytical predictions and simulations is excellent but, more importantly, a clear picture emerges. We can highlight a few phenomena that are illustrated in this figure:
Random features do not capture quadratic functions. The random features risk remains generally bounded away from zero for all values of . It is further highly dependent on the distribution of the weight vectors . Section 2.1 characterizes explicitly this dependence, for general activation functions . For large , the optimal distribution of the weight vectors uses covariance , but even in this case the risk is bounded away from zero unless .
Fully trained neural networks achieve vanishing risk on quadratic functions for : this is to be expected on the basis of the previous point. For the risk is generally bounded away from , but its value is smaller than for the neural tangent model. Namely, in Section 2.3 we give an explicit expression for the asymptotic risk (holding for ) implying that, for some (independent of ),
The picture emerging from these findings is remarkably simple. The fully trained network learns the most important eigendirections of the quadratic function and fits them, hence surpassing the model which is confined to a random set of directions.
Let us emphasize that the above separation between and is established only for . It is natural to wonder whether this separation generalizes to for more complicated classes of functions, or if instead it always vanishes for wide networks. We expect the separation to generalize to by considering higher order polynomial, instead of quadratic functions. Partial evidence in this direction is provided by [GMMM19]: for third- or higher-order polynomials does not achieve vanishing risk at any . The mechanism unveiled by our analysis of quadratic functions is potentially more general: neural networks are superior to linearized models such as or , because they can learn a good representation of the data.
2 Further related work
The connection (and differences) between two-layers neural networks and random features models has been the object of several papers since the original work of Rahimi and Recht [RR08]. An incomplete list of references includes [Bac13, AM15, Bac17a, Bac17b, RR17]. Our analysis contributes to this line of work by establishing a sharp asymptotic characterization, although in more specific data distributions. Sharp results have recently been proven in [GMMM19], for the special case of random weights uniformly distributed over a -dimensional sphere. Here we consider the more general case of anisotropic random features with covariance . This clarifies a key reason for suboptimality of random features: the data representation is not adapted to the target function . We focus on the population limit . Complementary results characterizing the variance as a function of are given in [HMRT19].
The model (3) is much more recent [JGH18]. Several papers show that SGD optimization within the original neural network is well approximated by optimization within the model as long as the number of neurons is large compared to a polynomial in the sample size [DZPS18, DLL+18, AZLS18, ZCZG18]. Empirical evidence in the same direction was presented in [LXS+19, ADH+19].
Chizat and Bach [CB18] clarified that any nonlinear statistical model can be approximated by a linear one in an early (lazy) training regime. The basic argument is quite simple. Given a model with parameters , we can Taylor-expand around a random initialization . Setting , we get
Here the second approximation holds since, for many random initializations, because of random cancellations. The resulting model is linear, with random features.
Our objective is complementary to this literature: we prove that and have limited approximation power, and significant gain can be achieved by full training.
Finally, our analysis of fully trained networks connects to the ample literature on non-convex statistical estimation. For two layers neural networks with quadratic activations, Soltanolkotabi, Javanmard and Lee [SJL19] showed that, as long as the number of neurons satisfies there are no spurious local minimizers. Du and Lee [DL18] showed that the same holds as long as where is the sample size. Zhong et. al. [ZSJ+17] established local convexity properties around global optima. Further related landscape results include [GLM17, HYV14, GJZ17].
Main results: quadratic functions
As mentioned in the previous section, our results for quadratic functions (qf) assume and where
We consider random feature model with first-layer weights . We make the following assumptions:
Then, the following holds as with :
Moreover, assuming to have a limit as , (10) simplifies as follows for :
Notice that is the risk normalized by the risk of the trivial predictor . The asymptotic result in (11) is remarkably simple. By Cauchy-Schwartz, the normalized risk is bounded away from zero even as the number of neurons per dimension diverges , unless , i.e. the random features are perfectly aligned with the function to be learned. For isotropic random features, the right-hand side of Eq. (11) reduces to . In particular, performs very poorly when , and no better than the trivial predictor if .
Notice that the above result applies to quite general activation functions. The formulas simplify significantly for quadratic activations.
Under the assumptions of Theorem 1, further assume . Then we have, as with :
The right-hand side of Eq. (12) is plotted in Fig. 1 for isotropic features , and for optimal features .
2 Neural tangent
For the regime, we focus on quadratic activations and isotropic weights .
where the expectation is taken over .
3 Neural network
For the analysis of SGD-trained neural networks, we assume to be a quadratic function as per Eq. (8), but we will now restrict to the positive semidefinite case . We consider quadratic activations , and we fix the second layers weights to be :
Notice that we use an explicit offset to account for the mismatch in means between and . It is useful to introduce the population risk, as a function of the network parameters :
Here expectation is with respect to . We will study a one-pass version of SGD, whereby at each iteration we perform a stochastic gradient step with respect to a fresh sample
Then we have (probability is over the initialization and the samples)
where are the ordered eigenvalues of .
The proof of this theorem depends on the following proposition concerning the landscape of the population risk, which is of independent interest.
Let be a quadratic function as per Eq. (8), with . For any sub-level set of the risk function , there exists constants such that is -strict saddle in the region . Namely, for any with , we have .
We can now compare the risk achieved within the regimes , and . Gathering the results of Corollary 1, and Theorems 2, 3 (using for and ), we obtain
As anticipated, learns the most important directions in , while , do not.
Main results: mixture of Gaussians
In this section, we consider the mixture of Gaussian setting (mg): with equal probability , and , . We parametrize the covariances as and , and will make the following assumptions:
There exists constants such that ;
.
The scaling in assumption M2 ensures the signal-to-noise ratio to be of order one. If the eigenvalues of are much larger than , then it is easy to distinguish the two classes with high probability (they are asymptotically mutually singular). If then no non-trivial classifier exists.
As mentioned in the introduction, the picture emerging from our analysis of the mg model is aligned with the results obtained in the previous section. We will limit ourselves to stating the results without repeating comments that were made above. Our results are compared with simulations in Figure 2. Notice that, in this case, the Bayes error (MMSE) is not achieved even for very wide networks either by or .
As in the previous section, we generate random first-layer weights . We consider a general activation function satisfying condition . We make the following assumption on :
Define , . Then, the following holds as with :
Moreover, assume to have limits as , i.e. we have for . Then the following holds as :
2 Neural tangent
For the model, we first state our theorem for general and and then give an explicit concentration result in the case and isotropic weights .
Assuming further that and , we have as with :
In particular, for , we have (for almost every )
3 Neural network
We consider quadratic activations with general offset and coefficients . This is optimized over and .
Let us emphasize that, for this setting, we do not have a convergence result for SGD as for the model qf, cf. Theorem 3. However, because of certain analogies between the two models, we expect a similar result to hold for mixtures of Gaussians.
We can now compare the risks achieved within the regimes , and . Gathering the results of Theorems 4, 5 and 6 for and (using for RF and NT), we obtain
We recover a similar behavior as in the case of the (qf) model: learns the most important directions of , while , do not. Note that the Bayes error is not achieved in this model.
Numerical Experiments
For the experiments illustrated in Figures 1 and 2, we use feature size of , and number of hidden units . and models are trained with SGD in TensorFlow [ABC+16]. We run a total of SGD steps for each (qf) model and steps for each (mg) model. The SGD batch size is fixed at and the step size is chosen from the grid where the hyper-parameter that achieves the best fit is used for the figures. models are fitted directly by solving KKT conditions with observations. After fitting the model, the test error is evaluated on fresh samples. In our figures, each data point corresponds to the test error averaged over models with independent realizations of .
For (qf) experiments, we choose to be diagonal with diagonal elements chosen i.i.d from standard exponential distribution with parameter . For (mg) experiments, is also diagonal with the diagonal element chosen uniformly from the set .
Acknowledgements
This work was partially supported by grants NSF DMS-1613091, CCF-1714305, IIS-1741162, and ONR N00014-18-1-2729, NSF DMS-1418362, NSF DMS-1407813.
References
Appendix A Technical background
A.2 Notations
Appendix B Proofs for quadratic functions
Our results for quadratic functions (qf) assume and where
Note that it is easy to see from the proof that the result stays the same if we add an offset .
where , and , with
Simply write the KKT conditions. The optimum is achieved at . ∎
B.1.2 Approximation of kernel matrix 𝑼𝑼{\boldsymbol{U}}
where independently. Assume conditions A1 and A2 hold.
Then we have as and ,
Step 1. Hermite expansion of for . Denote . First notice that by a change of variables, we get
By Assumption A1, there exists such that
Denote the Hermite expansion of to be
By dominated convergence theorem, we have
In addition, by sub-Gaussianity of the norm of a multivariate Gaussian random variable (see [Ver10]), it is easy to show that
Step 2. Expansion of . Denote , then we have
Step 3. Term . By definition of , we have
Recall the change of variable (22) and do a first order Taylor expansion of the exponential: there exists a function such that
We see that the integrand goes to zero as . For sufficiently small, we have
Furthermore, for with , we have
where the last equality comes from assumption A2. We get
Step 4. Term . For , we have
By the uniform convergence of to , cf Eq. (24), we have
where we denoted by the matrix with columns . Hence, we have
Step 5. Term . We have
By the uniform convergence of to , we have
Moreover, by the estimates in proof of Theorem 2.1 in [EK+10], we have
Step 6. Term . Denote the diagonal matrix composed of diagonal entries of . We have
Step 7. Term . We have
Combining the bounds (27), (28), (29), (30) and (31) into the decomposition (25) proves the lemma. ∎
B.1.3 Approximation of the 𝑽𝑽{\boldsymbol{V}} vector
Under the assumptions of Theorem 1, define with
where independently. Then as with , we have
where is the projection on the hyperplane orthogonal to , and we recall the definition of of Lemma 2:
with a standard normal random variable.
We define the following interpolating variables:
and the associated vectors , and . We bound successively the distance between these vectors. We will denote by the projection onto vector . First, we consider:
One can check, using a similar argument as for Eq. (26) and dominated convergence, that
Let us first show that the sum is bounded with high probability: denoting , classical sub-Gaussian concentration inequalities (see for example Theorem 6.3.2 in [Ver10]) shows that
where denotes the sub-Gaussian Orlicz norm. By assumption, we have , and . Hence, for , we have
Furthermore, we readily have (for example from (23))
Noticing that and by the same argument as for (34), we have:
By assumption A2, we have and
Combining the bounds (36), (37) and (39) into (33), we get
which, combined with (39) and (41), yields
where . Combining the above three bounds (33), (42) and (43) yields the desired result. ∎
The following proposition is stated in slightly more general terms, in order to be used in both the proofs of Theorem 1 and Theorem 4.
where is the empirical distribution of eigenvalues of .
The proof of Proposition 2 is a direct combination of Lemma 4, 5, and 6 below.
Let independently. Assume condition A2 holds (resp. B2). Let , and , where and are constants that are asymptotically upper and lower bounded by strictly positive constants. Then as and , we have
We first prove the lemma under the following extra assumption on the covariance matrix: there exists a (fixed) integer such that
for some orthogonal matrix and . Furthermore, there exists an such that for sufficiently large.
Without loss of generality, we assume , and we divide into vectors corresponding to each block
Using the fact that is independent of for , the following two sets of random variables have the same distribution:
Since as , we have
Combining (47), (48) and (49) proves the lemma in the case of a covariance of the form (46):
Step 4. From discrete to continuous spectrum.
We consider a covariance matrix verifying assumption A2. For a given and sufficiently large, we consider a matrix obtained from by binning its eigenvalues to at most points of , such that we have and (recall that by assumption). Such a matrix always exists from the condition and the weak convergence of the spectrum of .
Furthermore, using , we have
Noticing that , and using (50) applied to , we get for sufficiently large:
Taking a sequence and such that shows that this is equivalent to
Taking , we deduce that this is equivalent to
Substituting (52) and (53) in (51) concludes the proof. ∎
Under the same setting as Proposition 2, we have
Define . Then we have
By Sherman Morrison Woodbury formula, we have
In the following, we give an asymptotic expression for .
Let . We have almost surely
In addition, assume is the limiting spectral distribution of . Then, we have almost surely
We know due to fast concentration of around one (see e.g. [BLM13]), vanish exponentially fast in (equivalently in since is fixed to be ).
Now, let’s consider . . By Hanson-Wright inequality (see e.g. [BLM13]), we have
B.1.5 Proof of Theorem 1
By Lemma 1, the risk has a representation
B.2 Neural Tangent model: proof of Theorem 2
We can rewrite the neural tangent model with a squared non-linearity as
where for . We readily deduce that
The last term of the sum (65) is also derived by first conditioning on . Let us denote and the projections of on the hyperplane perpendicular to , on which is uniformly distributed over the unit sphere. We decompose into two components: one along that we denote and one perpendicular to , denoted . Then we have:
where we used the same argument as for (66). Plugging the above limits (66), (67) and (68) in the expansion (65), we get
The above formula for the risk Eq. (69) has two terms that corresponds to the two limits (e.g. spiked matrix)
and (i.e. )
B.3 Neural Network model: proof of Theorem 3
We consider two-layers neural networks with quadratic activation function and we fix the second layer weights to ,
We consider the ground truth function to be a quadratic function as per Eq. (20), and the risk function defined by
We consider running SGD dynamics upon the risk function for a fresh sample for each iteration
The infimum of over is equivalent to the low-rank approximation problem of matrix in Frobenius norm, with rank less or equal to , and is given by the Eckart-Young-Mirsky theorem (see [EY36]). ∎
B.3.2 Landscape: proof of Proposition 1
Without loss of generality, throughout the proof, we assume that is diagonal and . Our first proposition characterizes the critical points of .
Then for any critical point of , there exists a projection matrix for some injection , such that is diagonal and satisfy
We consider the gradient of this function. We get:
By the stationary condition, at a critical point , we must have:
This is of the form of the eigenvalue equation of matrix . Hence we must have the columns of to be a set of eigenvectors and to be positive eigenvalues of . This proves the proposition. ∎
Note the global minimizers are attained for corresponding to the directions of with the largest eigenvalues. We prove in the following proposition that stationary points that are not global minimizers are strict saddle points.
Define the spectral separation of as
and the minimum strictly positive eigenvalue of .
Consider a stationary point of but not a global minimizer. Then, we have
Let us first compute the Hessian of the risk with respect to the variable. We have
Plugging the value of at a critical point (cf Eq. (70)), we get
Case 1: Consider the case . Then there exists an such that (recall that we assumed diagonal , with diagonal elements given by the positive eigenvalues of ) and . For simplicity, let us permute the coordinates so that . The singular value decomposition of verifies
We have and . Plugging these matrices in the above expression of the Hessian, see Eq. (73), we get
Case 2: Consider the case when and does not correspond to the largest eigenvalues of . Then there exists , such that , and . For simplicity, let us permute the coordinates such that and . The SVD decomposition of now verifies:
We have . Plugging these matrices in the above expression of the Hessian (73), note
First, remark that has compact sub-level sets. The proposition then follows from Proposition 4 and the continuity of the gradient and of the minimum eigenvalue of the Hessian . ∎
B.3.3 Dynamics
The following lemma is a standard combination of Lojasiewicz inequality and center and stable manifold theorem. We prove it for completeness.
Then for (Lebesgue) almost all initialization , there exists a second order local minimizer , such that
Step 1. Show convergence to a critical point. Since is an analytic function, by Lojasiewicz inequality [Loj82], and the fact that the level set of is compact, we have
for some critical point of .
Step 2. Show convergence to a local minimizer. In this step, we proceed similarly to the proof of Theorem 3 in [PP16]. First, consider a sublevel set
Then we have compact. Since is an analytic function, is Lipschitz in the compact set . We define the map , where is defined as the solution of
By Picard’s existence and uniqueness theorem, we have is a diffeomorphism from to for any . Fix an , and we define .
Let be a strict saddle point of , then must be an unstable fixed point of the diffeomorphism . By center and stable manifold theorem (such as Theorem 9 in [PP16]), there exists a manifold of dimension at most , and a ball centered at with radius , such that we have the following facts:
;
If for all , we have (here means composition of for times).
We consider the union of the balls associated to all the strict saddle points of in
Due to Lindelof’s lemma, we can find a countable subcover for , i.e., there exists fixed-points such that . If gradient descent converges to a strict saddle point, starting from a point , there must exist a and such that for all . By center and stable manifold theorem, we get that . By setting and we get that for all . Hence the set of initial points in such that gradient descent converges to a strict saddle point is a subset of
The following lemma is standard, and a corollary of Theorem 2.11 in [Kur70].
Let be the trajectory of
with initialization . Further assume that there exists , such that .
Consider the following Markov jump process starting from , with jump time to be an exponential random variable with fixed mean , and jump direction where is the current state, and an independent sample. Then we have for any fixed and ,
B.3.4 Proof of Theorem 3
By Proposition 4, we know that for , any critical point that is not a global minimizer is a strict saddle point. Consider the gradient flow
with random initialization where is a distribution that is absolutely continuous with respect to Lebesgue measure. Since is an analytic function, by Lemma 8, we have converges to a global minimizer of . That is, we have almost surely (over )
where is calculated in Lemma 7.
Consider the following Markov jump process starting from , with jump time to be an exponential random variable with fixed mean , and jump direction to be where
with the current state, and an independent sample. By Lemma 9, we have for any fixed and ,
Note the sequence of Markov jump process at jump time is exactly the SGD iterates. Hence the SGD iterates with properly scaled number of iterations is uniformly close to over finite horizon as . This proves the Theorem.
Appendix C Proofs for Mixture of Gaussians
In this section, we consider the mixture of Gaussian setting (mg): with equal probability , and , where and . With these notations,
Throughout this section, we will make the following assumptions:
There exists constants such that ;
.
Note that it is easy to see from the proof that the result stays the same if we add an offset .
Consider the RF model introduced above. We have
where , and , with
Simply write the KKT conditions. The optimum is achieved at . ∎
C.1.2 Approximation of kernel matrix 𝑼𝑼{\boldsymbol{U}}
where independently. Assume conditions A1 and B2 hold.
Then we have as and , we have
Recalling that in the () model, we have , we have
We also have by assumptions M2 and B2, hence
Therefore, combining (76) and (77), we get:
Combining (75) and (78) concludes the proof. ∎
C.1.3 Approximation of the 𝑽𝑽{\boldsymbol{V}} vector
Under the assumption of Theorem 4, define with
where independently. Then as with , we have
Using dominated convergence theorem and arguments similar to those used to prove (26), one can check that
The same arguments as in the proofs of Lemma 2 and Lemma 3 show
Combining (80) with (81) in (79), we get:
Bounding similarly the term depending on in , we get
Now, consider the difference between and . We use the fact for on a neighborhood of , there exists such that
where the last equality is due to assumptions M2 and B2. We conclude that
For the last comparison between and , we take the expectation:
Combining the above three bounds (82), (83) and (84) yields the desired result. ∎
C.1.4 Proof of Theorem 4
By Lemma 10, the risk has a representation
C.2 Neural Tangent model: proof of Theorem 5
Assume conditions M1 and M2 hold. Consider the function
Define the risk function optimized over while is fixed
Minimizing successively over and , we get the following formula:
By Assumptions M1 and M2, we have and for some constants and . We get
C.2.2 Proof of Theorem 5
where the minimizer is obtained by Cauchy-Schwarz inequality.
Case . Consider now the case when . From (88), the optimal is the one maximizing
which we rewrite as the following convex problem
which yields, using ,
where for . The constraint reads in the basis
Considering the (unique) symmetric optimizer and substituting (92) in (90), we get the minimizer
Substituting (94) in (88), we then obtain
where with is the random projection along the orthogonal subspace to the columns of . From Theorem 2, we know that
by assumption M2 on . We deduce that there exists a constant (that depends on and ) such that:
Using (97) and (95), we deduce the final high probability formula for the risk of the NT model:
C.3 Neural Network model: proof of Theorem 6
where we consider the function class of two-layers neural networks (with neurons) with quadratic activation function and general offset and coefficients
We define the risk function for a given set of parameters as
The risk is optimized over and .
where . Define and using Eq. (87) in Lemma 13, the minimizer is the solution of
where the ’s are the singular values of in descending order. Plugging this expression in Eq. (87) concludes the proof. ∎