Reevaluating Theoretical Analysis Methods for Optimization in Deep Learning

## Abstract

Abstract There is a significant gap between our theoretical understanding of optimization algorithms used in deep learning and their practical performance. Theoretical development usually focuses on proving convergence guarantees under a variety of different assumptions, which are themselves often chosen based on a rough combination of intuitive match to practice and analytical convenience. The theory/practice gap may then arise because of the failure to prove a theorem under such assumptions, or because the assumptions do not reflect reality. In this paper, we carefully measure the degree to which these assumptions are capable of explaining modern optimization algorithms by developing new empirical metrics that closely track the key quantities that must be controlled in theoretical analysis. All of our tested assumptions (including typical modern assumptions based on bounds on the Hessian) fail to reliably capture optimization performance. This highlights a need for new empirical verification of analytical assumptions used in theoretical analysis.

## 1 Introduction

In optimization theory, algorithmic development and analysis requires a set of assumptions about the functions we aim to optimize. These assumptions fundamentally influence the behavior of optimization algorithms and their efficacy in practice. For example, Adagrad (Duchi et al., ; McMahan and Streeter, ) (which later inspired Adam (Kingma and Ba, )) classically relies on the convexity assumption to provide a theoretical convergence guarantee.
When the loss is non-convex, a variety of alternate assumptions are deployed, such as smoothness (e.g. a bounded Hessian) (Ghadimi and Lan, ; Carmon et al., ; Li and Orabona, ; Ward et al., ; Wang et al., ) or “weak convexity” (Davis and Drusvyatskiy, ; Mai and Johansson, ; Liu et al., ).
If these conditions are not met, the convergence analyses of these algorithms no longer hold.

In this paper, we systematically verify these assumptions and related optimization analyses across various deep learning tasks using simple, computationally feasible methods. We hope that our findings will serve as a guideline for future research, helping to develop theoretical frameworks that are both robust and practically applicable.

Importantly, we do not want to just ask “do current assumptions apply to deep neural networks”. Instead, we wish to ask whether the *analyses* based on currently prevalent techniques can predict current practical performance. This is a subtly different question: it turns out that most modern analyses actually rely on a few key identities. These identities are usually *empirically measurable* from the iterates of an optimizer. In theoretical analysis, these identities are controlled via various global assumptions (such as convexity or smoothness), but we instead measure directly these identities. This has a significant advantage: not only can it falsify the global assumptions, it can tell if any *different* assumptions can be made that would “rescue” the analysis.

We propose simple, on-the-fly measures that capture how well modern analyses describe practice. We measure these on a wide range of tasks, including basic convex optimization problems, image classification tasks using deep residual networks, and pre-training large language models (LLMs). Overall, our results suggest that most analytical techniques do *not* describe practical performance.

Our work fits into a recent trend of challenging and moving past classical optimization assumptions Simsekli et al. (); Zhang et al. (, ); Davis et al. (, ). However, our focus is not on algorithm development. Instead, we simply want to promote empirical verification of optimization analysis.

Of independent interest, we develop a new smoothness measure closely approximates the sharpness measure. This is an exciting finding, as our
measure is computationally feasible even for very deep networks, where computing sharpness is computationally infeasible. This allows for the use of our smoothness measure in studying flat/sharp minima and their implications for generalization. Finally, we offer alternative theoretical analyses for cases where common theoretical assumptions do not hold.

Overall, we feel that our findings motivate two actions in the research community: first, it is important to develop new assumptions and analytical techniques to understand modern optimization. Second, we advocate for verifying any new assumptions by carefully measuring quantities that *actually appear in the optimization analysis* rather than attempting to verify global assumptions.

## 2 Background and Experiment Setup

In typical optimization analysis for machine learning, the goal is to minimize a loss function $F$ given by:

$$ $\displaystyle F(\mathbf{x})=\mathbb{E}_{z\sim P_{z}}[f(\mathbf{x},z)],$ $$

where $f(\mathbf{x},z):\mathbb{R}^{d}\times\mathcal{Z}\mapsto\mathbb{R}$ is a differentiable function of $\mathbf{x}\in\mathbb{R}^{d}$. $\mathbf{x}$ indicates the model parameters, $z\in\mathcal{Z}$ indicates an example data point or minibatch of examples, and $P_{z}$ is some data distribution. The goal of optimization is to minimize the function $F$, which represents minimizing either a train loss or a population loss depending on various details of the problem setup.

The most common paradigm in optimization analysis is the following three-step strategy: first, identify a "convergence criterion" of interest - for example the loss of some weights output by an algorithm minus the loss of the optimal weights. Second, identify an algebraic expression that can be related to this convergence criterion (often through use of some assumption on the loss landscape). Finally, establish that a given algorithm can guarantee a bound on this algebraic expression (often again using some assumption on the loss landscape):

$$ $\displaystyle\underbrace{\text{Convergence Criterion}}_{\text{e.g. }\frac{1}{T }\sum_{t=1}^{T}F(\mathbf{x}_{t})-F(\mathbf{x}_{\star})}\leq\underbrace{\text{ Algebraic Expression}}_{\text{e.g. }\frac{1}{T}\sum_{t=1}^{T}\langle\nabla F( \mathbf{x}_{t}),\mathbf{x}_{t}-\mathbf{x}_{\star}\rangle}\leq\underbrace{\text {Upper Bound}}_{\text{e.g. }O(1/\sqrt{T})}$ (1) $$

The example values for the three terms above are typical of analysis of SGD for convex objectives, in which $\mathbf{x}_{\star}=\mathop{\text{argmin}}F$, and the middle “algebraic expression” is often termed the *regret* (see Orabona (); Hazan () for details).

This paradigm is used in two different ways: first, from a *scientific* perspective, one can try to prove convergence properties for well-known algorithms such as AdamW in an attempt to explain why these algorithms work well in practice (see e.g. Li and Orabona (); Faw et al. (); Ward et al. (); Zaheer et al. (); Reddi et al. ()). Second, from an *engineering* perspective, one can try to design better optimizers from first principles. For this second use-case, the typical approach is to identify a large class algorithms, such as SGD parametrized by the learning rate, and then choose the member of this class that analytically minimizes the upper bound (see e.g. Duchi et al. (); McMahan and Streeter (); Hazan et al. (); Ghadimi and Lan ()). This exact approach is how the AdaGrad family of algorithms (which was the intellectual precursor to Adam) was developed.

In order for this paradigm to provide meaningful answers, we must believe that the inequalities in equation (1) hold at least approximately. We can investigate this from two angles: first, we can ask whether the original assumptions that motivated the analysis hold. Second, we can often *empirically measure* expressions related to those appearing in (1), and check the degree to which the desired inequalities hold. These are more likely to hold than the underlying assumptions, because the assumptions imply the inequalities, but the reverse may not be true.

Empirical verification of these inequalities is made especially attractive for two reasonns. First, many optimization analyses actually use only a few options for the “algebraic expression” in (1): the only thing that changes is the analysis of the algorithm leading to improved upper bounds. Thus, by empirically measuring the degree to which the *first* inequality in (1) holds, we can interrogate whether popular analyses strategies can explain optimization success in deep learning in way that is less tightly coupled to whether particular global assumptions hold or not.

Two very popular assumptions about the loss landscape and the optimization process are smoothness and convexity.
Formally, a differentiable function $f(\cdot,\cdot):\mathbb{R}^{d}\times\mathcal{Z}\mapsto\mathbb{R}$ is convex if it satisfies:

$$ $\displaystyle f(\mathbf{y},z)$ $\displaystyle\geq f(\mathbf{x},z)+\langle\nabla f(\mathbf{x},z),\mathbf{y}- \mathbf{x}\rangle\quad\forall\mathbf{x},\mathbf{y}\in\mathbb{R}^{d},z\in \mathcal{Z}$ $$

Further, $f(\cdot,\cdot)$ is $L-$smooth if it satisfies:

$$ $\displaystyle\|\nabla f(\mathbf{x},z)-\nabla f(\mathbf{y},z)\|$ $\displaystyle\leq L\|\mathbf{x}-\mathbf{y}\|\quad\forall\mathbf{x},\mathbf{y} \in\mathbb{R}^{d},z\in\mathcal{Z}$ $$

