R EVISITING THE STABILITY OF STOCHASTIC GRADIENT DESCENT : A TIGHTNESS ANALYSIS
Anonymous authors
Paper under double-blind review
A BSTRACT
The technique of algorithmic stability has been used to capture the generalization power of several learning models, especially those trained with stochastic gradient descent (SGD).
This paper investigates the tightness of the algorithmic stability bounds for SGD given by Hardt et al.
We show that the analysis of Hardt et al.
2016) is tight for convex objective functions but loose for non-convex objective functions.
In the non-convex case we provide a tighter upper bound on the stability (and hence generalization error) and provide evidence that it is asymptotically tight up to a constant factor.
However, deep neural networks trained with SGD exhibit much better stability and generalization in practice than what is suggested by these (tight) bounds, namely, linear or exponential degradation with time for SGD with constant step size.
We aim towards characterizing deep learning loss functions with good generalization guarantees, despite training using SGD with constant step size.
In this vein, we propose the notion of a Hessian Contractive (HC) region, which quantiﬁes the contractivity of regions containing local minima in the neural network loss landscape.
We provide empirical evidence that several loss functions exhibit
HC characteristics, and provide theoretical evidence that the known tight SGD stability bounds for convex and non-convex loss functions can be circumvented by HC loss functions, thus partially explaining the generalization of deep neural networks.
I NTRODUCTION
Stochastic gradient descent (SGD) has gained great popularity in solving machine learning optimization problems (Kingma & Ba, 2014; Johnson & Zhang, 2013).
SGD leverages the ﬁnite-sum structure of the objective function, avoids the expensive computation of exact gradients, and thus provides a feasible and efﬁcient optimization solution in large-scale settings (Bottou, 2012).
The convergence and the optimality of SGD have been thoroughly studied (Ge et al., 2015;
Rakhlin et al., 2012; Reddi et al., 2018; Zhou & Gu, 2019; Carmon et al., 2019a;b; Shamir & Zhang, 2013) .
In recent years, new research questions have been raised regarding SGD’s impact on a model’s generalization power.
The seminal work (Hardt et al., 2016) tackled the problem using the algorithmic stability of SGD, i.e., the progressive sensitivity of the trained model w.r.t.
the replacement of a single (test) datum in the training set.
The stability-based analysis of the generalization gap allows one to bypass classical model capacity theorems (Vapnik, 1998; Koltchinskii & Panchenko, 2000) or weight-based complexity theorems (Neyshabur et al., 2017; Bartlett et al., 2017; Arora et al., 2018).
This framework also provides theoretical insights into many phenomena observed in practice, e.g., the “train faster, generalize better” phenomenon, the power of regularization techniques such as weight decay (Krogh & Hertz, 1992), Dropout (Srivastava et al., 2014), and gradient clipping.
Other works have applied the stability analysis to more sophisticated settings such as Stochastic Gradient Langevin
Dynamics and momentum SGD (Mou et al., 2018; Chaudhari et al., 2019; Chen et al., 2018).
Despite the promises of this stability-based analysis, it remains open whether this framework can explain the strong generalization performance of deep neural networks in practice.
Existing theoretical upper bounds of the stability (and thus, generalization) (Hardt et al., 2016) are ideal for strongly convex loss functions: the upper bound remains constant even as the number of training iterations increases.
However, the same bound deteriorates signiﬁcantly when we relax to more general and realistic settings.
In particular, for convex (but not strongly convex) and non-convex loss functions, if
SGD has constant step size, then the upper bound grows linearly and exponentially with the number of training iterations.
This bound fails to match the superior generalization performance of deep neural networks, and leads to the following question:
Question 1:
Can we ﬁnd a better stability upper bound for convex or non-convex loss functions?
In this paper, we ﬁrst address the question above and investigate the tightness of the algorithmic stability analysis for stochastic gradient methods (SGM) proposed by (Hardt et al., 2016).
R1 .
We show in Theorem 1 that the analysis in (Hardt et al., 2016) is tight for convex and smooth objective functions; in other words, there is a convex loss function whose stability grows linearly with the number of training iterations, with constant step size ( α t = α ) in SGD.
R2 .
We show that in Theorem 2 that for linear models, the analysis in the convex case can be tightened to show that (cid:15) stab does not increase with t .
R3 .
In Theorem 3 we show that the analysis in (Hardt et al., 2016) for decreasing step size ( α t =
O (1 /t ) ) is loose for non-convex objective functions by providing a tighter upper bound on the stability (and hence generalization error).
R4 .
The bound on the stability of SGD by (Hardt et al., 2016) is achieved by bounding the divergence at time t , deﬁned as δ t :=
E || w t − w (cid:48)
t || , where w t is the model trained on data set S and w (cid:48) t is the model trained on a data set S (cid:48) that differs from S in exactly one sample.
In Theorem 4 we provide evidence that our new upper bound in the non-convex case is tight, by showing a non-convex loss function whose divergence matches the upper bound for our divergence.
R5 .
Although it is not derived formally, the techniques in (Hardt et al., 2016) can be employed to show an exponential upper bound for non-convex loss functions minimized using SGD with constant-size step.
In Theorem 5, we give evidence that this abysmal upper bound is likely tight for non-convex loss functions, by exhibiting a non-convex loss function for which the divergence δ t increases exponentially.
Thus the only functions whose stability provably does not increase with the number of iterations when a constant step-size during SGD is employed, are strongly convex functions.
However, a) it has been empirically observed that for deep neural network loss, near the local minima, the Hessians are usually low rank (Chaudhari et al., 2017; Yao et al., 2019), and b) neural networks trained with constant step-size SGD do generalize well in practice (Lin & Jegelka, 2018; Huang et al., 2017;
Smith et al., 2017).
Combined with our lower bounds on convex and non-convex functions, we seem to hit an obstacle on the way to explaining generalization using the stability framework.
Question 2: What is it that makes constant-step SGD on deep learning loss function generalize well?
Realizing the limitation of the current state of stability analysis, we investigate whether a strongerthan-convex, but weaker-than-strongly-convex assumption of the loss function can be made, at least near local minima.
If we can show algorithmic stability near local minima, we can still show the stability using similar argument as (Du et al., 2019; Allen-Zhu et al., 2019).
Aiming towards a characterization of loss functions exhibiting good stability, we propose a new condition for loss near local minima.
This condition, called Hessian contractive , is slightly stronger than a general convex condition, but considerably weaker than strongly convex.
Formally, the Hessian contractive condition stipulates that near any local minima, (1) the function is convex; and (2) a data dependent Hessian is positive deﬁnite in the gradient direction.
Theoretically, we show that such a condition is sufﬁcient to guarantee a constant stability bound for SGD (constant step size) near the local minima, while allowing the Hessian to be low rank.
We also provide examples showing Hessian
Contractive is a reasonable condition for several loss functions.
Empirically, we verify the Hessian
Contractive condition near a local minima of the loss while training deep neural networks.
We sample points from a neighborhood of current iterates by adding Gaussian noise and verify the HC condition locally by Hessian product approximation.
Summarizing our second set of contributions:
R6 .
In Observation 1 we show that the family of widely used (convex) linear model loss functions will satisfy the Hessian Contractive condition.
One typical example of such linear model loss is the regression loss function.
These observation suggests that Hessian Contractive is a condition satisﬁed by (potentially many) machine learning loss functions.
R7 .
In Theorem 6 we show that the Hessian Contractive condition will localize SGD iterates in a neighborhood of minima, which implies a constant stability bound for SGD near the local minima.
[Table]
1. R ELATED W ORKS
Stability and generalization.
The stability framework suggests that a stable machine learning algorithm results in models with good generalization performance (Kearns & Ron, 1999; Bousquet & Elisseeff, 2002; Elisseeff et al., 2005; Shalev-Shwartz et al., 2010; Devroye & Wagner, 1979a;b;
Rogers & Wagner, 1978).
It serves as a mechanism for provable learnability when uniform convergence fails (Shalev-Shwartz et al., 2010; Nagarajan & Kolter, 2019).
The concept of uniform stability was introduced in order to derive high probability bounds on the generalization error (Bousquet &
Elisseeff, 2002).
Uniform stability describes the worst case change in the loss of a model trained on an algorithm when a single data point in the dataset is replaced.
In (Hardt et al., 2016), a uniform stability analysis for iterative algorithms is proposed to analyze SGD, generalizing the one-shot version in (Bousquet & Elisseeff, 2002).
Algorithmic uniform stability is widely used in analyzing the generalization performance of SGD (Mou et al., 2018; Feldman & Vondrak, 2019; Chen et al., 2018).
The worst case leave-one-out type bounds also closely connect uniform stability with differential private learning (Feldman et al., 2018; 2020; Dwork et al., 2006; Wu et al., 2017b), where the uniform stability can lead to provable privacy guarantee.
While the upper bounds of algorithmic stability of SGD have been extensively studied, the tightness of those bounds remains open.
In addition to uniform stability, an average stability of the SGD is studied in Kuzborskij & Lampert (2018) where the authors provide data-dependent upper bounds on stability 1 .
In this work, we report for the ﬁrst time lower bounds on the uniform stability of SGD.
Our tightness analysis suggests necessity of additional assumptions for analyzing the generalization of SGD on deep learning.
Geometry of local minima.
The geometry of local minima plays an important role in the generalization performance of deep neural networks (Hochreiter & Schmidhuber, 1995; Wu et al., 2017a).
The ﬂat minima, i.e., minima whose Hessians have a large portion of zero-valued eigenvalues, are believed to attain better generalization (Keskar et al., 2016; Li et al., 2018).
In (Chaudhari et al., 2019), the authors construct a local entropy-based objective function which converges to a solution with good generalization in a ﬂat region, where “ﬂatness” means that the Hessian matrix has a large portion of nearly-zero eigenvalues.
However, these observations have not been supported theoretically.
In this paper, we propose the Hessian contractive condition that is slight stronger than ﬂat minima.
Such condition suggests that the minima is sharp only in the gradient direction while remains ﬂat in other directions, which uniﬁes the geometrical interpretation of ﬂat minima and uniform stability analysis.
P RELIMINARIES
In this section we introduce the notion of uniform stability and establish our notations.
We ﬁrst introduce the quantities Empirical and Population Risk and Generalization Gap .
Given an unknown distribution D on labeled sample space Z
=
X × {− 1 , +1 } , let S =
{ z 1 , ..., z n } denote a set of n samples z i =
( x i , y i ) drawn i.i.d.
from D .
Let w ∈ R
d be the parameter(s) of a model that tries to predict y given x , and let f be a loss function where f ( w ; z ) denotes the loss of the model with parameter w on sample z .
Let f ( w ; S ) denote the empirical risk f ( w ; S )
=
E z ∼ S
[ f ( w ; z )] =
1 n
[Equation]
=1 f ( w ; z i ) with corresponding population risk E z
∼D
[ f ( w ; z )] .
The generalization error of the model with parameter w is deﬁned as the difference between the empirical and population risks:
[Equation]
Next we introduce the Stochastic Gradient Descent (SGD) method.
We follow the setting of (Hardt et al., 2016), and starting with some initialization w 0 ∈ R d , consider the following SGD update step:
[Equation]
where i t is drawn from [ n ] := { 1 , 2 , · · · , n } uniformly and independently in each round.
The analysis of SGD requires the following crucial properties of the loss function f ( ., z ) at any ﬁxed point z , viewed solely as a function of the parameter w :
Deﬁnition 1 ( L -Lipschitz) .
A function f ( w ) is L -Lipschitz if ∀ u, v ∈ R d : | f ( u ) − f ( v ) | ≤ L (cid:107) u − v (cid:107) .
Deﬁnition 2 ( β -smooth) .
A function f ( w ) is β -smooth if ∀ u, v ∈ R d : |∇ f ( u ) −∇ f ( v ) | ≤ β (cid:107) u − v (cid:107) .
Deﬁnition 3 ( γ -strongly convex) .
A function f ( w ) is γ strongly convex if ∀ u, v ∈ R d : f ( u ) >
f ( v ) + ∇ f ( v ) (cid:62) [ u − v ] + γ 2 (cid:107) u − v (cid:107) 2 .
Algorithmic Stability Next we deﬁne the key concept of algorithmic stability , which was introduced by (Bousquet & Elisseeff, 2002) and adopted by (Hardt et al., 2016).
Informally, an algorithm is stable if its output only varies slightly when we change a single sample in the input dataset.
When this stability is uniform over all datasets differing at a single point, this leads to an upper bound on the generalization gap.
More formally:
Deﬁnition 4.
Two sets of samples S, S (cid:48) are twin datasets if they differ at a single entry, i.e., S = { z 1 , ...
z i , ..., z n } and S (cid:48)
=
{ z 1 , ..., z (cid:48) i , ..., z n } .
Consider a possibly randomized algorithm A that given a sample S of size n outputs a parameter
A ( S ) .
Deﬁne the algorithmic stability parameter of A by:
[Equation]
Here E A denote expectation over the random coins of A .
Also, for such an algorithm, one can deﬁne its expected generalization error as:
[Equation]
Stability and generalization: It was proved in (Hardt et al., 2016) that GE ( A, n ) ≤ ε stab ( A, n ) .
Furthermore, the authors observed that an L -Lipschitz condition on the loss function f enforces a uniform upper bound: sup z | f ( w ; z ) − f ( w (cid:48) ; z ) | ≤ L (cid:107) w − w (cid:48) (cid:107) .
This implies that for Lipschitz loss, the algorithmic stability ε stab ( A, n ) (and hence the generalization error GE ( A, n ) ) can be bounded by obtaining bounds on (cid:107) w − w (cid:48) (cid:107) .
Let w T and w (cid:48)
T be the parameters obtained by running SGD starting on twin datasets S and S (cid:48) , respectively.
Throughout this paper we will focus on the divergence quantity δ T :=
E A || w T − w (cid:48)
T || .
While (Hardt et al., 2016) reports upper bounds on δ T with different types of loss functions, e.g., convex and non-convex loss functions, we investigate the tightness of those bounds.
T IGHTNESS OF EXISTING BOUNDS
In this section we report our main results.
We ﬁrst consider the convex case with constant step size, where we prove 1) that the existing bounds stating (cid:15) stab ∝ t are tight, and 2) for linear models, the analysis can be tightened to show that (cid:15) stab does not increase with t .
Then we move on to the non-convex case, where a) for decreasing step size we improve the existing upper bound, and give evidence that our new upper bound is tight, and b) for constant step size we give loss functions whose divergence δ t increases exponentially with t .
3. C ONVEX C ASE
In this section we analyze the stability of SGD when loss function is convex and smooth.
We begin with a construction which shows that Theorem 3.8 in (Hardt et al., 2016) is tight.
Our lower bound analysis will require the following quadratic function:
[Equation]
where A is a d × d matrix.
In the construction of lower bounds, we carefully choose A and S so that the single data point replaced in twin data set will cause the instability of SGD.
Theorem 1.
Let w t , w (cid:48) t be the outputs of SGD on twin datasets S, S (cid:48) respectively.
Let ∆ t = w t − w (cid:48) t
and α t be the step size of SGD.
There exists a function f which is convex, β -smooth, and L -Lipschitz on the domain of w , and twin datasets S, S (cid:48) such that:
[Equation]
and
[Equation] [Equation]
The convex upper bound in Theorem 3.8 in (Hardt et al., 2016) states that (cid:107) ∆ T (cid:107) ≤
L (cid:80) T i =1 α t n , which implies that the divergence increases throughout training.
The lower bound in Theorem 1 suggests the tightness of the upper bound.
However, in practice, such phenomenon is not commonly observed, i.e., for a family of convex but not-strongly-convex loss functions, the generalization performance does not deteriorate as the number of training iterations increases.
This motivates us to investigate a weaker condition which still can enforce an O (1) stability, without strong convexity.
In the next theorem, we restrict ourselves to a family of linear model loss functions and show that the divergence will not increase unboundedly during training.
We shall need the following deﬁnition of a ξ -self correlated data set.
Essentially, a self-correlated dataset requires an average linear dependence of each x .
Recall that the i’th sample z i =
( x i , y i ) .
Deﬁnition 5.
A set S = { z 1 , ..., z n } is ξ -self correlated if ∀ j ∈ [ n ] , 1 n (cid:80) ni =1 ( x (cid:62) j x i ) 2 ≥ ξ > 0 .
Assuming that ∀ j ∈ [ n ] , (cid:107) x j (cid:107) ≥ r for some r > 0 , deﬁnition 5 implies that S is at least r 2 n -self correlated.
Thus the above condition holds for all datasets S not containing the zero-feature vector.
In our next theorem, we leverage on the ξ -self correlated condition to prove a non-accumulate uniform stability bound for SGD on a loss function of Linear Models .
We characterize a linear model by rewriting the loss function f ( w ; z ) in terms of f y ( w (cid:62) x ) where f y ( · ) is a scalar function depending only on the inner product of the model parameter w and the input feature x .
Theorem 2.
Suppose a loss function f ( w, z ) is of the form f ( w, S )
=
1 n (cid:80) nj =1 f y j ( w (cid:62) x j ) ,
where f y ( w (cid:62) x ) satisﬁes (1) | f
(cid:48)
y ( · ) | ≤ L , (2) 0 <
γ ≤ f (cid:48)(cid:48) y ( · ) ≤ β , (3) (cid:107) x (cid:107) ≤ R and (4) S, S (cid:48) are ξ -self correlated, twin datasets.
Let w t and w (cid:48) t be the outputs of SGD on S and S (cid:48) after t steps, respectively.
Let the divergence ∆ t :=
w t − w (cid:48) t and α ≤ 1 β be the step size of SGD.
Then, E (cid:107) ∆ T (cid:107) ≤ 4 LRξγn .
Remark 1.
In (Hardt et al., 2016), an O (cid:16) L 2 γn (cid:17) stability bound is derived on a loss function f ( w, z i ) which is strongly convex, i.e., ∇ 2 f ( w ) (cid:31) γI .
In practice one can incorporate a strongly convex regularizer to impose strong convexity, often resulting in improved generalization performance in practice (Shalev-Shwartz et al., 2010; Bousquet & Elisseeff, 2002).
The ξ -self correlated condition allows SGD to maintain a uniformly upper-bounded divergence guarantee for a family of widely used models for arbitrary long training without using strongly convex regularizer.
The theorem suggests that if the dataset S is reasonably simple, e.g., every x i lies in a low dimensional subspace, the divergence of SGD is comparable with a strongly convex loss function.
This analysis suggests an alternative condition other can strong convexity can empower SGD an O (1) stability which is data-dependent.
This motivates us to go beyond linear model and seek for a generalized condition in Theorem 2.
In section 4.1, we propose the Hessian Contractive condition for more general loss function driven by the observation on the linear model.
Example: Linear and logistic regression.
Linear regression minimizes the quadratic loss on w : f ( w, S )
= 12 n (cid:80) x j ∈ S ( x (cid:62) j w − y j ) 2 .
Note that the Hessian of an individual linear regression loss term is x j x (cid:62) j which is not strongly convex since it has rank 1 .
One cannot apply the strongly convex bound, and the bound for convex suggests stability will increase linearly.
However, one can rewrite the loss function as f y ( w (cid:62) x ) where f (cid:48)(cid:48) y ( · ) = 1 .
Hence Thm. 2 can be applied to give a non-accumulative bound on SGD’s stability.
A similar result can be derived for the logistic regression loss.
N ON -C ONVEX C ASE
In this section, we construct a non-convex loss function to analyze the tightness of the divergence bound in (Hardt et al., 2016).
We ﬁrst focus on the case where SGD applies a step size that decreases with t .
We ﬁrst ﬁx a hitting time t 0 and prove Lemma 4 in the Appendix.
The following theorem follows from Lemma 4 by optimizing over t 0 .
The choice of hitting time t 0 plays an important role in the analysis, which is also illustrated in the “burn-in Lemma” 3.11 in (Hardt et al., 2016).
Theorem 3.
Let w t , w (cid:48) t be the SGD outputs on twin datasets S, S (cid:48) , ∆ t := w t − w (cid:48) t .
There exists f that is non-convex and β -smooth, twin datasets S, S (cid:48) and a constant a > 0 such that the SGD divergence after T rounds ( T > n ) using decreasing step size α t = a 0 .
99 βt satisﬁes: E (cid:107) ∆ T (cid:107) ≥ [Equation] 3 n [Equation]
The divergence upper bound in proof of the Theorem 3.12 (Hardt et al., 2016) is of the form O (cid:16) 1 n (cid:16) Tt 0 (cid:17) a (cid:17) . The stability upper bound in Theorem 3.12 is then derived by assuming f ( w, z ) < 1 , and equals t 0 n {++ 1 n (cid:16) Tt 0 (cid:17) a . By selecting t 
+}
= T aa +1 , they get a stability upper bound of O (cid:16) T a 1+ a n (cid:17) . Our lower bound on divergence in Theorem 3 is lower than the divergence upper bound in Hardt et al.
According to the lower bound provided in Theorem 3, the bound in Hardt et al.
(2016) may not be tight in the region T a 1+ a ≤ n .
We investigate this gap and derive a tighter bound in the next theorem which improves the Theorem 3.12 in Hardt et al.
Theorem 4.
Assume f is β -smooth and L -lipschitz.
Running T ( T > n ) iterations of SGD on f ( w ; S ) with step size α t
= aβn , the stability of SGD satisﬁes:
[Equation]
Dividing our bound with the one in Theorem 3.12 in Hardt et al.
, we obtain the ratio Ω (cid:18) T a 2 1+ a n a (cid:19) .
This factor is less than 1 (and so we improve the upper bound) exactly when T a 1+ a ≤ n .
Note that this is potentially a large range as a is a small and positive constant.
We remark that our tight bound is for permutation SGD .
The bound for SGD (see Appendix Theorem 4b) using sampling without replacement has an additional log( n ) factor (which we conjecture can be removed), which nevertheless is also a polynomial improvement over the known bounds.
D EEP L EARNING AND L IMITATIONS OF B OUNDS
While Theorem 4 improves existing upper bounds on stability by an polynomial factor, it still can not explain the generalization performance of deep learning model.
In particular, the analysis relies on a decreasing step size while in training deep learning model, constant instead of a decreasing step size is a common choice.
In the next result, we adopt the same construction as in Theorem 3 but with a constant learning rate to show that, unfortunately, SGD may have an exponential divergence rate for general β smooth function.
Theorem 5.
Let w t , w (cid:48) t be the outputs of SGD on twin datasets S, S (cid:48) , and let ∆ t :
=
w t − w (cid:48) t .
There exists a function f which is non-convex and β -smooth, twin sets S, S (cid:48) and constants a, γ such that the divergence of SGD after T rounds ( T > n ) using constant step size α = a 0 .
99 β satisﬁes:
E (cid:107) ∆ T (cid:107) ≥ 1 n 2 e aT/ 2 .
The above theorem implies that the generalization gap may deteriorate at an exponential rate if SGD is run with a constant step size for a non-convex function.
However, in Fig.
1a we observe that the distance between the weights of two deep models trained on twin datasets (in other words, the divergence δ T stabilizes after ≈ 20 epochs of training .
Fig.
1a suggests that the generalization gap for deep models may remain constant after sufﬁciently many training iterations.
However, the analysis of (Hardt et al., 2016) suggests that local minima of the loss landscape must be in strongly convex regions in order to achieve this sort of stability.
Indeed, strongly convex Hessians have been proven to be contractive, leading to the stability of SGD (Ge et al., 2015).
On the other hand, it is known that the Hessians of the loss functions of common deep learning architectures have a large fraction of eigenvalues which are close to zero (Yao et al., 2019; Chaudhari et al., 2017).
This phenomenon requires further investigation to close the gap between theory and practice.
Next, we formalize a condition requiring that local minima of deep learning loss landscapes lie in contractive regions, which aids in explaining why the generalization gap stabilizes.
We then provide empirical evidence that this property does indeed hold.
4. G EOMETRY OF L OCAL M INIMA
In Theorems 1 and 5, we show that in general, divergence (and hence stability) may deteriorate at a linear or exponential rate with the number of training iterations when the local minima are not in strongly convex regions.
We introduce the following property to aid in understanding the stability of the training curve of SGD.
Deﬁnition 6.
[Hessian Contractive] For a given set S
= { z 1 , ...
z n } , a local minimum w ∗ is in a ( σ, γ ) -Hessian contractive region if ∀ w, w (cid:48) with max( (cid:107) w (cid:48) − w ∗ (cid:107) , (cid:107) w − w ∗ (cid:107) ) ≤ σ and z ∈ S , [Equation] (cid:107)∇
[Equation]
(4) where H w (cid:48)
= ∇ 2 w f ( w (cid:48) ; S ) = 1 n (cid:80) [Equation] =
[Equation] ∇ [Equation] , z j ) .
When ( σ, γ ) -Hessian
contractive holds for all σ > 0 and local minima w ∗ , we say f ( w ; S ) is globally γ -Hessian contractive.
Hessian contractivity describes a region where the stochastic gradient will lie in the range of a positive semi-deﬁnite Hessian matrix.
Such a condition prevents the iterates of SGD from escaping from a local minima in the sense that all gradient descent steps will be pulled back to the minima by the power of Hessian, which mimics the structure of a strongly convex loss function but with a weaker assumption.
To show that this class is nonempty, we observe the (not strongly convex) linear models loss functions in Theorem 2 satisfy Hessian contractive condition globally.
Observation 1.
Suppose loss function f ( w ; S ) conditions in Theorem 2, i.e., f ( w, S ) =
n
[Equation]
satisﬁes
[Equation]
≤ R and (4) S is ξ -self correlated, we have f ( w ; S ) is globally ξγR 2 Hessian Contractive.
Dependence on dataset The Hessian Contractive condition states that the gradient of loss function evaluated on z can be regulated by Hessian evaluated on the whole dataset, which is a generalization of ξ -self correlated set condition.
In the linear model case, the power of Hessian Contractive condition depends on the the average correlation between data points which indicates the effect of data complexity in generalization.
We postulate that the value of γ in Hessian Contractive condition can be one complexity measurement of the data, which is believed to affect generalization power (Kawaguchi et al., 2017).
Next, we leverage on the Hessian contractive condition to show that once SGD hits a stationary point around w ∗ in a ( σ, γ ) -Hessian contractive region, it will be localized near the minima.
The localization of SGD implies that the divergence curve will be stable eventually.
Theorem 6.
Given a set S and a β -smooth and L -Lipschitz loss funtion f , suppose SGD with a ﬁxed step size α ≤ σ 2 2 γL 2 reaches point w 0 which is close to a local minimum w ∗ in a ( σ, γ )
-Hessian
contractive region: (cid:107) w 0 − w ∗ (cid:107) ≤
σ
with large enough radius so that σ > 12 Lγ , then we have ∀ T ≥ 1 , (cid:107) w T − w ∗ (cid:107) ≤ σ .
Theorem 6 states that once the iterate w of SGD encounters a point in a ( σ, γ ) -Hessian contractive region with large enough radius σ , w will remain in this region.
In terms of the stability of SGD, assuming SGD will bring w t into one of the local minima quickly (Ge et al., 2015; Allen-Zhu et al., 2019), the divergence (cid:107) w t − w (cid:48) t (cid:107) will be uniformly bounded by the difference between two local minima w ∗ , w ∗(cid:48) of loss functions f ( w ; S ) and f ( w (cid:48) ; S (cid:48) ) plus the σ -radius of the Hessian contractive region.
The O (1) uniform stability of SGD follows from the fact that the loss f is L -lipschitz.
The above suggests that a weaker condition than strong convexity is sufﬁcient to explain the observation in Fig.
1a.
In the next section, we provide empirical evidence that the local minima of deep learning loss landscapes lie in Hessian contractive regions. [Figure]
4. E MPIRICAL S UPPORT FOR H ESSIAN C ONTRACTIVITY
In order to explain the stabilization of the generalization gap observed when training deep learning models via SGD we hypothesize that local minima of deep loss landscapes found by SGD lie in Hessian contractive regions.
We propose to empirically support this hypothesis by locally approximating the LHS of Eq.
(6)–normalized by (cid:107)∇ w f ( ˜ w, z ) (cid:107) 2 –during the training of a model and showing that this quantity steadily increases as training progresses.
This indicates that SGD leads the training into regions of increasing contractivity
We now explain our approximation: For a model w ∗ , we generate many random samples ˜ w from the unit sphere around w ∗ .
For each ˜ w , we locally estimate a stochastic version of Hessian-gradient product to get the approximation
[Equation]
where the gradients on the RHS approximation are taken with respect to a random minibatch of samples.
For each perturbation ˜ w we normalize the corresponding approximation by (cid:107)∇ w f ( ˜ w, z ) (cid:107) 2 , and then take the mean and minimum over all of these quantities.
For our experiments, we used the well-known CIFAR10 dataset (Krizhevsky et al., 2009) and two popular deep architectures: ResNet18, and DenseNet121 (Huang et al., 2017; Lin & Jegelka, 2018).
To match the settings in the theorems of this paper as much as possible and avoid any confounding factors, we avoided standard regularization (e.g. weight decay), data augmentation, and adaptive learning rates.
We used SGD with a constant learning rate of 0.01 and momentum of 0.9.
The models were trained for 200 epochs and batch size of 128.
We trained ﬁve copies of each network and checkpointed the models every 8 epochs.
For each checkpoint, we generated 100 random perturbations from the unit sphere around the checkpoint weights.
We used η = 0 .
001 and batch size 128 for the approximation in Eq.
We averaged over these 100 approximations and then further took the average over the ﬁve networks.
The results of these experiments are shown in Fig.
1b, and indicate a clear increase in Hessian contractivity as training progresses.
C ONCLUSION
In this paper, we studied the stability bound of SGD with regard to different types of loss functions.
We proved a better upper bound and proved the tightness of various bounds.
These tightness results suggest that existing stability bounds may not sufﬁce in answering the generalization problem of deep neural nets.
We propose a new Hessian contractive condition that is slighly stronger than convex, but with O (1) stability bound.
We provide empirical evidence to support the hypothesis that deep learning loss function is Hessian contractive near local minima.
A P ROOFS
Lemma 1 (Dynamics of divergence) .
Let f ( w ; x ) = 12 w (cid:62)
Aw − yx .
Suppose [ x i − x (cid:48) i ] / (cid:107) x
i − x (cid:48)
i (cid:107) is an eigenvector of A where A [ x i − x (cid:48)
i ]
= λ xx (cid:48)
[ x i − x (cid:48) i ] .
Let ∆ t be w t − w (cid:48) t , α t ≤ λ xx (cid:48) be the step size of SGD and ∆
= 0 .
Suppose one runs SGD on f ( w, S ) and f ( w, S (cid:48) ) where S, S (cid:48) are twin datasets and x (cid:48)(cid:62)
i x j = 0 , x (cid:62) i x j = 0 , ∀ j (cid:54)
=
i , the dynamics of ∆ t are given by:
[Equation]
Proof : In case the different entry z i ,
z
i is not picked, the gradient difference of f ( w ; z ) and f ( w ; z (cid:48) ) is
[Equation]
and in case different entry z i , z i is picked,
[Equation]
Since ∆ 0 = 0 , one can inductively show ∆ t = θ t [ x i − x (cid:48)
i ] where θ t > 0 .
Since SGD selects z t = z (cid:48) t with probability 1 − 1 n and a different entry with probability 1 n we have the following dynamic:
[Equation]
t ] with prob.
1 − 1 n ( I
[Equation]
t A
[Equation]
[ w t
[Equation]
w (cid:48)
[Equation] [Equation]
t [ x i
[Equation]
x (cid:48)
i ] with prob 1 /n.
E (cid:107) ∆ t
[Equation] [Equation]
=
E [ (cid:107) ∆ t +1 (cid:107)| Index i is not selected ] P [ Index i is not selected ]
[Equation] [Equation]
Index i is selected ]
[Equation] [Equation]
i is selected ]
[Equation]
Lemma 2 (Lower bound on divergence) .
Let ∆ t be w t − w (cid:48) t , α t be the step size of SGD and ∆
= 0 .
Suppose [ x i − x (cid:48) i ] / (cid:107) x
i − x (cid:48)
i (cid:107) is an eigenvector of A where A [ x i − x (cid:48)
i ]
= λ xx (cid:48)
[ x i − x (cid:48) i ] .
Running
SGD on f ( w, S ) , we have:
[Equation]
Proof : By Lemma 1 we have
[Equation]
Theorem 1.
Let w t , w (cid:48) t be the outputs of SGD on twin datasets S, S (cid:48) respectively, ∆ t be w t − w (cid:48) t
and α t be the step size of SGD.
There exists a function f which is convex and β -smooth, L -Lipschitz on domain of w t , w (cid:
) t and twin datasets S, S (cid:48)
such that the divergence of the two SGD outputs satisﬁes:
[Equation]
Proof We set x i = v, y i = 0 .
5 , x (cid:48)
i = − v, y (cid:48)
i = 0 .
The proof is constructive.
Let f ( w, z ) =
12 w (cid:62)
Aw − yx .
The function is β smooth and convex by setting β = (cid:107) A (cid:107) and u (cid:62) Au ≥ 0 for all u .
We set S \ { z i } = S (cid:48) \ { z (cid:48) i } to lie in the range of A , where A is a PSD matrix which is not full-rank.
We further set x i , x (cid:48)
i to lie in the null space of A
so that Av = 0 .
The lower bound (cid:107) ∆ (cid:107) T follows from Lemma 2 from the fact that ∆ 0 = 0 .
Since w (cid:62) Aw = w (cid:48)(cid:62)
Aw (cid:48) , ε stab = sup
z E | f (
[Equation]
T , z
[Equation]
The last part we show for any sequence w t generated from stochastic gradient descent step using data set S will have a constant gradient thus the Lipshitzness will follow.
Let U be the range of
A (so any u ∈ U satisfy u
A u > 0 .
Pick γ so that u (cid:62)
Au ≥ γ > 0 holds for all u ∈ U .
For all u , (cid:107) w (cid:62)
[Equation]
+1 u (cid:107) ≤ (cid:107) ( I − α t A )
w (cid:62) t u + αz (cid:62) u (cid:107) ≤ (1 − α t γ ) (cid:107) w (cid:62) t u (cid:107) + α .
This implies (cid:107) w (cid:62) t u (cid:107) ≤ 1 γ .
Now we bound gradient (cid:107)∇ f w ( w t , z ) (cid:107) =
(cid:107)
Aw t − x (cid:107) ≤ | v (cid:62)
Aw | + | v (cid:62) yx | + | u (cid:62)
Aw | + | u (cid:62) yx | ≤ 1+ βγ .
This implies that the function is L -Lipschitz with L = 1 + βγ .
By setting β = 2 γ the proof follows.
Theorem 2.
Suppose loss function f ( w, z ) of the form f ( w, S )
=
1 n (cid:80) nj =1 f y j ( w (cid:62) x j ) and f y ( w (cid:62) x ) satisﬁes (1) | f (cid:48)
y ( · ) | ≤ L , (2) 0 <
γ ≤ f (cid:48)(cid:48) y ( · ) ≤ β , (3) (cid:107) x (cid:107) ≤ R and (4) , S (cid:48) are ξ -self correlated.
Let w t , w (cid:48) t be the outputs of SGD on twin datasets S, S (cid:48) , ∆ t := w t − w (cid:48) t and α ≤ 1 β is the step size of SGD.
Then,
[Equation]
Proof : For simplicity we omit the dependence of f on y j so that f y j ( w (cid:62) x j ) =
f ( w, z j ) .
Note that the gradient of the loss function is ∇ f y j ( w (cid:62) t x j ) =
f (cid:48)
y j ( w (cid:62) t x j ) x j and the Hessian is ∇ 2 f y j ( w (cid:62) t x j ) =
f
[Equation]
w
[Equation]
x j ) x
j x (cid:62) j .
The stochastic gradient step of f y j ( w (cid:62) t x j ) is
[Equation]
The dynamics of the divergence can be described as:
[Equation]
Note that [ f (cid:48)
y j y j
[Equation]
w
[Equation]
t
[Equation]
j ) − f
[Equation]
j ( w (cid:48)(cid:62) t x j )]
x j can be rewritten as f (cid:48)(cid:48)
y j ( w θ j t (cid:62) x
j
[Equation]
x j x (cid:62) j ∆ t where w θ j = (1 − θ j ) w t + θ j w (cid:48) t , 0 < θ j < 1 .
Similarly we can also rewrite f (cid:48)
[Equation]
i
[Equation]
−
[Equation]
(cid:48)
i ( w (cid:48)(cid:62)
[Equation]
x
[Equation]
i
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
Thus equation equation 8 can be written as
[Equation]
By the ξ -self correlated assumption and letting H = 1 n (cid:80)
[Equation]
j and H (cid:48)
= 1 n (cid:80) x j ∈ S (cid:48)
x j x (cid:62) j , we have:
[Equation]
The ﬁrst inequality follows from the fact that f (cid:48)(cid:48) ( · ) ≥ γ and x j x (cid:62) j s are all PSD.
The second inequality follows from the fact that ∆ t ∈ Span { x 1 , .., x n } .
Fix α t = α and the theorem follows.
Lemma 3.
Suppose x t 0 = 0 , x t +1 =
(1 + a 0 .
99 t ) x t + yt , we have x T ≥ y
( Tt 0 )
a if a > 0 is a sufﬁciently small constant.
Proof :
In the proof we use following inequality:
[Equation]
where a > 0 is a sufﬁciently small constant.
[Equation]
Lemma 4.
Let w t , w (cid:48) t be the outputs of SGD on twin datasets S, S (cid:48) , and ∆ t :=
w t − w (cid:48) t .
There exists a function f which is non-convex and β -smooth, twin datasets S, S (cid:48) and constants a such that the divergence of SGD using step size α t [Equation]
[Equation]
Proof : For simplicity we set x i = v, y i = 0 .
5 , x (cid:48)
i = − v, y (cid:48)
i = 0 .
We set S/x i and S/x (cid:48)
i to lie in the range of A .
x (cid:62)
j Ax j > 0 .
And we set v (cid:62) Av = − β .
We set α = a/ (0 . 99 γ ) where a is a sufﬁciently small constant. [Equation] with prob. [Equation]
[Equation] with prob [Equation] Since w t − w (cid:48) t = vθ t , the construction yields:
[Equation]
The theorem follows from Lemma 3.
Theorem 3.
Let w t , w (cid:48) t be the outputs of SGD on twin datasets S, S (cid:48) , and ∆ t :
=
w t − w (cid:48) t .
There exists a function f which is non-convex and β -smooth, twin datasets S, S (cid:48) and constants a such that the divergence of SGD after T rounds ( T > n ) using constant step size α t =
[Equation]
satisﬁes:
[Equation] [Equation]
Proof : The proof is based on Theorem 4 plus the idea of a “burn-in” period.
We have:
[Equation]
Lemma 5.
(Hardt et al., 2016)
Assume f is β -smooth and L -lipschitz.
Let w t , w (cid:48) t be outputs of
SGD on twin datasets S, S (cid:48) respectively after t iterations and let ∆ t :=
[ w t − w (cid:48) t ] and δ t = E (cid:107) ∆ t (cid:107) .
Running SGD on f ( w ; S ) with step size α t = aβt satisﬁes the following conditions:
• The SGD update rule is a (1 + α t β ) -expander and 2 α t L -bounded.
• E [ (cid:107) ∆ t (
cid:107)| ∆ t − 1 ] ≤ (1 + α t δ ) (cid:107) ∆ t − 1 (cid:107) + [-
-]2 α t Ln .
• E [ (cid:107) ∆ T (cid:107)| ∆ t k = 0] ≤ (cid:0) T t k − 1 (cid:1) a {+
+}
Ln .
Theorem 4 ( Permutation) .
Assume f is β -smooth and L -lipschitz.
Running T ( T > n ) iterations of
SGD on f ( w ; S ) with step size α t = aβt , the stability of SGD satisﬁes:
[Equation]
Proof.
Let H =
t represents the event that the ﬁrst time the SGD pick the different entry is at time t :
[Equation]
The inequality ( ∗ ) derived by applying Lemma 5.
Lemma 6.
Let w t , w (cid:48) t be outputs of SGD on twin datasets S, S (cid:48) respectively after t iterations and let ∆ t :
= w t − w (cid:48) t .
Suppose that t k = ct k − 1 .
Then the following conditions hold:
• P [∆ t k − 1 =
| ∆ t k (cid:54) = 0] ≤ n n + t k − 1 .
• P [∆ t k − 1 (cid:54) =
| ∆ t k (cid:54) = 0] ≤ 1 c (cid:0) 1 + t k n (cid:1) .
• E [ (cid:107) ∆ T (cid:107)| ∆ t k (cid:54) = 0] ≤ E
[ (cid:107) ∆ T (cid:107)| ∆ t k − 1 (cid:54) = 0] 1 c (cid:0) 1 + t k n (cid:1) + (cid:0) T t k − 1 (cid:1) a 2 Ln .
Proof.
In the proof we will use the following inequality with r ≥ 1 :
[Equation]
i):
[Equation]
[Equation]
By applying i) and ii) in the decomposition of E [∆ T | ∆ t k (cid:54) = 0] we have
[Equation]
where the last inequality uses the fact that E [ (cid:107) ∆ T (cid:107)|
[Equation]
t k
[Equation]
Theorem4b (Uniformly Independent) Assume f is β -smooth and L -lipschitz.
Running T ( T > n ) iterations of SGD on f ( w ; S ) with step size α t = a βt , the stability of SGD satisﬁes:
[Equation]
Proof.
We ﬁrst decompose ∆ T as follows by selecting t k = n :
[Equation]
Term 1 is easily bounded by applying Lemma 5 with α t =
atβ .
To bound Term 2, plug in
P [∆ t k (cid:54) = 0]
= 1 − (1 − 1 /n )
t k ≤ t k n and recursively apply point (iii) from Lemma 6 by setting t i +
= ct i .
We get:
[Equation]
In the second and third inequality we use the fact that 1 + x ≤ exp( x ) and t i +
= ct i to get (cid:81) k − 1 τ
= i +1 (1 + t τ +1 n ) ≤ exp ( (cid:80) k − 1 τ
= i +1 t τ +1 n ) ≤ exp (cid:16)
c c − 1 (cid:17) .
The last inequality is derived by picking c = 4 .
Theorem 5.
Let w t , w (cid:48) t be the outputs of SGD on twin datasets S, S (cid:48) , and let ∆ t :
=
w t − w (cid:48) t .
There exists a function f which is non-convex and β -smooth, twin sets S, S (cid:48) and constants a, γ such that the divergence of SGD after T rounds ( T > n ) using constant step size α =
[Equation]
satisﬁes:
[Equation] [Equation]
Proof : The proof is similar to Theorem 3.
Since ∆ t ∈ Span { x i − x (cid:48) i } , we have:
[Equation]
Suppose t 0 is the hitting time when (cid:107) ∆ t 0 (cid:107) > 0 and (cid:107) ∆ t 0 − 1 (cid:107) = 0 , (cid:107) ∆ T (cid:107) ≥ (cid:107) x
i − x (cid:48)
i (cid:107) 3 n
[Equation] [Equation]
Theorem 6.
Given a set S and a β -smooth and L -Lipschitz loss funtion f , suppose SGD with a ﬁxed step size α ≤ σ 2 2 γL 2 reaches point w 0 which is close to a local minimum w ∗ in a ( σ, γ )
-Hessian
contractive region: (cid:107) w 0 − w ∗ (cid:107) ≤
σ
with large enough radius so that σ > 12 Lγ , then we have ∀ T ≥ 1 , (cid:107) w
T − w ∗ (cid:107) ≤ σ
Proof : Let H w t ,w
[Equation]
=
[Equation] [Equation]
j ) We derive that:
[Equation] [Equation]
Due to the fact that w t − w 0 ∈ Span {∇ w f ( w
[Equation]
z )
[Equation] [Equation]
∇ w f ( w t −
[Equation]
z ) }
[Equation]
we have
[Equation] [Equation]
This implies (cid:107) w t − w 0 (cid:107) ≤ σ for all t .
B E MPIRICAL S UPPORT FOR T HEOREM
In order to empirically support Theorem 6, we ran the follow experiment: We started with a fullytrained model w ∗ , and generated random perturbations ˜ w = w ∗
+ ν where ν ∼ N (0 , σ 2 ) .
We then trained each ˜ w until convergence ˜ w ∗ , and computed the normalized distance (cid:107) ˜ w ∗ − w ∗ (cid:107) / (cid:107) w ∗ (cid:107) .
To match Theorem 6, this distance should be no more than 2 (cid:107) ˜
w ∗ − w ∗ (cid:107) / (cid:107) w ∗ (cid:107) , i.e., the trained weights ˜ w ∗ after perturbing stay close to w ∗ , as in the conclusion of Theorem 6.
For the above experiment, we ﬁrst trained both ResNet18 and Densenet121 for 200 epochs, with constant learning rate of 0.01, a momentum of 0.9, and batch size of 128.
We generated 20 Gaussian perturbations ˜ w of the trained model weights w ∗ and trained each for 50 more epochs, resulting in weights ˜ w ∗ .
We used standard deviation σ ∈ { 0 . 01 , 0 . 005 } for the Gaussian perturbations.
We then computed the normalized differences as explained in the previous paragraph.
The results are shown in
Table 2.
Inspecting the table shows that the distances between the trained weights after perturbing are quite close to the distances before further training, with low variance.
This indicates that the weights after training the perturbed model are well within the desired range as speciﬁed in Theorem 6.
[Equation]
ResNet
[Equation] [Equation]
[Equation] [Equation]
σ = 0 .0.274 ±
[Table]