Sam Babichenko

Reading notes / Deep Learning Alchemy

Noisy quadratics and weight norms

From Lecture 3 of Stanford CS 312 Deep Learning Alchemy (Fall 2026), taught by Tatsunori Hashimoto and Suhas Kotha

slides quiz answers assignment code

Optimizer step
θt\theta_tparameters after update tt
ℓt\ell_tloss on the batch of update tt
η\etapeak learning rate (Zhang et al. write α\alpha)
ηt\eta_tlearning rate at update tt, as set by the schedule
λ\lambdadecoupled weight decay coefficient: each update shrinks the weights by ηλ\eta\lambda times their value
β1,β2\beta_1,\beta_2Adam's averaging rates for the gradient and its square (0.9 and 0.95)
BBbatch size: sequences per update in the course, gradient queries per step in the noisy quadratic
LLtraining loss function
pppreconditioner exponent in P=HpP=H^p
Noisy quadratic model
HHHessian of the quadratic loss L(θ)=12θ⊤HθL(\theta)=\tfrac12\theta^\top H\theta
hih_ieigenvalues of the Hessian HH, the curvatures along its principal directions, h1≥⋯≥hdh_1\ge\dots\ge h_d
CCcovariance of one gradient query's noise, ε∼N(0,C)\varepsilon\sim N(0,C)
cic_inoise variance of one gradient query in direction ii, the diagonal entries of CC in HH's eigenbasis
ℓi\ell_iloss in direction ii, 12hiθi2\tfrac12h_i\theta_i^2
β\betaheavy-ball momentum coefficient, m←βm+gm\leftarrow\beta m+g, θ←θ−ηm\theta\leftarrow\theta-\eta m
P=HpP=H^ppreconditioner of power pp, applied to the gradient as P−1P^{-1}, with 0≤p≤10\le p\le1: p=0p=0 is plain SGD and p=1p=1 the Newton direction
κ\kappacondition number h1/hdh_1/h_d, the ratio of the sharpest to the flattest curvature
Weight norms and Hyperball
WWa weight matrix
W^\hat Wdirection of a weight matrix, W^=W/∥W∥F\hat W=W/\|W\|_F
∥⋅∥F\|\cdot\|_FFrobenius norm, the root sum of squared entries
rrweight norm r=∥W∥Fr=\|W\|_F
r∗r_*equilibrium weight norm, where growth from gradient steps balances shrinkage from weight decay
GGgradient norm at r=1r=1 in Lecture 3's toy case; at norm rr the gradient has norm G/rG/r
UUFrobenius norm of Adam's update in the noise-dominated model, U=(1−β1)/(1+β1) dindoutU=\sqrt{(1-\beta_1)/(1+\beta_1)}\,\sqrt{d_{in}d_{out}}
α\alpha1−ηλ1-\eta\lambda, the per-update shrink factor
ηang\eta_{\rm ang}angular step, ∥W^t+1−W^t∥F\|\hat W_{t+1}-\hat W_t\|_F
RRHyperball's radius ∥W0∥F\|W_0\|_F, the Frobenius norm of the matrix at initialization, kept for the whole run
utu_tthe base optimizer's update for a weight matrix (Adam's or Muon's), which Hyperball normalizes to unit Frobenius norm
Constants
kkcurvature of the course's quadratic rule for the excess loss in log⁡2\log_2 of ηλ\eta\lambda; 0.0074 to 0.0238 across budgets

Context. A neural-network training step is θt=θt−1−η∇ℓt(θt−1)\theta_t=\theta_{t-1}-\eta\nabla\ell_t(\theta_{t-1}): stochastic gradient descent stepping against the current batch gradient plus three additions that matter in practice: batch averaging, a a positive definite matrix AtA_t applied to the gradient before the step, θt=θt−1−ηAt∇ℓt\theta_t=\theta_{t-1}-\eta A_t\nabla\ell_t, rescaling the step per direction, and momentum. W←W−ηtm^/(v^+ϵ)−ηtλWW\leftarrow W-\eta_t\hat m/(\sqrt{\hat v}+\epsilon)-\eta_t\lambda W with running averages m^,v^\hat m,\hat v of the gradient and its square (rates β1,β2\beta_1,\beta_2): decoupled weight decay acts on WW directly instead of passing through v^\sqrt{\hat v} combines momentum, a diagonal preconditioner, and decoupled weight decay. Lecture 3 of Hashimoto and Kotha's Stanford course CS 312 (Deep Learning Alchemy) examines how batch size interacts with momentum and preconditioning. It also asks what a learning rate means for weights whose scale the loss ignores. Deep-learning optimizers are judged by how quickly they reach a loose solution rather than by asymptotic convergence. Adam's original convergence proof was wrong, and language models never train to convergence. The lecture therefore relies on two compact models that predict real runs: Zhang et al.'s (2019) L=12θ⊤HθL=\tfrac12\theta^\top H\theta with gradient queries returning HθH\theta plus Gaussian noise whose variance scales as 1/B1/B, and Wen et al.'s scale-invariant weight-norm analysis (2025) and Hyperball optimizer (2026).

