Type at least 2 letters. Enter opens the first result, Esc closes.

    Quick recap

    The key takeaways of every lesson on one page. Read it in ten minutes to refresh the whole track; open a lesson when a point feels unclear.

    01 Loss surfaces and gradient descent

    • Gradient descent: xk+1=xk−η∇f(xk)x_{k+1} = x_k - \eta\nabla f(x_k), with learning rate (step size) η>0\eta > 0.
    • −∇f(x)-\nabla f(x) is the direction of steepest descent (Cauchy–Schwarz), and ∇f(x)\nabla f(x) is perpendicular to the level set through xx.
    • On f=λ2x2f = \tfrac{\lambda}{2}x^2: xk=(1−ηλ)kx0x_k = (1 - \eta\lambda)^k x_0; it converges if and only if 0<η<2/λ0 < \eta < 2/\lambda, and oscillates (but converges) for 1/λ<η<2/λ1/\lambda < \eta < 2/\lambda.
    • With several curvatures, one step size must satisfy η<2/λmax⁡\eta < 2/\lambda_{\max}; the flat directions then shrink only by 1−ηλmin⁡1 - \eta\lambda_{\min} per step.
    • The best fixed step on 12(λ1x12+λ2x22)\tfrac12(\lambda_1 x_1^2 + \lambda_2 x_2^2) is 2/(λ1+λ2)2/(\lambda_1 + \lambda_2), with factor (λ2−λ1)/(λ2+λ1)(\lambda_2 - \lambda_1)/(\lambda_2 + \lambda_1) per step.
    • A large ratio of curvatures (condition number κ\kappa) causes zig-zag across the valley and a slow crawl along it.
    • If gradient descent converges, the limit is a stationary point; on a nonconvex loss the start decides which one.
    • Stop on a small gradient norm plus a step budget; a small change of ff alone can stop far from the minimum.

    02 Convexity, smoothness, conditioning

    • ff is convex when chords lie on or above the graph; for differentiable ff, when f(y)≥f(x)+∇f(x)⊤(y−x)f(y) \ge f(x) + \nabla f(x)^\top(y - x) (tangents below); for twice-differentiable ff, when ∇2f⪰0\nabla^2 f \succeq 0 everywhere.
    • For a convex function every local minimum is global, and a point with ∇f=0\nabla f = 0 is a global minimizer.
    • Least squares and logistic regression are convex; neural-network losses are not, because permuting hidden units gives separate minimizers whose midpoint is worse.
    • LL-smooth: ∇f\nabla f is LL-Lipschitz (∇2f⪯LI\nabla^2 f \preceq LI for convex C2C^2 functions). μ\mu-strongly convex: ∇2f⪰μI\nabla^2 f \succeq \mu I. Condition number κ=L/μ\kappa = L/\mu; for a quadratic, the ratio of the extreme eigenvalues.
    • Descent lemma: f(y)≤f(x)+∇f(x)⊤(y−x)+L2∥y−x∥2f(y) \le f(x) + \nabla f(x)^\top(y - x) + \tfrac L2\|y - x\|^2; a step 1/L1/L decreases ff by at least ∥∇f∥2/(2L)\|\nabla f\|^2/(2L).
    • PL inequality: ∥∇f(x)∥2≥2μ(f(x)−f⋆)\|\nabla f(x)\|^2 \ge 2\mu(f(x) - f^\star); strong convexity implies it, but some nonconvex functions satisfy it too.
    • Feature scaling is a diagonal preconditioner: it changes κ\kappa from about smax⁡2/smin⁡2s_{\max}^2/s_{\min}^2 to about 1 for uncorrelated features, but cannot remove correlations (κ=(1+∣ρ∣)/(1−∣ρ∣)\kappa = (1 + |\rho|)/(1 - |\rho|)).

    03 GD rates and line search

    • On a quadratic with eigenvalues in [μ,L][\mu, L], gradient descent multiplies the error component along each eigenvector qiq_i by 1−ηλi1 - \eta\lambda_i; the total factor is ρ(η)=max⁡(∣1−ημ∣,∣1−ηL∣)\rho(\eta) = \max(|1 - \eta\mu|, |1 - \eta L|).
    • Gradient descent on a quadratic converges from every start exactly when 0<η<2/λmax⁡0 < \eta < 2/\lambda_{\max}; the steep direction sets this limit.
    • The best fixed step is 2/(μ+L)2/(\mu + L) with factor (κ−1)/(κ+1)(\kappa - 1)/(\kappa + 1): about κ2ln⁡(1/ε)\tfrac{\kappa}{2}\ln(1/\varepsilon) steps for accuracy ε\varepsilon. The step 1/L1/L needs about twice as many.
    • For LL-smooth, μ\mu-strongly convex ff, the step 1/L1/L gives f(xk)−f⋆≤(1−μ/L)k(f(x0)−f⋆)f(x_k) - f^\star \le (1 - \mu/L)^k(f(x_0) - f^\star) (descent lemma + PL).
    • For LL-smooth convex ff, the step 1/L1/L gives f(xk)−f⋆≤L∥x0−x⋆∥2/(2k)f(x_k) - f^\star \le L\|x_0 - x^\star\|^2/(2k): a sublinear rate, and xkx_k may converge much more slowly.
    • Armijo: φ(α)≤φ(0)+c1αφ′(0)\varphi(\alpha) \le \varphi(0) + c_1\alpha\varphi'(0) rejects steps that are too long. Backtracking (α0,τα0,…\alpha_0, \tau\alpha_0, \dots) stops with α≥min⁡(α0,2τ(1−c1)/L)\alpha \ge \min(\alpha_0, 2\tau(1 - c_1)/L), without knowing LL.
    • Wolfe = Armijo + curvature (φ′(α)≥c2φ′(0)\varphi'(\alpha) \ge c_2\varphi'(0), or ∣φ′(α)∣≤c2∣φ′(0)∣|\varphi'(\alpha)| \le c_2|\varphi'(0)| for strong Wolfe), with 0<c1<c2<10 < c_1 < c_2 < 1; usually c1=10−4c_1 = 10^{-4}, c2=0.9c_2 = 0.9.
    • The curvature condition guarantees y⊤s>0y^\top s > 0, which keeps the BFGS matrix positive definite.

    04 Momentum and Nesterov

    • Heavy ball: xk+1=xk−η∇f(xk)+β(xk−xk−1)x_{k+1} = x_k - \eta\nabla f(x_k) + \beta(x_k - x_{k-1}). For a constant gradient the step approaches ηg/(1−β)\eta g/(1 - \beta): ten times larger for β=0.9\beta = 0.9.
    • Momentum is a low-pass filter: gradient parts that keep their sign add up, parts that flip sign cancel.
    • On a quadratic each eigen-direction follows ck+1=(1+β−ηλ)ck−βck−1c_{k+1} = (1 + \beta - \eta\lambda)c_k - \beta c_{k-1}, with roots of z2−(1+β−ηλ)z+βz^2 - (1 + \beta - \eta\lambda)z + \beta; complex roots have size exactly β\sqrt\beta.
    • Polyak's parameters η=4/(L+μ)2\eta = 4/(\sqrt L + \sqrt\mu)^2, β=((κ−1)/(κ+1))2\beta = ((\sqrt\kappa - 1)/(\sqrt\kappa + 1))^2 give the factor (κ−1)/(κ+1)(\sqrt\kappa - 1)/(\sqrt\kappa + 1): about κ\sqrt\kappa steps per digit instead of κ\kappa.
    • Heavy ball on a quadratic is stable exactly when 0≤β<10 \le \beta < 1 and ηλmax⁡<2(1+β)\eta\lambda_{\max} < 2(1 + \beta).
    • Heavy ball's acceleration is proven only for quadratics; on some smooth strongly convex functions it cycles (Lessard–Recht–Packard).
    • Nesterov's method takes the gradient at a look-ahead point. It gives f(xk)−f⋆≤2L∥x0−x⋆∥2/(k+1)2f(x_k) - f^\star \le 2L\|x_0 - x^\star\|^2/(k+1)^2 for convex ff and about (1−1/κ)k(1 - 1/\sqrt\kappa)^k for strongly convex ff, and it is not monotone.
    • No method that moves only along past gradients can beat these rates by more than a constant factor (lower bounds); CG is optimal for one fixed quadratic.

    05 SGD and batch size

    • A minibatch gradient is unbiased, E[g]=∇f(x)\mathbb E[g] = \nabla f(x), with variance σ2/B\sigma^2/B.
    • Far from x⋆x^\star all examples agree on the direction; near x⋆x^\star (the region of confusion) they disagree, and the noise does not shrink.
    • With a constant step η≤1/L\eta \le 1/L on a μ\mu-strongly convex, LL-smooth ff: E∥ek∥2≤(1−ημ)k∥e0∥2+ησ2/(μB)\mathbb E\|e_k\|^2 \le (1 - \eta\mu)^k\|e_0\|^2 + \eta\sigma^2/(\mu B). SGD converges linearly to a noise ball, not to x⋆x^\star.
    • In 1D mean estimation the exact floor is ησ2/(2−η)\eta\sigma^2/(2 - \eta); a step 1/(k+1)1/(k+1) gives the running mean and the error σ2/k\sigma^2/k.
    • To reach x⋆x^\star, the steps must satisfy the Robbins–Monro conditions ∑ηk=∞\sum\eta_k = \infty and ∑ηk2<∞\sum\eta_k^2 < \infty; ηk=c/(k0+k)\eta_k = c/(k_0 + k) with cμ>1c\mu > 1 gives E∥ek∥2=O(1/k)\mathbb E\|e_k\|^2 = O(1/k).
    • Linear scaling rule: multiply the learning rate by cc when the batch grows by cc. It holds while B≪BnoiseB \ll B_{\text{noise}} and the step stays below the curvature limit, with warmup.
    • The simple noise scale Bsimple=tr⁡Σ/∥G∥2B_{\text{simple}} = \operatorname{tr}\Sigma/\|G\|^2 estimates the critical batch size; above it, extra examples per step are mostly wasted.
    • Per example gradient, SGD's cost to a fixed accuracy does not depend on nn; GD's grows like nn. On large datasets SGD wins.

    06 AdaGrad, RMSProp, Adam, AdamW

    • An EMA mt=βmt−1+(1−β)gtm_t = \beta m_{t-1} + (1-\beta)g_t remembers about 1/(1−β)1/(1-\beta) steps; with m0=0m_0 = 0 it is biased by the factor 1−βt1 - \beta^t.
    • AdaGrad divides by the root of the sum of squared gradients (steps decay like 1/t1/\sqrt t); RMSProp uses an EMA instead, without bias correction (first step 10η10\eta).
    • Adam: mtm_t and vtv_t are EMAs of gg and g2g^2; m^t=mt/(1−β1t)\hat m_t = m_t/(1-\beta_1^t), v^t=vt/(1−β2t)\hat v_t = v_t/(1-\beta_2^t); θt=θt−1−η m^t/(v^t+ε)\theta_t = \theta_{t-1} - \eta\,\hat m_t/(\sqrt{\hat v_t} + \varepsilon). Defaults 10−310^{-3}, (0.9,0.999)(0.9, 0.999), 10−810^{-8}.
    • Adam's first step is about ηsign⁡(g1)\eta\operatorname{sign}(g_1) in every coordinate; the step is invariant to the gradient scale and is typically at most about η\eta.
    • Adam is a diagonal preconditioner: it removes bad scaling along the coordinate axes, not along rotated directions.
    • A large ε\varepsilon turns Adam into momentum SGD with step η/ε\eta/\varepsilon; β2=0.95\beta_2 = 0.95 gives a shorter memory than 0.9990.999 and reacts faster to changes in the gradient scale.
    • L2 regularization equals weight decay for plain SGD, but inside Adam it is divided by v^\sqrt{\hat v}, so weights with large gradients are decayed less. AdamW decays every weight by 1−ηλ1 - \eta\lambda per step.

    07 Schedules, warmup and clipping

    • A schedule gives η(t)\eta(t). Warmup + cosine: η=ηmax⁡t/W\eta = \eta_{\max}t/W for t<Wt < W, then ηmin⁡+12(ηmax⁡−ηmin⁡)(1+cos⁡πp)\eta_{\min} + \tfrac12(\eta_{\max} - \eta_{\min})(1 + \cos\pi p) with p=(t−W)/(T−W)p = (t - W)/(T - W).
    • WSD = warmup, a stable phase at ηmax⁡\eta_{\max}, and a short cooldown (linear or 1−sqrt); a 10–20% cooldown matched cosine in language-model experiments.
    • SGD with a constant step stays in a noise ball whose expected loss is ησ2/(2(2−ηλ))\eta\sigma^2/(2(2 - \eta\lambda)) per direction, proportional to η\eta; decaying η\eta shrinks it, which is why the loss drops sharply in the cooldown.
    • A cosine planned for TT cannot be stopped early or extended; WSD can be branched from any checkpoint of its stable phase.
    • Warmup lets training reach regions of lower sharpness before η\eta is large, protects Adam's early second-moment estimate, and is needed with the linear scaling rule for large batches.
    • A learning-rate range test increases η\eta until the loss blows up; pick a value clearly below the blow-up, which is near 2/λmax⁡2/\lambda_{\max} on a quadratic.
    • Clipping by global norm, min⁡(1,c/∥g∥) g\min(1, c/\|g\|)\,g, keeps the direction, changes only large gradients, and caps the step length at ηc\eta c; it helps on (L0,L1)(L_0, L_1)-smooth losses, ∥∇2f∥≤L0+L1∥∇f∥\|\nabla^2 f\| \le L_0 + L_1\|\nabla f\|.

    08 Lagrange multipliers, KKT, duality

    • At a constrained minimum of ff on h(x)=0h(x) = 0, a level set of ff is tangent to the constraint, so ∇f(x⋆)+ν∇h(x⋆)=0\nabla f(x^\star) + \nu\nabla h(x^\star) = 0 (if ∇h(x⋆)≠0\nabla h(x^\star) \ne 0). This also holds at constrained maxima.
    • The Lagrangian is L(x,λ,ν)=f0+∑iλifi+∑jνjhj\mathcal L(x, \lambda, \nu) = f_0 + \sum_i \lambda_i f_i + \sum_j \nu_j h_j, with λi≥0\lambda_i \ge 0 for constraints fi(x)≤0f_i(x) \le 0 and νj\nu_j of any sign for hj(x)=0h_j(x) = 0.
    • A multiplier is a price: under strong duality, ∂p⋆/∂ui=−λi⋆\partial p^\star/\partial u_i = -\lambda_i^\star when constraint ii is relaxed to fi(x)≤uif_i(x) \le u_i.
    • KKT conditions: primal feasibility, dual feasibility λ≥0\lambda \ge 0, complementary slackness λifi(x)=0\lambda_i f_i(x) = 0, and stationarity ∇xL=0\nabla_x \mathcal L = 0.
    • For a convex problem, KKT points are global minimizers. Under Slater's condition (a strictly feasible point), KKT is also necessary.
    • The dual function g(λ,ν)=inf⁡xLg(\lambda, \nu) = \inf_x \mathcal L is concave and g≤p⋆g \le p^\star (weak duality). For a feasible xx, f0(x)−g(λ,ν)f_0(x) - g(\lambda, \nu) bounds f0(x)−p⋆f_0(x) - p^\star.
    • The projection onto the probability simplex is xi=max⁡(yi−ν,0)x_i = \max(y_i - \nu, 0), with one threshold ν\nu chosen so that the entries sum to 1.
    • The lasso dual is max⁡θ12∥b∥2−12∥b−θ∥2\max_\theta \tfrac12\|b\|^2 - \tfrac12\|b - \theta\|^2 s.t. ∥A⊤θ∥∞≤λ\|A^\top\theta\|_\infty \le \lambda; at the optimum θ⋆=b−Ax⋆\theta^\star = b - Ax^\star.

    09 Proximal methods and ADMM

    • The proximal operator is prox⁡ηg(v)=arg⁡min⁡ug(u)+12η∥u−v∥2\operatorname{prox}_{\eta g}(v) = \arg\min_u g(u) + \frac{1}{2\eta}\|u - v\|^2: move toward small gg without going far from vv.
    • The prox of λ∣⋅∣\lambda|\cdot| with step η\eta is soft thresholding, sign⁡(v)max⁡(∣v∣−ηλ,0)\operatorname{sign}(v)\max(|v| - \eta\lambda, 0); it maps a whole interval to exactly 0, which is why the lasso is sparse.
    • The prox of the indicator of a closed convex set is the Euclidean projection, so projected gradient is a special case of proximal gradient.
    • Proximal gradient: x+=prox⁡ηg(x−η∇f(x))x^+ = \operatorname{prox}_{\eta g}(x - \eta\nabla f(x)); with η≤1/L\eta \le 1/L it minimizes an upper bound of F=f+gF = f + g, so FF never goes up.
    • For convex ff and gg, x⋆x^\star minimizes f+gf + g if and only if x⋆=prox⁡ηg(x⋆−η∇f(x⋆))x^\star = \operatorname{prox}_{\eta g}(x^\star - \eta\nabla f(x^\star)), for any η>0\eta > 0.
    • With step 1/L1/L: ISTA has F(xk)−F⋆≤L∥x0−x⋆∥2/(2k)F(x_k) - F^\star \le L\|x_0 - x^\star\|^2/(2k); FISTA has 2L∥x0−x⋆∥2/(k+1)22L\|x_0 - x^\star\|^2/(k + 1)^2 at the same cost per step, but it is not monotone.
    • ADMM for min⁡f(x)+g(z)\min f(x) + g(z) s.t. x=zx = z alternates an xx-minimization, a prox step for zz, and a dual update u←u+x−zu \leftarrow u + x - z; for the lasso the zz-step is the soft threshold.

    10 Newton, BFGS and Gauss–Newton

    • The Newton step solves ∇2f(x) Δx=−∇f(x)\nabla^2 f(x)\,\Delta x = -\nabla f(x): it jumps to the minimum of the local quadratic model. On a strictly convex quadratic it needs one step, for any condition number.
    • Near a minimizer with ∇2f(x⋆)≻0\nabla^2 f(x^\star) \succ 0 and a Lipschitz Hessian, Newton converges quadratically: ∥ek+1∥≤(M/μ)∥ek∥2\|e_{k+1}\| \le (M/\mu)\|e_k\|^2, so the correct digits double. The result is local.
    • Damped Newton adds a line search; when the Hessian is not positive definite, the Newton step can go to a maximum or a saddle, so one modifies the Hessian or uses a trust region.
    • Newton's method is affine invariant: rescaling or rotating the variables does not change its iterates (in the new coordinates). Gradient descent is not affine invariant.
    • Quasi-Newton methods impose the secant condition Hk+1yk=skH_{k+1}y_k = s_k. The BFGS update H+=(I−ρsy⊤)H(I−ρys⊤)+ρss⊤H^+ = (I - \rho sy^\top)H(I - \rho ys^\top) + \rho ss^\top stays positive definite exactly when y⊤s>0y^\top s > 0, which a Wolfe line search guarantees.
    • L-BFGS keeps the mm newest pairs (si,yi)(s_i, y_i) and computes −Hkg-H_k g with the two-loop recursion in O(md)O(md) time and 2md2md memory.
    • Gauss–Newton solves J⊤J h=−J⊤rJ^\top J\,h = -J^\top r: Newton for 12∥r∥2\tfrac12\|r\|^2 without the term ∑iri∇2ri\sum_i r_i\nabla^2 r_i. It is quadratic for zero residuals, linear for small ones, and can fail for large ones.
    • Levenberg–Marquardt solves (J⊤J+λI)h=−J⊤r(J^\top J + \lambda I)h = -J^\top r; small λ\lambda gives Gauss–Newton, large λ\lambda a short gradient step −∇F/λ-\nabla F/\lambda, and the gain ratio adapts λ\lambda.

    11 Saddles, sharpness and stability

    • At a stationary point the Hessian eigenvalues decide: all positive is a strict local minimum, all negative a strict maximum, mixed signs a saddle; a zero eigenvalue makes the test undecided (x3x^3, x4x^4, monkey saddle).
    • GD with step 1/L1/L on an LL-smooth function bounded below guarantees only min⁡i<k∥∇f(xi)∥2≤2L(f(x0)−finf⁡)/k\min_{i<k}\|\nabla f(x_i)\|^2 \le 2L(f(x_0) - f_{\inf})/k: a small gradient, not a minimum.
    • Near a strict saddle, the component along a direction with λ<0\lambda < 0 grows by 1+η∣λ∣1 + \eta|\lambda| per step; GD converges to a strict saddle only from a measure-zero set of starts, and escape takes about log⁡(1/δ)/log⁡(1+η∣λmin⁡∣)\log(1/\delta)/\log(1 + \eta|\lambda_{\min}|) steps.
    • Newton's method jumps to any stationary point, including saddles; saddle-free Newton uses ∣H∣|H|.
    • A Hessian-vector product Hv=ddt∇f(x+tv)∣t=0Hv = \tfrac{d}{dt}\nabla f(x + tv)|_{t=0} costs a small constant times one gradient; power iteration or Lanczos on HVPs gives the top eigenvalue without forming HH.
    • The sharpness S=λmax⁡(∇2L)S = \lambda_{\max}(\nabla^2 L) sets the stability limit: GD can stay at a minimum only if S≤2/ηS \le 2/\eta. In practice SS rises (progressive sharpening) to about 2/η2/\eta and hovers there (edge of stability) while the loss keeps decreasing.
    • Sharpness depends on the parametrization (Dinh et al.), so "flat minima generalize" is a heuristic; SAM minimizes max⁡∥ε∥≤ρL(w+ε)\max_{\|\varepsilon\| \le \rho} L(w + \varepsilon) using the gradient at w+ρ∇L/∥∇L∥w + \rho\nabla L/\|\nabla L\|.

    12 K-FAC, Shampoo and Muon

    • Optimizers differ by their preconditioner: the identity (gradient descent), a diagonal (Adam), the full curvature (Newton), or per-layer Kronecker factors (K-FAC, Shampoo) in between.
    • K-FAC approximates the Fisher block of a linear layer, E[(aa⊤)⊗(δδ⊤)]\mathbb{E}[(aa^\top)\otimes(\delta\delta^\top)], by A⊗DA \otimes D with A=E[aa⊤]A = \mathbb{E}[aa^\top] and D=E[δδ⊤]D = \mathbb{E}[\delta\delta^\top]; it is exact for one example, and its step D−1∇WA−1D^{-1}\nabla_W A^{-1} needs only two small inverses.
    • Steepest descent under a norm: arg⁡min⁡Δ[⟨g,Δ⟩+L2∥Δ∥2]=−(∥g∥∗/L)arg⁡max⁡∥t∥=1⟨g,t⟩\arg\min_\Delta[\langle g, \Delta\rangle + \tfrac{L}{2}\|\Delta\|^2] = -(\|g\|_*/L)\arg\max_{\|t\| = 1}\langle g, t\rangle. The ℓ2\ell_2 norm gives gradient descent, ℓ∞\ell_\infty gives sign descent.
    • Under the spectral norm the steepest direction is −UV⊤-UV^\top for G=UΣV⊤G = U\Sigma V^\top (Theorem 2): keep the singular vectors and set all singular values to 1. The spectral and nuclear norms are dual.
    • Newton–Schulz iterations X+=aX+b(XX⊤)X+c(XX⊤)2XX^+ = aX + b(XX^\top)X + c(XX^\top)^2X act on each singular value with the polynomial p(σ)=aσ+bσ3+cσ5p(\sigma) = a\sigma + b\sigma^3 + c\sigma^5 and leave the singular vectors unchanged.
    • Muon = momentum, then five quintic Newton–Schulz steps, applied to the 2D hidden weights only; its singular values end in a band of about [0.7,1.2][0.7, 1.2], not exactly 1. The factor 0.2max⁡(m,n)0.2\sqrt{\max(m, n)} matches AdamW's update RMS.
    • Shampoo steps along L−1/4GR−1/4L^{-1/4}GR^{-1/4}; without accumulation this equals UV⊤UV^\top. SOAP runs Adam in the eigenbasis of Shampoo's factors.
    • As of 2025–2026, matrix optimizers (Shampoo, Muon, SOAP) are the fastest well-tested methods, but with carefully tuned baselines their speedup over AdamW shrinks with model size (about 1.4×1.4\times at 0.1B to 1.1×1.1\times at 1.2B parameters).