On Feature Learning in Neural Networks with Global Convergence Guarantees
Zhengdao Chen, Eric Vanden-Eijnden, Joan Bruna
Introduction
The training of neural networks (NNs) is typically a non-convex optimization problem, but remarkably, simple algorithms like gradient descent (GD) or its variants can usually succeed in finding solutions with low training losses. To understand this phenomenon, a promising idea is to focus on NNs with large widths (a.k.a. under over-parameterization), for which we can derive infinite-width limits under suitable ways to scale the parameters by the widths. For example, under a “” scaling of the weights, the GD dynamics of wide NNs can be approximated by the linearized dynamics around initialization, and as the widths tend to infinity, we obtain the Neural Tangent Kernel (NTK) limit of NNs, where the solution obtained by GD coincides with a kernel method . Importantly, theoretical guarantees for optimization and generalization can be obtained for wide NNs under this scaling . Nonetheless, it was pointed out that this NTK analysis replies on a form of lazy training that excludes the learning of features or representations , which is a crucial ingredient to the success of deep learning, and is therefore not adequate for explaining the success of NNs .
Meanwhile, for shallow (i.e., one-hidden-layer) NNs, if we choose a “1 / width” scaling, we can derive an alternative mean-field (MF) limit as the widths tend to infinity. Under this scaling, feature learning occurs even in the infinite-width limit, and the training dynamics can be described by the Wasserstein gradient flow of a probability measure on the space of the parameters, which converges to a global minimizer of the loss function under certain conditions . Generalization guarantees have also been proved for learning with shallow NNs under the MF scaling by identifying a corresponding function space . However, currently there are three limitations to this model of over-parameterized NNs. First, the global convergence guarantees for shallow NNs only hold in the infinite-width limit (i.e. they are asymptotic). While studies the deviation between finite-width NNs and their infinite-width limits during training, the analysis is done only asymptotically to the next order in width. Second, a convergence rate has yet to be established except under special assumptions or with modifications to the GD algorithm . Third, while several works have proposed to extend the MF formulation to deep (i.e., multi-layer) NNs , there is less concensus on what the right model should be than for the shallow case. In summary, we still lack a model for the GD optimization of shallow and multi-layer NNs that goes beyond lazy training while admitting fast global convergence.
In this work, we study the optimization of both shallow NNs under the MF scaling and a type of partially-trained multi-layer NNs, and obtain theoretical guarantees of linear-rate global convergence.
We consider the scenario of training NN models to fit a training set of data points in dimension , where the model parameters are optimized by gradient flow (GF, which is the continuous-time limit of GD) with respect to the squared loss. Allowing most choices of the activation function, we prove that:
For a shallow NN, if the hidden layer is sufficiently wide and the input data are linearly independent (requiring ), then with high probability, the training loss converges to zero at a linear rate.
For a multi-layer NN where we only train the second-to-last layer, if the hidden layers are both sufficiently wide, then with high probability, the training loss converges to zero at a linear rate. Unlike for shallow NNs, here we no longer need the requirement on input dimension, demonstrating a benefit of jointly having depth and width.
We also run numerical experiments to demonstrate that our model exhibits feature learning and can achieve better generalization performance than its NTK counterpart.
2 Related works
Many recent works have studied the optimization landscape of NNs and the benefits of over-parameterization . One influential idea is the Neural Tangent Kernel (NTK) , which characterizes the behavior of GD on the infinite-width limit of NNs under a particular scaling of the parameters (e.g. for shallow NNs, replacing with in (1)). In particular, when the network width is polynomially large in the size of the training set, the training loss converges to a global minimum at a linear rate under GD . Nonetheless, in the NTK limit, due to a relatively large scaling of the parameters at initialization, the hidden-layer features do not move significantly . For this reason, the NTK scaling has been called the lazy-training regime, as opposed to a feature-learning or rich regime . Several works have investigated the differences between the two regimes both in theory and in practice . In addition, several works have generalized the NTK analysis by considering higher-order Taylor approximations of the GD dynamics or finite-width corrections to the NTK .
An alternative path has been taken to study shallow NNs in the mean-field scaling (as in (1)), where the infinite-width limit is analogous to the thermodynamic or hydrodynamic limit of interacting particle systems . Thanks to the interchangeability of the parameters, the neural network is equivalently characterized by a probability measure on the space of its parameters, and the training can then be described by a Wasserstein gradient flow followed by this probability measure, which, in the infinite-width limit, converges to global mimima under mild conditions. Regarding convergence rate, ref. proves that if we train a shallow NN to fit a Lipschitz target function under population loss, the convergence rate cannot beat the curse of dimensionality. In contrast, we will study the setting of empirical risk minimization, where there are finitely many training data. Ref. shows that mean field Langevin dynamics on shallow NNs can converge exponentially to global minimizers in over-regularized scenarios, but we focus on GF without entropic regularization. Besides the question of optimization, shallow NNs under this scaling represent functions in the Barron space or variation-norm function space , which provide theoretical guarantees on generalization as well as fluctuation in training . Several works have proposed different mean-field limits of wide multi-layer NNs and proved convergence guarantees , but questions remain. First, due to the presence of different symmetries in a multi-layer network compared to a shallow network , the limiting object at the infinite-width limit is often quite complicated. Second, it has been pointed out that under the MF scaling of a multi-layer network, an i.i.d. initialization of the weights would lead to a collapse of the diversity of neurons in the middle layers, diminishing the effect of having large widths . In addition, while another line of work develops MF models of residual models , we are interested in multi-layer NN models with a large width in every layer.
Ref. demonstrates the importance of hierarchical learning by proving the existence of concept classes that can be learned efficiently by a deep NN with quadratic activations but not by non-hierarchical models. Ref. studies the optimization landscape and generalization properties of a hierarchical model that is similar to ours in spirit, where an untrained embedding of the input is passed into a trainable shallow model, and prove an improvement in sample complexity in learning polynomials by having neural network outputs as the embedding. However, the trainable models they consider are not shallow NNs but their linearized and quadratic-Taylor approximations, and furthermore the convergence rate of the training is not known. Ref. proposes a novel parameterization under which there exists an infinite-width limit of deep NNs that exhibits feature learning, but properties of its training dynamics is not well-understood. Our multi-layer NN models adopt an equivalent scaling (see Appendix C), and our focus is on proving non-asymptotic convergence guarantees for its partial training under GF.
Problem setup
Thus, we obtain a -layer feed-forward NN whose first-layer weights are random and fixed, and we call it a partially-trained -layer (P-L) NN. Note that the scaling in this model is different from both the NTK scaling ( instead of in (4)) and the MF scaling for multi-layer NNs adopted in ( instead of in (5)). We show in Appendix B that when is homogeneous, this scaling is consistent with the Xavier initialization of neural network parameters up to a reparameterization . We also show in Appendix C that in certain cases this scaling is equivalent to the maximum-update parameterization proposed in . Numerical experiments that compare different scalings are described in Section 4.
2 Training with gradient flow
for some independent from , which is the law of a scaled Rademacher random variable.
If is Lipschitz, it is differentiable almost everywhere, and we write to denote the derivative of when it is differentiable at and otherwise. When is differentiable at , there is
and the gradient of the loss function with respect to is given by
Thus, we can perform GD updates on according to the following rule: and ,
where denotes the output function and denote the hidden-layer feature maps determined by the parameters at time . Then, induced by the evolution of , each evolves according to
Accordingly, the output function satisfies
Thus, the loss function evolves according to
Compared to the NTK scaling of neural networks, the crucial difference is the factor in (2), instead of . It is known that under the NTK scaling, due to the factor, the movement of the feature maps, , is only of order while the function value changes by an amount of order . While this greatly simplifies the convergence analysis, it also implies that the hidden-layer representations are not being learned. In contrast, with the factor in (2), if is Lipschitz with Lipschitz constant , there is , . Therefore, regardless of and ,
which implies that the average movement of the feature maps is on the same order as the change in function value, and thus the hidden-layer representations as well as the NTK undergoes nontrivial movement during training. In Appendix C, we further justify the occurrence of feature learning using the framework developed in .
Convergence analysis
To prove that the training loss converges to zero, we need a lower bound on the absolute value of . Indeed, if is positive definite, which depends on and the training data, we can establish one in the following way. First, as a simple case, if we use an activation function whose derivative’s absolute value is uniformly bounded from below by a constant , such as linear, cubic or (smoothed) Leaky ReLU activations, we can derive a Polyak-Lojasiewicz (PL) condition from (14) directly,
which implies , indicating that the training loss decays to at a linear rate.
For more general choices of the activation function, a challenge is to guarantee that, heuristically speaking, for each , \sigma^{\prime}\big{(}h_{i}(\bm{x}_{a})\big{)} does not become near zero for too many before the loss vanishes. To facilitate a finer-grained analysis, we need the following mild assumption on :
Intuitively, is an active region of , within which the derivative has a magnitude bounded away from zero. This assumption is satisfied by the majority of activation functions in practice, including smooth ones such as and sigmoid as well as non-smooth ones such as ReLU. Then, under the following initialization scheme, we prove a general result for models with a fixed embedding.
is the -dimensional standard Gaussian distribution, i.e., each is sampled independently from a standard Gaussian distribution.
Suppose that Assumptions 1, 2 and 3 are satisfied, and . Then , and such that , if and , then with probability at least , it holds that ,
Here, , and depend on and (but not on , , , , , or ).
The result is proved in Appendix E, and below we briefly describe the intuition. A key to the proof is to guarantee that enough neurons remain in the active region throughout training. Specifically, with respect to each training data point (i.e. for each ), we can keep track of the proportion of neurons (among all ) for which . We show that if the proportion is large enough at initialization (shown by Lemma 3 in Appendix E.2 under Assumption 3), then it cannot drop dramatically without a simultaneous decrease of the loss value, as long as the ’s are not too small in absolute value. This property of the dynamics is formalized in the following lemma:
Consider the dynamics of and \big{\{}h_{i}^{t}(\bm{x}_{a})\big{\}}_{i\in[m],a\in[n]} governed by (11) and (14). Assume that , and , . Under Assumption 2, define
where .
Suppose that Assumptions 1, 2 and 3 are satisfied. If the training data are linearly-independent vectors, then under GF (10) on the first-layer weights of the shallow NN, the training loss converges to zero at a linear rate.
While the assumption that is restrictive, we note that existing convergence rate guarantees for the GD-type training of shallow NNs in the MF scaling need strong additional assumptions , modifications to the GD algorithm , or restrictions to certain special tasks .
2 Models with a high-dimensional random embedding
A clear limitation of Corollary 1 is that it is only applicable when , since otherwise the Gram matrix cannot be positive definite. This motivates us to consider the use of a high-dimensional embedding to lift the effective input dimension. In particular, we focus on the scenario where is large and is random. While the Gram matrix in this case is also random, we only need that it concentrates around a deterministic and positive definite limit as tends to infinity:
Condition 1 is sufficient for us to apply Lemma 1 and obtain the following global convergence guarantee, which extends Theorem 1 to models with a high-dimensional random embedding. The proof is given in Appendix F.
Under Assumptions 1, 2, 3 and Condition 1, , and such that , if , and , then with probability at least , it holds that ,
Here, , and depend on and (but not , , , , , or ).
Consider the P-L NN model defined in (4). In this case, the Gram matrix is , defined by
Thus, for the convergence result, the assumption we need on the limiting Gram matrix is
is sub-Gaussian and the matrix , which depends on the choice of and the training set, is positive definite with \lambda_{\min}\big{(}\bar{G}^{(1)}\big{)}>0 and .
This assumption also plays an important role in the NTK analysis, and it is satisfied if, for example, is the -dimensional standard Gaussian distribution, no two data points are parallel, and is either the ReLU function or analytic and not a polynomial . When Assumption 4 is satisfied, as long as is Lipschitz, we can use standard concentration techniques to verify Condition 1. Thus, Theorem 2 implies that
Under Assumptions 1, 2, 3 and 4, , , and such that , if , and , then with probability at least , it holds that ,
Here, , , and depend on as well as the sub-Gaussian norm of (but not on , , , , or ).
The proof is given in Appendix G. Compared to Corollary 1 for shallow NNs, a highlight of Theorem 3 is that the requirement of is no longer needed. This demonstrates an advantage of the high-dimensional random embedding realized by the first hidden layer in the P-L NN, thus illustrating a benefit of having both depth and width in NNs from the viewpoint of optimization. Compared to the NTK result , our analysis assumes the same level of over-parameterization, but crucially allows feature training to occur, which we discuss in Section 2.2 and support empirically in Section 4.3.
Furthermore, by using a multi-layer NN with random and fixed weights as the high-dimensional random embedding, we extend the P-L NN to a partially-trained -layer NN model in Appendix H, for which similar convergence results can be proved for training its second-to-last layer via GF.
Numerical experiments
Additional results and details of the experiments are provided in Appendix I.
We train shallow NNs to fit a randomly labeled data set with . Specifically, we sample each i.i.d. with every entry sampled independently from a standard Gaussian distribution, and each i.i.d. uniformly on and independently from the ’s. We see from Figure 3 that the convergence happens at a nearly linear rate when and , and the rate decreases as becomes larger. This is coherent with our theoretical result (Corollary 1), and interestingly also echoes a prior result that the convergence rate of optimizing a shallow NN using population loss can suffer from the curse of dimensionality , which implies a worsening of the convergence rate as the number of data points increases.
2 Experiment 2: Benefit of input embedding
3 Experiment 3: Feature learning v.s. lazy training
We consider the P-L NN model defined in (4) and (5) with (i.e. both hidden layers having the same width), and compare it with -layer NN models under NTK and MF scalings, as we define in Table 1 based on prior literature , which undergo partial training in the same fashion. We adopt the data set used in (more details in Appendix I.3), and train the models by minimizing the unregularized squared loss for varying ’s and ’s.
First, we see from the top-left plot in Figure 4 that, consistently across different , the training loss converges at a linear rate for the model under our scaling, which is coherent with Theorem 3. Second, we see from the second row that feature learning occurs in the model under our scaling but negligibly in the model under the NTK scaling, as expected . Note also that under the MF scaling, the feature maps concentrate near at initialization due to the small scaling, but gains diversity during training. Third, we see from Figure 3 that our model yields the smallest test errors out of all three, and in addition, as grows the test error decreases faster under the MF scaling than under the NTK scaling, both indicating an advantage of feature learning compared to lazy training.
Conclusions and limitations
We consider a general type of models that includes shallow and partially-trained multi-layer NNs, which exhibits feature learning when trained via GF, and prove non-asymptotic global convergence guarantees that accommodates a general class of activation functions. For a randomly-initialized shallow NN in the MF scaling that is wide enough, we prove that by performing GF on the input-layer weights, the training loss converges to zero at a linear rate if the number of training data does not exceed the input dimension. For a randomly-initialized multi-layer NN with large widths, we prove that by performing GF on the weights in the second-to-last layer, the same result holds except there is no requirement on the input dimension. We also perform numerical experiments to demonstrate the advantage of feature learning in our partially-trained multi-layer NNs relative to their counterparts under the NTK scaling.
Our work focuses on the optimization rather than the approximation or generalization properties of NNs, which are also crucial to understand. In addition, as our current theoretical results on global convergence neglect the bias terms and assume that the last-layer weights are untrained, a more general version is left for future work.
Acknowledgments
The authors acknowledge support from the Henry MacCracken Fellowship, NSF RI-1816753, NSF CAREER CIF 1845360, NSF CHS-1901091 and NSF DMS-MoDL 2134216.
References
Appendix A Additional notations
For a positive integer , we let denote the set .
We write for .
We use bold letters (e.g. , , , ) to denote vectors.
We use and interchangeably to refer to the same set of parameters.
Appendix B Consistency of the scaling and GD update rule with Xavier initialization
Consider a three-layer network defined by
with weight parameters \big{\{}\theta^{(1)}_{jk}\big{\}}_{j,k\in[m]}, \big{\{}\theta^{(2)}_{ij}\big{\}}_{i,j\in[m]} and \big{\{}\theta^{(3)}_{i}\big{\}}_{i\in[m]} are initialized according to Xavier initialization, which means that we sample each i.i.d. from , each i.i.d. from , and each i.i.d. from . If , both and can be approximated by . Then, up to this approximation, by redefining , and , we can write
and note that and are all initialized i.i.d. of order . In addition, if is homogeneous, this is then equivalent to (4) and (5) when .
Moreover, there is . Then, since performing GD on with step size means updating according to
this is equivalent to updating according to
which justifies the factor on the right-hand-side of (9).
Appendix C Relationship to the maximum-update parameterization and feature learning
Consider the partially-trained -layer NN model defined in Section H in the case where . In the framework of abc-parameterization introduced in , our model corresponds to setting
Furthermore, as we explain in Appendix B, the appropriate learning rate scales linearly with (as in (9)), which corresponds to having
Meanwhile, the maximum-update (P) parameterization is characterized by setting
Recall the symmetry of abc-parameterization derived in , which states that one gets a different but equivalent abc-parameterization by setting
Since our parameterization can be obtained from the maximum-update parameterization by applying the transformation above with , they are equivalent in the function space. In particular, for our parameterization, the parameter defined in can be computed as
Hence, according to , our parameterization exhibits feature learning.
Appendix D Proof of Lemma 1
Since we assume that is positive definite and , , we can derive from (14) that
Since is an open interval, such that we can find a subinterval such that the distance between and the boundaries of (if is bounded on either side) is no less than , i.e.,
In particular, we can choose and . Then there is
where we set for simplicity. As a consequence,
where we set for simplicity. Therefore, when ,
Appendix E Proof of Theorem 1
To apply Lemma 1, we need two additional lemmas, which we will prove in Appendix E.1 and E.2. The first one guarantees that the loss value at initialization, , is upper-bounded with high probability:
, if , then with probability at least , there is
, if , then with probability at least , there is
where is a positive number that depends on , and .
With these two lemmas, we deduce that , if , then with probability at least , there is ,
where is defined as in Lemma 3. Therefore, if our choice of satisfies
which will allow us to finally conclude that
Note that (60) establishes a PL condition. Several other convergence analyses of NNs have also relied on variants of the PL condition .
Since at initialization, \big{\{}c_{i}\big{\}}_{i\in[m]} and \big{\{}W_{ij}^{0}\big{\}}_{i\in[m],j\in[D]} are both sampled i.i.d. and \big{\{}c_{i}\big{\}}_{i\in[m]} has mean zero, we know that , f^{0}(\bm{x}_{a})=\frac{1}{m}\sum_{i=1}^{m}c_{i}\sigma\big{(}h_{i}^{t}(\bm{x}_{a})\big{)} is the sample mean of i.i.d. random variables with zero-mean. Moreover, since \big{\{}W_{ij}^{0}\big{\}}_{i\in[m],j\in[D]} is sampled from , we know that , the random variable c_{i}\sigma\big{(}h_{i}^{t}(\bm{x}_{a})\big{)} is sub-Gaussian , with sub-Gaussian norm
where is some absolute constant. Thus, by Hoeffding’s inequality , , ,
where is some absolute constant. Hence, by union bound,
then with probability at least , there is
E.2 Proof of Lemma 3
Since each are sampled i.i.d. from , we know that , independently for each , follows a Gaussian distribution with mean 0 and variance . Therefore,
Hence, by Hoeffding’s inequality, , ,
, choosing , we then get
Since , there is ,
Letting , we can then write
Appendix F Proof of Theorem 2
By Condition 1, we know that , if , then with probability at least , there is , and hence , , , and . We then perform the following analysis conditioned on the event that .
Since the sampling of \big{\{}c_{i}\big{\}}_{i\in[m]} and \big{\{}W_{ij}^{0}\big{\}}_{i\in[m],j\in[D]} is independent from the realization of , we know from Lemma 3 that if , then with probability at least , there is
From Lemma 2, we also know that if , then with probability at least , there is . Therefore, in total, we know that with probability at least , the following conditions all hold:
in which case, by applying Lemma 1 with , we get
where . Thus, by the definition of , we know that
Therefore, if our choice of satisfies
Hence, (50) implies that ,
Appendix G Proof of Theorem 3
In view of Theorem 2, it is sufficient to verify that Condition 1 holds for , which is given by the following lemma:
, if , then with probability at least ,
Hence, by Lemma 2.7.7 in , we know that , is a sub-exponential random variable with sub-exponential norm
Then, by Bernstein’s inequality (Theorem 2.8.1 in ), since each is sampled i.i.d. from , we have that and ,
where is some absolute constant. In other words, for any , if
then we have with probability at least . If we choose and , then we get, if
Hence, with probability at least , we have
Appendix H Generalization to deeper models
By setting to be the activations of the second-to-last hidden-layer of a multi-layer NN, we can obtain generalizations of the P-L NN to deeper architectures. For example, in the feed-forward case, we can obtain the following partially-trained -layer NN:
Appendix I Further details of the numerical experiments
In our models, \big{\{}c_{i}\big{\}}_{i\in[m]} is sampled i.i.d. from the Rademacher distribution , \big{\{}\bm{z}_{j}\big{\}}_{j\in[D]} is sampled i.i.d. from , and \big{\{}W_{ij}\big{\}}_{i\in[m],j\in[D]} is initialized by sampling i.i.d. from . In the model under NTK scaling, we additionally symmetrize the model at initialization according to the strategy used in to ensure that the function value at initialization does not blow up when the width is large. We choose to train the models using steps of (full-batch) GD with step size . When the test error is computed, we use a test set of size generated by sampling i.i.d. from the same distribution as the training set.
The experiments are run with NVIDIA GPUs (1080ti and Titan RTX).
We choose to be . For each choice of , we run the experiment with different random seeds, and Figure 3 plots the evolution of the training loss during GD averaged over the runs with .
Figure 5 is the same as Figure 3 except for having . We see that the two two plots agree well.
I.2 Experiment 222
We choose to be ReLU. For each choice of and each of the two models, we experiment with different random seeds, and Figure 3 plots the test error at the GD step averaged over the runs its standard deviation.
In Figure 6, we plot the evolution of the training loss and test error during GD for the two different models, with or and different choices of , averaged over runs with different random seeds. We see in particular that the difference between the two choices of is negligible, suggesting that it is unlikely to obtain performance improvements with further over-parameterization.
I.3 Experiment 333
and each follow the uniform distribution in $x_{1},x_{2}y$.
Figures 8 and 8 are the same as Figure 4 except for having and , respectively. We see that as increases, test error improves for all three models, while our P-L NN model remains the one achieving the lowest test error.