Takeaways in practice. In a noisy quadratic, every direction approaches a steady-state noise floor proportional to the learning rate η\eta divided by the batch size BB. Momentum and preconditioning speed convergence, but they also raise that floor. Both therefore pay off mainly at large batch; at small batch, tuning η\eta erases most of momentum's benefit. For any weight matrix whose output is normalized, the loss sees only the matrix's direction. Decoupled weight decay λ\lambda sets an equilibrium weight norm, and that norm sets how far each step turns the direction, about 2ηλ\sqrt{2\eta\lambda} radians per step for SGD. In practice, tune η\eta and λ\lambda jointly along lines of constant ηλ\eta\lambda. Missing the optimum by a factor of 2 costs 0.007 to 0.009 in loss on d8 at 0.3B tokens or more. When raising batch size at a fixed token budget, scale λ\lambda in proportion to BB instead of scaling η\eta. Late in training, gradient norms of normalized layers climb as the learning rate decays; that climb reflects shrinking weight norms rather than instability. Norm-constrained optimizers like Hyperball make η\eta the turning angle directly and produce a cleaner optimal-learning-rate trend across token budgets.

The model organism. The course runs its experiments on d8, an 8-layer, width-512, 8-head Llama-style transformer with a 4,096-token vocabulary, about 35M parameters, and RMS normalization of each attention head's queries and keys before their dot product. Reading note: Small-scale proxies for large-scale Transformer training instabilities. Each run trains in one pass over fresh data at context length 1,024. The default recipe uses AdamW with peak learning rate η=.003\eta=.003, weight decay λ=.1\lambda=.1, Adam's averaging rates for the gradient and its square, here .9.9 and .95.95 equal to .9.9 and .95.95, and sequences of 1,024 tokens per update in d8, or gradient queries averaged per step in the noisy quadratic model equal to 64. The default run uses 1% linear warmup, linear decay to zero, and gradient clipping at norm 1. A 614.4M-token run takes about 15 minutes on one H100. Weight decay applies only to weight matrices, never to embeddings, normalization gains, or biases. All d8 measurements below come from the course's assignments and quizzes.

The noisy quadratic model and the noise floor. To see how batch size trades against learning rate, rotate a quadratic loss into the eigenbasis of its Hessian HH, giving L(θ)=12θ⊤Hθ=12∑ihiθi2L(\theta)=\tfrac12\theta^\top H\theta=\tfrac12\sum_ih_i\theta_i^2 with curvatures the eigenvalues of the Hessian HH along its dd principal directions. Suppose each gradient query returns Hθ+εH\theta+\varepsilon with ε∼N(0,C)\varepsilon\sim N(0,C), so a batch of BB queries has noise covariance C/BC/B. Zhang et al. assume why: each eigendirection then decouples with a closed-form expected loss; they set C=HC=H, which holds near the data distribution and proves tight for a CNN and moderate for a transformer, with variances cic_i. Plain SGD then updates coordinate ii independently via θi←(1−ηhi)θi+ηci/B ξ\theta_i\leftarrow(1-\eta h_i)\theta_i+\eta\sqrt{c_i/B}\,\xi for standard normal ξ\xi. For ηhi<2\eta h_i\lt2, the expected loss ℓi=12hiθi2\ell_i=\tfrac12h_i\theta_i^2 after tt steps splits into a decaying initial term and a steady-state floor:E ℓi(t)=(1−ηhi)2t E ℓi(0)⏟convergence+(1−(1−ηhi)2t)×ηci2B(2−ηhi)⏟noise floor.\begin{aligned}\mathbb E\,\ell_i(t)&=\underbrace{(1-\eta h_i)^{2t}\,\mathbb E\,\ell_i(0)}_{\text{convergence}}\\&\quad+\big(1-(1-\eta h_i)^{2t}\big)\\&\qquad\times\underbrace{\frac{\eta c_i}{2B(2-\eta h_i)}}_{\text{noise floor}}.\end{aligned}A larger learning rate shrinks the first term faster but raises the floor. A larger batch lowers the floor in proportion. When ηhi\eta h_i is small, the floor is roughly ηci/(4B)\eta c_i/(4B) and depends only on η/B\eta/B. Doubling both BB and η\eta holds the floor fixed and finishes in half as many steps, giving linear scaling. That trade breaks once ηh1\eta h_1 hits the stability boundary 2 and the sharpest direction diverges. Past this the batch size beyond which doubling BB no longer halves the steps to a target loss, because extra samples mostly average noise that is already small (McCandlish et al., 2018). Reading note: Learning-rate schedules and batch size, raising BB can no longer be paired with a larger η\eta, and step savings saturate. In their simulations, Zhang et al. set hi=1/ih_i=1/i to match an estimated CNN Hessian spectrum and take d=104d=10^4, giving condition number 10410^4.