These are some of the most common assumptions in optimization theory (Zinkevich, ; Duchi et al., ; Ghadimi and Lan, ; Bubeck et al., ; Carmon et al., ; Zhao et al., ; Hu et al., ; Hazan, ; Cutkosky and Orabona, ). We would like to quantify them in our experiments. Since computing the global smoothness constant as well as the convexity of the true loss functions $F(\mathbf{x})$ is infeasible, we instead measure proxies that we call the instantaneous convexity gap, denoted by inst_gap, and instantaneous smoothness, denoted by inst_smooth, to estimate the levels of convexity and smoothness of the true loss function. Formally, the instantaneous convexity gap with respect to a reference point $\mathbf{y}_{t}$ of the function $f(\cdot,z_{t})$ (stochastic loss function computed at iteration $t$ using datapoint $z_{t}$) is defined as:

$$ $\displaystyle\textrm{inst_gap}_{t}(\mathbf{y}_{t})\coloneqq f(\mathbf{x}_{t}, z_{t})-f(\mathbf{y}_{t},z_{t})-\langle\nabla f(\mathbf{x}_{t},z_{t}),\mathbf{x }_{t}-\mathbf{y}_{t}\rangle$ (2) $$

In our measurements, we use two settings for $\mathbf{y}_{t}$. First, we consider $\mathbf{y}_{t}=\mathbf{x}_{t-1}$ to analyze the properties of consecutive points and their impact on the optimization path. Next, we use the constant value $\mathbf{y}_{t}=\mathbf{x}^{\star}$, where $\mathbf{x}^{\star}$ is the *final* iterate produced by a previous training run. This setting provides a more global view of the loss landscape. If $f$ is convex, $f(\mathbf{y}_{t},z_{t})\geq f(\mathbf{x}_{t},z_{t})+\langle\nabla f(\mathbf{x}
_{t},z_{t}),\mathbf{y}_{t}-\mathbf{x}_{t}\rangle$ and the convexity gap defined in Eq. 2 should be non-positive. We also compute the average convexity gap and the exponential moving average of the convexity gaps with respect to a sequence of reference points $\mathbf{y}_{1},\ldots,\mathbf{y}_{t}$ (denoted as $\mathbf{y}_{1:t}$ for short), respectively defined as

$$ $\displaystyle\textstyle\textrm{avg_gap}_{t}(\mathbf{y}_{1:t})=\frac{1}{t}\sum _{i=1}^{t}\textrm{inst_gap}_{i}(\mathbf{y}_{i}),$ $\displaystyle\textrm{exp_gap}_{t}(\mathbf{y}_{1:t})=\beta\cdot\textrm{exp_ gap}_{t-1}(\mathbf{y}_{1:t-1})+(1-\beta)\cdot\textrm{inst_gap}_{t}(\mathbf{y} _{t}).$ (3) $$

where $\beta\in(0,1)$ (we choose $\beta=0.99$ for our measurements).

Next, we define the instantaneous smoothness at iteration $t$ with respect to $\mathbf{y}_{t}$ as:

$$ $\displaystyle\textrm{inst_smooth}_{t}(\mathbf{y}_{t})=\frac{\|\nabla f( \mathbf{x}_{t},z_{t})-\nabla f(\mathbf{y}_{t},z_{t})\|}{\|\mathbf{x}_{t}- \mathbf{y}_{t}\|}$ (4) $$

If the loss function is $L$-smooth, then $\textrm{inst_smooth}_{t}\leq L$ for all $t\in[T]$. Thus, if this instantaneous smoothness quantity is uniformly bounded by a constant, it could indicate that our loss landscape is smooth. Similar to the convexity gap, we also keep track of other forms of the smoothness measure such as the maximum smoothness
and the exponential average smoothness, respectively defined as

$$ $\displaystyle\textrm{max_smooth}_{t}(\mathbf{y}_{1:t})=\max_{i\leq t}\textrm{ inst_smooth}_{i}(\mathbf{y}_{i}),$ $\displaystyle\textrm{exp_smooth}_{t}(\mathbf{y}_{1:t})=\beta\cdot\textrm{exp _smooth}_{t-1}(\mathbf{y}_{1:t-1})+(1-\beta)\cdot\textrm{inst_smooth}_{t}( \mathbf{y}_{t}).$ (5) $$

Our maximum smoothness is similar to the smoothness metric proposed in (Santurkar et al., ; Zhang et al., ). However, instead of tracking the largest smoothness value along the line of the update difference $\mathbf{x}_{t}-\mathbf{x}_{t-1}$, we keep track of the largest value across all iterations.

Most of our training runs involve multiple epochs. In this case, for the non-instantaneous metrics, we “reset” the averages at the start of each epoch so that the averages contain only iterates from the current epoch. The only exceptions are our pre-training tasks for BERT and GPT-2. Due to the large size of the datasets used in these tasks, we completed the training without traversing the entire dataset. Hence, we do not reset our metrics in these experiments. Beyond smoothness and convexity, we also track many other key properties.
We defer these results to the Appendix.
These metrics collectively offer deeper insights into the dynamic behavior of the loss function throughout the optimization process.

We conduct experiments across a diverse array of tasks, ranging from simple convex problems to complex NLP tasks involving models with hundreds of millions of parameters. For convex tasks, we run gradient descent on a synthetic dataset using squared loss and also perform logistic regression on various OpenML datasets (Aloi, Connect-4, Covertype, Poker). In the realm of non-convex tasks, we address both Image Classification and NLP benchmarks. For Image Classification tasks, we train popular benchmark datasets Cifar10 and Imagenet (Deng et al., ) on Resnet18 (He et al., ) using SGD with momentum (SGDM) and Adamw. we use the configurations reported in (Yao et al., ; Tran and Cutkosky, ). For NLP tasks, we pre-train Bert (Devlin et al., ) using the C4 dataset (Raffel et al., ) and GPT2 (Radford et al., ) using the Pile dataset (Gao et al., ). Both tasks are trained using SGDM and AdamW. The learning rates for each optimizer are fine-tuned through a grid search in the range $[10^{-6},0.1]$.

## 3 Measuring Convexity

Figure: Figure 1: Instantaneous convexity gap w.r.t. $\mathbf{y}_{t}=\mathbf{x}_{t-1}$ of Gradient Descent (GD) on the squared loss (left) and Logistic Regression on OpenML datasets (Vanschoren et al., ) (right).
Refer to caption: extracted/5703902/imgs/inst_gap_convex_new.png

Convexity is a fundamental assumption in optimization theory since convex functions have many pleasant theoretical guarantees. For instance, every local minimum of a convex function is also a global minimum, which allows us to derive bounds on the suboptimality gap (Bottou and Bousquet, ; Defazio et al., ; Cutkosky, ). Unfortunately, the landscape of deep learning training is known to be non-convex (Jain et al., ; Li et al., ; Garipov et al., ; Choromanska et al., ) due to the complex architectures of deep learning models and the nonlinearity of the activation functions. However, the degree of non-convexity in practical scenarios still remains a bit of a mystery. In this section, we aim to quantify the level of convexity across various machine learning tasks.
As a sanity check, we first examine the instantaneous convexity gaps with respect to the previous iterate in simple tasks for which the objective is indeed convex to verify that they align with our theoretical expectations. Results are presented in Fig.1.
As we can see from Fig.1, the convexity gap is always non-positive as expected. Now, let us turn our attention to more complex deep learning tasks.

### 3.1 Are Deep Learning Loss Landscapes locally convex?

In this section, we aim to examine the convexity of optimization paths taken by popular optimizers such as Adam and SGD. To achieve this, we compute both the average and the exponential average convexity gaps with respect to the previous iterates, i.e., $\mathbf{y}_{t}=\mathbf{x}_{t-1}$, across various deep learning benchmarks. Setting $\mathbf{y}_{t}=\mathbf{x}_{t-1}$, allows us to measure convexity on a “small scale” along the optimization path, rather than as a global property. The presence of any positive gap would indicates non-convexity.

By measuring average gaps (both avg_gap and exp_gap), we
gain insight into whether the optimization path could be in some sense “mostly” convex - i.e. whether instantaneous non-convexity is essentially a “rare event”. Stochastic optimization analysis typically involves summing or averaging identities derived from convexity, and so one might hope that it is possible to exploit a non-positive average convexity gap.We also provide the instantaneous gap results in Section D in the Appendix.

Surprisingly, the convexity gap along the optimization trajectories of non-convex tasks is not consistently negative or positive, as demonstrated in Fig. 2. For instance, while the convexity gap remains uniformly positive (indicating non-convnexity) during the training of ImageNet on ResNet18, the optimization trajectory in the training of Bert frequently shifts between convex and non-convex regions. Notably, in experiments involving CIFAR-10 and GPT-2, the convexity gap consistently exhibits negative values. Similar phenomenon is also observed in (Xing et al., ), where they demonstrated that the loss interpolation $F(\alpha\mathbf{x}_{t}+(1-\alpha)\mathbf{x}_{t+1})$ of deep neural networks trained on CIFAR-10 by SGD is locally convex.

