Implicit Bias of Gradient Descent for Wide Two-layer Neural Networks Trained with the Logistic Loss
Lenaic Chizat, Francis Bach
Introduction
Artificial neural networks are successfully used in a variety of difficult supervised classification tasks, but the mechanisms behind their performance remain unclear. The situation is particularly intriguing when the number of parameters of these models exceeds by far the number of input data points and they are trained with gradient-based methods until zero training error, without any explicit regularization. In this case, the training algorithm induces an implicit bias: among the many classifiers which overfit on the training set, it selects a specific one which often turns out to perform well on the test set. In this paper, we study the implicit bias of wide neural networks with two layers (i.e., with a single hidden-layer) trained with gradient descent on the logistic loss, or any loss with an exponential tail. Our analysis lies at the intersection of two lines of research that study (i) the implicit bias of gradient methods, and (ii) the training dynamics of wide neural networks.
Dynamics of infinitely-wide neural networks.
This fine characterization is made possible by looking at the infinite width limit of two-layer neural networks. This strategy has been used in several works to obtain insights on their statistical properties (Bengio et al., 2006; Bach, 2017a) or training behavior (Nitanda and Suzuki, 2017; Rotskoff and Vanden-Eijnden, 2018; Chizat and Bach, 2018; Mei et al., 2018; Sirignano and Spiliopoulos, 2019), which can be described by a Wasserstein gradient flow (Ambrosio et al., 2008). In particular, Chizat and Bach (2018) show that if the loss is convex, if the initialization is “diverse enough”, and if the gradient flow of the objective converges, then its limit is a global minimizer. This result does not apply in our context because the gradient flow diverges, which turns out to be beneficial for the analysis of the implicit bias that we propose.
A general drawback of those mean-field analyses is that they are mostly non-quantitative, both in terms of number of neurons and number of iterations. While some works have shown quantitative results by modifying the dynamics (Mei et al., 2019; Wei et al., 2019; Chizat, 2019), we do not take this path in order to stay close to the way neural networks are used in practice and because our numerical experiments suggest that those modifications are not necessary to obtain a good practical behavior. Finally, we stress that our analysis does not take place in the lazy training regime (Chizat et al., 2019) which consists of training dynamics that can be analyzed in a perturbative regime around the initialization (see, e.g., Li and Liang, 2018; Jacot et al., 2018; Du et al., 2019). Lazy training is another kind of implicit bias that amounts to training a linear model and does not lead to adaptivity results as those shown in Section 6 (see Figure 3 for an illustration in our context).
1 Organization and contributions
After preliminaries on wide neural networks in Section 2, we make the following contributions :
In Section 3, we show that for a class of two-layer neural networks and for losses with an exponential tail, the classifier learnt by the non-convex gradient flow is a max-margin classifier for a certain functional norm known as the variation norm.
When fixing the “directions” of the neurons (Section 4), or when only training the output layer (Section 5), we show that the dynamics implicitly performs online mirror ascent on a sequence of smooth-margin objectives and thus naturally maximizes the margin. This leads to convergence guarantees in in situations where no rate was previously known.
In Section 6, we study the margins of those classifiers and prove dimension-independent generalization bounds for classification in presence of hidden linear structures.
We perform numerical experiments in Section 7 for two-layer ReLU neural networks which confirm the statistical efficiency of this implicit bias in a high-dimensional setting.
In summary, we show that training two-layer ReLU neural networks implicitly solves a problem with strong statistical benefits. We stress however that the runtime of the algorithm is still unknown.
2 Notation
Preliminaries on infinitely wide two-layer networks
Here are examples of models which satisfy (A1):
2 Parameterizing with a measure
Finite width networks as in Eq. (1) are recovered when is a discrete measure with atoms.
3 Max-margins and functional norms
In this paper we deal with two notions of norms, that in turn define two types of max-margin classifiers. We refer to Bach (2017a) for a more detailed presentation.
RKHS norm.
This is a separable kernel support vector machine problem.
Statistical and computational properties.
In Section 6, we will show that the margin can be large even in high dimension when the dataset has hidden low dimensional structure, which leads to strong generalization guarantees, which is a priori not true for . While -max-margin classifiers can be found with convex optimization techniques (such as training only the output layer, as shown in Section 5), it is not clear a priori how to find -max-margin classifiers. In the next section, we show that training an over-parameterized two-layer neural network precisely does that.
4 Training dynamics in the infinite width limit
The family is linearly independent and for , the function is differentiable with a Lipschitz-continuous gradient and subanalytic (i.e., its graph is locally the linear projection of a bounded semianalytic set).
Gradient flow of the smooth-margin objective.
Up to the gradient sign, this gradient flow is an approximation of gradient descent (Gautschi, 1997; Scieur et al., 2017) and stochastic gradient descent (SGD) (Kushner and Yin, 2003, Thm. 2.1) with small step sizes.Although Theorem 3.1 below could be extended to discrete time analysis, this would be of little interest since the result is so far purely qualitative. In simpler settings, we study discrete time dynamics in Sections 4 and 5. Classical results guarantee that under Assumption (A2-3), this gradient flow is uniquely well defined.
Wasserstein gradient flow.
It can be directly checked that when is discrete, we recover the training dynamics defined in Eq. (7). In this case, is the position (in parameter space) at time of the hidden unit initialized with parameters . The following theorem shows that Wasserstein gradient flows characterize the training dynamics of infinitely wide two-layer neural networks. It is an application of Chizat and Bach (2018, Thm. 2.6), see details in Appendix C (hereafter, by convergence in , we mean weak convergence and convergence of the second moments (Ambrosio et al., 2008)).
This limit can be made quantitative using the geodesic convexity estimates of Chizat and Bach (2018), and the stability results of Ambrosio et al. (2008, Thm. 11.2.1) but with an exponential dependency in time. In the different setting of the square loss, error estimates for SGD have been derived by Mei et al. (2018, 2019). This limit dynamics covers, but is not limited to, the lazy training dynamics studied by Li and Liang (2018); Jacot et al. (2018); Du et al. (2019) which here corresponds to a short time analysis when the initialization has a large variance (see Figure 3 in Section 7).
Main result: implicit bias of gradient flow
We are now in position to state the main theorem of this paper, which characterizes the implicit bias of training infinitely wide two-layer neural networks with a loss with an exponential tail.
Under (A1-3), assume that has full support on . If converges and converges weakly to some , then this limit is a maximizer for the -max-margin problem in Eq. (4).
The strength of this result is that the limit of a non-convex dynamics is a global minimizer of Eq. (4). Its proof relies, among other things, on a compatibility between the optimality conditions and the gradient flow dynamics, which is specific to the -homogeneous case.
It is an open question to prove that and converge is this setting. Note that the unnormalized measure does not converge, so the global convergence result from Chizat and Bach (2018) (which has a similar assumption regarding the existence of a limit) does not apply.
Unlike in the convex case (Soudry et al., 2018), the dynamics does not completely forget where it started from. For instance, when initialized with a Dirac measure, the Wasserstein gradient flow can only converge to a Dirac measure, which is typically not a global minimizer.
Together, Theorems 2.2 and 3.1 give asymptotic guarantees for training finite width neural networks.
There exists a Wasserstein gradient flow of the objective Eq. (9) with , i.e., input (resp. output) weights uniformly distributed on the sphere (resp. on ). If converges weakly in , if converges weakly in and if (*) converges in to some that satisfies the Morse-Sard property (see details in Appendix H), then is a maximizer for
Insights on the convergence rate and choice of step-size
While making Corollary 3.2 quantitative in terms of number of neurons and the number of iterations is left as an open question, it is of practical importance to better understand the effect of the choice of step-size. In this section, we look at a simplified dynamics where the direction of each parameter is fixed after initialization and only its magnitude evolves. A complete discrete-time analysis is possible in this case, using tools from convex analysis.
Let for , and . For the step-sizes and a uniform initialization , it holds
where and when .
In the proof of Lemma E.3, it can be seen that our bound on grows to as goes to zero.
To prove Proposition 4.1, we consider the family of smooth-margin functions
and we show that approximately follows online mirror ascent for the sequence of concave functions in the simplex with step-sizes . It then only remains to apply classical bounds for mirror descent and use the fact that . This algorithm thus implicitly performs online optimization on the regularization path. It is also analogous to smoothing techniques in non-smooth optimization (Nesterov, 2005).
Continuous limit.
Using the notations from Section 2, the dynamics solves
When converges to the uniform measure on the sphere, we thus recover the same implicit bias as in Theorem 3.1 and (note that the logarithmic dependency in in Proposition 4.1 could be removed with a slightly finer analysis as done in Chizat (2019)). While functions in may be well-approximated with a small number of neurons (Bach, 2017a; Jones, 1992), this is not anymore true if the positions of those neurons are fixed a priori (see Barron (1993) for exponential lower bounds in a similar setting). In Theorem 3.1, positions are allowed to vary during training: this makes its setting more challenging but also much more relevant.
Training only the output layer
Let , and . Assume . For the step-sizes and initialization , it holds
Random features for kernel max-margin classifier.
Using the notations from Section 2, the dynamics converges to a solution to
Dimension independent generalization bounds
In this section, we give arguments showing the favorable statistical properties of the bias exhibited in Theorem 3.1 for ReLU networks. We propose to measure the complexity of the dataset with the following projected interclass distance defined, for , as
For each dimension , it looks for the -dimensional subspace which maximizes the distance between the two classes. Interclass distance often appears in the statistical analysis of classification problems (see, e.g., Li and Liang, 2018) often complemented with “clustered data” assumptions. Our definition is designed to capture the fact that if for , then there is a hidden structure which can be exploited for statistical efficiency.
We first lower-bound the margins and in terms of and then apply margin-based generalization bounds (Koltchinskii and Panchenko, 2002) and bounds on the Rademacher complexity of the unit ball of and .
Numerical experiments
In this section, we consider a large ReLU network with hidden units, and compare the implicit bias and statistical performances of training both layers – which leads to a max margin classifier in – versus the output layer – which leads to max margin classifier in . The experiments are reproducible with the Julia code that can be found online\urlhttps://github.com/lchizat/2020-implicit-bias-wide-2NN.
Low dimensional illustrations.
Figure 1 illustrates the differences in the implicit biases when . It represents a sampled training set and the resulting decision boundary between the two classes for examples. The - max-margin classifier is non-smooth and piecewise affine, which comes from the fact that the mass constraint in Eq. (4) favors sparse solutions. In contrast, the max-margin classifier in has a smooth decision boundary, which is typical of learning in a RKHS.
Performance.
Two implicit biases in one dynamics.
In Figure 3, we illustrate for a case where two different kinds of implicit biases show up in a single dynamics ( is the number of iterations with a constant step-size). We initialize the ReLU network with a large variance (). The model is at first in the lazy regime (Chizat et al., 2019) and follows closely the dynamics of its linearization around initialization, which converges to the max-margin classifier for the tangent kernel (Jacot et al., 2018). It then converges to the -max-margin classifier as suggested by Theorem 3.1. In order to observe this intermediate implicit bias, one needs an initial step-size inversely proportional to the scale of the initialization (Chizat et al., 2019).
Conclusion
We have shown that for wide two-layer ReLU neural networks, training both layers or only the output layer leads to very different implicit biases. When training both layers, the classifier converges to a max-margin classifier for a non-Hilbertian norm, which enjoys favorable statistical properties. Interestingly, this problem does not seem to be directly solvable with known convex methods in high dimension. Proving complexity guarantees for this non-convex gradient flow is an important open question for future work. In particular, even for infinite width, continuous time dynamics as in Theorem 3.1, it is still unknown whether a convergence rate can be given under reasonable conditions.
Acknowledgements
Part of this work was carried through while the first author was visiting the Chair of Statistical Field Theory at the École Polytechnique Fédérale de Lausanne (EPFL), Switzerland. This work was funded in part by the French government under management of Agence Nationale de la Recherche as part of the “Investissements d’avenir” program, reference ANR-19-P3IA-0001 (PRAIRIE 3IA Institute). We also acknowledge support the European Research Council (grant SEQUOIA 724063).
References
Appendix A Organization of the appendix
In Appendix B, we prove the equivalence between our definition of the variation norm in Section 2.3 with the one that is used in the literature on convex neural networks.
In Appendix C, we discuss properties of the Wasserstein gradient flow and justify Theorem 2.2.
In Appendix D, we prove our main theorem Theorem 3.1 and its corollary.
In Appendix E, we prove Proposition 4.1 on the convergence rate with fixed “positions”.
In Appendix F, we prove Proposition 5.1 on the convergence rate when training the output layer.
In Appendix G, we prove Theorem 6.1 on the margins and generalization performance.
In Appendiz H, we prove Theorem 3.3 which covers the case of ReLU networks.
Appendix B Equivalence of two variation norms
Let us introduce, for ReLU networks, the variation norm introduced in Section 2.3 and the different definition from the literature (Bengio et al., 2006; Bach, 2017a). We will show that they are equal up to a factor . This is a known result (Neyshabur et al., 2014), and we provide here a natural proof using the measure theoretic formalism, for the sake of completeness. We stress that the analogous equivalence would fail for the RKHS norms, i.e., such a modification of the feature function could lead to different functional spaces.
An interesting consequence of this result is that empirical risk minimization with the commonly used weight decay regularization and the total variation regularization used by Bengio et al. (2006); Bach (2017a) (the path-norm) are equivalent.
As for the total variation norm of , it can be bounded as follows. In the definition of , we may restrict the integral over , which defines a measure . Similarly restricting the integral over an taking the opposite gives another measure . It holds and thus . Moreover, by integrating against , it holds
since for . Using a similar bound for , we get that
Finally, tracking the equality cases, it holds if and only if is concentrated on the set given in Proposition B.1, which is the intersection of the sphere with the set of points satisfying .
Conversely, let and consider its Jordan decomposition into two nonnegative measures, which is such that . We define two maps as and . Now, define the linear map as
Since pushforwards preserve the mass of nonnegative measures, it holds . Moreover, using the definition of pushforward measures, we have
Appendix C Details on Wasserstein gradient flows
(Divergence form) It can be shown that a Wasserstein gradient flow as defined in Definition 2.1 satisfies, in the sense of distributions, the following partial differential equation (Ambrosio et al., 2008)
(Projected representation) If we look at the projected trajectory , it can be shown that it solves the following dynamic, which is known as Wasserstein-Fisher-Rao or Hellinger-Kantorovich gradient flow of the functional satisfying . In equation,
where is defined on the sphere, see Chizat (2019). Note that there is also a Lagrangian representation for this projected dynamics (Maniglia, 2007) .
(Renormalized dynamics) It can also be seen with a direct computation that the normalized dynamics satisfies the following equation
When the driving potential is (instead of ), this dynamics is known as the spherical Wasserstein-Fisher-Rao or spherical Hellinger Kantorovich gradient flow (Kondratyev and Vorotnikov, 2019) and was considered by Rotskoff et al. (2019) for neural networks training.
C.2 Proof of Theorem 2.2
We just need to prove that the assumptions of Chizat and Bach (2018, Theorem 2.6) are satisfied and justify that non-compactly supported initialization are also allowed.
under Assumption (A3), the function is differentiable with a locally Lipschitz continuous gradient. Moreover its gradient has at most a linear growth by -homogeneity (this verifies assumptions from Chizat and Bach (2018, Assumptions 2.1-(iii)-(c))).
Removing the compact support assumption.
Appendix D Appendix to Section 3: main theorem
Let us restate Theorem 3.1 and give its proof. We recall that and .
Step 1: mass grows unbounded. In a first step, we prove that . Assume that is not constant (the other case will be considered later), and let be such that is a regular value of , i.e., be such that does not vanish on the level-set of . Such a is guaranteed to exist thanks to the fact that is subanalytic (which implies that , which is a finite sum of such , is also subanalytic) and that the sphere is a subanalytic set, and then applying (Bolte et al., 2006, Thm. 14). Note that such admissible are dense in the range of , which will be useful in Step. 3. Let be the corresponding super-level set. By the regular value theorem, the boundary of is a differentiable orientable compact submanifold of and is orthogonal to . By construction, it holds for all , and, for some , by the regular value property, for all where is the unit normal vector to at pointing inwards. Since converges in towards , there exists such that for all , and thus
It follows by Grönwall’s lemma that for . On the other hand, has full support on since it can be written as the pushforward of a rescaled version of by a diffeomorphism, see Maniglia (2007, Eq. (1.3)) (this is the only place where the assumption on the support is needed). Thus and it follows that . To deal with the case where is constant and is equal to , we can directly take to show that . In the rest of the proof, we show that satisfy the optimality conditions of Eq. (4) given by Proposition D.5, which we refer to as the complementary slackness conditions.
Step 2: complementary slackness (I). We first show that . Using the property of gradient flows and previously established estimates, we have for ,
Step 3: complementary slackness (II). We now show that is concentrated on , where is the normalized path and its limit. This is immediate if is constant. Otherwise, assuming that is also a regular value of and taking a potentially smaller (which can always be achieved by perturbing if needed, since regular values are dense as mentioned in Step. 1), it holds for ,
using the fact that no mass enters into due to the divergence term in Eq. (11) for . Comparing the rate of growth of the mass in and in , we get that since is open and by the properties of weak convergence of measures (Portmanteau Theorem). Since this holds for arbitrarily close to , it follows that is concentrated on .
Step 4: conclusion. We have proved the two complementary slackness properties, so by Proposition D.5, the pair satisfies the optimality conditions, which concludes the proof.
D.2 Proof of Corollary 3.2
On the other hand, direct computations using the fact that leads to
Combining both gives the total derivative
Moreover, by Lemma D.7, we have for large enough, uniformly for in a compact set. Hence for all ,
It remains to show that for all , there exists such that if then , so that we deduce from the above
Since is arbitrary, it would follow that which is our claim.
To see this, it is sufficient to notice that since is increasing in for all , and , we have that for all , there exists such that for all and .
D.3 Intermediate results
This section contains intermediate results used in the proof of Theorem 3.1.
By minimax duality (Sion, 1958), we can rewrite Eq (4) as the minimax problem
and it admits (at least) a saddle point . Moreover, the optimality conditions are necessary and sufficient for the right-hand side to equal the left-hand side.
Let us now prove some useful properties of the function
which is a soft-min function under assumption (A2), as shown in the next lemma.
As a consequence, . Thus, .
Under Assumption (A2), let be a sequence such that is lower bounded and converges. Then .
We analyze separately two cases, whether there is such that is upper bounded or not. In the first case, we have
The next lemma is adapted from Gunasekar et al. (2018a, Lemma 8) and exploits the fact that the gradient of is a soft-argmax.
Taking any , we have
Appendix E Appendix for Section 4
Let us recall Proposition 4.1 and prove it.
Let for , and . For the step-sizes and a uniform initialization , it holds
where and the last sum is uniformly bounded in as soon as .
Let us first prove that the normalized dynamics satisfies the (perturbed) online mirror ascent recursion (on the simplex, with the entropy mirror map):
We mention that it is perturbed because for the plain online mirror ascent, the multiplicative term in the first line would be , so we have second order corrections in .
Since , it follows
Now using the fact that , it follows
which are the online mirror ascent updates, with a second-order error term . Notice that , so if we assume that we have . Using the inequality for , we get by applying it with ,
We now follow the usual proof of mirror ascent from Bubeck (2015, Thm. 4.2) (or Beck and Teboulle (2003) for the variable step-size case) and including this error term leads to, for all ,
We get a telescopic sum and using the concavity of each ,
With our choice of initialization, . Let us choose . Using the inequalities
In particular, with the choice , we get
where we used to simplify the expression. Finally, using inequality (14), we have
In the next result, we show that the norm of the iterates grows to and that is finite. For simplicity, we do not track the constants.
Under the assumptions of Proposition 4.1, we have that and is bounded uniformly in .
where only depend on . By summing we get
where we only track the dependency in and . On the other hand, using inequality (14),
Taking for instance shows that and thus . By Lemma E.5 then is increasing for and grows to at a super-polynomial rate and the conclusion follows.
We now prove the asymptotic rate of growth of the norm of the iterates.
If and , then is increasing for large enough and
The result follows since .
Appendix F Appendix to Section 5
Let us recall Proposition 5.1 and prove it.
Let , and and assume that is positive. For the step-sizes and initialization , it holds
Using the fact that and we have
Finally, since it follows that . Thus follows the iterations and
Now using the bound of Eq. (14), it follows
since . It follows that . Using the fact that with and the bound , it follows that and thus
Plugging into the previous bound gives the conclusion. Note that we did not attempt to make the lower bound on tight.
Appendix G Appendix to Section 6: generalization bounds
With the notations of Section 6, let us first lower bound the margins in and in .
Assume that for . For any and , there exists such that
This function is -Lipschitz continuous, satisfies and for all . Let us first consider the case . Using the approximation results of Lipschitz functions in from Bach (2017a, Prop. 6), we know that if is larger than a constant independent of and satisfies
where , then there exists such that and . Since is feasible for the -max-margin problem Eq. (5), this shows that and it remains to estimate how large must be. In the next computations, the dimension dependent constant might change from line to line. Using the bound for , we obtain the stronger condition on :
This is a direct application of the margin-based generalization bounds of Theorem G.5, using that for any with ,
Assume that we have . Then, with probability at least over the sample, for all margins and all we have
Appendix H Proof for the ReLU case
In this appendix, we detail how to rigorously cover the case of ReLU networks, i.e. models as in Eq. (2) with a feature function of the form
We assume that the input distribution has the following properties:
The assumption on excludes discrete measures. Also, the continuity assumption on means that the sets where and where are disconnected, and this implies that they are at a positive distance from each other since the level-sets and are both compact and with empty intersection. This distribution could be for instance the population distribution of the input, or also could be obtained by taking the expectation over small perturbations of the input training set, which is a well-known smoothing technique (e.g., Duchi et al. (2012)). This leads to the definition of the population smooth-margin
defined for , where is the space of continuous and real-valued functions on endowed with the supremum norm. Let us give some facts about this function.
Let be such that and . By continuity of and uniform convergence, there exists such that , it holds for all and for all , where is the open ball of radius centered at . It follows
This shows that . Since this is true for any , it follows that .
Our next step is to gather some regularity properties of . Let us consider the sets
We endow with its Riemannian geometry inherited from the sphere (it is a disconnected manifold with two connected components and ) and let us denote the restriction of to .
Let us now show that is Lipschitz continuous on , which implies the same for . Since this is immediate for the component so let us focus on . For , defining , we have
Existence of a Wasserstein gradient flow.
After these preliminaries, we are in position to show the existence of Wasserstein gradient flows for certain initializations. In this section, we will not attempt to prove uniqueness of the dynamics.
So far, we have proved that for all , there exists a Wasserstein gradient flow starting from , defined on and such that for . The rest of the proof follows that in (Chizat and Bach, 2018, Thm. 2.6) where we extract a (weak) limit curve by compactness and show that it satisfies the Wasserstein gradient flow equation Eq. (8). The only technical point is Step.(iii) in that proof, which is taken care of by the last claim of Lemma H.5. Note that here we do not prove uniqueness of the Wasserstein gradient flow, only its existence.
Implicit bias for ReLU networks.
Let us restate Theorem 3.3 in a slightly more general form and making Assumption (*) explicit. We recall that and .
if converges weakly to some ,
if converges weakly to some , and
then is a maximizer for the -max-margin problem
Before proving this theorem, let us discuss its assumptions. First, the assumption on the initialization given here is satisfied by given in Theorem 3.3 (which is an example given for the sake of concreteness). The conditions in the two first bullets are similar to those of Theorem 3.1 and just require the uniqueness of limits of some sequences that live in compact spaces. In Assumption (*), the fact that the Morse-Sard property holds for was already required in Chizat and Bach (2018) and it is an open question to guarantee that this property holds in this context (where is potentially an infinite sum of subanalytic functions, instead of a finite sum as in Theorem 3.3). Finally, the most undesirable assumption is perhaps the convergence of to in . The fact that it converges in can be shown a priori, so the assumption is really on the uniform convergence of the gradient. In particular, it requires to be continuously differentiable, which is for instance not true if is a discrete measure.
Step 1. The argument of Theorem 3.1 goes through if we replace by the set , in particular thanks to Assumption (*). Lemma H.5 and the positive -homogeneity guarantee that the restriction of the flow to is a diffeomorphism.
Step 2. Since we focus on the exponential loss, we can directly apply Lemma H.3, which gives .
Steps 3. The argument of Theorem 3.1 goes through, again replacing by the set .
Steps 4. We conclude with the optimality conditions in Proposition H.13 and the structure of the minimizers given in Proposition B.1.
The maximization problem (17) admits global maximizers . Moreover, a measure is a global maximizer of (4) if and only if and there exists such that