Stochastic and adaptive optimizers
The minibatch gradient and its noise, the noise ball of a constant step and decreasing steps, momentum and Nesterov with noisy gradients, the per-coordinate steps of AdaGrad, RMSProp and Adam with its bias correction, and what each of them leaves unfixed.
A gradient from a sample
Gradient descent uses the full gradient at each step. For , a uniformly sampled example gives an unbiased gradient estimate at a fixed . Averaging independent draws with replacement gives
Here is the covariance of one sampled example's gradient. The gradient RMSE is , not proportional to . Stochastic gradient descent uses at cost roughly instead of .
For a uniform batch without replacement at fixed weights, multiply that covariance by . During a shuffled epoch, the current weights and later batches depend on earlier choices; the independent-draw proof does not apply unchanged.
On the original 240-row sensor fixture, standardize the eight inputs and centre the target for a fixed training objective. At zero weights, 6000 independent batches give gradient RMSE for . Exact finite-dataset predictions are . Seed 20261114 controls batch sampling; these are synthetic training calculations.
The noise ball
Unbiased gradients can remain noisy at the optimum. Consider with stochastic gradient , where each new noise is independent, mean zero and variance . For a constant step,
If , the mean decays and the variance follows
With persistent noise, a smaller stable step reduces the limiting variance. Within the nonoscillating range , it also slows the mean's approach. The expected loss is ; it is not the loss of each sampled trajectory.
For , and 240 steps, exact expectation propagation gives losses at step , at step , and for starting at . No Monte Carlo estimate is involved. If every per-example gradient vanishes at a shared optimum, this persistent-noise model no longer applies; constant-step convergence can then be possible under suitable stability assumptions.
Decreasing steps and schedules
For standard stochastic-approximation guarantees, a common step requirement is
The first prevents the available movement from ending too soon; the second controls accumulated noise. A positive schedule proportional to meets both. These sums alone do not prove convergence: assumptions on the objective, noise and iterates also matter. For a strongly convex objective on a convex feasible set, unbiased stochastic gradients with bounded second moment, projected updates and a suitable schedule, weighted averaging yields an expected excess-loss bound. This is not a guarantee for arbitrary networks.
A finite budget needs an experiment. On the synthetic sensor fixture, all methods start at zero and train for 40 epochs with shuffled batches of 24. Five shared seeds 400–404 control permutations. SGD with has mean training excess loss ; cutting the step tenfold after 20 epochs gives . At , both results round to . Reducing the step too early can obstruct progress along a flat direction.
This compares training optimization under a fixed budget. It does not measure generalization or establish a universal best schedule.
Momentum with noisy gradients
Momentum accumulates a velocity:
For a constant gradient and , velocity approaches . Thus describes the effective step in a sustained direction. It is not a universal formula for stationary noise when gradients depend on the changing weights.
On an exact strongly convex quadratic, carefully tuned heavy-ball parameters can improve the asymptotic dependence from the condition number to . The error may increase temporarily; this does not promise a decrease at each step. Nesterov's method evaluates a gradient at a look-ahead point and has suitable smooth strongly convex guarantees. Those assumptions must travel with the rate.
In our 40-epoch sensor experiment, momentum with , gives mean excess loss , or with the halfway cut. The learning rate, momentum and schedule work together. Replacing them with a single “effective step” does not prove two algorithms have identical noise.
A step per coordinate: AdaGrad and RMSProp
Coordinates may see gradients on very different scales. AdaGrad tracks every squared gradient:
Operations are coordinatewise. A rarely active coordinate accumulates less history and can keep a larger effective step. For a constant nonzero scalar gradient , , so with negligible the update magnitude is . This statement concerns the update, not a guarantee about the loss.
RMSProp replaces the cumulative sum by recent history:
It divides by the square root of that moving average, with a small stabilizer. Forgetting old squared gradients prevents the denominator from growing forever merely because training continues. It also means history is no longer monotone. Neither accumulator is the full Hessian; per-coordinate scaling cannot generally remove correlations between coordinates.
Adam and its bias correction
Adam combines a moving mean of gradients with a moving mean of their squares. Starting from , at step compute
Correct the initialization bias and update:
With a stationary gradient mean, the uncorrected first moment has expectation multiplied by ; the analogous second-moment calculation explains its correction. This removes the zero-initialization factor, not every source of statistical bias.
At the first step, and . A nonzero scalar gradient therefore gives update , approximately when the stabilizer is negligible. Large and small gradients can initially produce similar-sized coordinate updates. This is not a guarantee that their coordinates reach a good solution equally quickly.
What is fixed and what is not
SGD makes gradient steps cheaper. Momentum remembers direction. Adaptive methods use coordinatewise gradient history. None of these operations validates the model or removes the need to choose a learning rate.
For the same 40-epoch synthetic experiment, Adam with gives mean training excess loss , while gives . Cutting the smaller step halfway worsens the result to : too little progress is not repaired by making the step even smaller. These are finite-budget measurements with shared permutations, not a general superiority claim.
Adam has counterexamples to general convergence, and diagonal scaling has no universal condition-number rate. On neural networks, use held-out evidence rather than transferring a convex theorem without its assumptions. The optional notebook reproduces the original fixture, checks gradients by finite differences and executes the first Adam step. It uses no external data or downloaded weights.
Next, Regularization changes the objective to control unstable fits. The reviewed source note retains primary algorithm references and theorem conditions. New calculations and assessment were prepared for the Fedor Pakhurov project with Codex assistance.
Check your understanding
The same questions as in Pulse. Answers are shared between modes.
Go deeper — optional
Code and labs do not count toward the main percentage or the certificate.
- Optimizers: noise and a finite budgetoptional
Compare batch noise and SGD, momentum and Adam training; separately compute the exact expectation of a noisy scalar recurrence.
~25 min · easier on a computer · The matching course topic has been read.
Self-check in the notebook — not part of mastery or the certificate.
Answers are saved on the server and tied to this browser until you sign in.