Momentum raises the floor and helps at large batch. Heavy-ball momentum, m←βm+gm\leftarrow\beta m+g and θ←θ−ηm\theta\leftarrow\theta-\eta m, shifts both the noise floor and the stability barrier. By Zhang et al.'s Theorem 1, direction ii settles at the steady-state noise floorℓi∞=(1+β) ηci2B(2β+2−ηhi)(1−β)≈ηci4B(1−β)(ηhi≪1).\begin{aligned}\ell_i^{\infty}&=\frac{(1+\beta)\,\eta c_i}{2B(2\beta+2-\eta h_i)(1-\beta)}\\&\approx\frac{\eta c_i}{4B(1-\beta)}\quad(\eta h_i\ll1).\end{aligned}At small ηhi\eta h_i, this matches plain SGD's floor at the η/(1−β)\eta/(1-\beta): the plain-SGD step size with the same convergence rate and noise floor as momentum SGD at small ηhi\eta h_i η/(1−β)\eta/(1-\beta). Whenever a direction is β<(1−ηhi)2\beta\lt(1-\sqrt{\eta h_i})^2: both recursion roots are real so the iterate approaches the minimum without oscillating; above it, the iterate spirals in, its convergence factor is also about 1−ηhi/(1−β)1-\eta h_i/(1-\beta). Total loss is bottlenecked by the flattest direction, which optimal momentum keeps overdamped. At small batch, the noise floor forces a tiny η\eta, so momentum behaves like plain SGD with a rescaled learning rate and tuning η\eta erases its advantage. At large batch, the floor is low and plain SGD hits the stability wall η<2/h1\eta\lt2/h_1. Momentum pushes the effective rate η/(1−β)\eta/(1-\beta) past that wall.

Preconditioning speeds noise-free convergence while amplifying flat-direction noise. Under Zhang et al.'s convention, preconditioning by P=HpP=H^p multiplies the gradient by P−1P^{-1} for preconditioner strength: p=0p=0 is plain SGD and p=1p=1 is the exact Newton step. That step is equivalent to plain SGD on a quadratic with curvatures hi1−ph_i^{1-p} and noise variances cihi−pc_ih_i^{-p}. The κ=h1/hd\kappa=h_1/h_d: ratio of sharpest to flattest curvature, setting how many steps the flattest direction needs at the largest stable rate shrinks from κ\kappa to κ1−p\kappa^{1-p}, speeding noise-free convergence by up to κp\kappa^p. Direction ii's noise floor becomes ηcihi−p/(2B(2−ηhi1−p))\eta c_ih_i^{-p}/\big(2B(2-\eta h_i^{1-p})\big). That floor grows with pp because preconditioning amplifies noise in flat directions, so most of the gain appears once BB is large enough that the floor no longer bottlenecks training. Zhang et al. test these optimizers on CNNs (MNIST, Fashion-MNIST, and CIFAR-10) and a two-layer transformer on LM1B by plotting steps-to-target against batch size. Momentum matches plain SGD at small batch and extends linear scaling to larger batches. Adam and Kronecker-factored approximate curvature: approximates each layer's curvature as A⊗GA\otimes G (input-activation covariance times output-gradient covariance), so inversion splits into two small inverses A−1⊗G−1A^{-1}\otimes G^{-1} (Martens and Grosse, 2015) push linear scaling further, and K-FAC also saves a small constant factor of steps at small batch. The noisy quadratic simulation reproduces the same ordering in seconds. Exponential moving averaging (EMA) of the iterates lowers the floor without slowing convergence and becomes redundant at large batch.

