Gradient Descent on Two-layer Nets: Margin Maximization and Simplicity Bias
Kaifeng Lyu, Zhiyuan Li, Runzhe Wang, Sanjeev Arora
Introduction
One major mystery in deep learning is why deep neural networks generalize despite overparameterization [Zhang et al., 2017]. To tackle this issue, many recent works turn to study the implicit bias of gradient descent (GD) — what kind of theoretical characterization can we give for the low-loss solution found by GD?
The seminal works by Soudry et al. [2018a, b] revealed an interesting connection between GD and margin maximization: for linear logistic regression on linearly separable data, there can be multiple linear classifiers that perfectly fit the data, but GD with any initialization always converges to the max-margin (hard-margin SVM) solution, even when there is no explicit regularization. Thus the solution found by GD has the same margin-based generalization bounds as hard-margin SVM. Subsequent works on linear models have extended this theoretical understanding of GD to SGD [Nacson et al., 2019b], other gradient-based methods [Gunasekar et al., 2018a], other loss functions with certain poly-exponential tails [Nacson et al., 2019a], linearly non-separable data [Ji and Telgarsky, 2018, 2019b], deep linear nets [Ji and Telgarsky, 2019a, Gunasekar et al., 2018b].
Given the above results, a natural question to ask is whether GD has the same implicit bias towards max-margin solutions for machine learning models in general. Lyu and Li studied the relationship between GD and margin maximization on deep homogeneous neural network, i.e., neural network whose output function is (positively) homogeneous with respect to its parameters. For homogeneous neural networks, only the direction of parameter matters for classification tasks. For logistic and exponential loss, Lyu and Li assumed that GD decreases the loss to a small value and achieves full training accuracy at some time point, and then provided an analysis for the training dynamics after this time point (Theorem 3.1), which we refer to as late phase analysis. It is shown that GD decreases the loss to in the end and converges to a direction satisfying the Karush-Kuhn-Tucker (KKT) conditions of a constrained optimization problem (P) on margin maximization.
However, given the non-convex nature of neural networks, KKT conditions do not imply global optimality for margins. Several attempts are made to prove the global optimality specifically for two-layer nets. Chizat and Bach provided a mean-field analysis for infinitely wide two-layer Squared ReLU nets showing that gradient flow converges to the solution with global max margin, which also corresponds to the max-margin classifier in some non-Hilbertian space of functions. Ji and Telgarsky [2020a] extended the proof to finite-width neural nets, but the width needs to be exponential in the input dimension (due to the use of a covering condition). Both works build upon late phase analyses. Under a restrictive assumption that the data is orthogonally separable, i.e., any data point can serve as a perfect linear separator, Phuong and Lampert analyzed the full trajectory of gradient flow on two-layer ReLU nets with small initialization, and established the convergence to a piecewise linear classifier that maximizes the margin, irrespective of network width.
In this paper, we study the implicit bias of gradient flow on two-layer neural nets with Leaky ReLU activation [Maas et al., 2013] and logistic loss. To avoid the lazy or Neural Tangent Kernel (NTK) regime where the weights are initialized to large random values and do not change much during training [Jacot et al., 2018, Chizat et al., 2019, Du et al., 2019b, a, Allen-Zhu et al., 2018, 2019, Zou et al., 2018, Arora et al., 2019b], we use small initialization to encourage the model to learn features actively, which is closer to real-life neural network training.
When analyzing convergence behavior of training on neural networks, one can simplify the problem and gain insights by assuming that the data distribution has a simple structure. Many works particularly study the case where the labels are generated by an unknown teacher network that is much smaller/simpler than the (student) neural network to be trained. Following Brutzkus et al. , Sarussi et al. and many other works, we consider the case where the dataset is linearly separable, namely the labels are generated by a linear teacher, and study the training dynamics of two-layer Leaky ReLU nets on such dataset.
Among all the classifiers that can be represented by the two-layer Leaky ReLU nets, we show any global-max-margin classifier is exactly linear under one more data assumption: the dataset is symmetric, i.e., if is in the training set, then so is . Note that such symmetry can be ensured by simple data augmentation.
Still, little is known about what kind of classifiers neural network trained by GD learns. Though Lyu and Li showed that gradient flow converges to a classifier along KKT-margin direction, we note that this result is not sufficient to guarantee the global optimality since such classifier can have nonlinear decision boundaries. See Figure 1 (left) for an example.
In this paper, we provide a multi-phase analysis for the full trajectory of gradient flow, in contrast with previous late phase analyses which only analyzes the trajectory after achieving training accuracy. We show that gradient flow with small initialization converges to a global-max-margin linear classifier (Theorem 4.2). The proof leverages power iteration to show that neuron weights align in two directions in an early phase of training, inspired by Li et al. . We further show the alignment at any constant training time by associating the dynamics of wide neural net with that of two-neuron neural net, and finally, extend the alignment to the infinite time limit by applying Kurdyka-Łojasiewicz (KL) inquality in a similar way as Ji and Telgarsky [2020a]. The alignment at convergence implies that the convergent classifier is linear.
The above results also justify a recent line of works studying the so-called simplicity bias: GD first learns linear functions in the early phase of training, and the complexity of the solution increases as training goes on [Kalimeris et al., 2019, Hu et al., 2020, Shah et al., 2020]. Indeed, our result establishes a form of extreme simplicity bias of GD: if the dataset can be fitted by a linear classifier, then GD learns a linear classifier not only in the beginning but also at convergence.
On the pessimistic side, this paper suggests that such global margin maximization result could be fragile. Even for linearly separable data, global-max-margin classifiers may be nonlinear without the symmetry assumption. In particular, we show that for any linearly separable dataset, gradient flow can be led to converge to a linear classifier with suboptimal margin by adding only extra data points (Theorem 6.2). See Figure 1 (right) for an example.
Related Works
Margin often appears in the generalization bounds for neural networks [Bartlett et al., 2017, Neyshabur et al., 2018], and larger margin leads to smaller bounds. Jiang et al. conducted an empirical study for the causal relationships between complexity measures and generalization errors, and showed positive results for normalized margin, which is defined by the output margin divided by the product (or powers of the sum) of Frobenius norms of weight matrices from each layer. On the pessimistic side, negative results are also shown if Frobenius norm is replaced by spectral norm. In this paper, we do use the normalized margin with Frobenius norm (see Section 3).
Some works studied the training dynamics of (nonlinear) neural networks on linearly separable data (labels are generated by a linear teacher). Brutzkus et al. showed that SGD on two-layer Leaky ReLU nets with hinge loss fits the training set in finite steps and generalizes well. Frei et al. studied online SGD (taking a fresh sample from the population in each step) on the two-layer Leaky ReLU nets with logistic loss. For any data distribution, they proved that there exists a time step in the early phase such that the net has a test error competitive with that of the best linear classifier over the distribution, and hence generalizes well on linearly separable data. Both two papers reveal that the weight vectors in the first layer have positive correlations with the weight of the linear teacher, but their analyses do not imply that the learned classifier is linear. In the NTK regime, Ji and Telgarsky [2020b], Chen et al. showed that GD on shallow/deep neural nets learns a kernel predictor with good generalization on linearly separable data, and it suffices to have width polylogarithmic in the number of training samples. Still, they do not imply that the learned classifier is linear. Pellegrini and Biroli provided a mean-field analysis for two-layer ReLU net showing that training with hinge loss and infinite data leads to a linear classifier, but their analysis requires the data distribution to be spherically symmetric (i.e., the probability density only depends on the distance to origin), which is a more restrictive assumption than ours. Sarussi et al. provided a late phase analysis for gradient flow on two-layer Leaky ReLU nets with logistic loss, which establishes the convergence to linear classifier based on an assumption called Neural Agreement Regime (NAR): starting from some time point, for any training sample, the outputs of all the neurons have the same sign. However, it is unclear why this can happen a priori. Comparing with our work, we analyze the full trajectory of gradient flow and establish the convergence to linear classifier without assuming NAR. Phuong and Lampert analyzed the full trajectory for gradient flow on orthogonally separable data, but every KKT-margin direction attains the global max margin (see Appendix H) in their setting, which it is not necessarily true in general. In our setting, KKT-margin direction with suboptimal margin does exist.
Kalimeris et al. empirically observed that neural networks in the early phase of training are learning linear classifiers, and provided evidence that SGD learns functions of increasing complexity. Hu et al. justified this view by proving that the learning dynamics of two-layer neural nets and simple linear classifiers are close to each other in the early phase, for dataset drawn from a data distribution where input coordinates are independent after some linear transformation. The aforementioned work by Frei et al. can be seen as another theoretical justification for online SGD on aribitrary data distribution. Shah et al. pointed out that extreme simplicity bias can lead to suboptimal generalization and negative effects on adversarial robustness.
Several theoretical works studying neural network training with small initialization can be connected to simplicity bias. Maennel et al. uncovered a weight quantization effect in training two-layer nets with small initialization: gradient flow biases the weight vectors to a certain number of directions determined by the input data (independent of neural network width). It is hence argued that gradient flow has a bias towards “simple” functions, but their proof is not entirely rigorous and no clear definition of simplicity is given. This weight quantization effect has also been studied under the names of weight clustering [Brutzkus and Globerson, 2019], condensation [Luo et al., 2021, Xu et al., 2021]. Williams et al. studied univariate regression and showed that two-layer ReLU nets with small initialization tend to learn linear splines. For the matrix factorization problem, which can be related to training neural networks with linear or quadratic activations, we can measure the complexity of the learned solution by rank. A line of works showed that gradient descent learns solutions with gradually increasing rank [Li et al., 2018, Arora et al., 2019a, Gidel et al., 2019, Gissin et al., 2020, Li et al., 2021]. Such results have been generalized to tensor factorization where the complexity measure is replaced by tensor rank [Razin et al., 2021]. Beyond small initialization of our interest and large initialization in the lazy or NTK regime, Woodworth et al. , Moroshko et al. , Mehta et al. studied feature learning when the initialization scale transitions from small to large scale.
Preliminaries
Throughout this paper, we restrict our attention to -homogeneous neural nets with definable with respect to in an o-minimal structure for all . (See Coste 2000 for reference for o-minimal structures.) This is a technical condition needed by Theorem 3.1, and it is a mild regularity condition as almost all modern neural networks satisfy this condition, including the two-layer Leaky ReLU networks studied in this paper.
For a dataset , we define to be the output margin on the data point , and to be the output margin on the dataset (or margin for short). It is easy to see that are -homogeneous functions, and so is . We define the normalized margin to be the output margin (on the dataset) for the normalized parameter .
Alternatively, we can also constrain the margin to have and minimize the norm:
One can easily show that is a global maximizer of (M) if and only if is a global minimizer of (P). For convenience, we make the following convention: if is a local/global maximizer of (M), then we say is along a local-max-margin direction/global-max-margin direction; if satisfies the KKT conditions of (P), then we say is along a KKT-margin direction.
Gradient flow with logistic loss is defined by the following differential inclusion,
For homogeneous neural networks, if , then , , and converges to a KKT-margin direction as .
2 Two-Layer Leaky ReLU Networks on Linearly Separable Data
Let be the training set. For simplicity, we assume that . We focus on linearly separable data, thus we assume that is linearly separable throughout the paper.
Training on Linearly Separable and Symmetric Data
In this section, we study the implicit bias of gradient flow assuming the training data is linearly separable and symmetric. We say a dataset is symmetric if whenever is present in the training set, the input is also present. By linear separability, and must have different labels because , where is the max-margin linear separator. The formal statement for this assumption is given below.
is even and for .
This symmetry can be ensured via data augmentation. Given a dataset, if it is known that the ground-truth labels are produced by an unknown linear classifier, then one can augment each data point by flipping the sign, i.e., replace it with two data points , (and thus the dataset size is doubled).
Our results show that gradient flow directionally converges to a global-max-margin direction for two-layer Leaky ReLU networks, when the dataset is linearly separable and symmetric. To achieve such result, the key insight is that any global-max-margin direction represents a linear classifier, which we will see in Section 4.1. Then we will present our main convergence results in Section 4.2.
Theorem 4.2 below characterizes the global-max-margin direction in our case by showing that margin maximization and simplicity bias coincide with each other: a network that representing the max-margin linear classifier (i.e., for some ) can simultaneously achieve the goals of being simple and maximizing the margin.
The result of Theorem 4.2 is based on the observation that replacing each neuron in a network with two neurons of oppositing parameters and does not decrease the normalized margin on the symmetric dataset, while making the classifier linear in function space. Thus if any direction attains the global max margin, we can construct a new global-max-margin direction which corresponds to a linear classifier. We can show that every weight vector of this linear classifier must be in the direction of or . Then the original classifier must also be linear in the same direction.
2 Convergence to Global-Max-Margin Directions
Though Theorem 3.1 guarantees that gradient flow directionally converges to a KKT-margin direction if the loss is optimized successfully, we note that KKT-margin directions can be non-linear and have complicated decision boundaries. See Figure 1 (left) for an example. Therefore, to establish the convergence to linear classifiers, Theorem 3.1 is not enough and we need a new analysis for the trajectory of gradient flow.
Combining Theorem 4.2 and Theorem 4.3, we can conclude that gradient flow achieves the global max margin in our case.
In the settings of Theorem 4.3, gradient flow on linearly separable and symmetric data directionally converges to the global-max-margin direction with probability .
3 Additional Notations and Assumptions
We make the following technical assumption, which holds if we are allowed to add a slight perturbation to the training set.
For all , .
Another technical issue we face is that the gradient flow may not be unique due to non-smoothness. It is possible that is not well-defined as the solution of (1) may not be unique. See Section I.2 for more discussions. In this case, we assign to be an arbitrary gradient flow trajectory starting from . In the case where has only one possible value for all , we say that is a non-branching starting point. We assume the following technical assumption.
Proof Sketch for the Symmetric Case
In this section, we provide a proof sketch for Theorem 4.3. Our proof uses a multi-phase analysis, which divides the training process into phases, from small initialization to the final convergence. We will now elaborate the analyses for them one by one.
Expanding and reorganizing the terms, we have
where -function [Maennel et al., 2018] is defined below:
This means gradient flow optimizes each separately near origin.
2 Phase II: Near-Two-Neuron Dynamics
It is easy to check that by the homogeneity of the activation ( for ):
Moreover, by taking the chain rule, we can obtain the following lemma showing that the trajectories starting from and are essentially the same.
Given with and , if both and are non-branching starting points, then for all .
and moreover, for the -neuron dynamics of , the following holds for all ,
3 Phase III: Dynamics near Global-Max-Margin Direction
With some efforts, we have the following characterization for the two-neuron dynamics.
For , if initially , , and , then directionally converges to the following global-max-margin direction,
where is the max-margin linear separator.
To overcome this issue, we follow a similar proof strategy as Ji and Telgarsky [2020a] to prove local convergence near a local-max-margin direction, as formally stated below. Theorem 5.6 holds for -homogeneous neural networks in general and we believe is of independent interest.
Non-symmetric Data Complicates the Picture
Now we turn to study the case without assuming symmetry and the question is whether the implicit bias to global-max-margin solution still holds. Unfortunately, it turns out the convergence to global-max-margin classifier is very fragile — for any linearly separable dataset, we can add extra data points so that every linear classifier has suboptimal margin but still gradient flow with small initialization converges to a linear classifier.Here linear classifier refers to a classifier whose decision boundary is linear. See Definition 6.1 for the construction and Figure 1 (right) for an example.
Moreover, the convergent classifier only attains a suboptimal margin.
Theorem 6.2 is actually a simple corollary general theorem under data assumptions that hold for a broader class of linearly separable data. From a high-level perspective, we only require two assumptions: (1). There is a direction such that data points have large inner products with this direction on average; (2). The support vectors for the max-margin linear separator have nearly the same labels. The first hint data point is for the first condition and the second and third data point is for the second condition. We defer formal statements of the assumptions and theorems to Appendix A.
Conclusions and Future Works
We study the implicit bias of gradient flow in training two-layer Leaky ReLU networks on linearly separable datasets. When the dataset is symmetric, we show any global-max-margin classifier is exactly linear and gradient flow converges to a global-max-margin direction. On the pessimistic side, we show such margin maximization result is fragile — for any linearly separable dataset, we can lead gradient flow to converge to a linear classifier with suboptimal margin by adding only extra data points. A critical assumption for our convergence analysis is the linear separability of data. We left it as a future work to study simplicity bias and global margin maximization without assuming linear separability.
Acknowledgments and Disclosure of Funding
The authors acknowledge support from NSF, ONR, Simons Foundation, DARPA and SRC. ZL is also supported by Microsoft Research PhD Fellowship.
References
Appendix A Theorem Statements for the Non-symmetric Case
Theorem 6.2 is indeed a simple corollary of Theorem A.7 below which holds for a broader class of datasets. Now we illustrate the assumptions one by one.
There exists a unit-norm vector such that and
where is the projection matrix onto the space perpendicular to , and is the mean vector of .
Indeed, our main theorem is based on a weaker assumption than Assumption A.1, which is Assumption A.2 below, but the geometric meaning of Assumption A.2 is not as clear as Assumption A.1. We will show in Lemma G.1 that Assumption A.1 implies Assumption A.2.
In general, the norms and should not be equal: for any given dataset , we can make by adding arbitrarily small perturbations to the data points. This motivates us to assume that . Without loss of generality, we can assume that for convenience (Assumption A.3). When the reverse is true, i.e., , we can change the direction of the inequality by flipping all the labels in the dataset so that our theorems can apply. We include the theorem statements for this reversed case in Section A.3.
The norm of is strictly larger than , i.e., .
Now we define to be the max-margin linear separator of the dataset consisting of , where , and define to be this max margin. That is,
The reason that we care about and is because that it can be related to margin maximization on one-neuron Leaky ReLU nets. The following lemma is easy to prove.
The third assumption we made is that this margin cannot be obtained when all are negative, regardless of the width. This assumption holds when all the support vectors have positive labels, i.e., . Conceptually, this assumption is about whether nearly all the support vectors have positive labels (or negative labels in the reversed case where ).
Similar to Assumption 4.6 in the symmetric case, we need Assumption A.6 on non-branching starting point due to the technical difficulty for the potential non-uniqueness of gradient flow trajectory.
Now we are ready to state our theorem, and we defer the proofs to Appendix G.
A.2 Applying Theorem A.7 to prove Theorem 6.2
We give a proof of Theorem 6.2 here given the result of Theorem A.7.
With a (, , )-Hinted Dataset (Definition 6.1) with proper , we only need to show that Assumptions A.2, A.3 and A.5 hold for Theorem 6.2. Specifically, we choose the parameters such that
Notice that is indepenent of as the data point has projection . For Assumption A.1, is a valid principal direction in this case, as
Then Assumption A.2 follows from Assumption A.1 by Lemma G.1. Since ,
A.3 Results in the Reversed Case
In a reversed case where , we can apply Theorem A.7 by flipping the labels in the dataset. Below we state the assumptions and the theorem in the reversed case.
.
Now similarly we define and .
Appendix B Additional Preliminaries and Lemmas
In this section, we will introduce additional notations and give some preliminary results for the dynamics of the two-layer Leaky ReLU network. The only assumption we will use for the results in the section is that the input norm is bounded and we do not assume other properties of the dataset (such as symmetry) except we assume it explicitly.
For notational convenience for calculation with subgradients, we generalize the following notations for vectors to vector sets. More specifically, we define
Furthermore, we use the following notations to denote the radial and spherical components of (which will be used in analyzing Phase III):
Let be the set of parameter vectors so that for all , i.e., no activation function has zero input. For any , and are continuously differentiable at , and the gradients are given by
Then the Clarke’s subdifferential for any can be computed from (8) with if needed.
Recall that -function (Section 5.1) is defined by
B.2 Grönwall’s Inequality
We frequently use Grönwall’s inequality in our analysis.
Let be real-valued functions defined on . Suppose that are continuous and is integrable on every compact subinterval of . If and satisfies the following inequality for all :
Furthermore, if is non-decreasing, then for all ,
B.3 Homogeneous Functions
The following is a direct corollary of Lemma B.4.
B.4 Karush-Kuhn-Tucker Conditions for Margin Maximization
We say that is a feasible point if for all . A feasible point is a KKT point if it satisfies Karush-Kuhn-Tucker Conditions: there exist such that
;
.
;
For all , if then .
For two-layer Leaky ReLU network, . Then the KKT-margin direction is defined as follows.
For all , ;
For all , ;
For all , if then .
For along a KKT-margin direction of two-layer Leaky ReLU network, Lemma B.9 below shows that for all .
By Definition B.8 and Theorem B.3, we have
Therefore . ∎
B.5 Lemmas for Perturbation Bounds
Writing the formula with respect to , we have
which completes the proof for and thus the same bounds hold for the general case. ∎
Lemma B.11 is a lemma for bounding the partial subderivatives. For the full subgradient, we have the following lemma.
If , by (13), there exists for all such that
Writing it with respect to , we have
We conclude the proof by noticing that by Lemma B.10. ∎
B.6 Basic Properties of Gradient Flow
The following lemma is a simple corollary from Davis et al. .
For gradient flow on a two-layer Leaky ReLU network with logistic loss, we have
The following lemma is from Du et al. . We provide a simple proof here for completeness.
For gradient flow on a two-layer Leaky ReLU network with logistic loss, the following holds for all ,
where . Therefore, for all .
By (9), we have the following for any ,
By -homogeneity of and Theorem B.3, we have , which implies that .
By chain rule, for a.e. we have
The following lemma shows that if a neuron has zero weights, then it stays with zero weights forever. Conversely, this also implies that the weights stay non-zero if they are initially non-zero.
If and at some time , then and for all .
By Lemma B.16, we know that hold for all . Also, we have , where is some constant. Then
By Grönwall’s inequality (12) this implies that for all . Similarly,
By Grönwall’s inequality (12) again, for all , which completes the proof. ∎
A direct corollary of Lemma B.16 and Lemma B.17 is the following characterization in the case where the weights are initially balanced.
If initially for , then this equation holds for all . Moreover,
If , then for all ;
If , then for all .
B.7 A Useful Theorem for Loss Convergence
In this section we prove a useful theorem for loss convergence, which will be used later in our analysis for both symmetric and non-symmetric datasets.
Under Assumption 3.2, for any linear seprator of the data with positive linear margin (e.g. for all ), if initially there exists such that
then for all , and and as .
Before proving Theorem B.19, we first prove a lemma on gradient lower bounds.
We only need to show that there exists such that , then we can apply Theorem 3.1 to show that . Assume to the contrary that for all . By Lemma B.20,
Lemma B.15 ensures that for a.e. . Then we have
Integrating on from to , we can see that the LHS is upper bounded by while the RHS is unbounded, which leads to a contradiction. Therefore, there exist time such that , and thus as . ∎
Appendix C Proofs for Linear Maximality for the Symmetric Case
For linearly separable and symmetric data, we show that all global-max-margin directions represent linear functions in Theorem 4.2. We give a proof here.
Now we define and let where
Meanwhile, by the Cauchy-Schwarz inequality,
Thus . As is already a global-max-margin direction, equalities should hold in all the inequalities above, so
There is that .
Certainly as otherwise the margin would be zero. Then , which means , and therefore
;
.
Appendix D Proofs for Phase I
In the subsequent sections we first show the proofs for the symmetric datasets under Assumption 4.1. Additional proofs for the non-symmetric counterparts are provided in Appendix G.
By definition and Cauchy-Schwartz inequality,
For initial point , we have
Appendix E Proofs for Phase II
To prove Lemma 5.3, we start from the following lemma.
Given with and , then is a gradient flow trajectory on starting from .
For any and , .
Below we use to denote the embedding of a parameter set.
For every (i.e., no activation function has zero input), let , and clearly . Then and are the usual differentials. In this case, we can apply the chain rule as
Notice that the embedding preserves the function value,
so . Then from the chain rule above we can see , and we proved the lemma in this case.
In the general case, by the definition of Clarke’s subdifferential,
For any with , , and
Taking the convex hull, it follows that , and we finished the proof. ∎
For notations we write and . Then for a.e. . At these , . From Lemma E.2 we know . Then for a.e. , and therefore is indeed a gradient flow trajectory. ∎
By Lemma E.1, is indeed a gradient flow trajectory. Then, as , as well as the fact that and are non-branching starting points, the gradient flow trajectory is unique and therefore for all . ∎
E.2 A General Theorem for Limiting Trajectory Near Zero
We say that is a well-aligned parameter vector if it satisfies the following for some :
For , for all ;
For , , .
Our analysis for Phase I shows that weight vectors approximately align to either of or , and both of them are maximizers of . Therefore, gradient flow goes near a well-aligned parameter vector (with ) at the end of Phase I.
The following is the main theorem of this subsection.
Then for all , the following is true:
exists. This limit is independent of the choice of when the gradient flow may not be unique.
lies near :
Let be a series of parameters converging to , be a series of positive real numbers converging to . If for some , then
Now we prove Theorem E.4. Throughout this subsection, we fix a well-aligned parameter vector with constant . We also use and to denote the same constant defined by (14) and the same function as in Theorem E.4.
For all , ;
within the time interval (and thus it also holds for by continuity), and to show that is actually equal to , i.e., is the minimum among . It is easy to see that proving these suffice to deduce the original lemma statement, given the translation of time .
For , . Also note that by Lemma B.5. Then and . Combining these with (15) gives
For , we can combine Theorem B.3 and (15) to give the following bound for the norm growth:
To prove the lemma, now we only need to show that . Combining (19) and (21), we have for ,
For all time , we can use (22) to deduce
For norm growth, we can again use (22) to deduce
Now we have . Recall that by definition. Then must hold, which completes the proof. ∎
For , by triangle inequality and Lemma B.5 we have
For , we use triangle inequality again to give the following bound:
At time , this bound can be rewritten as
First we show that exists. We consider the case of , where is chosen to be small enough so that the properties in Lemma E.5 hold. For any , by Lemma E.5 we have
Note that . So this proves
For any fixed , the RHS converges to as , which implies Cauchy convergence of the limit and thus the limit exists. By the 1st property in Lemma E.5, we know that there is no activation pattern switch in the time interval if is small enough. This means is locally smooth near the trajectory of and thus the trajectory is unique. Therefore, the limit is uniquely defined.
Taking on both sides gives the range of the limit :
So is proved. ∎
E.3 Proof for Approximate Embedding
To analyze Phase II, we need to deal with approximate embedding instead of the exact one. For this, we further divide Phase II into Phase II.1 and II.2 and analyze them in order. At the end of this subsection we will prove Lemma 5.4.
Given the discussions in the previous sections, we are ready to present proofs for the phase II dynamics (Lemma 5.4) here.
For the -neuron dynamics , the following holds for all ,
Applying Theorem E.4 proves the following for all :
E.4 Proofs for Phase II.2
Next, at the end of Phase II.1, has a constant norm. Then we show the trajectory convergence with respect to the initialization scale in Phase II.2.
We first start with a simple lemma on gradient upper bounds, and then show that the trajectory of gradient flow is Lipschitz with time.
Finally we show that is indeed a valid gradient flow trajectory. Notice that is -Lipschitz, then by Rademacher theorem for is differentiable for a.e. . We are left to show whenever is differentiable at .
For any that , we investigate the behaviour of in the -neighborhood of . Let be the set of so that . By definition of differential inclusion, has full measure in . Define be the following closed convex hull:
It is easy to see that is monotonic with respect to . Then we know that for any ,
Then taking the limits , as all are closed, we know .
Now let be the following closed convex hull of subgradients:
Then we know for all and . Notice that and are also monotonic with respect to and respectively so we can take the respective limit. As for , , by the upper-semicontinuity of , . Then .
When and is differential at , we can take the limit , and by the upper-semicontinuity of again, we have
as is closed convex for any . Therefore is indeed a gradient flow trajectory. ∎
Appendix F Proofs for Phase III
In this subsection we prove Theorem 5.5 for the symmetric datasets. By Theorem B.19 and Theorem 3.1, we know that gradient flow must converge in a KKT-margin direction of width- two-layer Leaky ReLU network (Definition B.8). Thus we first give some characterizations for KKT-margin directions by proving Lemma F.1 and Lemma F.2.
for all Clarke’s sub-differentials .
We prove by cases for any fixed . By Assumption 4.1 we have
Otherwise, , then we have , , and thus
Suppose that or . WLOG we assume that (the case of can be proved similarly). Then we have
If is along a KKT-margin direction of width- two-layer Leaky ReLU network and , then , .
, ;
, ;
For all , if then .
Let and . Let . Then the following conditions hold for all :
By homogeneity, . Left-multiplying or on both sides of (25), we have
where the last inequality is due to Lemma F.1. Since we have deduced that , we further have
Combining this with , we have . So all the inequalities become equalities, and thus . (36) also equals to (37), so
By (27), we have whenever . Combining this with (38), we have
Then we prove that by discussing two cases:
If , then since ;
This means and have the same projection onto the linear space spanned by . By (25) and (26), and are in the span of . Therefore, and we can easily deduce that , . ∎
If is along a KKT-margin direction of width- two-layer Leaky ReLU network and , and , then one of the following three cases is true:
;
;
.
Suppose and , then by Lemma F.2, we know , . Since , we know , which implies is differentiable at . Let and , we know is along the KKT direction of the following optimization problem:
By Theorem B.19 and Theorem 3.1, we know must be along a KKT-margin direction. By Lemma F.3, we know that there are only KKT-margin directions:
Thus it suffices to show . ( would hold for the same reason.)
For convenience, we define if and if . By Assumption 4.1 we know that and .
We first define the angle between and as and angle between and as . Since and , by Lemma B.20 we know that for all .
We also define , which can be understood as the angle between and the decision boundary determined by the linear separator .
Below we will prove by contradiction. Suppose holds. Then and as . Thus there must exist such that .
Note that for all . By symmetry, for we have
We will use these to show that is non-decreasing for , which further implies is lower bounded by some constant. Thus it contradicts with the assumption of convergence.
By Corollary B.18, we know that and for all . Then for all , we have
By (10), if then we have
where . Note that this only holds for . By taking limits through (8), we know that for a.e. , there exists such that (39) holds and
By chain rule, for a.e. we have:
Now we are ready to prove for . For this, we only need to show that in two cases.
By (40), we therefore have .
If , then by our choice of we have . Then for all , . So we have
Thus .
Now we have shown that , where is a constant (ratio at time ). So for ,
is lower bounded, which contradicts with . ∎
F.2 Directional Convergence of L𝐿L-homogeneous Neural Nets
Define to be the length of the trajectory swept by from time to . Define to be the cosine of the angle between and .
We leverage the following two lemmas from Ji and Telgarsky [2020a] on desingularizing function. Formally, we say that is a desingularizing function if is continuous on with and continuously differentiable on with .
Given a locally Lipschitz definable function with an open domain , for any , there exists and a definable desingularizing function on such that
Given a locally Lipschitz definable function with an open domain , for any , there exists and a definable desingularizing function on such that
For , we have the following lemma from Lyu and Li .
F.2.2 Characterizing Margin Maximization with Asymptotic Clarke Critical Value
Before proving Theorem 5.6, we first prove the following theorem that characterizes margin maximization using asymptotic Clarke critical value.
Combining these proves that . ∎
F.2.3 Proof for Theorem 5.6
Given Lemmas F.4 and F.5 from Ji and Telgarsky [2020a], we have the following inequality around any direction.
Since is definable, there exists a sufficiently small constant such that either holds for all , or holds for all . This means either for all or for all . Let in the former case and in the latter case. Then and , and thus both Items 1 and 2 hold. ∎
Now we prove the following lemma, which will directly lead to Theorem 5.6. The core idea of the proof is essentially the same as that for Lemma 3.3 in Ji and Telgarsky [2020a]. The key difference here is that the desingularizing function in their lemma has dependence on the initial point, while our lemma does not have such dependence.
Fix an arbitrary . Let be the desingularizing function on obtained from Lemma F.10. WLOG, we can make .
where .
We consider two cases, where assume (42) is true in Case 1 and (42) is not true in Case 2. According to our choice of and the monotonicity of , we have , and thus . This means
For any , if and (42) does not hold for , i.e.,
By the chain rule and Lemma C.5 in Ji and Telgarsky [2020a],
Putting (51), (52) and (56) together gives
where the last equality is due to . Applying (44) gives
For a.e. , lies in either Case 1 or Case 2, so (46) holds, and we can rewrite it as
By Lemma F.11, we can choose such that
If , then (57) implies that converges to some as , and if .
F.3 Proof for Theorem 4.3
Appendix G Trajectory-based Analysis for Non-symmetric Case
The proofs for the non-symmetric case follow similar manners from phase I to phase III. The high-level idea is to show the following in the 3 phases:
In Phase I, every weight vector in the first layer moves towards the direction of either or . At the end of Phase I the weight vectors towards have much smaller norms than those towards , thereby becoming negligible.
In Phase II, we show that the dynamics of is close to a one-neuron dynamic (after embedding) for a long time.
In Phase III, we show that the one-neuron classifier converges to the max-margin solution among one-neuron neural nets (while the embedded classifier may have suboptimal margin among -neuron neural nets), and the gradient flow on the -neuron neural net gets stuck at a KKT-direction near this embedded classifier.
In this section we highlight the additional notations that allow us to adapt the results from previous sections. For , define to be the convex cone containing all the unit weight vectors that have margin over the dataset .
We use , to denote , after normalization. Similar to , we define and as the perturbed versions of and in the sense that and .
G.2 More about Our Assumptions
The following lemma shows that Assumption A.1 is a weaker assumption than Assumption A.2.
Let be the principal direction defined in Assumption A.1. We can decompose , where is the along the direction of and is orthogonal to . Assumption A.1 implies that for all ,
On the other hand, recall that , then we have
Lemma G.2 gives the main property we will use from Assumption A.2, i.e. .
Therefore we have the following equivalence:
Lemma G.2 shows that every direction in has non-zero margin. Below we let the be the minimum of the margin of unit-norm linear separators in :
By (58) we have , and thus .
G.3 Phase I
The overall result we will prove for phase I in the non-symmetric case is Lemma G.5. Compared to the symmetric case, even function is not linear anymore. Recall is defined as below:
For any dataset satisfying Assumption A.2, suppose , and it holds that
then there exists , such that .
However, in the realistic setting, each is not following gradient flow of exactly — there are tiny correlations between different . And we will control those correlations by setting initialization very small. This yields Lemma G.4.
Under Assumption A.2, if satisfies the following three conditions:
For all , ;
If , then for any ;
If , then for any ;
By definitions of and , it holds that ,
By the continuity of the distance function, there exists such that , it holds that
where the inequality is because and .
Finally, by (63), it suffices to pick and . ∎
G.3.2 Proof of Lemma G.5
Let and . The largest eigenvalues for and are and respectively. Then the above linear ODE can be solved as
By Assumption A.3, we have . By definition and Cauchy-Schwartz inequality,
For with and , we have
Then we can argue as the proof for Lemma D.2 to show that
where the last equality is by definition of . Similarly for , we have
Combining these with (64) and (65), then for we have
Then by definition of and (66), we have
Letting and completes the proof. ∎
G.4 Phase II
As shown in our analysis for Phase I, if the intialization scale is small, the weight vectors of neurons with move towards the direction of , and all the other neurons are negligible. Now we show that the dynamic of is close to that of a one-neuron dynamic in a similar manner as we do for the symmetric case.
If , then ;
If , then .
When is compatible with , we define the (exact) embedding from two-neuron into -neuron neural nets as , where
One can easily show that Lemma 5.3 continue to hold when is compatible with .
For the two-neuron dynamics starting with rescaled initialization in the direction of , the following limit exists for all ,
The proof is similar to Lemma 5.4 for the symmetric case. Apply Theorem E.4 and then the lemma is straightforward. ∎
G.5 Phase III
In Phase III, we show that the dynamic of converges to the same classifier as the one-neuron dynamic.
The theorem below characterizes the solution found by the one-neuron dynamic.
Under Assumption 3.2, for , if initially , , then directionally converges to the following global-max-margin direction,
By Definition B.8, and can be expressed by a convex combination of among . Equivalently. we know that and can be expressed by a convex combination of among . Then the only possibility is . ∎
Now we turn to analyze the trajectory of on -neuron neural net. First we prove the following lemma, then we prove Theorem G.11 for local-max-margin directions.
Let . Then we have the following characterization for the global maximum of the normalized margin on the dataset :
By minimax theorem, we can swap the order between and in the following way:
For any embedding vect be an embedding vector satisfying the following:
is compatible with ;
the following statements are true under Assumption A.5,
is a local maximizer of among ;
.
Let and . Define and to be two unit-norm parameters so that , . Then we have
Note that . By minimax theorem (similar to Lemma G.10),
By definition of and KKT conditions, we can find so that . Letting for the above inequality, we can obtain
We only need to prove that both and are no more than . Note that combining Assumption A.5 and Lemma G.10 directly implies that . Now we focus on .
According to our choice of , we have . For , we have
This proves that , and thus . Therefore Item 1 is true.
For Item 2, we only need to note that the equality in only holds if and for all , so represents the same function as . ∎
For proving Theorem A.7, we only need to show this:
Appendix H Proofs for the Orthogonally Separable Case
In this section, we revisit the orthogonally separable setting considered by Phuong and Lampert . Suprisingly, in this setting, all KKT points which contains at least one positive neuron and negative neuron are indeed global-max-margin directions and unique in function space. This means it is possible to prove the global optimality of margin in Phuong and Lampert ’s setting even without a trajectory-based analysis.
A binary classification dataset is called orthogonally separable if for all , if whenever and whenever .
The Theorem H.2 is a simple corollary of the following lemma Lemma H.3.
If satisfies the KKT conditions of (P), then for , and is the global minimizer of the following optimization problem (Q):
In other words, all the non-zero can be split into groups according to the sign of , where in each group, is the same.
By Lemma H.3, we know for any satisfying the KKT condition of (P),
Thus is the same for all satisfying the condition in the theorem statement. Here the last equality uses (69) and .
Next we check the uniqueness of . For any , we have
and whenever . By Lemma B.9, .
Furthermore, for any , since , there is at least one index such that (otherwise by KKT conditions). For all , again by (70), it holds that
Therefore we can split the neurons with non-zero into two parts: , . Every satisfies the following:
Recall that whenever . When , can be rewritten as
So we can verify that satisfies the KKT conditions of the following constrained convex optimization problem:
By convexity, is the unique minimizer of the above problem. The negative part can be analyzed in the same way. ∎
Appendix I Additional Discussions
In this section we further illustrate the the relationship between KKT-margin and max-margin directions, as the examples have showed in Figure 1.
For some symmetric data, there are KKT-margin directions with non-linear decision boundary (and thus by Theorem 4.2 are not global-max-margin directions).
Let be the dual variable for , then the KKT conditions (Definition B.8 and Lemma B.9) ask
for all , ;
for all , ;
for all , if then (recall that ).
In this case, all the data points share the same output margin , so they are all support vectors. A possible choice of dual variables is . It is easy to verify that this KKT-margin direction does not have linear decision boundary and is thus not global-max-margin.
I.1.2 Middle and Right: Non-symmetric Data
In Figure 1 we further show two examples of non-symmetric data that gradient flow from small initialization converges to a linear-boundary classifier that has a suboptimal margin.
The idea of the middle plot dataset comes from Shah et al. . In the middle subplot, we exhibit a data example that is linear separable in the first dimension but not linear separable in the second dimension . The data is distributed on and with label and on with label (here is an interval in one dimension). We add identical entries to all the data in the third dimension so in the plane with the two-layer ReLU network can represent decision patterns with bias.
In the right plot, we add three hints to a linear separable dataset so that gradient flow converges to the solution with a linear decision boundary and suboptimal margin. The result follows from Theorem 6.2.
I.1.3 Experimental Results
We run gradient descent with small learning rate and 0.001 times the He intialization [He et al., 2015] on the two-layer LeakyReLU network for the examples in Figure 1. The contours of the neural net outputs are displayed in Figure 2. In the three settings the neural nets actually converge to linear classifiers.
I.2 On the Non-branching Starting Point Assumptions
In the proofs of the main theorems we make assumptions regarding the starting point of gradient flow trajectories being non-branching (Assumption 4.6 for the symmetric case and Assumption A.6 for the non-symmetric case). The assumptions address a technical difficulty due to the potential non-uniqueness of gradient flow trajectories on general non-smooth loss functions. The motivations for these assumptions are explained below.
Gradient flow trajectories are unique on smooth loss functions by the classic theory of ordinary differential equations. In this case, for trajectory defined by , at any point , if both and are continuous, then the trajectory is unique as long as it exists.
For the non-smooth case with differential inclusion , when is continuous and convex, the Clarke subdifferentials agree with the subdifferentials for convex functions, and gradient flow trajectory is also unique (for instance see Bolte et al. 2010). However, on loss functions that are non-smooth and non-convex, gradient flow may not be unique and the trajectory may branch at non-differentiable points (see Figure 3). When a non-differentiable point is atop a “ridge”, a gradient flow reaching it may go down different slopes next. Then any starting points wherefrom gradient flow can reach such on-the-ridge points are not non-branching starting points as the trajectory is not unique. For instance, with , then the trajectory with for and for is a valid gradient flow trajectory for any . On the other hand, when the point is either at the bottom of a “valley” or at a “refraction edge”, the trajectory would not split. Figure 3 sketches in red the possible gradient flow trajectories in different circumstances.
In the case of two-layer Leaky ReLU network dynamics, there are settings where Assumption 4.6 or Assumption A.6 holds. When data points are orthogonally separable (Definition H.1), all starting points are non-branching. In this case, the output of each Leaky ReLU neuron will change monotonically. By the chain rule, for any neuron , on any data sample ,
In the general cases, it is a future research direction to find other analyses that can replace the non-branching starting point assumptions, and doing so may deepen our understanding in the trajectory behaviors in non-smooth settings.
Appendix J Additional Experiments
We conducted several additional experiments on synthetic datasets. The goal is to show that 2-layer Leaky ReLU networks actually converges to the max-margin linear classifiers in different settings with moderately small initialization. The results are summarized in Table 1 and Figure 4.
data points are randomly sampled from the standard gaussian distribution in the space of dimension , and are classified with a linear classifier through zero. Then the points are translated mildly away from the classifier to make a small nonzero margin that assists learning.
We used the two-layer leaky ReLU network with hidden layer width and with bias terms. In out setting the bias term is equivalent to adding an extra dimension of value to all the data points. We trained our model with the gradient descent method from 0.001 times the He initialization [He et al., 2015] and initial learning rate 0.01. The learning rate is raised after interpolation to boost margin increase.
We compare the neural network output with the max-margin linear classfier produced by the support vector machine (SVM) on hinge loss. In Table 1, the test errors are calculated from 10000 test points from the same distribution. In Figure 4, we drawn the decision boundaries for both the SVM max-margin linear classifier and the neural network restricted to a plane passing 0. The results show that the neural network classifier converges to the max-margin linear classfier in our setting.