Gradient Descent Maximizes the Margin of Homogeneous Neural Networks
Kaifeng Lyu, Jian Li
Introduction
A major open question in deep learning is why gradient descent or its variants, are biased towards solutions with good generalization performance on the test set. To achieve a better understanding, previous works have studied the implicit bias of gradient descent in different settings. One simple but insightful setting is linear logistic regression on linearly separable data. In this setting, the model is parameterized by a weight vector , and the class prediction for any data point is determined by the sign of . Therefore, only the direction is important for making prediction. Soudry et al. (2018a; b); Ji & Telgarsky (2018; 2019c); Nacson et al. (2019c) investigated this problem and proved that the direction of converges to the direction that maximizes the -margin while the norm of diverges to , if we train with (stochastic) gradient descent on logistic loss. Interestingly, this convergent direction is the same as that of any regularization path: any sequence of weight vectors such that every is a global minimum of the -regularized loss with (Rosset et al., 2004). Indeed, the trajectory of gradient descent is also pointwise close to a regularization path (Suggala et al., 2018).
The aforementioned linear logistic regression can be viewed as a single-layer neural network. A natural and important question is to what extent gradient descent has similiar implicit bias for modern deep neural networks. For theoretical analysis, a natural candidate is to consider homogeneous neural networks. Here a neural network is said to be (positively) homogeneous if there is a number (called the order) such that the network output , where stands for the parameter and stands for the input, satisfies the following:
It is important to note that many neural networks are homogeneous (Neyshabur et al., 2015a; Du et al., 2018). For example, deep fully-connected neural networks or deep CNNs with ReLU or LeakyReLU activations can be made homogeneous if we remove all the bias terms, and the order is exactly equal to the number of layers.
In (Wei et al., 2019), it is shown that the regularization path does converge to the max-margin direction for homogeneous neural networks with cross-entropy or logistic loss. This result suggests that gradient descent or gradient flow may also converges to the max-margin direction by assuming homogeneity, and this is indeed true for some sub-classes of homogeneous neural networks. For gradient flow, this convergent direction is proven for linear fully-connected networks (Ji & Telgarsky, 2019a). For gradient descent on linear fully-connected and convolutional networks, (Gunasekar et al., 2018b) formulate a constrained optimization problem related to margin maximization and prove that gradient descent converges to the direction of a KKT point or even the max-margin direction, under various assumptions including the convergence of loss and gradient directions. In an independent work, (Nacson et al., 2019a) generalize the result in (Gunasekar et al., 2018b) to smooth homogeneous models (we will discuss this work in more details in Section 2).
In this paper, we identify a minimal set of assumptions for proving our theoretical results for homogeneous neural networks on classification tasks. Besides homogeneity, we make two additional assumptions:
Exponential-type Loss Function. We require the loss function to have certain exponential tail (see Appendix A for the details). This assumption is not restrictive as it includes the most popular classfication losses: exponential loss, logistic loss and cross-entropy loss.
Separability. The neural network can separate the training data during training (i.e., the neural network can achieve training accuracy)Note that this does NOT mean the training loss is 0..
While the first assumption is natural, the second requires some explanation. In fact, we assume that at some time , the training loss is smaller than a threshold, and the threshold here is chosen to be so small that the training accuracy is guaranteed to be (e.g., for the logistic loss and cross-entropy loss, the threshold can be set to ). Empirically, state-of-the-art CNNs for image classification can even fit randomly labeled data easily (Zhang et al., 2017). Recent theoretical work on over-parameterized neural networks (Allen-Zhu et al., 2019; Zou et al., 2018) show that gradient descent can fit the training data if the width is large enough. Furthermore, in order to study the margin, ensuring the training data can be separated is inevitable; otherwise, there is no positive margin between the data and decision boundary.
Our Contribution. Similar to linear models, for homogeneous models, only the direction of parameter is important for making predictions, and one can see that the margin scales linearly with , when fixing the direction of . To compare margins among in different directions, it makes sense to study the normalized margin, .
In this paper, we focus on the training dynamics of the network after (recall that is a time that the training loss is less than the threshold). Our theoretical results can answer the following questions regarding the normalized margin.
Second, how large is the normalized margin at convergence? To answer this question, we formulate a natural constrained optimization problem which aims to directly maximize the margin. We show that every limit point of is along the direction of a KKT point of the max-margin problem. This indicates that gradient descent/gradient flow performs margin maximization implicitly in deep homogeneous networks. This result can be seen as a significant generalization of previous works (Soudry et al., 2018a; b; Ji & Telgarsky, 2019a; Gunasekar et al., 2018b) from linear classifiers to homogeneous classifiers.
As by-products of the above results, we derive tight asymptotic convergence/growth rates of the loss and weights. It is shown in (Soudry et al., 2018a; b; Ji & Telgarsky, 2018; 2019c) that the loss decreases at the rate of , the weight norm grows as for linear logistic regression. In this work, we generalize the result by showing that the loss decreases at the rate of and the weight norm grows as for homogeneous neural networks with exponential loss, logistic loss, or cross-entropy loss.
Experiments.Code available: https://github.com/vfleaking/max-margin The main practical implication of our theoretical result is that training longer can enlarge the normalized margin. To justify this claim empiricaly, we train CNNs on MNIST and CIFAR-10 with SGD (see Section K.1). Results on MNIST are presented in Figure 1. For constant step size, we can see that the normalized margin keeps increasing, but the growth rate is rather slow (because the gradient gets smaller and smaller). Inspired by our convergence results for gradient descent, we use a learning rate scheduling method which enlarges the learning rate according to the current training loss, then the training loss decreases exponentially faster and the normalized margin increases significantly faster as well.
For feedforward neural networks with ReLU activation, the normalized margin on a training sample is closely related to the -robustness (the -distance from the training sample to the decision boundary). Indeed, the former divided by a Lipschitz constant is a lower bound for the latter. For example, the normalized margin is a lower bound for the -robustness on fully-connected networks with ReLU activation (see, e.g., Theorem 4 in (Sokolic et al., 2017)). This fact suggests that training longer may have potential benefits on improving the robustness of the model. In our experiments, we observe noticeable improvements of -robustness on both training and test sets (see Section K.2).
Related Work
Implicit Bias in Training Linear Classifiers. For linear logistic regression on linearly separable data, Soudry et al. (2018a; b) showed that full-batch gradient descent converges in the direction of the max -margin solution of the corresponding hard-margin Support Vector Machine (SVM). Subsequent works extended this result in several ways: Nacson et al. (2019c) extended the results to the case of stochastic gradient descent; Gunasekar et al. (2018a) considered other optimization methods; Nacson et al. (2019b) considered other loss functions including those with poly-exponential tails; Ji & Telgarsky (2018; 2019c) characterized the convergence of weight direction without assuming separability; Ji & Telgarsky (2019b) proved a tighter convergence rate for the weight direction.
Those results on linear logistic regression have been generalized to deep linear networks. Ji & Telgarsky (2019a) showed that the product of weights in a deep linear network with strictly decreasing loss converges in the direction of the max -margin solution. Gunasekar et al. (2018b) showed more general results for gradient descent on linear fully-connected and convolutional networks with exponential loss, under various assumptions on the convergence of the loss and gradient direction.
Margin maximization phenomenon is also studied for boosting methods (Schapire et al., 1998; Rudin et al., 2004; 2007; Schapire & Freund, 2012; Shalev-Shwartz & Singer, 2010; Telgarsky, 2013) and Normalized Perceptron (Ramdas & Pena, 2016).
Implicit Bias in Training Nonlinear Classifiers. Soudry et al. (2018a) analyzed the case where there is only one trainable layer of a ReLU network. Xu et al. (2018) characterized the implicit bias for the model consisting of one single ReLU unit. Our work is closely related to a recent independent work by (Nacson et al., 2019a) which we discuss in details below.
Comparison with (Nacson et al., 2019a). Very recently, (Nacson et al., 2019a) analyzed gradient descent for smooth homogeneous models and proved the convergence of parameter direction to a KKT point of the aforementioned max-margin problem. Compared with their work, our work adopt much weaker assumptions: (1) They assume the training loss converges to , but in our work we only require that the training loss is lower than a small threshold value at some time (and we prove the exact convergence rate of the loss after ); (2) They assume the convergence of parameter direction Assuming the convergence of the parameter direction may seem quite reasonable, however, the problem here can be quite subtle in theory. In Appendix J, we present a smooth homogeneuous function , based on the Mexican hat function (Absil et al. (2005)), such that even the direction of the parameter does not converge along gradient flow (it moves around a cirle when increases). , while we prove that KKT conditions hold for all limit points of , without requiring any convergence assumption; (3) They assume the convergence of the direction of losses (the direction of the vector whose entries are loss values on every data point) and Linear Independence Constraint Qualification (LICQ) for the max-margin problem, while we do not need such assumptions. Besides the above differences in assumptions, we also prove the monotonicity of the normalized margin and provide tight convergence rate for training loss. We believe both results are interesting in their own right.
Another technical difference is that their work analyzes discrete gradient descent on smooth homogeneous models (which fails to capture ReLU networks). In our work, we analyze both gradient descent on smooth homogeneous models and also gradient flow on homogeneous models which could be non-smooth.
Other Works on Implicit Bias. Banburski et al. (2019) also studied the dynamics of gradient flow and among other things, provided mathematical insights to the implicit bias towards max margin solution for homogeneous networks. We note that their analysis of gradient flow decomposes the dynamics to the tangent component and radial component, which is similar to our proof of Theorem 4.1 in spirit. Wilson et al. (2017); Ali et al. (2019); Gunasekar et al. (2018a) showed that for the linear least-square problem gradient-based methods converge to the unique global minimum that is closest to the initialization in distance. Du et al. (2019); Jacot et al. (2018); Lee et al. (2019); Arora et al. (2019b) showed that over-parameterized neural networks of sufficient width (or infinite width) behave as linear models with Neural Tangent Kernel (NTK) with proper initialization and gradient descent converges linearly to a global minimum near the initial point. Other related works include (Ma et al., 2019; Gidel et al., 2019; Arora et al., 2019a; Suggala et al., 2018; Blanc et al., 2019; Neyshabur et al., 2015b; a).
Preliminaries
Gradient Descent. We consider the process of training this neural network with either gradient descent or gradient flow. For gradient descent, we assume the training loss is -smooth and describe the gradient descnet process as , where is the learning rate at time and is the gradient of at .
Gradient Descent / Gradient Flow on Homogeneous Model
Gradient Flow. For gradient flow, we assume the following:
(Regularity). For any fixed , is locally Lipschitz and admits a chain rule;
(Homogeneity). There exists such that ;
(Separability). There exists a time such that .
(A1) is a technical assumption about the regularity of the network output. As shown in (Davis et al., 2020), the output of almost every neural network admits a chain rule (as long as the neural network is composed by definable pieces in an o-minimal structure, e.g., ReLU, sigmoid, LeakyReLU).
Gradient Descent. For gradient descent, we assume (A2), (A3), (A4) similarly as for gradient flow, and the following two assumptions (S1) and (S5).
2 Main Theorem: Monotonicity of Normalized Margins
The margin for a single data point is defined to be , and the margin for the entire dataset is defined to be . By homogenity, the margin scales linearly with for any fixed direction since . So we consider the normalized margin defined as below:
We say is an -additive approximation for the normalized margin if , and -multiplicative approximation if .
Gradient Flow. Our first result is on the overall trend of the normalized margin . For both gradient flow and gradient descent, we identify a smoothed version of the normalized margin, and show that it is non-decreasing during training. More specifically, we have the following theorem for gradient flow.
Gradient Descent. For gradient descent, Theorem 4.1 holds similarly with a slightly different function that approximates multiplicatively rather than additively.
Under assumptions (S1), (A2) - (A4), (S5), there exists an -multiplicative approximation function for the normalized margin such that the following statements are true for gradient descent:
For all , ;
For all , either or ;
and as ; therefore, .
Due to the discreteness of gradient descent, the explicit formula for is somewhat technical, and we refer the readers to Appendix E for full details.
It is shown in Theorem 4.1, 4.2 that and . In fact, with a more refined analysis, we can prove tight loss convergence and weight growth rates using the monotonicity of normalized margins.
For gradient flow under assumptions (A1) - (A4) or gradient descent under assumptions (S1), (A2) - (A4), (S5), we have the following tight bounds for training loss and weight norm:
where for gradient flow and for gradient descent.
3 Main Theorem: Convergence to KKT Points
To understand the implicit regularization effect, a natural question arises: what optimality property does the limit of normalized margin have? To this end, we identify a natural constrained optimization problem related to margin maximization, and prove that directionally converges to its KKT points, as shown below. We note that we can extend this result to the finite time case, and show that gradient flow or gradient descent passes through an approximate KKT point after a certain amount of time. See Theorem A.9 in Appendix A and Theorem E.4 in Appendix E for the details. We will briefly review the definition of KKT points and approximate KKT points for a constraint optimization problem in Appendix C.1.
For gradient flow under assumptions (A1) - (A4) or gradient descent under assumptions (S1), (A2) - (A4), (S5), any limit point of is along the direction of a KKT point of the following constrained optimization problem (P):
That is, for any limit point , there exists a scaling factor such that satisfies Karush-Kuhn-Tucker (KKT) conditions of (P).
Minimizing (P) over its feasible region is equivalent to maximizing the normalized margin over all possible directions. The proof is as follows. Note that we only need to consider all feasible points with . For a fixed , is a feasible point of (P) iff . Thus, the minimum objective value over all feasible points of (P) in the direction of is . Taking minimum over all possible directions, we can conclude that if the maximum normalized margin is , then the minimum objective of (P) is .
It can be proved that (P) satisfies the Mangasarian-Fromovitz Constraint Qualification (MFCQ) (See Lemma C.7). Thus, KKT conditions are first-order necessary conditions for global optimality. For linear models, KKT conditions are also sufficient for ensuring global optimality; however, for deep homogeneous networks, can be highly non-convex. Indeed, as gradient descent is a first-order optimization method, if we do not make further assumptions on , then it is easy to construct examples that gradient descent does not lead to a normalized margin that is globally optimal. Thus, proving the convergence to KKT points is perhaps the best we can hope for in our setting, and it is an interesting future work to prove stronger convergence results with further natural assumptions.
Moreover, we can prove the following corollary, which characterizes the optimality of the normalized margin using SVM with Neural Tangent Kernel (NTK, introduced in (Jacot et al., 2018)) defined at limit points. The proof is deferred to Appendix C.6.
Assume (S1). Then for gradient flow under assumptions (A2) - (A4) or gradient descent under assumptions (A2) - (A4), (S5), any limit point of is along the max-margin direction for the hard-margin SVM with kernel , where . That is, for some , is the optimal solution for the following constrained optimization problem:
If we assume (A1) instead of (S1) for gradient flow, then there exists a mapping such that the same conclusion holds for .
4 Other Main Results
The above results can be extended to other settings as shown below.
Then all our results for gradient flow continue to hold (Appendix A). Using a similar modification, we can also extend it to gradient descent (Appendix F).
Cross-entropy Loss. In multi-class classification, we can define to be the difference between the classification score for the true label and the maximum score for the other labels, then the margin and the normalized margin can be similarly defined as before. In Appendix G, we define the smoothed normalized margin for cross-entropy loss to be the same as that for logistic loss (See Remark A.4). Then we show that Theorem 4.1 and Theorem 4.4 still hold (but with a slightly different definition of (P)) for gradient flow, and we also extend the results to gradient descent.
Multi-homogeneous Models. Some neural networks indeed possess a stronger property than homogeneity, which we call multi-homogeneity. For example, the output of a CNN (without bias terms) is -homogeneous with respect to the weights of each layer. In general, we say that a neural network with is -homogeneous if for any and any , we have . In the previous example, an -layer CNN with layer weights is -homogeneous.
One can easily see that that -homogeneity implies -homogeneity, where , so our previous analysis for homogeneous models still applies to multi-homogeneous models. But it would be better to define the normalized margin for multi-homogeneous model as
In this case, the smoothed approximation of for general binary classification loss (under some conditions) can be similarly defined for gradient flow:
Proof Sketch: Gradient Flow on Homogeneous Model with Exponential Loss
In this section, we present a proof sketch in the case of gradient flow on homogeneous model with exponential loss to illustrate our proof ideas. Due to space limit, the proof for the main theorems on gradient flow and gradient descent in Section 4 are deferred to Appendix A and E respectively.
Lemma 5.1 below is the key lemma in our proof. It decomposes the growth of the smoothed normalized margin into the ratio of two quantities related to the radial and tangential velocity components of respectively. We will give a proof sketch for this later in this section. We believe that this lemma is of independent interest.
For ease of presentation, we ignore the regularity issues of taking derivatives in this proof sketch. We start from the equation which follows from the chain rule (see also Lemma I.3). Then we note that can be decomposed into two parts: the radial component and the tangent component .
The radial component is easier to analyze. By the chain rule, . For , we have an exact formula:
The last equality is due to by homogeneity of . This is sometimes called Euler’s theorem for homogeneous functions (see Theorem B.2). For differentiable , it can be easily proved by taking the derivative over on both sides of and letting .
With (6), we can lower bound by
where the last inequality uses the fact that . (7) also implies that for since and is non-increasing. As , this also proves the first inequality of Lemma 5.1.
Now, we have on the one hand; on the other hand, by the chain rule we have . So we have
Dividing on the leftmost and rightmost sides, we have
Discussion and Future Directions
In this paper, we analyze the dynamics of gradient flow/descent of homogeneous neural networks under a minimal set of assumptions. The main technical contribution of our work is to prove rigorously that for gradient flow/descent, the normalized margin is increasing and converges to a KKT point of a natural max-margin problem. Our results leads to some natural further questions:
Can we generalize our results for gradient descent on smooth neural networks to non-smooth ones? In the smooth case, we can lower bound the decrement of training loss by the gradient norm squared, multiplied by a factor related to learning rate. However, in the non-smooth case, no such inequality is known in the optimization literature.
Can we make more structural assumptions on the neural network to prove stronger results? In this work, we use a minimal set of assumptions to show that the convergent direction of parameters is a KKT point. A potential research direction is to identify more key properties of modern neural networks and show that the normalized margin at convergence is locally or globally optimal (in terms of optimizing (P)).
Can we extend our results to neural networks with bias terms? In our experiments, the normalized margin of the CNN with bias also increases during training despite that its output is non-homogeneous. It is very interesting (and technically challenging) to provide a rigorous proof for this fact.
Acknowledgments
The research is supported in part by the National Natural Science Foundation of China Grant 61822203, 61772297, 61632016, 61761146003, and the Zhongguancun Haihua Institute for Frontier Information Technology and Turing AI Institute of Nanjing. We thank Liwei Wang for helpful suggestions on the connection between margin and robustness. We thank Sanjeev Arora, Tianle Cai, Simon Du, Jason D. Lee, Zhiyuan Li, Tengyu Ma, Ruosong Wang for helpful discussions.
References
Appendix A Results for General Loss
We first focus on gradient flow. We assume (A1), (A2) as we do for exponential loss. For (A3), (A4), we replace them with two weaker assumptions (B3), (B4). All the assumptions are listed below:
(Regularity). For any fixed , is locally Lipschitz and admits a chain rule;
(Homogeneity). There exists such that ;
There exists such that is non-decreasing for , and as .
Let be the inverse function of on the domain . There exists such that and for all and .
We summarize the corresponding and for exponential loss and logistic loss below:
The proof for Remark A.1 is trivial. For Remark A.2, we give a proof below.
By simple calculations, the formulas for are correct. (B3.1) is trivial. , so (B3.2) is satisfied. For (B3.3), note that . The denominator is a decreasing function since
A.2 Smoothed Normalized Margin
Assuming (B3)Indeed, (B3.4) is not needed for showing Lemma A.5 and Theorem A.7., we have the following properties about the margin:
.
If , then there exists such that
(a) can be easily deduced from . Combining (a) and the monotonicity of , we further have for . By the mean value Theorem, there exists such that . Dividing on each side of proves (b).
Now we prove (c). Without loss of generality, we assume for all . It follows from (b) that for every there exists such that
Note that . So by (B3.3). Also note that there exists a constant such that for all since is continuous on the unit sphere . So we have
A.3 Theorems
Now we state our main theorems. For the monotonicity of the normalized margin, we have the following theorem. The proof is provided in Appendix B.
Under assumptions (A1), (A2), (B3), (B4), the following statements are true for gradient flow:
For the normalized margin at convergence, we have two theorems, one for infinite-time limiting case, and the other being a finite-time quantitative result. Their proofs can be found in Appendix C. As in the exponential loss case, we define the constrained optimization problem (P) as follows:
First, we show the directional convergence of to a KKT point of (P).
Consider gradient flow under assumptions (A1), (A2), (B3), (B4). For every limit point of , is a KKT point of (P).
Second, we show that after finite time, gradient flow can pass through an approximate KKT point.
Consider gradient flow under assumptions (A1), (A2), (B3), (B4). For any , there exists and such that is an -KKT point at some time satisfying .
For the definitions for KKT points and approximate KKT points, we refer the readers to Appendix C.1 for more details.
With a refined analysis, we can also provide tight rates for loss convergence and weight growth. The proof is given in Appendix D.
Under assumptions (A1), (A2), (B3), (B4), we have the following tight rates for loss convergence and weight growth:
Applying Theorem A.10 to exponential loss and logistic loss, in which , we have the following corollary:
Appendix B Margin Monotonicity for General Loss
In this section, we consider gradient flow and prove Theorem A.7. We assume (A1), (A2), (B3), (B4) as mentioned in Appendix A.
We follow the notations in Section 5 to define and , and sometimes we view the functions of as functions of .
To prove the first two propositions, we generalize our key lemma (Lemma 5.1) to general loss.
Before proving Lemma B.1, we review two important properties of homogeneous functions. Note that these two properties are usually shown for smooth functions. By considering Clarke’s subdifferential, we can generalize it to locally Lipschitz functions that admit chain rules:
That is, .
That is, for all .
Let be the set of points such that is differentiable at . According to the definition of Clarke’s subdifferential, for proving (a), it is sufficient to show that
Taking limits on both sides, we know that the LHS converges to iff the RHS converges to . Then by definition of differetiability and gradient, is differentiable at iff it is differentiable at , and iff . This proves (10).
holds for a.e. . Pick an arbitrary making (11) hold. Then by (a), (11) is equivalent to , which proves (b). ∎
Applying Theorem B.2 to homogeneous neural networks, we have the following corollary:
where is the network output for a fixed input .
Corollary B.3 can be used to derive an exact formula for the weight growth during training.
The proof idea is to use Corollary B.3 and chain rules (See Appendix I for chain rules in Clarke’s sense). Applying the chain rule on yields for all and a.e.. Then applying the chain rule on , we have
By Corollary B.3, , and thus . ∎
For convenience, we define for all . Then Theorem B.4 can be rephrased as for a.e. .
By Lemma A.5, for all . Then by Assumption (B3),
Combining this with the definitions of and gives
On the one hand, for a.e. by Lemma I.3; on the other hand, by Theorem B.4. Combining these together yields
By the chain rule, for a.e. . So we have
B.2 Proof for Proposition 3
Therefore, and as .
Integrating on both sides from to , we can conclude that
Note that is non-decreasing. If does not grow to , then neither does . But the RHS grows to , which leads to a contradiction. So .
To make , must converge to . So . ∎
Appendix C Convergence to the Max-margin Solution
In this section, we analyze the convergent direction of and prove Theorem A.8 and A.9, assuming (A1), (A2), (B3), (B4) as mentioned in Section A.
We follow the notations in Section 5 to define and , and sometimes we view the functions of as functions of .
We first review the definition of Karush-Kuhn-Tucker (KKT) conditions for non-smooth optimization problems following from (Dutta et al., 2013).
A feasible point of (P) is a KKT point if satisfies KKT conditions: there exists such that
;
.
It is important to note that a global minimum of (P) may not be a KKT point, but under some regularity assumptions, the KKT conditions become a necessary condition for global optimality. The regularity condition we shall use in this paper is the non-smooth version of Mangasarian-Fromovitz Constraint Qualification (MFCQ) (see, e.g., the constraint qualification (C.Q.5) in (Giorgi et al., 2004)):
Following from (Dutta et al., 2013), we define an approximate version of KKT point, as shown below. Note that this definition is essentially the modified -KKT point defined in their paper, but these two definitions differ in the following two ways: (1) First, in their paper, the subdifferential is allowed to be evaluated in a neighborhood of , so our definition is slightly stronger; (2) Second, their paper fixes , but in our definition we make them independent.
For , a feasible point of (P) is an -KKT point if there exists for all such that
;
.
As shown in (Dutta et al., 2013), -KKT point is an approximate version of KKT point in the sense that a series of -KKT points can converge to a KKT point. We restate their theorem in our setting:
C.2 KKT Conditions for (P)
Recall that for a homogeneous neural network, the optimization problem (P) is defined as follows:
Using the terminologies and notations in Appendix C.1, the objective and constraints are and . The KKT points and approximate KKT points for (P) are defined as follows:
A feasible point of (P) is a KKT point if there exist such that
for some satisfying ;
.
A feasible point of (P) is an -KKT point of (P) if there exists such that
for some satisfying ;
.
By the homogeneity of , it is easy to see that (P) satisfies MFCQ, and thus KKT conditions are first-order necessary condition for global optimality.
(P) satisfies MFCQ at every feasible point .
Take . For all satisfying , by homogeneity of ,
holds for any . ∎
C.3 Key Lemmas
For showing Theorem A.8 and Theorem A.9, we first prove Lemma C.8. In light of this lemma, if we aim to show that is along the direction of an approximate KKT point, we only need to show (which makes ) and (which makes ).
Let be two constants defined as
Proof for (13).
Note that . By Lemma B.5 and Lemma D.1, we have
By Theorem A.7, we have already known that . So it remains to bound . For this, we first prove the following lemma to bound the integral of .
By Lemma B.4, for a.e. . By Lemma B.1, for a.e. ,
By the chain rule, . So we have
where the last equality follows from the definition of . Combining 14 and 15, we have
Integrating on both sides from to proves the lemma. ∎
A direct corollary of Lemma C.9 is the upper bound for the minimum within a time interval:
For all , then there exists such that
Denote the RHS as . Assume to the contrary that for a.e. . By Lemma B.1, for a.e. . Then by Lemma C.9, we have
In the rest of this section, we present both asymptotic and non-asymptotic analyses for the directional convergence by using Corollary C.10 to bound .
C.4 Asymptotic Analysis
We first prove an auxiliary lemma which gives an upper bound for the change of .
Note that every summand is positive. By Lemma A.5, is lower-bounded by , so we can replace with in the above inequality. Combining with the fact that is just , we have
To prove Theorem A.8, we consider each limit point , and construct a series of approximate KKT points converging to it. Then can be shown to be a KKT point by Theorem C.4. The following lemma ensures that such construction exists.
Let be a time such that . According to Theorem A.7, , so must exist. We construct to be a time that , where the existence can be shown by Corollary C.10.
Now we show that this construction meets our requirement. It follows from that . By Lemma C.11, we also know that
C.5 Non-asymptotic Analysis
C.6 Proof for Corollary 4.5
By the homogeneity of , we can characterize KKT points using kernel SVM.
If is KKT point of (P), then there exists for such that is an optimal solution for the following constrained optimization problem (Q):
It is easy to see that (Q) is a convex optimization problem. For , from Theorem B.2, we can see that , which implies Slater’s condition. Thus, we only need to show that satisfies KKT conditions for (Q).
By the KKT conditions for (P), we can construct for such that for some and . Thus, satisfies
;
.
So satisfies KKT conditions for (Q). ∎
Now we prove Corollary 4.5 in Section 4.3.
By Theorem A.8, every limit point is along the direction of a KKT point of (P). Combining this with Lemma C.13, we know that every limit point is also along the max-margin direction of (Q).
For smooth models, in (Q) is exactly the gradient . So, (Q) is the optimization problem for SVM with kernel . For non-smooth models, we can construct an arbitrary function that ensures . Then, (Q) is the optimization problem for SVM with kernel . ∎
Appendix D Tight Bounds for Loss Convergence and Weight Growth
In this section, we give proof for Theorem A.10, which gives tight bounds for loss convergence and weight growth under Assumption (A1), (A2), (B3), (B4).
Before proving Theorem A.10, we show some consequences of (B3.4).
For all , ;
For all , .
Thus, .
To prove Item 1, it is sufficient to show that
To prove Item 2, we only need to notice that Item 1 implies for all . ∎
Recall that (B3.4) directly implies that and . Combining this with Lemma D.1, we have the following corollary:
and .
Also, note that Lemma D.1 essentially shows that and . So and , which means that and grow at most polynomially.
and .
D.2 Proof for Theorem A.10
We follow the notations in Section 5 to define and , and sometimes we view the functions of as functions of . And we use the notations from Appendix C.3.
The key idea to prove Theorem A.10 is to utilize Lemma B.6, in which is bounded from above by . So upper bounding reduces to lower bounding . In the following lemma, we obtain tight asymptotic bounds for and :
For function defined in Lemma B.6 and its inverse function , we have the following bounds:
We first prove the bounds for , and then prove the bounds for .
Let . For ,
On the other hand, for , we have
Let for . always has a finite value whenever is finite. So when . According to the first part of the proof, we know that . Taking logarithm on both sides and using Corollary D.3, we have . By Corollary D.2, . Therefore,
This implies that . ∎
For other bounds, we derive them as follows. We first show that . With this equivalence, we derive an upper bound for the gradient at each time in terms of , and take an integration to bound from below. Now we have both lower and upper bounds for . Plugging these two bounds to gives the lower and upper bounds for .
We first prove the upper bound for . Then we derive lower and upper bounds for in terms of , and use these bounds to give a lower bound for . Finally, we plug in the tight bounds for to obtain the lower and upper bounds for in terms of .
Upper Bounding ℒℒ\mathcal{L}.
By Lemma B.6, we have . Using Lemma D.4, we have , which completes the proof.
Bounding ρ𝜌\rho in Terms of ℒℒ\mathcal{L}.
Lower Bounding ℒℒ\mathcal{L}.
Let be a set of vectors such that and
By (17) and Corollary D.2, . Again by (17), we have . Combining these two bounds together, it follows from Corollary D.2 that
By definition of , this implies that there exists a constant such that for any that is small enough. We can complete our proof by applying Lemma D.4.
Bounding ρ𝜌\rho in Terms of t𝑡t.
By (17) and the tight bound for , . Using Corollary D.2, we can conclude that . ∎
Appendix E Gradient Descent: Smooth Homogeneous Models with Exponential Loss
In this section, we discretize our proof to prove similar results for gradient descent on smooth homogeneous models. As usual, the update rule of gradient descent is defined as
Here is the learning rate, and is the gradient of at .
We first focus on the exponential loss. At the end of this section (Appendix F), we discuss how to extend the proof to general loss functions with a similar assumption as (B3).
Technically, recall that does not hold exactly for gradient descent. However, if the smoothness can be bounded by , then it is well-known that
As stated in Section 4.1, we assume (A2), (A3), (A4) similarly as for gradient flow, and two additional assumptions (S1) and (S5).
(Homogeneity). There exists such that ;
(Separability). There exists a time such that .
(Learing rate condition). and .
Here is a function of the current training loss. The explicit formula of is given below:
where is a constant, and are two non-decreasing functions. For constant learning rate , (S5) is satisfied when if sufficiently small.
Roughly speaking, is an upper bound for the smoothness of in a neighborhood of when . And we set the learning rate to be the inverse of the smoothness multiplied by a factor . In our analysis, can be any non-decreasing function that maps to and makes the integral exist. But for simplicity, we define as
The value of will be specified later. The definition of depends on . For , we define as
where . The specific meaning of and will become clear in our analysis.
E.2 Smoothed Normalized Margin
Here is constructed as follows. Construct the first-order derivative of as
where . And then we set to be
is well-defined for and has the following properties:
First we verify that is well-defined. To see this, we only need to verify that
exists for all , then it is trivial to see that is indeed the derivative of by .
Note that exists for all as long as exists for a small enough . By definition, it is easy to verify that is decreasing when is small enough. Thus, for a small enough , we have
So we have the following for small enough :
To prove (b), we combine (19) and (20), then for small enough , we have
So . ∎
Now we specify the value of . By (S1) and (S2), we can define as follows:
Then we set .
E.3 Theorems
Now we state our main theorems for the monotonicity of the normalized margin and the convergence to KKT points. We will prove Theorem E.2 in Appendix E.4, and prove Theorem E.3 and E.4 in Appendix E.5.
Under assumptions (S1), (A2) - (A4), (S5), the following are true for gradient descent:
For all , ;
For all , either or ;
Consider gradient flow under assumptions (S1), (A2) - (A4), (S5). For every limit point of , is a KKT point of (P).
Consider gradient descent under assumptions (S1), (A2) - (A4), (S5). For any , there exists and such that is an -KKT point at some time satisfying .
With a refined analysis, we can also derive tight rates for loss convergence and weight growth. We defer the proof to Appendix E.6.
Under assumptions (S1), (A2) - (A4), (S5), we have the following tight rates for training loss and weight norm:
where .
E.4 Proof for Theorem E.2
We define as we do for gradient flow. Then we can get a closed form for easily from Corollary B.3. Also, we can get a lower bound for using Lemma B.5 for exponential loss directly.
. If , then .
By the chain rule and the definitions of , we have
For all , we interpolate between and by defining for . Then for all integer , , and the following holds for all :
.
.
.
To prove Lemma E.8, we only need to prove the following lemma and then use an induction:
Fix an integer . Suppose that (P1), (P2), (P3), (P4) hold for any . Then if (P1) holds for for some , then all of (P1), (P2), (P3), (P4) hold for .
We prove this lemma by induction. For , by (S4) and Corollary E.6. (P2), (P3), (P4) hold trivially since , and . By Lemma E.1, (P1) also holds trivially.
Now we fix an integer and assume that (P1), (P2), (P3), (P4) hold for any (where is an integer and ). By (P3), , so . We only need to show that (P1), (P2), (P3), (P4) hold for and .
Applying (P3) on , we have . Then by Corollary E.6, we have . Applying (P2) on , we can get .
By definition, . By Corollary E.6, we have
So . For the other direction, we have the following using Corollary E.6 and Lemma E.7,
Proof for (P3).
(P3) holds trivially for or . So now we assume that and . By the update rule (18) and Taylor expansion, there exists such that
By Lemma E.7, , so we have
Now we only need to show that for all . Assuming this, we can have by the monotonicity of , and thus
Proof for (P4).
We define and similarly as in the analysis for gradient flow. For , we have
Decompose . Then by (P3), we have
Multiplying on both sides, we have
By Corollary E.6, we can bound by . By (P2), we have the inequality . So we further have
From the definition , it is easy to see that . Let , then . Combining these together gives
Then by convexity of and , we have
And by definition of , this can be re-written as
Proof for (P1).
By (P4), . Note that . So we have
For showing the third proposition in Theorem E.2, we use (P1) to give a lower bound for , and use (P3) to show the speed of loss decreasing. Then it can be seen that and . By Lemma E.1, we then have .
Let . Then for all ,
Therefore, and as .
For any integer , and . Combining these with (P3), we have
By (P1), . By Corollary E.6, . Thus we have
It is easy to see that is unimodal in , so is non-decreasing and is convex. So we have
which proves . Note that is non-decreasing. If does not decreases to , then neither does . But the RHS grows to , which leads to a contradiction. So . To make , must converge to . So . ∎
E.5 Proof for Theorem E.3 and E.4
The proofs for Theorem E.3 and E.4 are similar as those for Theorem A.8 and A.9 in Appendix C.
Dividing on the leftmost and rightmost sides, we have
which implies that . Therefore, for any , we can always find the minimum time such that , and it holds for sure that as . ∎
For proving Theorem E.3, we also need the following lemma as a variant of Lemma C.11.
where the last inequality uses the inequality . Using this inequality again, we can bound the second term by
We only need to change the choices of in the proof for Lemma C.12. We choose to be a time such that
Then we let be the minimum time such that . According to Theorem E.2, and must exist. Finally, we construct to be a time that , where the existence can be shown by (22).
To see that this construction meets our requirement, note that and
where the last inequality is by Lemma E.11. ∎
E.6 Proof for Theorem E.5
By a similar analysis as Lemma D.4, we have
We can also bound the inverse function by . With these, we can use a similar analysis as Theorem A.10 to prove Theorem E.5.
First, using a similar proof as for (17), we have . So we only need to show . With a similar analysis as for (P3) in Lemma E.9, we have the following bound for :
Using the fact that , we have . By Lemma E.7, . Using a similar proof as for Lemma E.10, we can show that . Combining this with Lemma E.10, we have . Therefore, . ∎
Appendix F Gradient Descent: General Loss Functions
It is worth to note that the above analysis can be extended to other loss functions. For this, we need to replace (B3) with a strong assumption (S3), which takes into account the second-order derivatives of .
There exists such that is non-decreasing for , and as .
Let be the inverse function of on the domain . There exists such that for all ,
It can be verified that (S3) is satisfied by exponential loss and logistic loss. Now we explain each of the assumptions in (S3). (S3.2) and (S3.3) are essentially the same as (B3.2) and (B3.3). (S3.1) and (B3.1) are the same except that (S3.1) assumes is -smooth rather than -smooth.
(S3.4) can also be written in the following form:
That is, and grow no faster than and , respectively. In fact, (B3.4) can be deduced from (S3.4). Recall that (B3.4) ensures that and . Thus, (S3.4) also gives us the interchangeability between and .
(S3.4) implies (B3.4) with and .
Fix and . Integrating (23) on both sides of the inequalities from to and to , we have
Therefore, we have and . ∎
To extend our results to general loss functions, we need to redefine in order. For and , we redefine them as follows:
By Lemma D.1, . So is well-defined. Using , we can define and as follows.
For , we define it to be the following.
Finally, the definitions for and in (S5) remain unchanged except that and now use the new definitions.
Similar as gradient flow, we define . The key idea behind the above definitions is that we can prove similar bounds for as Corollary E.6 and Lemma E.7.
. If , then and has the lower bound .
It can be easily proved by combining Theorem B.4, Lemma B.5 and Lemma D.1 together. ∎
Note that a direct corollary of (23) is that for . So we have
where . Applying (S3.4), we can also deduce that
Now we bound and . By the chain rule, we have
With Corollary E.6 and Lemma E.7, we can prove Lemma E.8 with exactly the same argument. Then Theorem E.2, E.3, E.4 can also be proved similarly. For Theorem E.5, we can follow the argument for gradient flow to show that it holds with slightly different tight bounds:
Under assumptions (S1), (A2), (S3), (A4), (S5), we have the following tight rates for training loss and weight norm:
where .
Appendix G Extension: Multi-class Classification
In this section, we generalize our results to multi-class classification with cross-entropy loss. This part of analysis is inspired by Theorem 1 in (Zhang et al., 2019), which gives a lower bound for the gradient in terms of the loss .
The margin for a single data point is defined to be , and the margin for the entire dataset is defined to be . We define the normalized margin to be , where and as usual.
For gradient flow, we assume the following:
(Regularity). For any fixed and , is locally Lipschitz and admits a chain rule;
(Homogeneity). There exists such that ;
(Cross-entropy Loss). is defined as the cross-entropy loss on the training set;
(Separability). There exists a time such that .
If , then for all , and thus for all . So (M4) ensures the separability of training data.
Theorem 4.1 and 4.4 still hold. Here we redefine the optimization problem (P) to be
Most of our proofs are very similar as before. Here we only show the proof for the generalized version of Lemma 5.1.
Define by the following formula:
Using a similar argument as in Theorem B.4, it can be proved that for a.e. .
The rest of the proof for this lemma is exactly the same as that for Lemma 5.1. ∎
Gradient Descent.
For gradient descent, we only need to replace (M1) with (S1) and make the assumption (S5) on the learning rate.
(Smoothness). For any fixed and , is -smooth;
(Learing rate condition). and .
We only need to show that Lemma F.2 and Lemma F.3 continue to hold. Using the same argument as we do for gradient flow, we can show that and do satisfy the propositions in Lemma F.2. For Lemma F.3, we first note the original definition of involves , which are undefined in the multi-class setting. So now we redefine them as
Using these bounds, we can prove with the constant defined as follows:
where .
Appendix H Extension: Multi-homogeneous Models
In this section, we extend our results to multi-homogeneous models. For this, the main difference from the proof for homogeneous models is that now we have to separate the norm of each homogeneous parts of the parameter, rather than consider them as a whole. So only a small part to proof needs to be changed. We focus on gradient flow, but it is worth to note that following the same argument, it is not hard to extend the results to gradient descent.
Let be -homogeneous. Let and . The smoothed normalized margin defined in (5) can be rewritten as follows:
We only prove the generalized version of Lemma 5.1 here. The other proofs are almost the same.
On the one hand, for a.e. by Lemma I.3; on the other hand, by Theorem B.4. Combining these together yields
By the chain rule, for a.e. . So we have
For cross-entropy loss, we can combine the proofs in Appendix G to show that Lemma H.2 holds if we use the following definition of the smoothed normalized margin:
The only place we need to change in the proof for Lemma H.2 is that instead of using Lemma B.5, we need to prove in a similar way as in Lemma G.2. The other parts of the proof are exactly the same as before.
Appendix I Chain Rules for Non-differentiable Functions
In this section, we provide some background on the chain rule for non-differentiable functions. The ordinary chain rule for differentiable functions is a very useful formula for computing derivatives in calculus. However, for non-differentiable functions, it is difficult to find a natural definition of subdifferential so that the chain rule equation holds exactly. To solve this issue, Clarke proposed Clarke’s subdifferential (Clarke, 1975; 1990; Clarke et al., 2008) for locally Lipschitz functions, for which the chain rule holds as an inclusion rather than an equation:
For analyzing gradient flow, the chain rule is crucial. For a differentiable loss function , we can see from the chain rule that the function value keeps decreasing along the gradient flow :
But for locally Lipschitz functions which could be non-differentiable, (25) may not hold in general since Theorem I.1 only holds for an inclusion.
Following (Davis et al., 2020; Drusvyatskiy et al., 2015), we consider the functions that admit a chain rule for any arc.
It is shown in (Davis et al., 2020; Drusvyatskiy et al., 2015) that a generalized version of (25) holds for such functions:
We can see that -smooth functions admit chain rules. As shown in (Davis et al., 2020), if a locally Lipschitz function is subdifferentiablly regular or Whitney -stratifiable, then it admits a chain rule. The latter one includes a large family of functions, e.g., semi-algebraic functions, semi-analytic functions, and definable functions in an o-minimal structure (Coste, 2002; van den Dries & Miller, 1996).
It is worth noting that the class of functions that admits chain rules is closed under composition. This is indeed a simple corollary of Theorem I.1.
Since and admit chain rules on arcs and respectively, the following holds for a.e. ,
Combining these we obtain that for a.e. ,
for all and for all . The RHS can be rewritten as . By Theorem I.1, every can be written as a convex combination of a finite set of points in the form of . So holds for a.e. . ∎
Appendix J Mexican Hat
In this section, we give an example to illustrate that gradient flow does not necessarily converge in direction, even for -smooth homogeneous models.
It is known that gradient flow (or gradient descent) may not converge to any point even when optimizing an function (Curry, 1944; Zoutendijk, 1976; Palis & De Melo, 2012; Absil et al., 2005). One famous counterexample is the “Mexican Hat” function described in (Absil et al., 2005):
However, the Maxican Hat function is not homogeneous, and Absil et al. (2005) did not consider the directional convergence, either. To make it homogeneous, we introduce an extra variable , and normalize the parameter before evaluate . In particular, we fix and define
Consider gradient flow on , where for all . Suppose the polar representation of is . If and holds at time , then does not converge to any point, and the limit points of form a circle .
Define . Our proof consists of two parts, following from the idea in (Absil et al., 2005). First, we show that as long as . Then we can infer that for all . Next, we show that as . Using , we know that the polar angle as . Therefore, circles around , and thus it does not converge.
Proof for . For convenience, we use to denote . By simple calculation, we have the following formulas for partial derivatives:
By writing down the movement of in the polar coordinate system, we have
For , the partial derivatives of with respect to and can be evaluated as follows:
So if , then by the direct calculation below:
Appendix K Experiments
To validate our theoretical results, we conduct several experiments. We mainly focus on MNIST dataset. We trained two models with Tensorflow. The first one (called the CNN with bias) is a standard 4-layer CNN with exactly the same architecture as that used in MNIST Adversarial Examples Challengehttps://github.com/MadryLab/mnist_challenge. The layers of this model can be described as conv-32 with filter size , max-pool, conv-64 with filter size , max-pool, fc-1024, fc-10 in order. Notice that this model has bias terms in each layer, and thus does not satisfy homogeneity. To make its outputs homogeneous to its parameters, we also trained this model after removing all the bias terms except those in the first layer (the modified model is called the CNN without bias). Note that keeping the bias terms in the first layer prevents the model to be homogeneous in the input data while retains the homogeneity in parameters. We initialize all layer weights by He normal initializer (He et al., 2015) and all bias terms by zero. In training the models, we use SGD with batch size without momentum. We normalize all the images to by dividing for each pixel.
In the first part of our experiments, we evaluate the normalized margin every few epochs to see how it changes over time. From now on, we view the bias term in the first layer as a part of the weight in the first layer for convenience. Observe that the CNN without bias is multi-homogeneous in layer weights (see (4) in Section 4.4). So for the CNN without bias, we define the normalized margin as the margin divided by the product of the -norm of all layer weights. Here we compute the -norm of a layer weight parameter after flattening it into a one-dimensional vector. For the CNN with bias, we still compute the smoothed normalized margin in this way. When computing the -norm of every layer weight, we simply ignore the bias terms if they are not in the first layer. For completeness, we include the plots for the normalized margin using the original definition (2) in Figure 3 and 4.
SGD with Constant Learning Rate. We first train the CNNs using SGD with constant learning rate . After about epochs, both CNNs have fitted the training set. After that, we can see that the normalized margins of both CNNs increase. However, the growth rate of the normalized margin is rather slow. The results are shown in Figure 1 in Section 1. We also tried other learning rates other than , and similar phenomena can be observed.
SGD with Loss-based Learning Rate. Indeed, we can speed up the training by using a proper scheduling of learning rates for SGD. We propose a heuristic learning rate scheduling method, called the loss-based learning rate scheduling. The basic idea is to find the maximum possible learning rate at each epoch based on the current training loss (in a similar way as the line search method). See Appendix L.1 for the details. As shown in Figure 1, SGD with loss-based learning rate scheduling decreases the training loss exponentially faster than SGD with constant learning rate. Also, a rapid growth of normalized margin is observed for both CNNs. Note that with this scheduling the training loss can be as small as , which may lead to numerical issues. To address such issues, we applied some re-parameterization tricks and numerical tricks in our implementation. See Appendix L.2 for the details.
Experiments on CIFAR-10. To verify whether the normalized margin is increasing in practice, we also conduct experiments on CIFAR-10. We use a modified version of VGGNet-16. The layers of this model can be described as conv-64 , max-pool, conv-128 , max-pool, conv-256 , max-pool, conv-512 , max-pool, conv-512 , max-pool, fc-10 in order, where each conv has filter size . We train two networks: one is exactly the same as the VGGNet we described, and the other one is the VGGNet without any bias terms except those in the first layer (similar as in the experiments on MNIST). The experiment results are shown in Figure 5 and 6. We can see that the normalize margin is increasing over time.
Test Accuracy. Previous works on margin-based generalization bounds (Neyshabur et al., 2018; Bartlett et al., 2017; Golowich et al., 2018; Li et al., 2018a; Wei et al., 2019; Banburski et al., 2019) usually suggest that a larger margin implies a better generalization bound. To see whether the generalization error also gets smaller in practice, we plot train and test accuracy for both MNIST and CIFAR-10. As shown in Figure 7, the test accuracy changes only slightly after training with loss-based learning rate scheduling for epochs, although the normalized margin does increase a lot. We leave it as a future work to study this interesting gap between margin-based generalization bound and generalization error. Concurrent to this work, Wei & Ma (2020) proposed a generalization bound based on a new notion of margin called all-layer margin, and showed via experiments that enlarging all-layer margin can indeed improve generalization. It would be an interesting research direction to study how different definitions of margin may lead to different generalization abilities.
K.2 Evaluation for Robustness
Recently, robustness of deep learning has received considerable attention (Szegedy et al., 2013; Biggio et al., 2013; Athalye et al., 2018), since most state-of-the-arts deep neural networks are found to be very vulnerable against small but adversarial perturbations of the input points. In our experiments, we found that enlarging the normalized margin can improve the robustness. In particular, by simply training the neural network for a longer time with our loss-based learning rate, we observe noticeable improvements of -robustness on both the training set and test set.
We first elaborate the relationship between the normalized margin and the robustness from a theoretical perspective. For a data point , we can define the robustness (with respect to some norm ) of a neural network for to be
This observation does match with our experiment results. In the experiments, we measure the -robustness of the CNN without bias for the first time its loss decreases below , , , (labelled as model-1 to model-4 respectively). We also measure the -robustness for the final model after training for epochs (labelled as model-5), whose training loss is about . The normalized margin of each model is monotone increasing with respect to the number of epochs, as shown in Table 1.
We use the standard method for evaluating -robustness in (Carlini & Wagner, 2017) and the source code from the authors with default hyperparametershttps://github.com/carlini/nn_robust_attacks. We plot the robust accuracy (the percentage of data with robustness ) for the training set in the figures on the first row of Figure 8. It can be seen from the figures that for small (e.g., ), the relative order of robust accuracy is just the order of model-1 to model-5. For relatively large (e.g., ), the improvement of model-5 upon model-2 to model-4 becomes marginal or nonexistent in certain intervals of , but model-1 to model-4 still have an increasing order of robust accuracy and the improvement of model-5 upon model-1 is always significant. This shows that training longer can help to improve the -robust accuracy on the training set.
We also evaluate the robustness on the test set, in which a misclassified test sample is considered to have robustness , and plot the robust accuracy in the figures on the second row of Figure 8. It can be seen from the figures that for small (e.g., ), the curves of the robust accuracy of model-1 to model-5 are almost indistinguishable. However, for relatively large (e.g., ), again, model-1 to model-4 have an increasing order of robust accuracy and the improvement of model-5 upon model-1 is always significant. This shows that training longer can also help to improve the -robust accuracy on the test set.
We tried various different settings of hyperparameters for the evaluation method (including different learning rates, different binary search steps, etc.) and we observed that the shapes and relative positions of the curves in Figure 8 are stable across different hyperparameter settings.
It is worth to note that the normalized margin and robustness do not grow in the same speed in our experiments, although the theory suggests . This may be because the Lipschitz constant (if defined locally) is also changing during training. Combining training longer with existing techniques for constraining Lipschitz number (Anil et al., 2019; Cisse et al., 2017) could potentially alleviate this issue, and we leave it as a future work.
Appendix L Additional Experimental Details
In this section, we provide additional details of our experiments.
where is the average training loss at epoch , and is a relative learning rate to be tuned (Similar parameterization has been considiered in (Nacson et al., 2019b) for linear model). The loss-based learning rate scheduling is indeed a variant of line search. In particular, we initialize by some value, and do the following at each epoch :
Initially ; Let be the training loss at the end of the last epoch;
Run SGD through the whole training set with learning rate ;
Evaluate the training loss on the whole training set;
If , and end this epoch; otherwise, and go to Step 2.
In all our experiments, we set . This specific choice of those hyperparameters is not important; other choices can only affact the computational efficiency, but not the overall tendency of normalized margin.
L.2 Addressing Numerical Issues
Forward Pass. Suppose we have a good estimate for in the sense that
is in the range of float64. can be thought of a relative training loss with respect to . Instead of evaluating the training loss directly, we turn to evaluate this relative training loss in a numerically stable way:
Perform forward pass to compute the values of with float32, and convert them into float64;
Let . If for all , then we compute
This algorithm can be explained as follows. Step 1 is numerically stable because we observe from the experiments that the layer weights and layer outputs grow slowly. Now we consider Step 2. If for some , then is in the range of float64, so we can compute by (28) directly except that we need to use a numerical stable implementation of . For , arithmetic underflow can occur. By Taylor expansion of , we know that when is small enough in the sense that the relative error . Thus, we can do the following approximation
Backward Pass. To perform backward pass, we build a computation graph in Tensorflow for the above forward pass for the relative training loss and use the automatic differentiation. We parameterize the learning rate as . Then it is easy to see that taking a step of gradient descent for with learning rate is equivalent to taking a step for with . Thus, as long as can fit into float64, we can perform gradient descent on to ensure numerical stability.
The Choice of . The only question remains is how to choose . In our experiments, we set to be the training loss at the end of the last epoch, since the training loss cannot change a lot within one single epoch. For this, we need to maintain during training. This can be done as follows: after evaluating the relative training loss on the whole training set, we can obtain by adding and together.
It is worth noting that with this choice of , in the loss-based learning rate scheduling. As shown in the right figure of Figure 4, is always between and , which ensures the numerical stability of backward pass.