Negative convexity gaps in our experiments do not necessarily indicate convex loss landscapes (since we only check the convexity gap at the points along the optimization trajectory) but rather suggests that effective optimizers like SGD and ADAM can navigate these landscapes by finding paths that are in some sense “locally convex”. Further, as illustrated in Figure 2, the dataset plays a significant role in shaping the loss landscape. Despite using the same optimizer settings and the ResNet-18 architecture, the loss landscapes for the ImageNet and CIFAR-10 datasets show markedly different levels of convexity. Fig. 2 also shows that the average convexity gap across most experiments (except for Imagenet) indicates convex behavior along the optimization path.

Figure: Figure 2: Average convexity gap and exponential average convexity gap w.r.t. $\mathbf{y}_{t}=\mathbf{x}_{t-1}$ of deep learning benchmarks. In most cases, the gaps are negative, indicating local convexity along training.
Refer to caption: extracted/5703902/imgs/convex_gap_new.png

### 3.2 Can Convexity-based Analysis Explain Optimization Success?

Though the results in Section 3.1 suggest local convexity along the optimization path does often occur, we might care more about global convexity, as this is useful to prove global convergence guarantees. Moreover, while the convexity gap can be used to falsify convexity or give intuition about the local properties of the loss landscape, this quantity does not appear in an obvious way in most optimization analyses. So, in this section, we measure a different quantity which we call the convexity ratio, which allows us to more directly probe the degree to which analyses based on convexity apply to real problems.

$$ $\displaystyle\textrm{convexity_ratio}_{T}=\frac{\sum_{t=1}^{T}\langle\nabla F (\mathbf{x}_{t}),\mathbf{x}_{t}-\mathbf{x}^{\star}\rangle}{\sum_{t=1}^{T}F( \mathbf{x}_{t})-F(\mathbf{x}^{\star})}$ (6) $$

Here we use a large batch loss to approximate $F$ in cases where it is computationally infeasible (more details on this computation are in the Appendix). $\mathbf{x}^{\star}$ is an approximate stationary point given by the output of a previous training run. When $F$ is convex, we should expect the convexity ratio to be larger than 1 so that we have the following important inequality:

$$ $\displaystyle\textstyle\sum_{t=1}^{T}F(\mathbf{x}_{t})-F(\mathbf{x}^{\star}) \leq\sum_{t=1}^{T}\langle\nabla F(\mathbf{x}_{t}),\mathbf{x}_{t}-\mathbf{x}^{ \star}\rangle$ (7) $$

Equation 7 is the essential ingredient in many optimization analyses based on convexity.
In fact, many analyses of SGD and related methods actually prove convergence by upper-bounding bounding the RHS of the above equation - it is the standard instantiation of Eq. 1 for convex analysis (Duchi et al., ; McMahan and Streeter, ; Zinkevich, ; Reddi et al., ; Hazan et al., , ). For example, a typical analysis of SGD (e.g. (Zinkevich, )) would show that:

$$ $\displaystyle\mathop{\mathbb{E}}\left[\sum_{t=1}^{T}\langle\nabla F(\mathbf{x} _{t}),\mathbf{x}_{t}-\mathbf{x}^{\star}\rangle\right]\leq O(\sqrt{T})$ $$

from which one can then conclude that $\frac{1}{T}\sum_{t=1}^{T}F(\mathbf{x}_{t})-F(\mathbf{x}^{\star})\leq O(1/\sqrt
{T})$: that is, the loss values of the iterates are “on average” approaching the loss of $F(x_{\star})$. This holds for all possible values of $x_{\star}$, even though we will only evaluate it for one particular point.

As a result, even if our function does not satisfy Eq. 7, it is still possible to derive global convergence. Assume that the convexity ratio is larger than $K$ for $0<K<1$ instead (this condition would be implied by “weak quasi-convexity” studied by Orabona and Tommasi ()). Then we still have:

$$ $\displaystyle\textstyle\sum_{t=1}^{T}F(\mathbf{x}_{t})-F(\mathbf{x}^{\star}) \leq\sum_{t=1}^{T}\frac{1}{K}\langle\nabla F(\mathbf{x}_{t}),\mathbf{x}_{t}- \mathbf{x}^{\star}\rangle$ $$

Since our actual *analysis* typically bounds the RHS of this equation, our convergence bound only gets worse by a factor of $1/K$. Thus, as long as $K\geq\Omega(1/\sqrt{T})$, popular algorithms such as SGD would still guarantee global convergence. Interestingly, our experiments for CIFAR-10 and Bert illustrated Figure 3 suggest that this property may in fact hold for some deep learning tasks. That is even though our data suggest that CIFAR-10 and Bert losses are *not* globally convex, nevertheless the *analysis* that is typically used in tandem with convexity assumptions may still be able to explain optimization success on these tasks.

Figure: Figure 3: Convexity ratios of deep learning benchmarks. A convexity ratio greater than 1 indicates a convex function. Ratios between 0 and 1 suggest slight non-convexity, still permitting the application of classic convex optimization arguments. Ratios less than 0 denote strong non-convexity.
Refer to caption: extracted/5703902/imgs/ratio.png

For the Cifar10 experiments, the convexity ratio indicated by AdamW suggests that the optimization trajectory remains globally convex relative to the stationary point. Although SGDM initially exhibits slight non-convexity, the convexity ratio consistently exceeds 0.5, allowing for the application of classical convex analysis arguments.
The Bert experiments show convexity ratios below 1 for both AdamW and SGDM, indicating a globally non-convex optimization trajectory. Nevertheless, since the convexity ratios are greater than 0.1, the classical arguments of convex analysis remain applicable (albeit with a 10x degradation in the convergence bounds).

Unfortunately, since the convexity ratios of both optimizers are negative in the GPT2 experiments, the convex analysis argument seems to be invalid. A similar lack of convexity is observed in the ImageNet experiments. Interestingly, AdamW seems to oftenfind a "more convex" optimization path compared to SGDM. Nevertheless, these data suggest that significant alterations to classical analysis based on convexity would be needed to adequately explain optimization success for deep learning in general.

## 4 Measuring Smoothness

Smoothness assumptions plays a pivotal role in optimization theory. In convex optimization, smoothness can help accelerate the training process and achieve superlinear convergence rate if the loss is strictly convex or strongly convex (Nesterov et al., ). In non-convex optimization, smoothness is the key ingredient that makes many convergence analyses possible (Ghadimi and Lan, ; Allen-Zhu and Hazan, ; Jain et al., ; Reddi et al., ). Although smoothness is assumed for the majority of non-convex optimization results, it is unclear how well these smoothness conditions are satisfied in practice.

In fact, from a purely theoretical point of view, it may seem unlikely that the objective could be truly smooth: common activation functions such as the ReLU, and common layers such as MaxPools are not globally differentiable and so cannot possibly be smooth. However, one might hope that such issues are essentially pathological problems that do not effect practice. In this section, we attempt to measure smoothness along the real optimization trajectory in an efficient way analogous to our investigation of convexity in Section 3.

We will focus on the exponential average smoothness and the max smoothness defined in Eq. 5 since they provide insights into the smoothness level of local and global loss landscape respectively.

Figure: Figure 4: Smoothness measures w.r.t. $\mathbf{y}_{t}=\mathbf{x}_{t-1}$ of deep learning benchmarks using the optimal configurations. (Top) are the experiments with optimal learning rate scheduler, and (bottom) are the experiments with constant learning rate. Details of experiment setup can be found in Appendix B.
Refer to caption: extracted/5703902/imgs/smooth_new.png

First, we compute these measures using the optimally tuned learning rate and schedule in each deep learning experiment.
As we can see from Fig. 4 (top), in all experiments, the smoothness constants appear to be upper-bounded. However, in many cases these constants are quite large ($10^{3}$ to $10^{6}$), making it hard to consider the loss landscapes in these experiments to be smooth in practice.
Furthermore, we note that smoothness correlates with changes in the learning rate scheduler. For example, as the learning rate approaches zero at the end of training, the smoothness value increases, as observed in Cifar10 with cosine decay and BERT with linear decay. Similarly, for Imagenet, where we used a piecewise linear scheduler, smoothness increases whenever the learning rate decreases. This observation suggests that smaller learning rates tend to result in larger smoothness values.