Momentum on d8: flat at small batch, sharp at large batch. The course tests this prediction on d8 at 614.4M tokens by sweeping β1\beta_1 from 0 to .99.99 at β2=.95\beta_2=.95, holding each batch size's learning rate and weight decay fixed. At batch 8, final validation loss stays nearly flat across β1\beta_1. All values lie within 0.041 of one another, moving from 2.973 at β1=0\beta_1=0 to 2.937 at .9.9. At batch 256, the curve turns sharp: loss drops from 3.233 at β1=0\beta_1=0 to 2.970 at .9.9, then climbs back to 3.126 at .99.99. That pattern is the characteristic momentum shape predicted by the noisy quadratic model.

Scale-invariant weights and the angular step. Consider a weight matrix WW whose output passes through normalization, such as RMSNorm(Wx)\mathrm{RMSNorm}(Wx) or queries and keys under QK-norm. Scaling WW leaves the loss unchanged, so scale invariance: rescaling WW by any c>0c\gt0 leaves the loss untouched for all c>0c\gt0. Differentiating in cc shows that the gradient is orthogonal to the weight, ⟨∇L(W),W⟩=0\langle\nabla L(W),W\rangle=0. Differentiating in WW shows that it scales inversely with norm, ∇L(cW)=∇L(W)/c\nabla L(cW)=\nabla L(W)/c. Because the loss depends on WW only through its unit direction W^=W/∥W∥F\hat W=W/\|W\|_F, where ∥W∥F=(∑ijWij2)1/2\|W\|_F=(\sum_{ij}W_{ij}^2)^{1/2} is the Frobenius norm, a fixed-size update rotates W^\hat W less when ∥W∥F\|W\|_F is larger. The ηang=∥W^t+1−W^t∥F\eta_{\rm ang}=\|\hat W_{t+1}-\hat W_t\|_F: distance the weight direction moves in one update (the turning angle in radians for small steps) measures that per-step change in direction. Without weight decay, every orthogonal gradient step lengthens WW, so the angular step shrinks outside the schedule's control.

Equilibrium norm and turning angle for SGD. A two-dimensional toy case shows how weight decay stabilizes the angular step. Take SGD with decoupled weight decay, W←(1−ηλ)W−ηgW\leftarrow(1-\eta\lambda)W-\eta g, on a scale-invariant loss. Let Frobenius norm of WW; r∗r_* denotes the equilibrium norm where gradient growth balances weight-decay shrinkage be the weight norm and GG the gradient norm at r=1r=1, so the gradient gg has norm G/rG/r. Because g⊥Wg\perp W, Pythagoras' theorem gives the squared-norm recursion. Setting rt+1=rt=r∗r_{t+1}=r_t=r_* for small ηλ\eta\lambda solves for the equilibrium:rt+12=(1−ηλ)2rt2+η2G2rt2,2ηλ r∗2≈η2G2r∗2  ⟹  r∗4≈ηG22λ.\begin{aligned}r_{t+1}^2&=(1-\eta\lambda)^2r_t^2+\frac{\eta^2G^2}{r_t^2},\\2\eta\lambda\,r_*^2&\approx\frac{\eta^2G^2}{r_*^2}\implies r_*^4\approx\frac{\eta G^2}{2\lambda}.\end{aligned}At equilibrium, the angular step is ηang=η(G/r∗)/r∗=ηG/r∗2≈2ηλ\eta_{\rm ang}=\eta(G/r_*)/r_*=\eta G/r_*^2\approx\sqrt{2\eta\lambda}. It depends only on the product ηλ\eta\lambda.

