A Comparative Analysis of the Optimization and Generalization Property of Two-layer Neural Network and Random Feature Models Under Gradient Descent Dynamics
Weinan E, Chao Ma, Lei Wu
Introduction
Optimization and generalization are two central issues in the theoretical analysis of machine learning models. These issues are of special interest for modern neural network models, not only because of their practical success , but also because of the fact that these neural network models are often heavily over-parametrized and traditional machine learning theory does not seem to work directly . For this reason, there has been a lot of recent theoretical work centered on these issues . One issue of particular interest is whether the gradient descent (GD) algorithm can produce models that optimize the empirical risk and at the same time generalize well for the population risk. In the case of over-parametrized two-layer neural network models, which will be the focus of this paper, it is generally understood that as a result of the non-degeneracy of the associated Gram matrix , optimization can be accomplished using the gradient descent algorithm regardless of the quality of the labels, in spite of the fact that the empirical risk function is non-convex. In this regard, one can say that over-parametrization facilitates optimization.
The situation with generalization is a different story. There has been a lot of interest on the so-called “implicit regularization” effect , i.e. by tuning the parameters in the optimization algorithms, one might be able to guide the algorithm to move towards network models that generalize well, without the need to add any explicit regularization terms (see below for a review of the existing literature). But despite these efforts, it is fair to say that the general picture has yet to emerge.
In this paper, we perform a rather thorough analysis of the gradient descent algorithm for training two-layer neural network models. We study the case in which the parameters in both the input and output layers are updated – the case found in practice. In the heavily over-parametrized regime, for general initializations, we prove that the results of still hold, namely, the gradient descent dynamics still converges to a global minimum exponentially fast, regardless of the quality of the labels. However, we also prove that the functions obtained are uniformly close to the ones found in an associated kernel method, with the kernel defined by the initialization.
In the second part of the paper, we study the more general situation when the assumption of over-parametrization is relaxed. We provide sharp estimates for both the empirical and population risks. In particular, we prove that for target functions in the appropriate reproducing kernel Hilbert space (RKHS) , the generalization error can be made small if certain early stopping strategy is adopted for the gradient descent algorithm.
Our results imply that under this setting over-parametrized two-layer neural networks are a lot like the kernel methods: They can always fit any set of random labels, but in order to generalize, the target functions have to be in the right RKHS. This should be compared with the optimal generalization error bounds proved in for regularized models.
The seminal work of presented both numerical and theoretical evidence that over-parametrized neural networks can fit random labels. Building upon earlier work on the non-degeneracy of some Gram matrices , Du et al. went a step further by proving that the GD algorithm can find global minima of the empirical risk for sufficiently over-parametrized two-layer neural networks . This result was extended to multi-layer networks in or a general setting . The related result for infinitely wide neural networks was obtained in . In this paper, we prove a new optimization result (Theorem 3.2) that removes the non-degeneracy assumption of the input data by utilizing the smoothness of the target function. Also the requirement of the network width is significantly relaxed.
The issue of generalization is less clear. established generalization error bounds for solutions produced by the online stochastic gradient descent (SGD) algorithm with early stopping when the target function is in a certain RKHS. Similar results were proved in for the classification problem, in for offline SGD algorithms, and in for GD algorithm. These results are similar to ours, but we do not require the network to be over-parametrized. Moreover, in Theorem 3.3 we show that in this setting neural networks are uniformly close to the random feature models if the network is highly over-parametrized.
More recently in , a generalization bound was derived for GD solutions using a data-dependent norm. This norm is bounded if the target function belongs to the appropriate RKHS. However, their error bounds are not strong enough to rule out the possibility of curse of dimensionality. Indeed the results of the present paper do suggest that curse of dimensionality does occur in their setting (see Theorem 3.4).
provided by a heuristic argument that the GD solutions of a infinitely-wide neural network are captured by the so-called neural tangent kernel. In this paper, we provide a rigorous proof of the non-asymptotic version of the result for the two-layer neural network under weaker conditions.
Preliminaries
We focus on the regression problem with a training data set given by , i.i.d. samples drawn from a distribution , which is assumed fixed but only known through the samples. In this paper, we assume and . We are interested in fitting the data by a two-layer neural network:
The ultimate goal is to minimize the population risk defined by
But in practice, we can only work with the following empirical risk
We are interested in analyzing the property of the following gradient descent algorithm: where is the learning rate. For simplicity, we will focus on its continuous version, the gradient descent (GD) dynamics:
2 Assumption on the input data
Throughout this paper, we make the following assumption on the training set.
For the given training set , we assume that the smallest eigenvalues of the two kernel matrices defined above are both positive, i.e.
Let .
Let denote its -th largest eigenvalue. If are independently drawn from , it was proved in that with high probability and . Using the similar idea, provided lower bounds for based on some geometric discrepancy, which quantifies the uniformity degree of . In this paper, we leave as our basic assumption.
3 The random feature model
We introduce the following random feature model as a reference for the two-layer neural network model
This dynamics is relatively simple since it is linear.
Analysis of the over-parameterized case
Since , we have
For any fixed , with probability at least over the random initialization, we have
where .
The proof of this lemma can be found in Appendix C.
In addition, at the initialization, the Gram matrices satisfy
For , if , we have, with probability at least over the random choice of
The proof of this lemma is deferred to Appendix D.
2 Gradient descent near the initialization
We define a neighborhood of the initialization by
Using the lemma above, we conclude that for any fixed , with probability at least over the random choices of , we must have
for all .
For the GD dynamics, we define the exit time of by
For any fixed , assume that . Then with probability at least over the random choices of , we have the following holds for any ,
where the last inequality is due to the fact that . This completes the proof. ∎
The following is the most crucial characterization of the GD dynamics.
For any , assume . Then, with probability at least , we have the following holds for any ,
To facilitate the analysis, we define the following two quantities,
Combining the two inequalities above, we get
Using Lemma 1 and the fact that , we have
Inserting the above estimates back to (10), we obtain
Since , we have
Therefore we have , which leads to
The following lemma provides that how and depend on and .
For any , assume . Let . If , we have
3 Global convergence for arbitrary labels
Proposition 3.1 and Lemma 4 tell us that no matter how large is, we have
This actually implies that the GD dynamics always stays in , i.e. .
For any , assume . Then with probability at least over the random initialization, we have
According to Lemma 3, we only need to prove that . Assume .
Let us first consider the Gram matrix . Since is Lipschitz and , we have
Next we turn to the Gram matrix . Define the event
Hence using , we obtain
By the Markov inequality, with probability we have
Consequently, with probability we have
where the last inequality comes from Lemma (4). Taking , we get
The above result contradicts the definition of . Therefore . ∎
Compared with Proposition 3.1, the above theorem imposes a stronger assumption on the network width: . This is due to the lack of continuity of when handling . If is continuous, we can get rid of the dependence on . In addition, it is also possible to remove this assumption for the case when , since in this case the Gram matrix is dominated by .
Theorem 3.2 is closely related to the result of Du et al. where exponential convergence to global minima was first proved for over-parametrized two-layer neural networks. But it improves the result of in two aspects. First, as is done in practice, we allow the parameters in both layers to be updated, while chooses to freeze the parameters in the first layer. Secondly, our analysis does not impose any specific requirement on the scale of the initialization whereas the proof of relies on the specific scaling: .
4 Characterization of the whole GD trajectory
In the last subsection, we showed that very wide networks can fit arbitrary labels. In this subsection, we study the functions represented by such networks. We show that for highly over-parametrized two-layer neural networks, the solution of the GD dynamics is uniformly close to the solution for the random feature model starting from the same initial function.
Assume . Denote the solution of GD dynamics for the random feature model by
where .
Again the factor in the condition for can be removed if is assumed to be smooth or is assumed to be small (see the remark at the end of Theorem 3.2).
If , the right-hand-side of (18) goes to as . For example, if we take , we have
Hence this theorem says that the GD trajectory of a very wide network is uniformly close to the GD trajectory of the related kernel method (5).
We are now going to bound and .
We first consider . By Theorem (3.1), with probability at least we have
Hence, by the estimates of in Lemma 1, we have
Inserting the estimate of in Lemma 4, we get
Consider the initializations for which . The probability of this event is no less than . For such initializations, we have
Using Proposition (3.1), we conclude that with probability no less than , the following holds:
Together with the fact that , we obtain
In addition, for any , we have . Hence, plugging (3.4) into leads to
Substituting in the estimates for and , and assuming that , we obtain, for any , with probability no less than ,
Finally, combining the estimates of and , we conclude that
holds for any with probability at least . This completes the proof of Theorem 3.3.
5 Curse of dimensionality of the implicit regularization
For any probability distribution over , we define
The Barron space is defined as the union of , i.e.
The Barron norm for any is defined by
To signify the dependence on the target function and data set, we introduce the notation:
where the right hand side is the GD solution of the random feature model obtained by using the training data with and as the initial parameters. Let . We then have the following theorem.
There exists an absolute constant , such that for any
Combined Theorem 3.4 with Theorem 3.3, we conclude that for any , if is sufficiently large, then with probability at least we have
denotes the solution at time of the GD dynamics for the two-layer neural network model. If is sufficiently small (e.g. ), then we see that the curse of dimensionality also holds for the solutions generated by the GD dynamics for the two-layer neural network model. Since this statement holds for all time , no early-stopping strategy is able to fix this curse of dimensionality problem.
In contrast, it has been proved in that an appropriate regularization can avoid this curse of dimensionality problem, i.e. if we denote by the estimator for the regularized model in (see (86) below), then it was shown that for any , with probability at least over the sampling of , the following holds
The comparison between (40) and (41) provides a quantitative understanding of the insufficiency of using the random feature model to explain the generalization behavior of neural network models.
To prove Theorem 3.4, we need the following lemma, which is proved in .
As is shown in , any function can be represented as
for some and , which means . Hence, . Next, since the training data and the initialization are fixed, we have
Analysis of the general case
In this section, we will relax the requirement of the network width. We will make the following assumption on the target function.
We assume that the target function admits the following integral representation
with .
The following approximation result is essentially the same as the ones in . Since we are interested in the explicit control for the norm of the solution, we provide a complete proof in Appendix A.
where is the population risk.
The following generalization bound for the random feature model will be used later.
For fixed , and any , with probability no less than over the choice of the training data, we have
We first show that the gradient descent algorithm can reduce the empirical risk to . Here we will assume . This assumption is not used in the next subsection, except for Corollary 4.3.
Take for some absolute constant . Assume that the target function satisfies Assumption 2, and . Then, for any , with probability no less than we have
for any , where is a constant depending on , and .
The next three lemmas give bounds on the changes of the parameters.
Let , and be a fixed constant. Then there exists constant depending on , such that for any ,
By the gradient descent dynamics, we have
Since and , we have
If , since and , we have
with . Hence, we have
For , consider a more refined estimate
Plugging in the above estimate for , we obtain
Let , , and assume . Then, for any , with probability no less than , we have for any ,
By Lemma 6 and Lemma 7, when , with probability no less than , we have
Under the assumptions of Lemmas 8 and 9, for any , we have
Using the estimates in Lemmas 8 and 9, we obtain
Let , then we have
By Lemma 7, we can bound as follows,
For , consider the Lyapunov function
Combining all the estimates above, we conclude that for any , with probability larger than , we have
For the estimate on , by Lemma 6, we have . To bound , we have
Together with the estimates in Lemmas 8, 9 and 10, and without loss of generality assuming that , we obtain
If we assume and take , then we can take and obtain
for some constant . Moreover, since is non-increasing, . Hence for any , we have
for some constant . Combining (73) and (74), we complete the proof for all .
2 Generalization results
The following theorem provides an upper bound for the population error of GD solutions at any time . It tells that one can use early stopping to reach the optimal error in the absence of over-parametrization.
Take for some constant . Assume that the target function satisfies Assumption 2, and . Fix any positive constant . Then for , with probability no less than we have, for
where is a constant depending only on , , and .
As a consequence, we have the following early-stopping results.
Assume that . Let . Under the condition of Theorem 4.2, we have
From these results we conclude that for target functions in a certain RKHS, with high probability the gradient descent dynamics can find a solution with good generalization properties in a short time. Compared to the long-term analysis in the last section, this theorem does not require to be very large. It works in the “mildly over-parameterized” regime.
The following Corollary provides a more detailed study of the balance between , and to achieve best rates for .
Assume for some . Then, if , take , we have
If , take , we have
Let and . We assume , then
Expand the right hand side of (75), we obtain
For each , we are going to find the corresponding for which the maximum value among all the terms at the right hand side of (80) is minimized. When , we have . Thus the second term is larger than any other terms. Hence, we only have to consider the case when . In this interval, we only need to compare the terms with powers , , and and neglect all other terms. The desired results are then obtained by comparing the second term with the other three terms. ∎
The right hand side of (82) has one more term than (66), and additional term can be bounded as
Hence, for any , with probability larger than , we have
Numerical experiments
In this section, we present some numerical results to illustrate our theoretical analysis.
The first experiment studies the convergence of GD dynamics for over-parametrized two-layer neural networks with different initializations. We uniformly sample from , and for each we specify a label , which is uniformly drawn from $n=50,d=50m=10,000\gg n$. Six initializations of different magnitudes are tested. Figure 1 shows the training curves.
We see that the GD algorithm for the neural network models converges exponentially fast for all initializations considered, even for the case when . This is consistent with the results of Theorem 3.2.
2 Learning the one-neuron function
We first choose to build the training set, and then use the gradient descent algorithm with learning rate to train two-layer neural network and random feature models. We initialize the models using . In addition, new samples are drawn to evaluate the test error. Figure 2 shows the training and test error curves of the two models of three widths: . We see that, when the width is very small, the GD algorithm for the random feature model does not converge, while it does converge for the neural network model and the resulting model does generalize. This is likely due to the special target function we have chosen here. For the intermediate width (), the GD algorithm for both models converges, and it converges faster for the neural network model than for the random feature model. The test accuracy is slightly better for the resulting neural network model (but not as good as for the case when ). When , the behavior of the GD algorithm for two models is almost the same.
Finally, we study the generalization properties of neural network models of different width. We train two-layer neural networks of different width until the training error is below . Then we measure the test error. We compare the test error with that of the regularized model proposed in :
The results are showed in Figure 3. One sees that when the width is small, the test error is small for both methods. However, when the width becomes very large, the un-regularized neural network model does not generalized well. In other words, implicit regularization fails.
The above results are consistent with the theoretical lower bound (40), which states that learning with GD suffers from the curse of dimensionality for functions in Barron space. Here the one-neuron function serves as a specific example. Intuitively, the one-neuron target function only relies on the specific direction . However the basis are uniformly drawn from . In high dimension, we know for any uniformly drawn from . Therefore, it is not surprising to see that learning with uniform features suffers from the curse of dimensionality.
Conclusion
To put things into perspective, let us first recall some results from .
One can define a space of functions called the Barron space. The Barron space is the union of all RKHS with kernels defined by
with respect to all probability distributions .
For regularized models with a suitably crafted regularization term, optimal generalization error estimates (i.e. rates that are comparable to the Monte Carlo rates) can be established for all target functions in the Barron space.
In the present paper, we have shown that for over-parametrized two-layer neural networks without explicit regularization, the gradient descent algorithm is sufficient for the purpose of optimization. But to obtain dimension-independent error rates for generalization, one has to require that the target function be in the RKHS with a kernel defined by the initialization. In other words, given a target function in the Barron space, in order for implicit regularization to work, one has to know beforehand the kernel function for that target function and use that kernel function to initialize the GD algorithm. This requirement is certainly impractical. In the absence of such a knowledge, one should expect to encounter the curse of dimensionality for general target functions in Barron space, as is proved in this paper.
We have also studied the case with general network width. Our results point to the same direction as for the over-parametrized regime although in the general case, one has to rely on early stopping to obtain good generalization error bounds. Our analysis does not rule out completely the possibility that in some scaling regimes of , the GD algorithm for two-layer neural network models may have better generalization properties than that of the related kernel method.
From a technical viewpoint, our analysis was facilitated greatly by the fact that the dynamics of the ’s is much slower than that of the ’s, as a consequence of the smallness of . As a result, the ’s are effectively frozen in the GD dynamics. While this is the same setup as the ones used in practice, one can also imagine putting out an explicit scaling factor to account for the smallness of , e.g.
as in . In this case, the separation of time scales is no longer valid and one can potentially obtain a very different picture. While this is certainly an interesting avenue to pursue, so far there are no results concerning the effect of implicit regularization in such a setting.
Acknowledgement: The work presented here is supported in part by a gift to Princeton University from iFlytek and the ONR grant N00014-13-1-0338.
References
Appendix A Proof of Lemma 6
For any , let , where is the function defined in Assumption 2. Let
Hence, by McDiarmid’s inequality, for any , with probability no less than , we have
Finally, by Assumption 2, . ∎
Appendix B Proof of Lemma 7
For any , let . We can bound the Rademacher complexity of as follows.
Next, let . Since for any , by the Cauchy-Schwartz inequality, . Hence we can bound the Rademacher complexity of by
using that is Lipschitz continuous with Lipschitz constant bounded by . Therefore, for any , with probability larger than , we have
for any with .
Finally, for any integer , let and . Then, with probability larger than
Appendix C Proof of Lemma 1
Define . By the standard Rademacher complexity bound (see Theorem 26.5 of ), we have, with probability at least ,
Moreover, since is Lipschitz continuous, by applying the contraction property of Rademacher complexity (see Lemma 26.9 of ) we have
where the last inequality follows from the Lemma 26.10 of . Thus with probability , we have that for any ,
Thus . ∎
Appendix D Proof of Lemma 2
For a given , define events
Thus with probability at least , we have
Taking , we complete the proof. ∎