To gain a better understanding of the loss landscapes, we decided to rerun all the experiments with a constant learning rate (Fig. 4 bottom).
With constant learning rates, the loss landscape appears much smoother and more stable. Both the max smoothness and the exponential average smoothness exhibit similar behavior in most experiments: a rapid drop at the beginning in the region of fast progress (except for SGDM on Imagenet), followed by a consistent increase until reaching a boundary, and then stabilizing around that boundary. We will discuss the stabilizing phenomenon in more details in the next section. Interestingly, Adam tends to obtain a smaller (i.e. more smooth) smoothness measure compared to SGD when using a learning rate scheduler, whereas SGD is more likely to find a smaller measure with a constant learning rate. We conjecture that this phenomenon indicates that SGD’s optimization path is more sensitive to changes in the learning rate, while Adam remains robust across different learning rate settings.

### 4.1 Smoothness measures as proxies for sharpness

As shown in Fig. 4, the smoothness measured in most experiments exhibit similar behaviors. This pattern closely resembles the edge-of-stability phenomenon observed by (Cohen et al., , ) in full-batch SGD and full-batch Adam for smaller tasks. Specifically, Cohen et al. () defines the “sharpness” as the operator norm of the Hessian $\nabla^{2}F(\mathbf{x}_{t})$. They observe that when training with full-batch gradient descent on CIFAR-10, the sharpness increases until it reaches a value inversely proportional to the learning rate, and then stabilizes.

Our measurements track different quantities than the sharpness, but are faster to compute. Thus, these observations pose an interesting question: Can our new metrics, max_smooth and exp_smooth, be used as proxies for the sharpness? If this is true, our approach could substantially expedite the evaluation of sharpness. Our method also makes evaluating the sharpness of much larger models possible (for which computing Hessian information is prohibitively expensive).

As discussed above, we notice that a smaller learning rate results in a larger smoothness value. We can potentially explain this using the edge-of-stability phenomenon. (Cohen et al., , ) observe that the sharpness is oscillating at the value $c/\eta$ for some constant $c>0$ and $\eta$ is the learning rate at the edge of stability. Thus, when the learning rate scheduler is applied, any time the learning drops, this boundary increases and causes the smoothness/sharpness level to increase. This phenomenon is also observed in (Cohen et al., ). To verify our conjecture, we replicate the experiments in (Cohen et al., ) where we train Cifar10 on a simple linear network with tanh activation and on a VGG-11 network (Simonyan and Zisserman, ) in Fig.5.

Figure: Figure 5: Sharpness (maximum eigenvalue of the training loss Hessian Matrix) v.s. Smoothness.
Refer to caption: extracted/5703902/imgs/sharp_convex_new.png

Our new smooth metrics track the actual sharpness value very closely (Fig.5). One possible justification for this is when we measure $\frac{\|\nabla f(\mathbf{x}_{t},z)-\nabla f(\mathbf{x}_{t-1},z)\|}{\|\mathbf{x
}_{t}-\mathbf{x}_{t-1}\|}$, we are effectively estimating how quickly the gradient of the function changes, which is bounded by the Hessian’s spectral norm in smooth functions. A higher value indicates a steeper change in the gradient, implying a larger maximum eigenvalue of the Hessian matrix, hence a higher "sharpness". Thus, this metric and the sharpness are inherently related to characterizing the function’s smoothness and curvature.

### 4.2 Can Smoothness-based Analysis Explain Optimization Success?

Figure: Figure 6: Update correlation of GD on the squared loss (left) and logistic regression on OpenML datasets (right). The blurred lines are the actual update correlations, and the thick lines are the average update correlations.
Refer to caption: extracted/5703902/imgs/update_corr_convex_new.png

Our smoothness measurements above are not actually the best criterion for judging the applicability of smooth non-convex optimization analysis. This is because they only capture gradient behavior rather than linking gradient dynamics to function values. In typical smoothness-based analysis, one encounters the quantity $\langle\nabla f(\mathbf{x}_{t+1},z_{t+1}),\mathbf{x}_{t+1}-\mathbf{x}_{t}\rangle$. In almost all analyses of non-convex optimization algorithms, this quantity usually plays the role of the “algebraic expression” in (1) (Khaled and Richtárik, ; Li et al., ; Zaheer et al., ; Carmon et al., ; Li and Orabona, ; Faw et al., ; Reddi et al., ). To illustrate, consider an optimizer with update $\mathbf{x}_{t+1}=\mathbf{x}_{t}+\eta\Delta_{t}$, and assume that $F$ is $L$-smooth, $\mathop{\mathbb{E}}[\Delta_{t}]=-\eta\nabla F(\mathbf{x}_{t})$ and $\\
E[\|\Delta_{t}\|^{2}]\leq\eta^{2}G^{2}$. Then:

$$ $\displaystyle\mathop{\mathbb{E}}[F(\mathbf{x}_{t+1})-F(\mathbf{x}_{t})]$ $\displaystyle\textstyle\leq\mathop{\mathbb{E}}[\langle\nabla F(\mathbf{x}_{t}) ,\mathbf{x}_{t+1}-\mathbf{x}_{t}\rangle+\frac{L}{2}\|\mathbf{x}_{t+1}-\mathbf{ x}_{t}\|^{2}]$ $\displaystyle\textstyle\leq-\eta\mathop{\mathbb{E}}\left[\|\nabla F(\mathbf{x} _{t})\|^{2}\right]+\frac{L\eta^{2}G^{2}}{2}.$ (8) $$

Typical analyses show that $-\eta\mathop{\mathbb{E}}[\|\nabla F(\mathbf{x}_{t})\|^{2}]$ dominates $\frac{L\eta^{2}G^{2}}{2}$ so that the objective $F(\mathbf{x}_{t})$ decreases over time. Intuitively, this holds if we make $\eta$ sufficiently small because the negative term is linear in $\eta$ while the positive term is quadratic in $\eta$. Note that this high-level idea is used even for analyses based on less classical smoothness assumptions such as (L0,L1) smoothness (Zhang et al., ).

To check whether this analysis technique can explain the success of practical optimizers, we would like to measure the inner-product $\langle\nabla F(\mathbf{x}_{t}),\mathbf{x}_{t+1}-\mathbf{x}_{t}\rangle$ and see if it is negative. This would directly capture the optimization analysis because in the typical analysis, all of the provable decrease in the function value is caused negative inner-products.

Unfortunately, this inner-product is difficult to estimate empirically because we do not know $\nabla F(\mathbf{x}_{t})$. One might consider instead estimating it using $\langle\nabla f(\mathbf{x}_{t},z_{t}),\mathbf{x}_{t+1}-\mathbf{x}_{t}\rangle$. However, this approach is flawed because $\mathbf{x}_{t+1}-\mathbf{x}_{t}$ is not independent of $z_{t}$, giving the correlation a negative bias. Instead, we measure a quantity that we call the update correlation, which is defined as

$$ $\textrm{update_corr}_{t}\coloneqq\langle\nabla f(\mathbf{x}_{t+1},z_{t+1}), \mathbf{x}_{t+1}-\mathbf{x}_{t}\rangle.$ (9) $$

Since $\mathbf{x}_{t+1}-\mathbf{x}_{t}$ is independent of $z_{t+1}$, the update correlation is an unbiased estimator of $\langle\nabla F(\mathbf{x}_{t+1}),\mathbf{x}_{t+1}-\mathbf{x}_{t}\rangle$. Moreover, it turns out that update correlation still captures the same notion of “function” progress measured by typical analysis. Here’s a brief reasoning. Consider the update $\mathbf{x}_{t+1}=\mathbf{x}_{t}+\Delta_{t}$ and assume $F$ is $L$-smooth (but this time we don’t make assumptions on $\Delta_{t}$). By smoothness,

$$ $\displaystyle F(\mathbf{x}_{t+1})-F(\mathbf{x}_{t})$ $\displaystyle\textstyle\geq\langle\nabla F(\mathbf{x}_{t+1}),\mathbf{x}_{t+1}- \mathbf{x}_{t}\rangle-\frac{L}{2}\|\mathbf{x}_{t+1}-\mathbf{x}_{t}\|^{2}$ (10) $\displaystyle F(\mathbf{x}_{t+1})-F(\mathbf{x}_{t})$ $\displaystyle\textstyle\leq\langle\nabla F(\mathbf{x}_{t+1}),\mathbf{x}_{t+1}- \mathbf{x}_{t}\rangle+\frac{L}{2}\|\mathbf{x}_{t+1}-\mathbf{x}_{t}\|^{2}$ (11) $$