Equilibrium norm and turning angle for AdamW. Unlike SGD, AdamW keeps its update magnitude fixed regardless of gradient size, and its momentum correlates consecutive updates with WW. Wen et al. (2025, 2026) analyze this balance in a noise-dominated model where every gradient entry is i.i.d. N(0,σ2)N(0,\sigma^2) and Adam's second moment is exact. A dout×dind_{out}\times d_{in} matrix then receives updates of Frobenius norm U=(1−β1)/(1+β1) dindoutU=\sqrt{(1-\beta_1)/(1+\beta_1)}\,\sqrt{d_{in}d_{out}}, the Frobenius norm of Adam's update under i.i.d. Gaussian gradients. Set the per-update multiplicative shrinkage factor from decoupled weight decay for the per-update weight-decay factor. Once training has run long enough to forget initialization, the equilibrium norm and angular step satisfyr∗=ηU1+αβ1(1−α2)(1−αβ1),ηang=2ηλ(1−β1)1+αβ1≈2ηλ(1−β1)1+β1.\begin{aligned}r_*&=\eta U\sqrt{\frac{1+\alpha\beta_1}{(1-\alpha^2)(1-\alpha\beta_1)}},\\\eta_{\rm ang}&=\sqrt{\frac{2\eta\lambda(1-\beta_1)}{1+\alpha\beta_1}}\\&\approx\sqrt{\frac{2\eta\lambda(1-\beta_1)}{1+\beta_1}}.\end{aligned}For small ηλ\eta\lambda, the norm simplifies to r∗≈Uη/(2λ)(1+β1)/(1−β1)r_*\approx U\sqrt{\eta/(2\lambda)}\sqrt{(1+\beta_1)/(1-\beta_1)}. A numpy simulation of this model at dindout=20,000d_{in}d_{out}=20{,}000, run for this note, matches both formulas to within 0.3%.

Three predictions of the equilibrium model. First, holding ηλ\eta\lambda constant fixes the angular step ηang\eta_{\rm ang} while scaling r∗∝η/λr_*\propto\sqrt{\eta/\lambda}. Doubling η\eta and halving λ\lambda therefore leaves the loss trajectory nearly unchanged while doubling the weight norm. Second, as the schedule lowers ηt\eta_t late in training, r∗∝ηt/λr_*\propto\sqrt{\eta_t/\lambda} shrinks. Because ∇L(cW)=∇L(W)/c\nabla L(cW)=\nabla L(W)/c, the gradient norm climbs like λ/ηt\sqrt{\lambda/\eta_t} even while the loss keeps falling. Defazio (2025) uses this climb to argue for decaying weight decay alongside the learning rate, setting λt∝ηt\lambda_t\propto\eta_t. Third, rt2r_t^2 relaxes toward r∗2r_*^2 by a factor α2≈1−2ηλ\alpha^2\approx1-2\eta\lambda per update, forgetting initialization after a few multiples of 1/(2ηλ)1/(2\eta\lambda) updates. At d8's defaults, ηλ=3×10−4\eta\lambda=3\times10^{-4} gives 1/(2ηλ)≈1,7001/(2\eta\lambda)\approx1{,}700 updates. A 614.4M-token run takes 9,375 updates of 65,536 tokens, so d8's norms reach equilibrium within a run (computed here). Weight decay also has effects beyond norm control, such as regularizing the network's Jacobian, which this model leaves aside.

The loss depends mostly on the product ηλ\eta\lambda. Experiments confirm both parts of the scaling prediction. In the Hyperball paper, two AdamW runs share ηλ=4×10−4\eta\lambda=4\times10^{-4}: one uses (η,λ)=(0.002,0.2)(\eta,\lambda)=(0.002,0.2) and the other uses (0.004,0.1)(0.004,0.1). Both trace nearly identical training-loss curves, while the second run's query and key norms sit roughly twice as high as the first's. On d8, fitting a local quadratic in (log⁡η,log⁡λ)(\log\eta,\log\lambda) across 3-by-3 grids at four budgets from 153.6M to 1.2288B tokens reveals long valleys along lines of constant ηλ\eta\lambda. When the ratio η/λ\eta/\lambda sits at its optimum, excess validation loss over the best cell followsΔL≈k(log⁡2ηλ(ηλ)best)2.\Delta L\approx k\Big(\log_2\frac{\eta\lambda}{(\eta\lambda)_{\rm best}}\Big)^2.The fitted curvature fitted curvature of ΔL\Delta L in log⁡2(ηλ)\log_2(\eta\lambda): 0.0238 at 153.6M tokens, 0.0084 and 0.0092 at the middle budgets, and 0.0074 at 1.2288B tokens falls from 0.0238 at 153.6M tokens to 0.0074 at 1.2288B tokens. Points away from the optimal ratio scatter slightly above this curve. As the token budget grows, the optimal product (ηλ)best(\eta\lambda)_{\rm best} falls cleanly along a straight line on log-log axes.

