A short tutorial · six lessons
We will walk through this slowly. First the SGD update. Then a simple quadratic. Then a real network. Then the tools we need once the linear theory runs out.
That is the first fact. We have parameters \(\theta\) and a loss \(L\). At every step we pick a random mini-batch \(B_t\) and take one step downhill on that batch:
\(\eta\) is the step size (the learning rate). \(B_t\) is a new random batch each time. That is all SGD is.
Now the natural question: is this stable? Do the parameters stay near a minimum, or do they run away?
A real neural network is too messy to answer that. So we study the simplest loss that still has curvature: a quadratic.
Let \(x\) be how far we are from the minimum. Each batch sees a slightly different curvature \(h_t\). Think of \(h_t\) as “how steep that batch is.” We sample it from a distribution. The easiest example is a Gaussian:
\(\mu\) is the average curvature. \(v\) is how much the batches disagree. Smaller batches mean larger \(v\). If we used the whole dataset every time, \(v=0\).
The loss on that batch is a simple quadratic, plus a little noise:
Plug this into SGD. The update becomes very short:
Read it in words. Every step we multiply the current position by a random number \(1-\eta h_t\), then add a small Gaussian kick. That is the whole model. A stochastic quadratic. Nothing else.
The iterate \(x_t\) is now random, so we need a metric. The usual one is: the average squared distance from the minimum stays bounded.
People call this mean-square stability.
Why the square? Because it is easy to compute. Square the update. The noise term has mean zero, so it drops out of the cross term, and we get:
Each step multiplies the mean square by one number, \(m_2(\eta)\). If that number is less than 1, the mean square settles down. If it is bigger than 1, the mean square grows forever.
And \(m_2\) has a closed form. It is less than 1 exactly when
Try it. Leave the curvature Gaussian. Move the step size across the line \(\eta_{\mathrm{MS}}\). Watch the histogram of \(x\).
The square was only one choice. We could have asked whether \(\mathbb E|x_t|\) stays finite, or \(\mathbb E|x_t|^4\), or \(\mathbb E|x_t|^{1/2}\).
For this simple update, each of those questions has its own answer. Write
The \(q\)-th moment of \(x_t\) stays finite when \(m_q(\eta)<1\), and blows up when \(m_q(\eta)>1\). So each \(q\) has its own step-size threshold.
Two named cases:
Mean-square asks about the second moment. Harmonic asks about the inverse moment: how often the random multiplier is small, i.e. how often a step pulls \(x\) back toward zero.
The picture below is the same Gaussian as above. Move \(\eta\). The blue curve is \(m_q\). Moments under the red line \(m_q=1\) are the stable ones.
So far we only asked whether averages stay finite. We can also ask: after many steps, what does a histogram of \(x\) look like?
When a typical run still contracts, the iterates settle into a fixed shape. That shape is not a Gaussian. Sometimes a few unlucky batches multiply \(x\) up several times in a row. Those rare runs make a heavy tail.
The 1-D Kesten theorem says exactly how heavy. Find the number \(\kappa>0\) that solves
Then the tail of the stationary law is a power law with that same \(\kappa\):
Change the step size, or change how the batch curvature is sampled. The histogram changes. That is all this lesson is.
Everything so far was a one-dimensional quadratic. A real network has thousands of parameters and a loss that is not a bowl. So a fair question is:
Here is one experiment. Take a trained network and freeze a checkpoint \(\theta_\star\). Keep running plain SGD from there. After each step, look only along the sharpest direction: the top eigenvector \(u_1\) of the Hessian. Call that one number
If the quadratic story were the whole story, then past the Lyapunov line this coordinate should run away. It does not. It sits in a stationary cloud. Raise the step size further and that cloud becomes two lobes.
The pictures below are not a simulation of a toy map. They are a real 2-block transformer, continued with full-batch SGD, then projected onto \(u_1\). The number \(\eta\lambda_1\) is the step size times the largest curvature. The classical edge is \(2\). The Lyapunov number \(\chi_{\mathrm{lin}}=\mathbb E\log|1-\eta\, u_1^\top H_B u_1|\) turns positive at the same place.
The network probe is high-dimensional. The same family of histograms appears in the small models you already have as labs. Those models add the next term in the loss — a cubic and a quintic — so the iterate is pulled back when it gets large. That is why a stationary cloud can exist past the Lyapunov line.
The first term is the quadratic we already know. The extra powers are the self-stabilization. Move \(\eta\) from the mean-square line, through Lyapunov, into the two-lobe region.
In two dimensions there is a sharp coordinate \(z\) and a tangent coordinate \(y\). The same walk: a blob at the origin, then a cloud past Lyapunov, then two lobes along the sharp axis.
One curvature, cubic and quintic return, the Fig. 1 strip.
Two coupled coordinates. Lobes live on the sharp axis.
SGD from \(\theta_\star\), occupancy in the top Hessian plane.
At the Lyapunov line the typical one-step gain stops contracting:
Kesten’s theorem needs \(\chi<0\). So the linear / quadratic theory stops here. It cannot tell us the shape of the cloud we just saw in the network, or in the 1-D and 2-D labs.
That is a negative moment. For \(\alpha>0\),
If \(m_{-\alpha}<1\), the gain is small often enough that a typical excursion is pulled back toward zero. Two named cases:
Harmonic is just the case \(\alpha=1\). It is the last of these inverse-moment edges. In the labs, the two-lobe histograms appear around there — not at the Lyapunov line, and not at the mean-square line.
That is the end of this first pass. The quadratic gave us a spectrum of ordinary moments and a Kesten tail. A real network, and the 1-D / 2-D maps, keep a stationary shape past Lyapunov. The new tools there are self-stabilization and the inverse moments — mean-square, then Lyapunov, then negative-moment, then harmonic.