Consequently, if $\langle\nabla F(\mathbf{x}_{t+1}),\mathbf{x}_{t+1}-\mathbf{x}_{t}\rangle$ is negative, for small enough learning rates $\eta$ the global loss decreases and the optimizer is consistently making progress. On the other hand, a positive update correlation $\langle\nabla F(\mathbf{x}_{t+1}),\mathbf{x}_{t+1}-\mathbf{x}_{t}\rangle$ appears to be disastrous since this analysis would suggest that the loss should increase. In particular, we are not aware of any analysis based upon negative values of $\langle\nabla F(\mathbf{x}_{t}),\mathbf{x}_{t+1}-\mathbf{x}_{t}\rangle$ that does not also predict negative values for the update correlation.
Therefore, if the standard analysis of smooth non-convex optimization can explain optimization success in deep learning, then in every experiment we should expect that the update correlation $\langle\nabla f(\mathbf{x}_{t+1},z_{t+1}),\mathbf{x}_{t+1}-\mathbf{x}_{t}\rangle$ should be negative on average.

First, we check if this is the case for simple convex experiments (Fig. 6). In all of these experiments, the update correlations are negative on average, which agrees with our intuition that a negative update correlation indicates progress in the training.

However, surprisingly, the update correlation is positive on average in almost every other Deep Learning experiment (Fig. 7) that we run. This is a fascinating phenomenon because it indicates that the optimizer changes direction very often, and
yet it still effectively minimizes the loss. This suggests that the classic smooth non-convex analysis that relies on the descent lemma is problematic in practice. The only experiment that we notice negative update correlations is GPT2 on the Pile dataset. However, the correlations again become positive if we shuffle the dataset or we change the dataset to C4. It would be interesting to find out exactly the cause of this behavior.

Figure: Figure 7: Update correlation
Refer to caption: extracted/5703902/imgs/update_corr.png

The observation that $\nabla F(\mathbf{x}_{t+1})$ is positively correlated with $\mathbf{x}_{t+1}-\mathbf{x}_{t}$ suggests that the objective may be in some sense “poorly conditioned”, so that the optimizer is bouncing back-and-forth along the walls of a narrow ravine in the optimization landscape. Previous empirical studies have also suggested similar dynamics Rosenfeld and Risteski (). The classical mitigations for poorly conditioned objectives in the *deterministic and convex* setting are preconditioning, including via second-order algorithms, as well as accelerated gradient descent. However, the advantages of such techniques are poorly understood in the stochastic setting (indeed, there is no advantage in the worst-case Arjevani et al. ()). Instead, most current analyses we are aware of in the stochastic setting appear to rely on negative update correlations.

### 4.3 Alternatives for smooth non-convex optimization

Figure: Figure 8: Cumulative sum (symmetric log scale) of update correlation, update correlation with RS, and loss difference of GPT2 model trained on Pile dataset. (Top) is SGDM and (bottom) is AdamW; (left) is update with RS and (right) is the benchmark without RS.
Refer to caption: extracted/5703902/imgs/gpt_pile_nonsmooth.png

In previous sections, we observed that some common assumptions or identities used in analysis, such as convexity, smoothness, or negative update correlation, might not hold in practice. In this section, we will discuss some recent theoretical alternative frameworks that do not rely on these assumptions.

The first direction is the line of research that focuses on a family of weakly convex objectives. Specifically, a function $F$ is $\rho$-weakly convex if $F(\mathbf{x})+\frac{\rho}{2}\|\mathbf{x}\|^{2}$ is convex, and its Moreau envelope (Moreau, ) with parameter $\lambda$ is defined as $F_{\lambda}(\mathbf{x})=\min_{\mathbf{y}}(F(\mathbf{y})+\frac{1}{2\lambda}\|
\mathbf{y}-\mathbf{x}\|^{2})$.
Prior works usually focused on finding first-order $\epsilon$-stationary points of the Moreau envelope $F_{\lambda}$ (Davis and Drusvyatskiy, ; Mai and Johansson, ). Rather than requiring a negative inner-product $\langle\nabla F(\mathbf{x}_{t}),\mathbf{x}_{t+1}-\mathbf{x}_{t}\rangle$, this style of analysis often requires a negative inner-product of the form $\langle\text{Prox}_{F}(\mathbf{x}_{t})-\mathbf{x}_{t},\mathbf{x}_{t+1}-\mathbf
{x}_{t}\rangle$, where $\text{Prox}_{F}$ is the proximal operator $\text{Prox}_{F}(x)=\mathop{\text{argmin}}_{y}F(y)+\lambda\|x-y\|^{2}$ for some appropriate $\lambda$. This identity is challenging to verify because estimating the proximal operator seemingly requires solving an optimization problem itself. We leave an empirical tractable verification of this identity as an important open problem.

In a different direction, Zhang et al. () proposes employing the Goldstein stationary point (Goldstein, ) as a convergence criterion that is tractable for non-smooth objectives. Specifically, $\mathbf{x}$ is a $(\delta,\epsilon)$-stationary point if there exists a random vector $\mathbf{y}$ such that $\mathop{\mathbb{E}}[\mathbf{y}]=\mathbf{x}$, $\|\mathbf{y}-\mathbf{x}\|\leq\delta$ almost surely, and $\|\mathop{\mathbb{E}}[\nabla F(\mathbf{y})]\|\leq\epsilon$. Later, Cutkosky et al. () proposes an online-to-non-convex conversion (O2NC) technique that later inspires other works on non-smooth non-convex optimization (Ahn et al., ; Zhang and Cutkosky, ).
The key idea of their technique is the use of random scaling:
suppose $s_{t}$ is sampled i.i.d. from $\mathrm{Exp}(1)$, then $\mathbf{x}_{t+1}=\mathbf{x}_{t}+s_{t}\Delta_{t}$ satisfies

$$ $\mathbb{E}_{s_{t}}[F(\mathbf{x}_{t+1})-F(\mathbf{x}_{t})]=\mathbb{E}_{s_{t}} \langle\nabla F(\mathbf{x}_{t+1}),\Delta_{t}\rangle.$ (12) $$

We refer to the update form $\mathbf{x}_{t+1}=\mathbf{x}_{t}+s_{t}\Delta_{t}$ where $s_{t}\sim\text{Exp}(1)$ i.i.d. as the update with random scaling (RS), and the update with $s_{t}\equiv 1$ as the update without RS.
Unlike the lower bound in Eq. 10, the equality in (12) suggests that $\langle\nabla F(\mathbf{x}_{t+1}),\Delta_{t}\rangle$, which we referred to as update correlation with RS, is an unbiased estimator of function progress $F(\mathbf{x}_{t+1})-F(\mathbf{x}_{t})$ and a good indicator of the training progress: we should expect $F(\mathbf{x}_{t})$ to decrease as long as $\langle\nabla F(\mathbf{x}_{t+1}),\Delta_{t}\rangle$ is negative in average.

To verify if the theory holds in practice, we test SGDM and AdamW with random scaling updates and compare them to their counterparts without RS. Specifically, we measure the following three properties: update correlation, update correlation with random scaling, and instantaneous loss difference, where the first is defined in Eq. 9 and the latter two are respectively defined as

$$ $\displaystyle\textrm{update_corr_RS}_{t}=\langle\nabla f(\mathbf{x}_{t},z_{t }),\Delta_{t-1}\rangle,\ \ \textrm{loss_diff}_{t}=f(\mathbf{x}_{t},z_{t})-f_{ t}(\mathbf{x}_{t-1},z_{t}).$ (13) $$

Note that if the update does *not* have random scaling applied, then $\textrm{update_corr_RS}_{t}=\textrm{update_corr}_{t}$.

In Fig. 8 we plot the cumulative sum of these quantities (i.e. the sum from $1$ to $t$ for all $t$). The sum of update correlation always increases, regardless of whether random scaling is employed. However, for optimizers with random scaling, the sum of update correlation with RS decreases and closely aligns with the sum of loss difference. This supports the theory that update correlation with RS is an unbiased estimator of loss difference, even for complicated LLM models. Furthermore, it motivates a guideline for developing empirically effective optimizers: keeping $\langle\nabla f(\mathbf{x}_{t},z_{t}),\Delta_{t-1}\rangle$ as negative as possible while applying random scaling to the update.

## 5 Related Works