Larger batches call for larger weight decay. Raising batch size BB at a fixed token budget cuts the number of updates in proportion. If ηλ\eta\lambda per update stays fixed, the norm's relaxation time 1/(2ηλ)1/(2\eta\lambda) eats up a larger share of the run. On d8, power laws fitted over B=8B=8 to 64 compare two ways to compensate: hold λ=.1\lambda=.1 and scale η\eta with BB, or hold η=.0015\eta=.0015 and scale λ\lambda with BB. Extrapolated to B=128B=128 and 256, the weight-decay rule lands within 0.003 of the best grid point at both batches. The learning-rate rule misses by 0.009 at 128 and by 0.130 at 256 because the optimal learning rate stops growing at large batch. As Lecture 3 summarizes, weight decay controls the effective learning rate in one-pass training, and letting that rate drift uncontrolled is often not ideal.

Hyperball: fixing the norm and step length directly. Weight decay sets the weight norm and turning angle only indirectly. Hyperball controls both directly. It holds every weight matrix at its initial Frobenius norm R=∥W0∥FR=\|W_0\|_F: Frobenius norm of the matrix at initialization, held constant throughout training and steps a fixed distance ηR\eta R along the normalized update utu_t of a base optimizer such as Adam or replaces each weight matrix's momentum UΣV⊤U\Sigma V^\top with its orthogonal polar factor UV⊤UV^\top (all singular values set to 1). Reading note: Muon:
def hyperball_step(W, u, lr, R):\n    # W: weight matrix, u: base optimizer's update (Adam or Muon)\n    # R: Frobenius norm of W at initialization\n    u_hat = u / u.norm()                 # unit Frobenius norm\n    W_trial = W - lr * R * u_hat         # step of length lr * R\n    return R * W_trial / W_trial.norm()  # back onto the sphere of radius R
To first order, W^\hat W turns by η\eta radians per step regardless of matrix shape, with no weight decay. Wen et al. apply Hyperball to attention and MLP matrices, leaving embeddings, normalization gains, and other scale-sensitive parameters on Adam. For a matrix that reads a normalized input, fixing its norm removes no functions. The post-normalization gain γ\gamma absorbs any scale because W(γ⊙RMSNorm(h))W(\gamma\odot\mathrm{RMSNorm}(h)) is invariant under (W,γ)↦(cW,γ/c)(W,\gamma)\mapsto(cW,\gamma/c).

Hyperball in practice: token savings and transfer. On 1.2B-parameter Qwen3-style models with QK-norm, Muon with Hyperball reaches losses that AdamW needs 20 to 30% more tokens to match, compared with about 10% for Muon with weight decay. Those runs span one to eight times the Chinchilla-optimal token count (about 20 tokens per parameter). The advantage widens with training length, as Hyperball starts slightly behind and overtakes during learning-rate decay. Hyperball also transfers better across shape on a hybrid-normalization variant trained for 10B tokens per run. Across depths 4 to 512 at width 128 and widths 128 to 2,048 at depth 4, the optimal learning rate drifts by about 1.4 times for Adam and Muon with Hyperball. Across depth, it drifts by about 3 times for AdamW and 4 times for Muon with weight decay. On d8, a sweep from 0.15B to 4.9B tokens compares AdamW against Hyperball (weight decay off, with Adam on embeddings and gains at .1041η.1041\eta). Hyperball's optimal peak learning rate falls smoothly along a near-straight log-log line, whereas AdamW's at λ=.1\lambda=.1 rises up to 1.2B tokens and then falls (read off a plot). Unlike AdamW's, Hyperball's line can roughly be extended to longer horizons.

