The alignment property of SGD noise and how it helps select flat minima: A stability analysis
Abstract
The phenomenon that stochastic gradient descent (SGD) favors flat minima has played a critical role in understanding the implicit regularization of SGD.
In this paper, we provide an explanation of this striking phenomenon by relating the particular noise structure of SGD to its linear stability (Wu et al., 2018).
Specifically, we consider training over-parameterized models with square loss.
We prove that if a global minimum θ ∗ is linearly stable for SGD, then it must satisfy ∥ H ( θ ∗ ) ∥ F ⩽ O ( √ B/η ) , where ∥ H ( θ ∗ ) ∥ F , B, η denote the Frobenius norm of Hessian at θ ∗ , batch size, and learning rate, respectively.
Otherwise,
SGD will escape from that minimum exponentially fast.
Hence, for minima accessible to SGD, the sharpness—as measured by the Frobenius norm of the
Hessian—is bounded independently of the model size and sample size.
The key to obtaining these results is exploiting the particular structure of SGD noise: The noise concentrates in sharp directions of local landscape and the magnitude is proportional to loss value.
This alignment property of SGD noise provably holds for linear networks and random feature models (RFMs), and is empirically verified for nonlinear networks.
Moreover, the validity and practical relevance of our theoretical findings are also justified by extensive experiments on CIFAR-10 dataset.
Introduction
Modern machine learning (ML) models are often operated with far more unknown parameters than training examples, a regime referred to as over-parameterization.
In this regime, there are many global minima, all of which have zero training loss but their test performance can be significantly different [47].
Fortunately, it is often observed that SGD converges to those generalizable ones, even without needing any explicit regularizations [49].
This suggests there must exist certain “implicit regularization” mechanism at work [32, 14, 47, 6].
More mysteriously, SGD solutions often generalize better than gradient descent (GD) solutions [21, 38].
Therefore, the SGD noise must play a critical role in implicit regularization.
The most popular explanation is that SGD favors flatter minima [21] and flatter minima generalize better [16].
This flat-minima principle has been extensively and successfully adopted in practice to tune the hyperparameters of SGD [44, 21] and to design new optimizers [17, 11, 43] for improving generalization.
Therefore, understanding how SGD noise biases SGD towards flatter minima is of paramount importance, which is the main focus of this paper.
The works [44, 10, 48] show that SGD noise is highly anisotropic; [30, 41] find the magnitude of
SGD noise to be loss dependent.
Both structures are shown to be critical for SGD picking flat minima.
However, these works all make unrealistic (even wrong) over-simplifications of SGD noise (see the related work section for more details) in their analysis.
In addition, instead of studying SGD, they all consider the continuous-time stochastic differential equation (SDE), which is a good modeling of
SGD only in finite time and small learning rate (LR) regime [25].
It is generally unclear how this
SDE modeling is relevant for understanding SGD with a large LR—a regime preferred in practice.
Consequently, these works only provide intuitive and empirical analyses, lacking a quantitative characterization of when and how SGD favors flat minima.
Another line of works [46, 29] relate the selection bias of SGD to the dynamical stability .
In overparameterized case, all global minima are fixed points of SGD but their dynamical stabilities can be very different.
At unstable minima, a small perturbation will drive SGD to leave away, whereas, for stable minima, SGD can stay around and even converge back after initial perturbations.
Thus SGD prefers stable minima over unstable ones.
Specifically, [46, 29] analyze the linear stability [1] of
SGD, showing that a linearly stable minimum must be flat and uniform.
Different from SDE-based analysis, this stability-based analysis is relevant for large-LR SGD and is even empirically accurate in predicting the properties of minima selected by SGD [46, 20, 8].
In this work, we follow the linear stability analysis in [46, 29] but take the particular structure of SGD noise into consideration.
We establish a direct connection between linear stability and flatness, which allows us to obtain a quantitative characterization of how the learning rate and batch size affect the flatness of minima accessible to SGD.
In contrast, [46, 29] have to introduce the another quantity: non-uniformity together with flatness to characterize linear stability because of neglecting the noise structure.
Setup Let { ( x i , y i ) } ni =1 with x i ∈ R d , y i ∈
R K be the training set and f ( · ; θ ) with θ ∈ R p be our model.
The model size is defined to be the number of parameters p and in this paper.
For simplicity, we will always assume K = 1 and the extension to the case of K > 1 is straightforward.
Let
L i ( θ ) = 12 | f ( x i ; θ ) − y i | 2 be the fitting error at the i -th sample and L ( θ )
= 1 n (cid:80) ni
=
L i ( θ ) be the empirical risk.
We shall focus on the over-parameterized case in the sense that inf θ L ( θ ) = 0 .
To minimize L ( · ) , we consider the mini-batch SGD:
[Equation]
where η and B are the learning rate and batch size, respectively.
This SGD can be rewritten as θ t +
=
θ t − η ( ∇ L ( θ t )+ ξ t ) , where ξ t is the noise, satisfying E [ ξ t ] = 0 and E [ ξ t ξ Tt ]
= Σ( θ t ) /B.
Here the noise covariance Σ( θ )
= 1 n
[Equation]
L i
[Equation]
θ ) [Equation] L i ( θ ) T [Equation]
L ( θ ) L ( θ ) T .
To characterize the local geometry of loss landscape, we consider the Fisher matrix: G ( θ ) = 1 n [Equation] x [Equation]
[Equation]
∇
[Equation]
x [Equation] T and the Hessian matrix: H ( θ ) =
G ( θ ) + 1 n [Equation]
[-=
-]ni =
[Equation] f [Equation] x i
[Equation]
θ ) − y i ) ∇ 2 f ( x i ; θ ) .
When the loss value is small, H ( θ ) ≈ G ( θ ) and in particular, if θ ∗ is an global minimum, H ( θ ∗ ) =
G ( θ ∗ ) .
Notations.
For a vector a , let ∥ a ∥ = √ a T a and ∥ a ∥ W = √ a T Wa .
For a matrix A , denote by { λ j ( A ) } the eigenvalue of A in a decreasing order.
For other notations, we refer to Appendix C.
Our main contributions are summarized as follows.
• We first show that for many ML models, the SGD noise is geometry aware: 1) the noise magnitude is proportional to the loss value; 2) the noise covariance aligns well with the Fisher matrix.
Specifically, to quantify the alignment strength, we define a loss-scaled alignment factor µ ( θ ) , which is proved to be bounded from below, i.e., there exists a sizeindependent positive constant µ 0 such that µ ( θ ) ⩾ µ 0 , for linear networks (Proposition 2.3) and RFMs (Proposition 2.5), and is also empirically justified for nonlinear networks.
Moreover, we identify that it is the uniformity of model gradient norms {∥∇ f ( x i ; θ ) ∥ G ( θ ) } i that accounts for this alignment property of SGD noise.
• We then provide a thorough analysis of the linear stability of SGD by exploiting the alignment property of noise.
We prove in Theorem 3.3 that if a global minimum θ ∗ is linearly stable, then ∥ H ( θ ∗ ) ∥ F ⩽ η −(cid:112) B/µ 0 .
Here the constant µ 0 quantifies the alignment strength of SGD noise.
Hence, for minima accessible to SGD, the Hessian’s Frobenius norm—the flatness perceived by SGD—is bounded independently of the model size and sample size.
Moreover, if a minimum is too sharp, violating the preceding stability condition, SGD will escape from it exponentially fast (Theorem 3.5).
Together, we obtain a quantitative characterization of when and how much SGD dislikes sharp minima.
• Our theoretical findings are also corroborated with well-designed experiments on a variety of models including linear networks, RFMs, convolutional networks, and fully-connected networks.
In particular, the practical relevance is demonstrated in Section 4 by extensive experiments on classifying full CIFAR-10 dataset with VGG nets and ResNets.
1.1 Related work
Noise structures.
[52, 19, 27] consider the Hessian-based approximation: Σ( θ )
≈ σ 2 H ( θ ) , where σ is a small constant.
[53] proposes an improved version: Σ( θ )
≈ 2 L ( θ ) H ( θ ) .
But these approximations in general cannot be accurate since Hessian is not semi-positive definite (SPD) in non-convex region.
More recently, [30] and [41] study SGD by assuming Σ( θ ) =
2 L ( θ ) H ( θ ∗ ) , where θ ∗ is a minimum of interest, and Σ( θ ) =
σ 2 L ( θ ) I p , respectively.
These assumptions completely ignore the state-dependence of noise direction.
In contrast, we assume Σ( θ ) =
2 L ( θ ) C ( θ ) with C ( θ ) having a nontrivial alignment with the Fisher matrix G ( θ ) , which does not impose any explicit structural assumption on C ( θ ) .
As a result, our assumption is much weaker and can be rigorously justified for popular ML models both theoretically and empirically.
More importantly, we show that this weak alignment property is sufficient for analyzing the linear stability of SGD.
We anticipate that our alignment assumption can be also adopted to analyze other properties of SGD.
Escape from sharp minima.
The escape behavior of SGD was first studied in [52, 46], as an indicator of how much SGD dislikes sharp minima.
One of the most mysterious observation is that the escape happens in an unreasonably efficient way.
However, the theoretical analysis there assumes the noise to be state-independent, and consequently, the derived escape time depends polynomially on the loss barrier.
Later [48, 30] attempt to study this issue using the classical diffusion-based framework [12] (Itô-SDE), which cannot explain the unreasonable escape efficiency at all since the resulting escape rates depend on the loss barrier exponentially.
See also [30] for an improved analysis.
[37, 51] argues that the SGD noise is heavy-tailed and thus SGD should be modeled as Lévy-SDE instead of
Itô-SDE.
Moreover, it is shown that the heavy-tailedness can ensure the escape rate depends on the basin volume instead of the loss barrier.
Unfortunately, the volume in high dimensions always scales with the dimension exponentially and consequently, this does not explain the escape efficiency in high dimensions.
Moreover, whether SGD noise is really heavy-tailed and whether the heavy-tailedness is really important for generalization are still debatable for neural networks [40, 26].
In contrast, we show that the unreasonable escape efficiency comes from the particular geometry-aware structure of
SGD noise, regardless of whether the noise is heavy- or light-tailed.
Flatness metrics In the literature, a variety of flatness metrics have been adopted, such as the largest eigenvalue of Hessian [21], the trace of Hessian [9, 6], the basin volume [51], and the ones scaled by parameter norms [28, 39] in order to achieve the scaling-invariance for ReLU nets.
These metrics are proposed for either computation easiness or bounding generalization gaps.
It is unclear if they are perceivable to SGD, let alone how the boundedness of them depends on the batch size, learning rate, as well as the model size and sample size.
We show that for SGD solutions, the Frobenius norm of
Hessian—a flatness perceived by SGD through the linear stability—is bounded by a size-independent quantity.
Note that a similar stability argument also applies to GD but only yielding the boundedness of the largest eigenvalue of Hessian [46, 31].
Lastly, we particularly mention the work [33], which provides a fine-grained analysis of the implicit bias of training two-layer diagonal linear networks.
This work is related to ours since we both consider the magnitude and direction structure of SGD noise simultaneously.
However, the analysis in [33] is limited to the specific toy model but ours is relevant for general models.
The alignment property of SGD noise
Since ∇ L i ( θ ) = ( f ( x i ; θ ) − y i ) ∇ f
( x i ; θ ) , we have the following intuitive approximation [30]:
[Equation]
where ( i ) assumes that the full-batch gradient ∇ L ( θ ) to be negligible compared with the sample gradients {∇ L i ( θ ) } ; ( ii ) assumes that {∇ f ( x i ; θ ) } i and { L i ( θ ) } i are nearly decoupled.
This approximation cannot be true in general but tells us that 1)
The noise magnitude is proportional to the loss value; 2) the noise covariance aligns with the Fisher matrix.
Motivated by (2), we define α ( θ ) =
[Equation]
∥
[Equation] Here α ( θ ) quantifies the similarity between Σ( θ ) and G ( θ ) , characterizing how much the noise concentrates in sharp directions of local landscape.
β ( θ ) characterizes the relative non-degeneracy of noise (with respect to the loss value).
Then we define the loss-scaled alignment factor:
[Equation]
which characterizes the direction and magnitude alignment simultaneously.
Intuitively speaking, if µ ( θ ) is bounded below, SGD noise is non-degenerate in sharp directions of local landscape.
In particular, α ( θ ) =
β ( θ )
= µ ( θ )
= 1 if the approximation (2) holds.
We say the noise satisfies the µ - alignment if µ ( θ ) > 0 .
Compared with the decoupling approximation (2), the µ -alignment is a much weaker condition.
Note that this specific weak quantification of alignment is inspired for analyzing the linear stability of SGD, which is the focus of this paper.
Specifically, Theorem 3.3 shows that µ ( θ ) along with the Frobenius norm of Hessian determines the linear stability of SGD.
One may define other metrics to quantify alignment strength for studying other properties of SGD, but this is beyond the scope of this paper.
A relaxed alignment.
Let Σ 1 ( θ ) = 1 n (cid:80) ni
=1 ∇ L i ( θ ) ∇ L i ( θ )
[Equation]
[Equation]
2 ( θ ) = ∇ L ( θ ) ∇ L ( θ ) T .
Then Σ( θ ) =
Σ 1 ( θ ) − Σ 2 ( θ ) .
It is often believed that the full-batch gradient ∇ L is relatively small compared to the sample gradients {∇ L i } i .
As a result, the influence of Σ 2 ( θ ) should be negligible compared to Σ 1 ( θ ) .
To disentangle the influences of them, we define
[Equation]
Then µ ( θ ) = µ 1 ( θ ) − µ 2 ( θ ) .
Our linear stability analysis in Section 3 show that µ 1 ( θ ) ⩾ µ 1 > 0 , a condition we refer to as µ 1 -alignment , is sufficient to ensure that SGD only selects flat minima.
2.1 Why does the alignment property hold?
Definition 2.1 (Norm uniformity of model gradients) .
Let g i ( θ ) =
∇ f
( x i ; θ ) , χ i ( θ ) : = ∥
[Equation]
[Equation]
(cid:80) ni
{+=
+}
χ i ( θ ) .
Define γ ( θ ) : = min i ∈ [ n ] χ i ( θ ) ¯ χ ( θ ) . The quantity γ ( θ ) measures the uniformity of model gradient norms and this property can guarantee the µ 1 -alignment as stated below.
Lemma 2.2.
µ 1 ( θ ) ⩾ γ ( θ )
Proof.
Noticing ¯ χ ( θ ) = 1 n (cid:80)
[Equation]
=
∥ G ( θ ) ∥ 2 F , we have
[Equation]
Thus µ 1 ( θ
[Equation]
Tr
[Equation] The above proof suggests that the “decoupling” approximation in (2) holds in a weak sense if {∥∇ f ( x i ; θ ) ∥ G ( θ ) } i are uniform.
One can apply a similar argument by assuming the uniformity of the fitting errors { L i ( θ ) } , which, unfortunately, we find never hold in practice.
In contrast, we will show that the norm uniformity of model gradients provably holds for linear networks and RFMs, and can be empirically justified for nonlinear networks.
Over-parameterized linear models.
Consider an over-parameterized linear model (OLM): f ( x ; θ ) =
F ( θ ) T x , where F : Ω
(cid:55)→ R d denotes a general re-parameterization function.
Note that f ( · ; θ ) only represents linear functions but the corresponding landscape can be highly nonconvex.
Typical examples include the linear network: F ( θ )
=
W 1 W 2 · · · W L and the diagonal linear network: F ( θ ) =
( α− β 21 , . . .
, α 2 d − β 2 d ) T .
Both have attracted a lot of attention in analyzing the implicit bias of GD and SGD [3, 42, 33, 13, 4].
The following proposition provides a precise characterization of the noise covariance for OLM models, whose proof is deferred to Appendix D.
Proposition 2.3.
Denote by N (0 , S ) the Gaussian distribution with mean zero and covariance matrix S .
Suppose f ( · ; θ ) is a general OLM and x ∼ N (0 , S ) .
Consider the online SGD setting, i.e., n = ∞ .
Then, Σ( θ ) = ∇ L ( θ ) ∇ L ( θ ) T + 2 L ( θ ) G ( θ ) and µ 1 ( θ ) ⩾ µ ( θ ) ⩾
This proposition shows that the alignment property holds in the entire parameter space and moreover, the alignment strength is independent of model size.
Here the alignment is only proved for the infinite-sample case.
Similar results should hold for finite-sample cases by concentration inequalities as long as n is relatively large, but this straightforward extension does not bring any new insights.
It is more interesting to consider the low-sample regime (i.e., n < d ), where the alignments indeed hold (at least in typical regions explored by SGD) as demonstrated empirically in Figure 1.
In addition, the above proposition provides a closed-form expression of the noise covariance, which might be useful for analyzing other properties of SGD beyond the linear stability.
A comprehensive analysis of these issues is left to future work.
Feature-based models.
Consider a feature-based model f ( x ; θ ) = (cid:80)
[Equation]
In this case, the model gradients: g i =
g i ( θ ) =
Φ( x i ) and the Hessian and Fisher matrix: G =
H = 1 n (cid:80) ni
=
g i g
Ti all are constant.
But the noise covariance Σ( θ ) is still state-dependent.
The norm uniformity of model gradients also becomes constant: γ = min i χ i / ( 1 n (cid:80) ni
=1 χ i ) with χ i = ∥
g i ∥ 2 G . Lemma 2.4. µ 1 ( [Equation]
[Equation]
, and
[Equation]
The above lemma suggests that the µ 2 ( θ ) term is negligible as long as the Fisher matrix is not nearly rank-1.
By bounding the γ and τ ( G ) , we can prove the µ 1 - and µ -alignment for random ReLU feature models as stated in the following proposition.
The proof is presented in Appendix F, where similar results for general RFMs are provided (see Proposition F.7).
Proposition 2.5.
If φ j ( x ) = ReLU( w Tj x ) with w j iid ∼ Unif( √ d S d − 1 ) and x ∼ Unif( S d − 1 ) .
Then, for any δ ∈ (0 , 1) , if m ⩾ n ≳ d 5 log(1 /δ )
, then w.p. at least 1 − δ , µ 1 ( θ ) ⩾ 1 and µ ( θ ) ≳ d − 1 .
Although feature-based models are linear, their analysis is still applicable to understand nonlinear models, as long as the nonlinear model locally behaves like the linearized one: f lin ( x ; θ ) :
= f
( x ; θ ∗ ) + ⟨ θ − θ ∗ , ∇ f ( x ; θ ∗ ) ⟩ with ∇ f ( x ; θ ∗ ) learned from data.
Hence, Proposition 2.5 can explain why the alignment property holds in a local region around global minima.
Note that this is sufficient for characterizing the linear stability of SGD, which is a local property in nature.
2.2 Empirical validations
Figure 1a reports the values of α ( θ t ) , β ( θ t ) , µ ( θ t ) during the SGD training of four types of models, including the linear networks and RFMs analyzed above, and fully-connected networks (FCN) and convolutional neural networks (CNN).
First, one can see that α ( θ t ) ’s are quite close to 1 during the entire training, suggesting the strong concentration of SGD noise in sharp directions of local landscape.
Second, β ( θ t ) ’s keep bounded below, implying the noise magnitudes are sufficiently large with respect to the training loss.
As a result, µ ( θ t ) ’s are significantly positive for all models examined.
In particular, for the linear networks, the alignment holds in the low-sample regime, where n < d .
The size independence.
Figure 1b further examines how the extent of over-parameterization affects the alignment strength.
One can see clearly that for linear networks and RFMs, µ ( θ ) ’s are independent of the model size, which confirms our theoretical findings proved above.
In addition, we also observe that for nonlinear networks, the alignment strength is also (nearly) independent of the model size.
For instance, for CNN, the value of µ ( θ ) only decreases from around 1 .
05 to 1 .
as the model size is increased by more than two orders of magnitude.
[Figure] [Figure]
The norm uniformity of model gradients.
Figure 2 shows the norm uniformity of model gradients, where we report the values of γ ( θ ) in the entire SGD trajectory.
On can see that γ ( θ ) is indeed bounded below, implying that the SGD noise satisfies the µ 1 -alignment according to Lemma 2.2.
[Figure]
Note that in experiments, we only show that the alignment property is satisfied in typical regions explored by SGD, including the random initialization and the convergent region.
In contrast, for OLMs and RFMs, we in fact prove the alignment property for the entire parameter space.
The linear stability analysis
Let θ ∗ be a global minimum of L ( · ) .
When θ t is close to θ ∗ , the local dynamical behavior of SGD can be characterized by linearizing the dynamics around θ ∗ :
[Equation]
(4) where ∇ 2 L i ( θ ∗ ) = ∇ f
( x i ; θ ∗ ) ∇ f ( x i ; θ ∗ ) T .
This corresponds to the local quadratic approximation of the loss L ( · ) or the local linearization of the model around θ ∗ :
[Equation]
Specifically, (4) is exactly the SGD of training the linearized model (5).
Definition 3.1 (Linear stability) .
A global minimum θ ∗ is said to be linearly stable if there exists a
C > 0 such that it holds for the linearized dynamics (4) that E [ L ( ˜ θ t )]
⩽ C E
[ L ( ˜ θ 0 )] , ∀ t ⩾ 0 .
It is well-known in dynamical system that the local behavior of the original nonlinear dynamics can be characterized by the linearized one if the local quadratic approximation is non-degenerate.
However, in over-parameterized case, the local quadratic approximation is degenerate in flat directions.
Consequently, one may be concerned about the relevance of local quadratic approximation and the resulting linear stability analysis.
Fortunately, the stability in Definition 3.1 is particularly measured with the change of loss value.
Thus the instability mostly comes from noise perturbations in sharp directions and the alignment property guarantees that noise mostly concentrates in sharp directions.
Consequently, the flat directions contribute little to the instability.
In sharp directions, the local quadratic approximation is always valid, thereby explaining the relevance of linear stability analysis.
The rigorous formulation of this intuition is left to future work and we instead resort to numerical experiments to demonstrate the validity in this paper.
For simplicity, we will use θ t to denote ˜ θ t ; let θ ∗ = 0 and g i = ∇ f ( x i ; θ ∗ ) .
For the linearized model f lin ( · ; θ ) , we have L (
[Equation]
[Equation]
n
[Equation]
where we omit the dependence on θ ∗ for simplicity.
Note that the Fisher and Hessian matrix are constant but the noise covariance Σ( θ ) = 1 n
[Equation]
Before considering the specific linearized SGD (4), we first have a general result.
Lemma 3.2.
Consider a general SGD: θ t +1 =
θ t − η ( ∇ L ( θ t ) + ξ t ) for the linearized model (5) , where ( ξ t ) t ⩾ 1 are any noises satisfying E [ ξ t ] = 0 , E [ ξ t ξ Tt ]
= S ( θ t ) .
Then we have
[Equation]
, (6) where ν ( θ ) =
Tr( HS ( θ )) / 2 and r ( θ ) ⩾ 0 .
Moreover, if η ⩽ 2 /λ 1 ( H ) , then r ( θ ) ⩽ 1 .
Proof.
Using the fact E [ ξ t ] = 0 and E [ ξ t ξ Tt ]
= S ( θ t ) , we have
E [ L ( θ t +1 )
[Equation]
where r ( θ ) = 1 − 2 η θ T H
2 θ θ T Hθ
+ η 2 θ T H
3 θ θ T Hθ since ∇ L ( θ ) =
Hθ .
By Lemma G.2, r ( θ ) {+⩾ 
+} and if η ⩽ 2 /λ 1 ( H ) , then r ( θ ) ⩽ 1 .
The two terms r ( θ t ) L ( θ t ) and η 2 v ( θ t ) denote the contributions from the full-batch gradient ∇ L ( θ t ) and the noise ξ t , respectively.
The stability is affected by both terms simultaneously.
It is well-known that if θ ∗ is linearly stable for GD, then λ 1 ( H ( θ ∗ ))
⩽ 2 /η (see, e.g., [46, 31]).
This also holds for
SGD but SGD imposes a stricter condition because of the extra η 2 ν ( θ t ) term.
Specifically,
[Equation]
Therefore, the more S ( θ ) aligns with H , the more unstable that minimum is.
Specifically, let S ( θ ) = 2 σ 2 L ( θ ) C ( θ ) .
Then, E [ L ( θ t +1 )] ⩾ η 2 σ 2 E [ L ( θ t )
Tr( HC ( θ t ))] . Thus to ensure a stable convergence, we should roughly have Tr( HC ( θ )) ⩽ 1 σ 2 η 2 . We next show that this can lead to a flatness control by utilizing the alignment between C ( θ ) and H . 3.1 The linear stability imposes size-independent flatness constraints
For the mini-batch SGD, the following theorem characterizes how the batch size and learning rate affect the flatness—as measured by the Frobenius norm of Hessian—of minima accessible to SGD.
Theorem 3.3.
Let θ ∗ be a global minimum that is linearly stable.
Denote by µ ( θ ) the alignment factors for the linearized SGD (4) and model (5) .
If µ ( θ ) ⩾ µ 0 , then ∥ H ( θ ∗ ) ∥ F ⩽ 1 η (cid:113)
Bµ 0 .
Proof.
By (8) and the definition of µ ( θ ) , we have
[Equation]
To ensure the stability, we must have µ 0 η 2 ∥ [Equation] B ⩽ 1 , leading to ∥ H ∥
[Equation]
We have shown in Section 2 that µ 0 is (nearly) size-independent, and thus the obtained upper bound of flatness is also (nearly) size-independent.
As a comparison, for GD, the linear stability can only ensure λ max ( H ( θ ∗ )) ⩽ 2 /η .
This gives a bound of the Hessian’s Frobenius norm: ∥ H ( θ ∗ ) ∥ F ⩽ 2 √ p/η , depending on the model size explicitly.
The comparison of two bounds partially explains why SGD tends to select flatter minima than GD.
We show below that the µ -alignment can be further relaxed to the µ 1 -alignment.
The proof is similar to the one of Theorem 3.3 and deferred to Appendix G.
Proposition 3.4.
Under the setting of Theorem 3.3, if the noise of linearized SGD satisfies µ 1 ( θ ) ⩾ µ 1 , then ∥ H ( θ ∗ )
∥ F ⩽ min (cid:18)
B √ ( B − 1) µ 1 , 2 Bµ 1 (cid:19) 1 η .
When B ≫ 1 , the bound becomes B/ ( η (cid:112) (
[Equation]
−
[Equation]
µ
[Equation]
≈ (cid:112)
B/µ 1 /η , which is the same as the case of µ -alignment.
Thus the influence of ∇ L is indeed negligible compared with {∇ L i } i .
Note that the linear stability is local in nature and hence our analysis essentially only needs the µ 1 -alignment to hold locally around minima of interest.
Experiments in Figure 2 shows that γ ( θ ∗ ) is always bounded below, i.e., the norm uniformity of model gradients is satisfied.
Combining with
Proposition F.7, we can conclude that the alignment property assumed in Proposition 3.4 holds.
Tightness of our analysis.
In the analysis above, we only inspect the instability caused by the noise, with the full-batch gradient completely ignored.
Therefore, we anticipate that our bound is tighter in small-batch regime, where the noise term dominates the full-batch term.
We will see that our numerical experiments indeed confirm this tightness in small-batch regime.
However, for obtaining the tightest bound, one may need to consider both components simultaneously; this is much more complicated and left to future work.
Numerical validations.
Figure 3a numerically shows how the Frobenius norm of Hessian (not only the upper bound) changes with extent of over-parameterization, where the trace of Hessian is also plotted for comparison.
One can see that the Frobenius norm indeed keeps almost unchanged as increasing the model size but the Hessian trace increases significantly.
Figure 3b further shows the ratio between the Frobenius norm and our upper bound in the training process and two batch sizes are examined.
We have two observations.
First, the correctness of our bound holds for the entire
SGD trajectory, suggesting that the linear stability analysis is relevant for the entire training process.
Second, as expected, the theoretical bound is indeed tighter for the case with a smaller batch size.
[Figure]
3.2 SGD escapes from sharp minima exponentially fast
The following theorem shows that the pure noise-driven escape from a sharp minimum is exponentially fast , whose proof follows trivially from (9).
Theorem 3.5.
Under the setting of Theorem 3.3, if ∥ H ( θ ∗ ) ∥ F > 1 η (cid:113)
Bµ 0 , then the linearized SGD satisfies E
[ L ( θ t )] ⩾ γ t 0 E [ L ( θ 0 )] with γ 0 =
η 2 µ 0 B ∥ H ( θ ∗ ) ∥
2 F > 1 .
Hence, linearized SGD takes roughly log γ 0 (1 /ε ) steps to escape from a O ( ε ) -loss region to a O (1) - loss region.
The escape time depends on the loss barrier only logarithmically and is independent of the parameter space dimension.
Due to the local closeness between linearized SGD and the original
SGD, this partially explains the unreasonable escape efficiency of SGD for training big models.
In contrast, the escape rates of existing works [48, 52, 51, 30] are either exponentially slow with respect to the loss barrier or suffer from the curse of dimensionality.
Figure 4 shows the trajectories of SGD escaping from sharp minima.
It is demonstrated that the escape is indeed exponentially fast and specifically, 10 steps are enough for SGD escaping to a high-loss region for all the models examined.
In addition, we observe that the escape is still exponentially fast in the high-loss region, although our analysis only applies to a local region.
How can we explain this nonlocal escape behavior?
We leave the study of this interesting phenomenon to future work.
[Figure]
3.3 The importance of the noise structure
The magnitude structure.
Theorem 3.5 together with its proof suggests that the loss dependence of noise magnitude is critical for obtaining the exponentially fast escape.
The intuition is as follows.
When θ t is perturbed by noise to θ t +1 where L ( θ t +1 ) >
L ( θ t ) , the noise magnitude becomes larger there and thus θ t +1 is easier to be perturbed to a larger-loss region.
This positive feedback drives
SGD to leave exponentially fast.
On the contrary, the following lemma shows that if the noise is uniformly bounded, the noise-driven escape is at most linear in time.
Lemma 3.6.
Under the setting of Lemma 3.2, assume η ⩽ 2 /λ 1 ( H ) and E [ HS ( θ )] ⩽ 2 σ 2 .
Then E [ L ( θ t ) − L ( θ 0 )] ⩽ η 2 σ 2 t.
We set η ⩽ 2 /λ 1 ( H ) to avoid the exponential escape caused by the full-batch component.
Proof.
By Lemma G.2, when η ⩽ 2 /λ 1 ( H ) , r ( θ ) ⩽ 1 .
Thus Lemma 3.2 implies E [ L ( θ t +1 )]
⩽ E [ L ( θ t )]
+ η 2 σ 2 , which implies E [ L ( θ t )] ⩽ E [ L ( θ 0 )]
+ η 2 σ 2 t .
The direction structure.
We now turn to consider the impact of direction structure.
Consider general SGDs: θ t +1 =
θ t − η ( ∇ L ( θ t ) + ξ t ) with E [ ξ t ξ t ]
= S ( θ t ) /B for the linearized model (5).
We compare two type of (unrealistic) noises:
• Geometry-aware noise: S 1 ( θ ) =
2 L ( θ ) H .
• Isotropic noise: S 2 ( θ ) = 2 σ 2 L ( θ )
I p with σ 2 =
Tr( H ) /p .
Here, the value of σ 2 is chosen to ensure two types of noises have the same total variance for a fair comparison [52].
Note that p denotes the model size.
Analogous to Theorem 3.3, for the second isotropic SGD,
[Equation]
Hence, the instability decreases with the parameter-space dimension and the resulting flatness constraint is
Tr( H ( θ ∗ )) ⩽ √ pB/η , depending on the model size explicitly.
In contrast, for the fist noise, Theorem 3.3 implies ∥ H ( θ ∗ ) ∥ F ⩽ √ B/η , independent of the model size.
This difference can be intuitively explained as follows.
The isotropic noise wastes most energy in perturbing SGD along flat directions, which barely affects the instability.
In contrast, the geometry-aware noise focuses most energy on perturbing SGD along sharp directions, causing much more instability.
Larger-scale experiments
We have provided small-scale experiments to justify the validity of our theoretical findings for a variety of ML models.
Here we turn to demonstrate the practical relevance by consider the classification of the CIFAR-10 dataset [22] with VGG nets [36] and ResNets [15].
In training, all explicit regularizations are removed to keep consistent with our theoretical analysis.
More details of the experimental setup can be found in Appendix A.
The alignment property and escaping behavior.
Figure 5a reports the alignment strength of
SGD noise during training for VGG-19 and ResNet-110.
One can see that the alignment factors are significantly positive and similar results are also observed for a variety of VGG nets and ResNets of different depths and can be found in Figure 8 of Appendix B.
On can see that the alignment strength is nearly independent of the model size.
Figure 5b shows the behavior of escaping from sharp minima for VGG-19 and ResNet-110.
One can still observe that the escape is exponentially fast and similar observation for other ResNets and VGG nets can be found in Figure 9 in the appendix.
These observations suggest that our theoretical findings also hold for this practical setting
[Figure]
The flatness and upper bound.
Figure 6a reports the flatness of convergent solution and the corresponding upper bound predicted by our theory for ResNets and VGG nets.
It is again observed that the flatness is nearly independent of the model size.
A surprising observation in Figure 6a is that our upper bounds are rather tight, see, e.g., VGG-16 and VGG-19.
This tightness suggests that
SGD runs (nearly) at the edge of stability [46, 8].
Moreover, as expected, Figure 6b shows that the our bound becomes tighter as decreasing batch size.
This is consistent with what we observe in small-scale experiment in Figure 3b.
[Figure]
Conclusion
We provide a stability-based explanation of why SGD selects flat minima.
Our current understanding is as follows.
1) For popular ML models, the SGD noise aligns very well with local landscape. 2)
This alignment property ensures that the flatness of stable minima must be size-independent.
This understanding is made rigorous and quantitative by introducing a loss-scaled alignment factor to characterize the alignment strength and analyze the linear stability.
Obviously, many questions remains open.
For example, can we understand what roles the stability plays in the whole dynamic process of SGD instead of only around global minima?
Can we establish the connection between the Hessian’s Frobenius norm and generalization?
Can we provide a fine-grained characterization of the noise structure and how the structure is related to implicit regularization of SGD?
We leave the discussion of these important questions to future work.
Acknowledgements
We thank Zhiqin Xu and the anonymous reviewers for helpful suggestions.
The work of Lei Wu is supported by a startup fund from Peking University. The work of Weijie Su is supported in part by
NSF Grants CAREER DMS-1847415 and an Alfred Sloan Research Fellowship.
Checklist
The checklist follows the references.
Please read the checklist guidelines carefully for information on how to answer these questions.
For each question, change the default [TODO] to [Yes] , [No] , or [N/A] .
You are strongly encouraged to include a justification to your answer , either by referencing the appropriate section of your paper or providing a brief inline description.
For example:
• Did you include the license to the code and datasets?
[Yes] See Section ?? .
• Did you include the license to the code and datasets?
[No] The code and the data are proprietary.
• Did you include the license to the code and datasets?
[N/A]
Please do not modify the questions and only use the provided macros for your answers.
Note that the
Checklist section does not count towards the page limit.
In your paper, please delete this instructions block and only keep the Checklist section heading above along with the questions/answers below.
For all authors... (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope?
[Yes] (b) Did you describe the limitations of your work?
[Yes] Local analysis (c) Did you discuss any potential negative societal impacts of your work?
[N/A] (d) Have you read the ethics review guidelines and ensured that your paper conforms to them?
[Yes]
If you are including theoretical results... (a) Did you state the full set of assumptions of all theoretical results?
[Yes] (b) Did you include complete proofs of all theoretical results?
[Yes] 3.
If you ran experiments... (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)?
[Yes] See Appendix A. (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)?
[Yes] See Appendix A. (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)?
[Yes] Estimated over 5 runs (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)?
[No] 4.
If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... (a) If your work uses existing assets, did you cite the creators?
[Yes] (b) Did you mention the license of the assets?
[N/A] (c) Did you include any new assets either in the supplemental material or as a URL?
[N/A] (d) Did you discuss whether
and how consent was obtained from people whose data you’re using/curating?
[N/A] (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content?
[N/A] 5.
If you used crowdsourcing or conducted research with human subjects... (a) Did you include the full text of instructions given to participants and screenshots, if applicable?
[N/A] (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable?
[N/A] (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation?
[N/A]
A Experiment setup
We consider training the following models in the over
-parameterized regime In training
, all explicit
regularizations
(including weight decay, dropout, data augmentation, batch normalization learning rate decay) are removed, and a simple constant-LR SGD is
used to train
our
models.
Small-scale models:
In this case, we set the sample size to be particularly small on purpose, which allows interested readers to quickly reproduce these experiments on their own computer.
Note that this choice does not impact our conclusions since we also discuss in details the influence of changing the extent of over-parameterization and provide larger-scale experiments.
• Random feature model (RFM).
The inputs { x i } ni =1 are drawn from N (0 , I d ) with d = 10 , n = 200 .
The labels are generated by
[Equation]
The model is f ( x ; θ ) =
[Equation]
mj =1 θ j ReLU( w Tj x ) with m = 2000 and { w j } mj =1 independently drawn from N (0 , I d ) at initialization and fixed during the training.
This model is trained by SGD with learning rate η = 0 .
003 and batch size B = 5 .
• Linear networks.
The inputs { x i } ni =1 drawn are drawn from N (0 , I d ) with d = 100 , n = 50 .
Here we set n <
d to examine the low-sample regime.
The labels are generated by
[Equation]
di
=1 x i /d .
The model is a four-layer linear network: d → m → m → m → 1 with m = 50 .
This model is trained by SGD with learning rate η = 0 .
1 and batch size B = 5 .
The default LeCun initialization is used.
• Fully-connected networks (FCN).
We randomly sample n data from the MNIST training set and label { 1 , 2 , 3 , 4 , 5 } to 0 and { 5 , 6 , 7 , 8 , 9 , 10 } to 1 to form our new training set.
The model is a ReLU-activated fully-connected network with the architecture:→ m → m → 1 .
Except for studying the influence of over-parameterization, we always set m = 30 , n = 1000 , and the model size is p = 25441 .
This model is trained by SGD with η = 0 .
05 , B =
and the LeCun initialization is used.
• Convolutional neural networks (CNN).
This is a small LeNet-type CNN [23] whose architecture is given in Table 1.
The training set is the same as the one constructed above for FCN.
The LeCun initialization is used and the model is trained by SGD with η = 0 .
1 , B = 5 .
[Table]
Larger-scale models: For these experiments, the full CIFAR-10 dataset are used to train our model.
• VGG nets.
The models are the standard VGG nets (including VGG-11, VGG-13, VGG-16, and VGG-19) for classifying CIFAR-10 proposed in [36].
• ResNets .
The residual networks for CIFAR-10 proposed in [15] are considered and the models include ResNets-26, ResNet-38, ResNet-50, and ResNet-100.
For ResNets, we follow [50] to use the fixup initialization in order to ensure that the model can be trained without batch normalization.
Both VGG nets and ResNets are trained by SGD with learning rate η = 0 .
1 and batch size B =until the training loss becomes smaller than 10 − 4 .
Hyperparameter choices.
In all experiments, the default model size, sample size, learning rate, and batch size described above are used unless explicitly specified, e.g., studying the influence of over-parameterization.
Efficient computations of the alignment factors and flatness.
Let g i = ∇ f
( x i ; θ ) , e i = f
( x i ; θ ) − y i .
Let Q
= ( g 1 , . .
. , g n ) ∈ R p × n and S =
( e 1 g 1 , . . .
, e n g n ) ∈
R p × n .
Then,
[Equation]
where P = I n × n − 1 n 11 T ∈ R n × n .
Here 1 ∈ R n denotes the all-one vector.
Notice that the computation of α ( θ ) , β ( θ ) , µ ( θ ) , ∥ H ( θ ) ∥ F can be reduced to computing ∥ G ∥ F , ∥ Σ ∥ F , and Tr( G Σ) .
The time complexity of naively computing them is on the order of O ( p 2 n ) , which is prohibitive for large-scale models where p ≫ n .
A more efficient way is to use the following equations
[Equation]
(10) where all the matrices are n × n .
Hence, using these equations, the computation complexity becomes
O ( n 2 p ) .
This is much smaller than O ( p 2 n ) when p ≫ n .
• For small-scale experiments, the equations in (10) are directly used.
• For the large-scale models, we need further approximations since the computation complexity O ( n 2 p ) is still prohibitive in this case.
Notice that the formulations in Eq.
(10) are all in the form of sample average, which allows us to perform Monte-Carlo approximation.
Specifically, we randomly choose B samples from x 1 , . . .
, x n and still use (10) to estimate these quantities.
But now the computation complexity becomes O ( B 2 p ) .
For the experiments on CIFAR-10, we test B ’s with different values and find
that B =
50 is sufficient to obtain a reliable approximation of the original full-data quantity.
Hence, for all large-scale experiments in this paper, we use B = 50 to speed up the computation of alignment factors and flatness
We clarify that the models are still trained on the full dataset
B Extra experiment results B.1 Small-scale experiments
Figure 7 shows the relative norm of model gradient, i.e., χ i ( θ ) / ¯ χ ( θ ) of each samples when the model convergences.
It is shown that γ ( θ ) = min i
χ i ( θ ) /
¯ χ ( θ ) is indeed bounded below.
This explains why the SGD noise satisfies the alignment property locally according to Lemma 2.4.
[Figure]
B.2 Larger-scale experiments
Figure 8 reports the values of alignment factors during the training for ResNet-26, ResNet-38, ResNet50, VGG-13, and VGG-19.
We see that the alignment factors are always significantly positive.
In particular, for VGG-16, α ( θ ) is close to 1 and µ ( θ ) is roughly on the order of 0 . 1 .
In addition, Figure 9 shows that the noise-driven escape is indeed exponentially fast as suggested by our theoretical analysis.
However, it should be stressed that the loss-scaled alignment factors for these larger-scale models are clearly smaller than the ones reported in small-scale experiments.
In particular, one can see that the values of µ ( θ ) for various ResNets are only the order of 0 .
To understand the underlying reason, we additionally examine the same models but for classifying a two-class subset of CIFAR-10 with the results reported in Figure 10.
It is shown that in this case, the loss-scaled alignment factors are roughly on the order of 0 .
1 for all the models, significantly larger than the case of classifying the full
CIFAR-10 dataset.
It is also very surprising to observe that for VGG nets, the standard alignment factor α ( θ ) ’s are nearly 1 , suggesting that the noise covariance completely aligns with the geometry of local landscape.
[Figure] [Figure]
C Notations.
For a vector v , let ∥ v ∥ p
= ( (cid:80) i v pi ) 1 /p
and ˆ v = v/ ∥ v ∥ 2 .
When p = 2 , we omit the subscript for simplicity.
For a matrix A
= ( a i,j ) , denote by ∥ A ∥ F = ( (cid:80) i,j a 2 i,j ) 1 / 2 the Frobenius norm.
For a matrix or linear operator A , denote by { λ i ( A ) } i ⩾ 1 the eigenvalues of A in a non-increasing order.
Let S d − 1 = { x ∈ R d |
∥ x ∥ = 1 } , r S d − 1 = { x ∈ R d | ∥ x ∥ = r } , and τ d − 1 = Unif( S d − 1 ) .
For any distribution ρ , let ∥ f [-(cid:107) 
-]∥ 2 L 2 ( ρ ) =
E x ∼ ρ [ f 2 ( x )] .
We use X ≲ Y to indicate X ⩽ CY for an absolute constant C > 0 and X ≳ Y is defined similarly.
Moreover, we use X ∼ Y to mean cY ⩽ X ⩾ CY for some absolute constants c, C > 0 .
We also use C to denote an absolute constant, whose value may change from line to line.
For a vector a and a SPD matrix W , let ∥ a ∥ W = √ a T Wa .
D Proof of Proposition 2.
We first need the following lemma.
Lemma D.1.
Suppose z ∼ N (0 , S ) .
Then, E z [ | v T z | 2 zz T ]
= 2 Svv T S + ∥ S 1 / 2 v ∥ 2 S .
[Figure]
Proof.
First assume S = I d .
Notice that
[Equation]
Therefore,
[Equation]
For general S , let x = S − 1 / 2 z .
Then x ∼ N (0 , I d ) .
Then we have
[Equation]
where the third step follows from (11).
Now we start to prove Proposition 2.3.
Let ∇ F : R p
(cid:55)→ R d be the Jacobian matrix of F .
Then ∇ f ( x ; θ ) = ∇ F ( θ ) T x .
Recall that we assume y = f
( x ; θ ∗ ) , i [Equation] e., there is no label noise.
Thus, we have
[Equation]
where u ( θ ) =
F ( θ ) − F ( θ ∗ ) .
For the noise covariance, we have
[Equation]
and
[Equation]
where the third step follows from Lemma D.1.
Consequently, µ 1 ( θ ) ⩾ µ ( θ ) ⩾ 1 .
E Proof of Lemma 2.
Recall the definition of feature-based model: f ( x ; θ ) =
(cid:80) mj
[Equation]
θ j φ j ( x ) = ⟨ θ, Φ( x ) ⟩ .
Here Φ( x ) ∈ R m denotes the feature of x .
In this case, the Hessian and Fisher matrix are both constant but the
SGD noise is still state-dependent.
Let g i =
Φ( x i ) be the sample feature of x i .
Then, Σ( θ [Equation] = [Equation]
n n
[Equation]
Proof.
Noticing ¯ χ = 1 n {+(cid:80) ni =
 g Ti+}
[Equation]
i = ∥ G ∥ 2 F , then [Equation] n
[Equation]
Thus µ 1 ( θ ) ⩾ γ .
In addition,
[Equation]
where the last step follows from Lemma G.1.
F Proof of Proposition 2. F.1 Rademacher complexity
We shall use the Rademacher complexity to bound the difference between empirical quantities and the corresponding population ones.
Definition F.1 (Rademacher complexity) .
Let F be a set of functions.
The (empirical) Rademacher complexity of F is defined as
[Equation]
ni
[Equation]
i f
[Equation]
z i )] , where { ξ i } ni =1 are i.i.d.
random variables satisfying P ( ξ i = +1)
=
P ( ξ i = − 1) = 12 .
In particular, the following classic result will be frequently used, which is a restatement of [35,
Theorem 26.5].
Theorem F.2.
Consider a function class F and assume | f | ⩽ B .
Then for any δ ∈ (0 , 1) , w.p. at least 1 − δ over the choice of ( z 1 , z 2 , . . .
, z n ) , we have,
[Equation]
Lemma F.3 (Contraction property [24]) .
Let ϕ : R (cid:55)→ R be β -Lispchitz continuous and ϕ ◦ F = { ϕ ◦ f : f ∈ F} .
Then,
[Equation]
[Table]
Lemma F.4.
Let F = { u T x : u ∈ S d − 1 } be the linear class.
Then
[Equation]
Lemma F.5.
Let ϕ : X (cid:55)→ H be a feature map and H be a Hilbert space.
Define k
( x, y )
= ⟨ ϕ x , ϕ y ⟩ H and H =
{ f ( x ) = ⟨ ϕ x , h ⟩ H | ∥ h ∥ H ⩽ 1 } .
Then,
[Equation]
H
[Equation]
Proof.
By the definition, we have
[Equation]
where ( i ) follows from the Jensen’s inequality.
For the proof of the above classic lemmas, we refer to [35].
The following lemma concerns the
Rademacher complexity of the product of two function classes.
Lemma F.6.
Let F and G be two function classes.
Suppose that sup f ∈F ∥ f ∥ ∞ ⩽ A and sup g ∈G ∥ g ∥ ∞ ⩽ B .
Define F ∗ G = { f ( x ) g ( x ) : X (cid:55)→ R : f ∈ F , g ∈ G} .
Then,
[Equation]
n [Equation] n
[Equation]
G
[Equation]
Proof. By the definition of Rademacher complexity, n (cid:100)
[Equation]
where ( i ) follows from the Lemma F.3 and the fact that t 2 / 4 is ( A + B ) / 2 Lipschitz continuous since | f | ⩽ A, | g | ⩽ B .
F.2 Results for general random feature models
Consider a random feature model (RFM):
[Equation]
, with { w j } mj =1 iid ∼ π and x ∼ ρ .
Here φ : X × Ω (cid:55)→ R is an arbitrary parametric feature function.
The scaling factor m − 1 / 2 is added only to ease taking the limit, which does not affect the noise structure.
The associated kernel and kernel operator are given by k ( x, x ′ ) =
E w ∼ π [ σ ( w T x ) σ ( w T x ′ )] and
K : L 2 ( ρ ) (cid:55)→ L 2 ( ρ ) , K u =
E x ′ ∼ ρ [ k ( · , x ′ )
u ( x ′ )] .
In this case, g i = m − 1 / 2 ( φ ( x i ; w 1 ) , φ ( x i ; w 2 ) , . . .
, φ ( x i ; w m ))
T ∈ R m .
Define the empirical kernel matrix: ˆ k ( x, x ′ ) =
[Equation]
m
[Equation]
[Equation]
Then g Ti g j = ˆ k
( x i , x j ) and as n, m → ∞ , we have
[Equation]
Therefore, in the limit, by our assumption χ i ⩾ χ :=
inf x ′ E x
[ k 2 ( x ′ , x )] for any i ∈ [ n ] .
The remaining issue is to transfer this to a non-asymptotic one.
We first make the following assumption on the feature function.
Assumption 1.
Let Ψ =
{ φ ( x ; · ) | x ∈ X} .
Assume sup x ∈X ,w ∈ Ω | φ ( x ; w ) | ⩽ b and (cid:100)
Rad n (Ψ) ⩽ b/ √ n .
Note that the assumption (cid:100)
Rad n (Ψ) =
O ( n − 1 / 2 ) is satisfied by the popular feature function φ ( x ; w ) =
σ ( w T x ) with σ : R (cid:55)→ R being a Lipschitz activation function.
Proposition F.7.
Suppose m ⩾ n .
Let χ ( x ) =
E x ′ ∼ ρ [ k 2 ( x, x ′ )] and ¯ χ = E x ∼ ρ
[ χ ( x )] .
For any δ ∈ (0 , 1 /e ) , w.p. larger than 1 − δ over the sampling of data and random features, we have µ
[Equation] θ [Equation] ) ¯ χ − τ ( K ) − 2 ϵ n , where τ ( K ) =
λ 21 ( K ) / [Equation]
and [Equation]
By this proposition, ensuring the alignment property only needs inf x χ ( x ) / ¯ χ > 0 .
This condition is very mild and satisfied by most popular kernels, e.g., the dot-product kernel, which appears naturally in the analysis of neural nets [18].
Next we proceed to prove this proposition.
We first need the following lemmas.
Lemma F.8.
Let Φ 1 = { k ( · , x ) | x ∈ X} .
Then,
[Equation]
Proof.
Denote by H k the reproducing kernel Hilbert space (RKHS).
Then, by the Moore-Aronsajn theorem [2],
[Equation]
Therefore, Φ 1 is a subset of the unit ball of H k , for which it is well-known that the Rademacher complexity is bounded by
[Equation]
Lemma F.9.
For any δ ∈ (0 , 1) , w.p. at least 1 − δ , we have
[Equation]
Proof.
Let Ψ 2 = { φ ( x ; · ) φ ( x ′ ; · ) | x, x ′ ∈ X} .
Notice that
[Equation] [Equation]
Then by the same argument in the proof of Lemma F.6, we can obtain
[Equation]
b 2 / √ m , where the last step follows from Lemma 1.
Then, applying Theorem F.2, we complete the proof.
Prove the first part of Proposition F.7 Notice that
[Equation]
Let Φ 2 = { k 2 ( x, · ) | x ∈ X} .
Since sup x,x ′ | k ( x, x ′ ) | ⩽ 1 , the Ledoux-Talagrand inequality (Lemma
F.3) implies that
[Equation]
Rad
[Equation]
⩽ 1 / √ n , where the last inequality follows from Lemma
F.8.
Then, applying Theorem F.2, for any δ ∈ (0 , 1 /e ) , we have w.p. 1 − δ that
[Equation]
Let ∆ =
sup x,x ′ | k
( x, x ′ ) − ˆ k ( x, x ′ ) | .
Therefore, | k
[Equation]
∆ ≲ ∆ .
Applying Lemma F.9 and together with (14), we have
[Equation]
On the other hand, by the Hoeffding’s inequality, w.p. at least 1 − δ , we have
[Equation]
By Proposition 2.2, we have
[Equation]
The above proves the first part of Proposition F.7.
We now turn to the second part.
We will frequently use the following McDiarmid’s inequality.
Theorem F.10 (McDiarmid’s inequality) .
Let X 1 , . . .
, X n are i.i.d.
random variables.
Assume for all i ∈ [ n ] and x 1 , . . .
, x n , ˜ x i ∈ X that
[Equation]
Let et σ 2 :=(cid:80) ni
=1 D 2 i .
Then, for any δ ∈ (0 , 1) , w.p. at least 1 − δ over the sampling of
X 1 , . . .
, X n , we have
[Equation]
We define two matrices
• The kernel matrix: K =
( K i,j ) ∈ R n × n with K i,j = 1 n k ( x i , x j ) ; • The approximate kernel matrix:
ˆ K =
( ˆ K i,j ) ∈ R n × n with
[Equation]
Note that the approximate kernel matrix is the normalized Fisher matrix, i.e., ˆ K = G/n .
We will frequently use the following inequality:
[Equation]
Bounding the largest eigenvalue.
Lemma F.11.
There exists a constant c > 0 such that for any δ ∈ (0 , 1) , w.p. at least 1 − δ over the sampling of random features, we have λ 1 ( ˆ K ) ⩽ λ 1 ( K ) + Cb(cid:112) log(2 /δ )
/m .
Proof.
Let ∆( w 1 , . . .
, w m )
= ∥ K − ˆ K ∥ F .
By Jensen’s inequality, we have
[Equation]
where the last inequality follows from (15).
Denote by ˆ K ′ the approximate kernel matrix associated with ( w 1 , . .
. , w ′ s , . .
. , w m ) .
Then,
[Equation]
Therefore σ 2 =(cid:80) ms =1 D 2 s ≲ b 4 /m .
By McDiarmid’s inequality (Theorem F.10), for any δ ∈ (0 , 1) , w.p. at least 1 − δ over the sampling of random features, we have
[Equation]
Plugging the above estimate to the Weyl’s inequality: λ 1 ( ˆ K ) ⩽ λ 1 ( K ) + ∥ K − ˆ K ∥ 2 , we complete the proof.
Lemma F.12.
Suppose k ( · , · ) to be positive semi-definite kernel and let ϕ : X (cid:55)→ H be a feature map satisfying k ( x, y ) = [Equation] x , ϕ
[Equation]
⟩ H .
Then,
[Equation]
Proof.
By the variational principle of eigenvalues, we have
[Equation]
Lemma F.13.
For any δ ∈ (0 , 1 /e ) , w.p. at least 1 − δ over the sampling of data, we have
[Equation]
Proof.
By Lemma F.12, we have
[Equation]
Let F 1 = { f ( x ) := ⟨ h, σ x ⟩ H | ∥ h
∥
H ⩽ 1 } and F 2 = { f 2 | f ∈ H 1 } . Then, we have: (1) for any f ∈ H 1 , | f ( x ) | ⩽ ∥ h
∥ H ∥ σ x ∥ H = (cid:112) k ( x, x )
[Equation]
1 ; (2) (cid:100) Rad
[Equation]
by Lemma F.5.
Using contraction inequality (Lemma F.3), we have
[Equation]
Using Theorem F.2, for any δ ∈ (0 , 1 /e ) , w.p. larger than 1 − δ over the sampling of data, we have
[Equation]
For any ε > 0 , let ˆ h ∈ H such that λ 1 ( K ) ⩽ ˆ E [ ⟨ ϕ x , ˆ h ⟩ 2 H ] + ε .
Then, using (18), we have
[Equation]
Taking ε → 0 completes the proof.
Lemma F.14.
For any δ ∈ (0 , 1) , w.p. at least 1 − δ over the sampling of data and random features, we have
[Equation]
Proof.
The conclusion directly follows from the combination of Lemma F.13 and F.11.
Bounding the Frobenius norm.
The following lemma provide a lower bound of the Frobenius norm of the approximate kernel matrix.
Lemma F.15.
For any δ ∈ (0 , 1 /e ) , w.p. at least 1 − δ over the sampling of data and random features, we have
[Equation]
Proof.
Denote by { ( λ s , v s ) } s ⩾ 1 the eigen-pairs of the kernel k ( · , · ) , and thus k ( x, x ′ ) = (cid:80) s
λ
s v s ( x ) v s ( x ′ ) .
Let x, x ′ be independently drawn from ρ .
Then,
[Equation]
Using the above equality, we have
[Equation]
Here, the last inequality is due to E [ k 2 ( x, x )] ⩾ E [ k 2 ( x, x ′ )] as explained as follows.
Notice that for any x, x ′ ∈ X , k 2 ( x, x ′ )
⩽ k ( x, x ) k
( x ′ , x ′ )
(See, e.g., [34, Lemma 35]).
Therefore, E [ k [Equation] x, x [Equation]
[Equation] ( x, x )
[Equation] ( x [Equation]
= ( E [ k ( x, x )]) 2 ⩽ E
[ k 2 ( x, x )] .
The last inequality follows from that ( E [ X ]) [-
-]2 ⩽ E
[ X 2 ] holds for any random variable X .
Let K ′ be the kernel matrix corresponding to the ( x 1 , . . .
, ˜ x i , . . .
, x n ) .
Then,
[Equation]
Therefore, σ 2 =(cid:80) ni =1 | D i | 2 ≲ 1 /n .
Using Theorem F.10 and Eq.
(20), we have w.p. at least 1 − δ over the sampling of data that
[Equation]
In addition, following the proof of Lemma F.11, we have for any δ ∈ (0 , 1 /e ) , w.p. larger than 1 − δ over the sampling of random features that ∥ ˆ K − K ∥ F ⩽ d (cid:112) log(2 /δ )
/m.
Thus,
[Equation]
Combing with (21), we complete the proof.
Prove the second part of Proposition F.7.
Recall ϵ n =
[Equation]
[Equation]
+ b
[Equation]
log [Equation] 1 /δ )
/m .
Combining Lemma F.14 and F.15, we have
[Equation]
[Equation]
F.3 Proof of Proposition 2.
Denote by τ d − 1 the uniform distribution over the unit sphere S d − 1 = { x ∈ R d : ∥ x ∥ 2 = 1 } .
According to [5], the eigenfunctions of
K are the spherical harmonics.
In particular, the eigenfunction corresponding to the largest eigenvalue is the first spherical harmonics: Y 1 ( x ) ≡ 1 .
Therefore,
[Equation]
where the last equality uses the rotational symmetry of τ d − 1 .
Moreover, by (19), (cid:80) i λ 2 i
( K ) =
E x,x ′ [ κ 2 ( x T x ′ )]
=
E x [ κ 2 ( x 1 )] .
For the ReLU activation function, [7] shows that k ( x, x ′ )
= κ ( x T x ′ ) with
[Equation]
The eigenvalues of this kernel has been derived in [5, 45].
Specifically, we have
[Equation]
Hence,
[Equation]
Then, applying Proposition F.7, we complete the proof.
G Proofs of Section
We first need the following technical lemma.
Lemma G.1.
For a, b > 0 , let g ( a, b, θ ) =
− a θ T H
2 θ θ T
Hθ
+ b θ Tt H
3 θ θ T Hθ .
Then, inf θ g ( a, b, θ ) ⩾ − a 2 / (4 b ) .
Proof.
Let u
= H 1 / 2 θ/ ∥ H 1 / 2 θ ∥ and H = (cid:80) j λ j e j e Tj the eigen-decomposition of H .
Suppose u
= (cid:80) j s j e j .
Then (cid:80) j s 2 j = 1 and − a
[Equation]
We first consider GD, for which the stability only imposes the flatness constraint: λ 1 ( H ) ⩽ 2 /η . This means that the flatness seen by GD is only the largest eigenvalue of Hessian. Lemma G.2.
[Equation]
[Equation]
inf
[Equation] sup θ [Equation] ⩽ 1 if η ⩽ 2 /λ
[Equation]
( H ) .
Proof.
Recall that r ( θ ) =
− 2 η θ T H
2 θ θ T Hθ
+ η 2 θ
Tt H
3 θ θ T Hθ .
Let u
= H 1 / 2 θ/ ∥ H 1 / 2 θ ∥ .
Then we have
[Equation]
Let u =
[Equation] j s j e j with { e j } j being the eigenvectors of H .
Then [Equation] j s 2 j = 1 due to ∥ u ∥ = 1 .
By the assumption, ( ηλ j − 1) 2 ⩽ 1 for all j ∈ [ n ] .
Then,
[Equation] [Equation]
Proof of Proposition 3.4 Using µ 1 ( θ ) ⩾ µ 1 and Σ( θ ) =
Σ 1 ( θ ) − Σ 2 ( θ ) , we have
[Equation]
where the contribution of Σ 2 ( θ ) is − θ T H 3 θ/ ( Bθ T Hθ ) .
Notice that there is a similar term in the contribution of mean gradient r ( θ ) .
Together we have E [ L ( θ t +1 )] ⩾ E [ L ( θ t ) γ ( θ )] with
[Equation]
By Lemma G.1, we have
[Equation]
Let γ {+
 ⩽+} 1 yields ∥ H ∥ 2 F ⩽ B/ ( η (cid:112) ( B − 1) µ 1 ) .
This bound is trivial for the case B = 1 , where
[Equation]
Noticing that ∥ H ∥ 2 F = (cid:80) j λ 2 j ( H ) , the stability condition needs 1 −
[Equation]
[Equation] 1 , leading to (cid:88) j
[Equation]
Thus, λ 1 ( H ) ⩽ 2 B/ ( µ 1 η ) .
Consequently, ∥ H ∥ 2 F [-(cid:54) 
-]⩽ 2 Bµ 1 η λ 1 ( H ) ⩽ ( 2 Bµ 1 η ) 2 .
Combing them, we complete the proof.