There have been extensive studies on the empirical properties and the loss landscape of training modern models. Goodfellow and Vinyals () proposed one-dimensional and two-dimensional visualization tools for the loss landscape of various neural networks, demonstrating that SGD rarely encounters local minima during training. Im et al. () tested the training trajectories of different optimizers using the same visualization tools and observed that different optimizers exhibit distinct behaviors when encountering saddle points. Li et al. () proposed more refined visualization techniques and showed that the smoothness of the loss landscape closely correlates with generalization performance.
Nakkiran et al. () studied the dynamics of SGD training, showing that SGD learns simple classifiers at early training stages and learns more complex classifiers at later stages.
Power et al. () reported the grokking phenomenon on a synthesized dataset such that after a long period of severe overfitting, validation score suddenly increases to almost perfect generalization.
Thilak et al. () revealed the slingshot effect of training neural networks with adaptive optimizers, which is a cyclic behavior between stable and unstable regimes during training process.
While these results are inspiring and carry their own implications, we focus on validating common assumptions and key identities fundamental to the analysis of optimization theory.

On the other hand, there are several other studies that align more closely with our primary focus. Xing et al. () demonstrated that loss interpolation between consecutive iterates is locally convex, which aligns with our observations in Sec 3.1. While their experiments focus on SGD and image classification tasks, we extended the scope of our convexity measures to include AdamW and LLMs. Furthermore, we also tested a more global convexity measure as seen in Sec 3.2.
Cohen et al. (, ) observed the “edge of stability” phenomenon where the sharpness, measured by maximum eigenvalue of the Hessian, increases during early stage of training and then stabilizes. Our observations in Sec 4 align with their finding and extend beyond CIFAR-10 tasks. Moreover, we proposed a smoothness measure that achieves the same goal of measuring sharpness but is computationally simpler, facilitating sharpness measurements for complex models like LLMs.
Rosenfeld and Risteski () demonstrated the opposing signal phenomenon that there are groups of outliers such that decreasing loss over one group increases loss over other groups, which could explain our observation of positive update correlation in Sec 4.2.
Besides the aforementioned differences, our work also distinguishes itself from prior research by not only verifying common assumptions but also directly measuring key quantities in modern analyses.

## 6 Conclusions

We address the critical question of whether modern analyses in stochastic optimization theory align with practical applications. To this end, we empirically measure key quantities that are commonly used in theory across a diverse range of machine learning benchmarks. Our results indicate that, in most cases, these commonly assumed identities do not hold in practice. Further, we provide comparisons between the behaviors of SGD and Adam across various important properties. We hope that our experiments results can contribute to a better understanding of what enables practical optimization, as well as motivate more rigorous empirical verification of optimization analyses in the future.

## Appendix A License

Image Classification: Imagenet is distributed under the BSD 3-Clause License, Resnet is distributed under the Apache License, Cifar10 is distributed under the MIT License.

NLP: Bert/GPT2 (Hugging Face), C4 dataset are distributed under the Apache 2.0 License. The Pile dataset is distributed under the MIT License.

## Appendix B Experiments Settings and Configurations

GD on squared loss: We run Gradient Descent on squared loss using synthetic datasets. We train the optimizer for 100 iterations with a learning rate equals to 0.1. We report the metrics computed every iteration.

Logistic regression with OpenML datasets: We run logistic regression with commonly used OpenML datasets such as Aloi (42396), Poker (1595), Connect-4 (1591), and Covertype (150). We run all experiments using a batch size equal to 64 and AdamW as the optimizer. We tune the learning rates using a grid search over the range $[1e-4,1]$. We report the metrics computed at the end of every epoch.

Training Cifar10 on Resnet18: We train the benchmark dataset Cifar10 on Resnet18 using SGDM and Adamw. For SGDM, we use a learning rate $=0.1$ and for AdamW, we use a learning rate $=0.001$. Both optimizers are trained with batch size equal to 128, weight decay equal to $5e-4$, and cosine learning rate scheduler. In the experiments with constant learning rates, we use the same optimal configurations as the normal experiments but without the scheduler. We train both optimizers for 200 epochs and all tracking measures (convexity gap, max smoothness, etc,…) are reset for the new epoch (this is why we see the max smoothness quantity goes down at various points in Fig.4). We use full batch to compute the large batch loss ($F(x)$) and gradient $\nabla F(x)$. We report the metrics computed at the end of every epoch.

Training Imagenet on Resnet18: We train Imagenet on Resnet18 using SGDM with a learning rate equal to 0.1 and Imagenet with a learning rate equal to 0.001. The weight decay is $1e-4$ and we employ a learning rate scheduler that decays the learning rate by 10 every 30 epochs for both optimizers. These are the experiments configurations used in (Yao et al., ; Tran and Cutkosky, ). Similar to the Cifar10 experiments, we keep the same configurations except for the learning rate scheduler for the constant learning rates experiments. We also reset the tracking quantities every epoch. We use full batch to compute the large batch loss ($F(x)$) and gradient $\nabla F(x)$. We report the metrics computed at the end of every epoch.

Pre-train Bert using the C4 dataset: We train the "bert-base-cased" model of HuggingFace (Devlin et al., ) from scratch using the C4 dataset. The model has approximately 110 million trainable parameters. We train the model for 1 million iterations with 10k warm-up steps and a linear decay scheduler. AdamW is trained with a learning rate of $5e-5$ and SGDM is trained with a learning rate of $1e-3$. The weight decay is set to be $0.01$ for both optimizers. Since the training never gets through the whole C4 dataset, we do not reset the value of the tracking quantities. For experiments with constant learning rates, we keep the same configurations but without the scheduler and the warm-up step. We use a batch size of 100000 to compute the large batch loss ($F(x)$) and gradient $\nabla F(x)$. We report the metrics computed every 10k iterations.

Pre-train GPT2 using the Pile dataset: We train the GPT2 model of HuggingFace (Devlin et al., ) from scratch using the Pile dataset. The model has approximately 124 million trainable parameters. We train the model for 1 million iterations with 10k warm-up steps and a linear decay scheduler. Both SGDM and AdamW are trained with a learning rat of $1e-4$. The weight decay is set to be $0.01$ for both optimizers. We do not reset the value of the tracking quantities. For experiments with constant learning rates, we keep the same configurations but without the scheduler and the warm-up step. We use a batch size of 100000 to compute the large batch loss ($F(x)$) and gradient $\nabla F(x)$. We report the metrics computed every 10k iterations.

Testing non-smooth measures: We train three different tasks with SGDM and AdamW with and without random scaling. We use a variant implementation of SGDM, which updates

$$ $\displaystyle\Delta_{t}=\beta(\Delta_{t-1}-\eta_{t}g_{t}),\quad x_{t+1}=x_{t}+ s_{t}\Delta_{t}.$ $$

$s_{t}$ is sampled i.i.d. from $\mathrm{Exp}(1)$ with random scaling turned on, and $s_{t}\equiv 1$ otherwise.
This is equivalent to SGDM with different effective learning rate and momentum constants, and is shown to have theoretical guarantee (Zhang and Cutkosky, ). We use the standard implementation of AdamW, with the only difference being the inclusion of the additional random scalar.

In the first task, we train the ResNet18 model on the Cifar10 dataset for $200$ epochs with batch size $=128$, with a total of roughly 80k iterations. For SGDM, we use a learning rate $=0.01$ and momentum $\beta=0.99$. For AdamW, we use a learning rate $=3e-4$, weight decay $=0.1$ and default values $b_{1}=0.9,b_{2}=0.999$. For both optimizers, we use linear decay scheduler with 5k warmup steps.

In the second task, we train the “bert-base-cased” model from scratch on the C4 dataset for 50k iterations with 5k warmup steps and a linear decay scheduler. For SGDM, we use a learning rate $=1e-3$ and momentum $\beta=0.99$. For AdamW, we use a learning rate $=5e-5$, weight decay $=0.01$ and default values $b_{1}=0.9,b_{2}=0.999$.

In the third task, we train the GPT2 model from scratch on the Pile dataset for 50k iterations with 5k warmup steps and a linear decay scheduler. For SGDM, weuse a learning rate $=0.01$ and momentum $\beta=0.99$. For AdamW, we use a learning rate $=3e-4$, weight decay $=0.1$ and default values $b_{1}=0.9,b_{2}=0.999$. In all tasks, the optimizers with random scaling have the same configuration as its benchmark without random scaling.

Runtime: All experiments are run on 1 NVIDIA
v100 GPUs. Cifar10 experiments take 3 hours, Imagenet experiments take 58 hours, both GPT2 and Bert experiments take about a week to train.