Caveats. The noisy quadratic model assumes a quadratic loss with noise aligned to curvature. It predicts batch-size trade-offs well, but high-learning-rate full-batch gradient descent on real networks produces noise-like loss curves that no quadratic explains, a topic taken up later in the course. The weight-norm equilibrium formulas assume equal variance in every coordinate, as in the i.i.d. N(0,σ2)N(0,\sigma^2) gradient entries of the noise-dominated model above, noise-dominated gradients, constant hyperparameters over a long history, and exact scale invariance. Real layers are only approximately scale-invariant, the schedule moves the equilibrium over training, and short or large-batch runs may never reach it. The d8 measurements come from one 35M-parameter model, mostly on a single seed, and the fitted curvature kk varies threefold across token budgets. Hyperball's width-transfer claim also held less cleanly on d8, where its optimal learning rate still fell with width under the baseline parametrization. For Muon, the overlap between successive updates follows a K(ρ)=E⟨msign⁡(Z),msign⁡(ρZ+1−ρ2Z′)⟩/min⁡(dout,din)K(\rho)=\mathbb E\langle\operatorname{msign}(Z),\operatorname{msign}(\rho Z+\sqrt{1-\rho^2}Z')\rangle/\min(d_{out},d_{in}) for independent standard Gaussian Z,Z′∈Rdout×dinZ,Z'\in\mathbb R^{d_{out}\times d_{in}} and polar factor msign⁡\operatorname{msign}; lag hh has ρ=β1h\rho=\beta_1^h and 0≤K(ρ)≤ρ0\le K(\rho)\le\rho bounded by β1h\beta_1^h at lag hh. That kernel changes the angular step by a constant factor while keeping the same ηλ\sqrt{\eta\lambda} scaling for small ηλ\eta\lambda.

Terms

Noisy quadratic model
loss 12θ⊤Hθ\tfrac12\theta^\top H\theta, gradients Hθ+εH\theta+\varepsilon with ε∼N(0,C/B)\varepsilon\sim N(0,C/B), CC diagonal in HH's eigenbasis
Noise floor
ηci/(2B(2−ηhi))\eta c_i/(2B(2-\eta h_i)) per direction: grows with η\eta, falls with BB
Critical batch
batch size past which doubling the batch no longer roughly halves the steps to a target
Momentum's effective learning rate
η/(1−β)\eta/(1-\beta): momentum SGD matches SGD at this rate when ηhi\eta h_i is small
Preconditioning HpH^p
condition number κ→κ1−p\kappa\to\kappa^{1-p}, noise floor larger for larger pp
Scale invariance
L(cW)=L(W)L(cW)=L(W); then ∇L⊥W\nabla L\perp W and ∇L(cW)=∇L(W)/c\nabla L(cW)=\nabla L(W)/c
Angular step
∥W^t+1−W^t∥F\|\hat W_{t+1}-\hat W_t\|_F; at equilibrium 2ηλ\sqrt{2\eta\lambda} for SGD, ≈2ηλ(1−β1)/(1+β1)\approx\sqrt{2\eta\lambda(1-\beta_1)/(1+\beta_1)} for AdamW
Equilibrium norm (AdamW)
r∗≈Uη/(2λ)(1+β1)/(1−β1)r_*\approx U\sqrt{\eta/(2\lambda)}\sqrt{(1+\beta_1)/(1-\beta_1)}; reached after a few multiples of 1/(2ηλ)1/(2\eta\lambda) updates
Product rule
excess loss ≈k (log⁡2[ηλ/(ηλ)best])2\approx k\,(\log_2[\eta\lambda/(\eta\lambda)_{\rm best}])^2, k≈0.007k\approx0.007 to 0.0240.024 on d8
Batch scaling
at a fixed token budget, scale the weight decay with the batch size; the optimal learning rate stops growing
Hyperball
W←R⋅normalize(W−ηR u/∥u∥F)W\leftarrow R\cdot\mathrm{normalize}(W-\eta R\,u/\|u\|_F), R=∥W0∥FR=\|W_0\|_F, no weight decay

Sources

Lecture 3, “Optimization 1: Anatomy of an optimizer, the noisy quadratic model, norms and weight decay” (Oct 1, 2026), of Stanford CS 312 Deep Learning Alchemy, Fall 2026. Taught by Tatsunori Hashimoto and Suhas Kotha; course staff Kaiyue Wen and Tristan Thrush (CAs).

Course site Lecture slides Online quiz Quiz answers Assignment Assignment code

The lessons, experiments, figures and quiz problems in this note are the course's, shown here with the instructors' permission.

Connected notes

Threads