Code: All experiments can be found in the anonymous repository: [https://github.com/Neurips24-Submission14212/Submission14212](https://github.com/Neurips24-Submission14212/Submission14212).

## Appendix C Notations and Definitions

Below we list all the notations and definitions related to our measurements.

**Table 1: Notations of the key identities measured in our experiments.**
| Symbol | Description |
| --- | --- |
| $\textrm{inst_gap}_{t}(\mathbf{y})$ | Instantaneous convexity gap in iteration $t$ w.r.t. $\mathbf{y}$, defined in (2) |
| $\textrm{avg_gap}_{t}(\mathbf{y}_{1:t})$ | Unweighted average of $\textrm{inst_gap}_{i}(\mathbf{y}_{i})$, defined in (3) |
| $\textrm{exp_gap}_{t}(\mathbf{y}_{1:t})$ | Exponential average of $\textrm{inst_gap}_{i}(\mathbf{y}_{i})$, defined in (3) |
| $\textrm{convexity_ratio}_{t}$ | Convexity ratio, defined in (6) |
| $\textrm{inst_smooth}_{t}(\mathbf{y})$ | Instantaneous smoothness in iteration $t$ w.r.t. $\mathbf{y}$, defined in (4) |
| $\textrm{exp_smooth}_{t}(\mathbf{y}_{1:t})$ | Exponential average of $\textrm{inst_smooth}_{i}(\mathbf{y}_{i})$, defined in (5) |
| $\textrm{max_smooth}_{t}(\mathbf{y}_{1:t})$ | Maximum over $\textrm{inst_smooth}_{i}(\mathbf{y}_{i})$, defined in (5) |
| $\textrm{update_corr}_{t}$ | Update correlation in iteration $t$, defined in (9) |
| $\textrm{update_corr_RS}_{t}$ | Update correlation with random scaling in iteration $t$, defined in (13) |
| $\textrm{loss_diff}_{t}$ | Instantaneous loss difference in iteration $t$, defined in (13) |

## Appendix D Extra experiments results

In this section, we report some results that we do not have space to include in the main text.

### D.1 The norm of the gradient increases as the training progresses

Figure: Figure 9: The $L2-$ norm of the gradients as the training progresses.
Refer to caption: extracted/5703902/imgs/grad_norm.png

When the objective is non-convex, since finding the global minima is NP-hard, previous works focus on finding the $\epsilon-$stationary point (Tran and Cutkosky, ; Fang et al., ; Arjevani et al., ), which is defined as a point such that the gradient $\|\nabla F(\cdot)\|\leq\epsilon$. The common assumption is that an optimizer performs well if it can find points with a small gradient norm, which is expected to decrease as training progresses. However, as we can see from Fig.9, this is not always the case in practice. In Cifar10 and Bert experiments,the full-batch gradient norms decrease for "good" optimizers (SGDM and AdamW for CIFAR-10, and AdamW for BERT), which supports the theory. Conversely, in the Imagenet and GPT2 experiments, the gradient norms hardly decrease, even though the optimizers are still making consistent progress. In fact, in the Imagenet experiments, the norms actually increase, indicating that we are straying further from the stationary point. This suggests that the use of $\epsilon-$stationary point as the convergence criterion might not be appropriate in practice.

### D.2 Gradient standard deviation increases

Let us compute the gradient standard deviation as $\sigma\coloneqq\frac{1}{T}\sum_{t=1}^{T}\|\nabla f(x_{t},z_{t})-\nabla F(x_{t})\|$. Intuitively, the optimizer might make rapid progress if the variance (or standard deviation) is small since it means that our gradient estimate $\nabla f(x_{t},z_{t})$ is approximating the true gradient well. This is the intuition that leads to the development of a branch of optimization algorithms called variance-reduced algorithms (Allen-Zhu and Hazan, ; Cutkosky and Orabona, ; Johnson and Zhang, ), Thus, we would expect that as the optimizer making progresses, the standard deviation also decreases.

Figure: Figure 10: Standard deviation of the gradients
Refer to caption: extracted/5703902/imgs/std.png

However, similar to the gradient norms, the standard deviation also does not decrease in every experiment. It is hard to conclusively justify why this is the case. One possible explanation for this phenomenon is the existence of multiple minima or low-loss "valley". Thus, even though the optimizer is deviating from the direction to a low-loss "valley" indicating by the true gradient, it is somehow still able to navigate to a different low-loss valley, thus it continues making progress. Further, we note that Adam also consistently returns gradient that is closer to the true gradient. It would be interesting to investigate further to see if this is a property of Adam or of any adaptive method.

### D.3 Parameters norm

We compute the total parameters norm of the model in each experiment. Adam consistently has larger parameters norm than SGD.

Figure: Figure 11: The total $L2-$norm of Model parameters
Refer to caption: extracted/5703902/imgs/param.png

### D.4 L1-norm of the stochastic gradients

Figure: Figure 12: $L1-$norm of the stochastic gradients
Refer to caption: extracted/5703902/imgs/l1.png

We present additional results in the $L1$-norm of the gradient to complement our $L2$-norm findings discussed in Section D.1. An interesting observation is that, although the $L2$-norm of SGD is consistently larger than that of Adam, this is not the case for the $L1$-norm (BERT experiments). This discrepancy suggests that the larger $L2$-norm in SGD may be attributed to outliers in the gradient coordinates, which significantly inflate the final norm. In contrast, Adam, with its adaptive learning rate for each coordinate, effectively minimizes all directions simultaneously, avoiding the issue of gradient outliers.

### D.5 Test accuracy for Image Classification

Figure: Figure 13: Test Accuracy of Cifar10 and Imagenet trained on ResNet18
Refer to caption: extracted/5703902/imgs/cifar_test.png

### D.6 Validation loss of NLP tasks

Figure: Figure 14: Validation loss of pre-training Bert on C4 and GPT2 on the Pile
Refer to caption: extracted/5703902/imgs/bert_test.png

### D.7 Instantaneous convexity gap for deep learning tasks

Figure: Figure 15: Instantaneous convexity gap w.r.t. $\mathbf{y}_{t}=\mathbf{x}_{t-1}$ of deep learning benchmarks. Non-positive gap indicates convexity. See Section 3.1 for detailed discussions.
Refer to caption: extracted/5703902/imgs/inst_gap.png

### D.8 Update Correlation: Shuffled vs Unshuffled

Figure: Figure 16: Update correlations of pre-training GPT2 on the Pile dataset - one experiment uses shuffled dataset, the other just iterates through the original dataset. Both are trained for 50k iterations.
Refer to caption: extracted/5703902/imgs/update_corr_extra.png

### D.9 Non-smooth measures for other deep learning tasks

Figure: Figure 17: Cumulative sum (symmetric log scale) of update correlation, update correlation with RS, and loss difference of Bert model trained on C4 dataset (left) and ResNet18 model trained on CIFAR10 dataset (right). Top row is SGDM and bottom row is AdamW; left column is update with RS and right column is the benchmark without RS. See Section 4.3 for detailed discussions.
Refer to caption: extracted/5703902/imgs/bert_c4_nonsmooth.png

## Peer Reviews

confidence: 3
contribution: 2
initial_rating: 5
presentation: 3
questions: 1. For the numerical experiments, since the initialization is randomly chosen, so how will the random initialization affects the numerical results?

2. How will the choice of learning rate affect the numerical results?
soundness: 3
strengths: 1. The organization and presentation of this paper is smooth and clear, and it provides new insights when comparing modern training algorithms SGD and AdamW.

2. This paper illustrates the necessity for developing a new theoretical framework to theoretically analyze optimization algorithms, which is crucial for this deep learning era.
summary: This paper revisits two commonly used assumptions (convexity and smoothness) for analyzing the convergence of optimization algorithms. Traditionally, theoretical understanding of optimization algorithms usually requires assumptions of global convexity and global smoothness. This paper numerically investigates these two assumptions by examining the optimization path for algorithms like GD/SGD/AdamW, and finds that in most cases the assumptions do not hold. The results suggest that new theoretical frameworks are needed.
weaknesses: In case I miss something, please correct me if I am wrong.

My biggest concern is that the main findings in this paper is not that surprising, i.e., it is expected that in the practical training, the loss landscape is highly non-convex, and thus it is reasonable if the convexity or the smoothness does not hold along the whole optimization path. In a high level point of view, this paper seems to reveal the gap between theory and practice, but this gap has been around since the days of deep learning. I would expect the authors propose some reasonable assumptions to enhance the theoretical understanding of modern training algorithms.

---

confidence: 3
contribution: 3
initial_rating: 6
presentation: 3
questions: - Could the authors clarify how the discussion in section 4 differs from the observations in Cohen et al. 2020?
- Could the authors elaborate on the motivation for the additional experiments in Appendix D, especially D.3, D.4, and D.8?
- Have the authors considered the effects of the reference point on these metrics? For example, is it possible that with a better reference point $\bar x$ (e.g. found by decaying the learning rate or averaging weights across an epoch) that the average update correlation $\langle \nabla f(\bar x), x_{t+1} - x_t \rangle$ would be consistently negative?
soundness: 3
strengths: - The primary goal of the paper – verifying the inequalities used in optimization theory – is clear and well motivated.
- The paper is overall well written. The paper connects high level assumptions to specific inequalities, and each section describes how the corresponding inequality is used in standard analyses and how the paper will attempt to verify them.
- The overall results, while not entirely surprising, strongly support the claim that existing analyses are unable to explain convergence in realistic settings.
summary: This paper studies whether the standard bounds used to analyze optimization actually hold in deep learning settings. First, the paper shows that optimizers sometimes find "locally convex" paths, but argues that convexity-based analysis cannot explain optimization in deep learning. It then considers smoothness and observes that the smoothness is connected to the learning rate, similar to Cohen et al. 2020. Finally, they observe that update correlations are often positive during training, which challenges analyses that rely on monotonic loss decrease in expectation.
weaknesses: - [1] proposed "directional smoothness" which is the same as this paper's notion of instantaneous smoothness. They also observed that this quantity can approximate the sharpness.
- The experiments and conclusion in section 4.1 are essentially equivalent to those in Cohen et al. 2020;2022.
- While not exactly equal to the update correlation (eq. 9), Cohen et al. 2020 Appendix H showed that for SGD, the loss does not decrease in expectation which carries a similar message to section 4.2.
- Appendix D is a bit rough and many of the figures are missing discussions. It may also make sense to discuss some of these findings in the main paper, especially Appendix D.1.

Minor Comments
- lines 373-377: this can be easily explained by the observation in Cohen et al. 2020 that at the edge of stability, the optimizer oscillates in the top eigenvector direction, and if $x_t$ and $x_{t-1}$ differ in the top eigenvector direction then a first order Taylor expansion shows that the instantaneous smoothness is approximately the sharpness.

[1] Mishkin et al. 2024: Directional Smoothness and Gradient Methods: Convergence and Adaptivity

---

confidence: 3
contribution: 2
initial_rating: 6
presentation: 3
questions: - Sections 3.1 and 3.2 appear to convey contradictory messages about GPT-2. The last plot in Figure 2 suggests that GPT-2 is locally convex, while the final plot in Figure 3 indicates a lack of convexity. Could you clarify this?
- Allen-Zhu et al. [3] proved that the ReLU networks are semi-smooth with high probability. Could you please comment on this? Do your experimental results violate their theoretical results?
- In the interpolation regime and x_t is close to y_t = x_*, both the numerator and denominator in (4) should converge to 0. Why did this quantity explode at the end in Figure 4?


[3] Allen-Zhu, Zeyuan, Yuanzhi Li, and Zhao Song. "A convergence theory for deep learning via over-parameterization." In International conference on machine learning, pp. 242-252. PMLR, 2019.
soundness: 3
strengths: - Overall, the main takeaways of this paper seem to be interesting and systematically validated. While some of them may not be entirely new to the readers, the paper effectively connects the dots to provide a clearer overall picture.
- The quantities tracked in this paper seem to be well-designed owing to a good abstraction of existing proof techniques.
summary: In this paper, the authors numerically track some quantities (related to convexity and smoothness) on the iterates of SGDm and Adam across the training epochs. The values of these quantities (e.g., ≥ 0 or < 0, ≥ 1 or < 1) are important for classical convergence analysis to proceed. Their experimental results might shed light on new theoretical frameworks explaining the success of popular stochastic algorithms used in deep learning.
weaknesses: - Several possible alternatives discussed by the authors for smooth non-convex optimization do not seem to contribute much to the "theoretical understanding of optimization algorithms used in deep learning": a) Weak convexity still might not hold globally; b) The algorithms for non-convex non-smooth optimization (e.g. [1, 2]) might be too complicated to be practical; c) The variants without random scaling of existing algorithms seem to perform on par with the variants with random scaling.

[1] Zhang, J., Lin, H., Jegelka, S., Sra, S. and Jadbabaie, A., 2020, November. Complexity of finding stationary points of nonconvex nonsmooth functions. In International Conference on Machine Learning (pp. 11173-11182). PMLR.
 
[2] Jordan, M., Kornowski, G., Lin, T., Shamir, O. and Zampetakis, M., 2023, July. Deterministic nonsmooth nonconvex optimization. In The Thirty Sixth Annual Conference on Learning Theory (pp. 4570-4597). PMLR.

---

confidence: 3
contribution: 2
initial_rating: 6
presentation: 3
questions: - lines 205-212 report that on several networks (e.g. ResNet on ImageNet), the 'instantaneous convexity gap' between successive iterates is often positive during training.  If I understand correctly, this means that the loss at step $t+1$ lies _below_ the local linear approximation of the loss at step $t$.   I find this surprising, and in fact somewhat hard to believe -- I would think that the curvature along the step direction is always positive.  In order to be sure that there is no bug, could the authors please provide a one-dimensional plot of the loss function along the step direction, i.e. a plot of $F(\alpha x_t+(1-\alpha) x_{t+1})$ for $0 \le \alpha \le 1$.
  - If the reported result is correct, I suspect that the difference between CIFAR-10 and ImageNet experiments is due to some factor we could understand such as differences in the batch size, rather than to an intrinsic difference between the CIFAR-10 and ImageNet datasets.
- why didn't you ever assess convexity by tracking the instantaneous convexity gap between the iterate $x_t$ and the ultimate solution $x^*$?
- in figure 5, over what time ranges are you computing the convexity ratios?  is the convexity ratio at epoch $t$ a sum over all $t$'s within the epoch, or a sum over all $t$'s up to and including the epoch?
soundness: 3
strengths: - the findings in section 3.2 imply that a popular convexity-based analysis technique cannot apply in deep learning (since the so-called 'convexity ratio' is negative in many deep learning settings)
- in section 4, it is shown that a certain measure of smoothness (the relative change in the gradients after each step) is large for deep learning landscapes.  This implies that smoothness-based analyses based on this property do not apply in deep learning.  This is a more computationally tractable measure of smoothness than the Hessian spectral norm, which has been considered in previous works, but is computationally expensive for large networks. 
- while prior works have reported highly similar findings to those of section 4, experiments in those works did not cover 'modern' architectures such as  GPT2.
summary: This paper empirically tests whether theoretical optimization analyses apply to deep learning optimization problems.  While the global assumptions made in classical analyses such as convexity and smoothness obviously do not literally apply in deep learning, one might hope that classical analyses still can be partly rescued.  The goal of this paper is to test whether that is the case.

In section 3.1, the authors show that the deep learning loss functions often exhibit negative curvature when interpolating between successive iterates, which clashes with convexity.  In section 3.2, they show that a popular convexity-based bound analysis technique could still conceivably apply to some of the tested deep learning optimization problems, but not to others.  In section 4, the authors show that deep learning loss functions are not smooth, and that the smoothness along the trajectory also depends on the learning rate (which is closely related to observations from prior works).  In section 4.1, they point out that their smoothness measure can be viewed as a computationally cheap proxy for Hessian spectral norm.    In section 4.2, they observe that successive updates are negatively correlated, which invalidates a certain class of optimization analyses.  In section 4.3, they explore an alternative analysis techinque.

Overall, the authors conclude that classical optimization analyses are generally inapplicable - "real optimizers often make progress even when typical optimization analysis suggests that they should not."
weaknesses: - the quantity measured in section 3.1 (which measures whether the loss is convex along the line between successive iterates) does not really enter into convergence analyses.  Thus, it's not clear what is the significance of these results for convergence analyses.
- the paper's findings regarding smoothness (e.g. that it adapts to the learning rate) are similar to results which have already been reported in prior works, in particular Cohen et al '21.  Prior works such as Xing et al '18 have already reported that successive updates are anti-correlated, which is the main finding of section 4.3.1.  The conclusion that "the classic smooth non-convex analysis that relies on the descent lemma is problematic in practice" (line 446) was already stated in Cohen et al '21, in the discussion section.
- since the loss difference plots in figure 8 are the same with or without random scaling, it's not clear to me whether the guideline mentioned in section 497 should actually be viewed as a guideline for optimizer design.