Browse Stanford's online courses in deep learning: https://stanford.io/4zhLWFNWhy does mini-batch SGD, a weak algorithm by convex optimization standards, work so well for deep learning? In this Stanford CS312: Deep Learning Alchemy lecture, Assistant Professor Tatsunori Hashimoto breaks down the anatomy of an optimizer: learning rate, batch size, preconditioning, momentum, and AdamW. He uses the noisy quadratic model to explain critical batch size and when momentum pays off, then turns to norms and weight decay, showing how layer norm makes weight norms grow and why weight decay mainly controls the effective learning rate. He closes with Hyperball, which projects weights onto a fixed-radius sphere.Key questions answered in this lecture:Q: What is the noisy quadratic model in deep learning optimization?A: A diagonalized quadratic loss with gradient noise whose covariance is aligned with the curvature, so each coordinate can be analyzed separately and batching divides the noise variance by the batch size. Hashimoto uses it to analyze plain SGD, momentum and preconditioning, trading convergence rate against steady-state loss.Q: Why does increasing batch size stop speeding up training?A: Larger batches reduce noise and allow bigger learning rates, but the learning rate cannot exceed the stability limit of 2 over the largest curvature. Past that point, extra batches give strongly diminishing returns, which is the critical batch size.Q: Does momentum help SGD at small batch sizes?A: The NQM predicts momentum adds little at small batch sizes, where noise forces small learning rates, and helps mainly at large batch sizes. Experiments agree, and SGD at batch size 1 roughly matched the AdamW training curve for GPT-3 style training.Q: Why do weight norms grow in transformers and why does it matter?A: Layer norms make the loss nearly scale invariant, so gradients lie tangent to the sphere and each step pushes the norm outward until weight decay balances it. Bigger norms shrink the effective step size (learning rate over norm squared), so you lose control of your learning rate.Q: What does weight decay do in LLM pretraining?A: In one-pass training, Hashimoto argues weight decay mainly controls the effective learning rate, not model complexity, and tuning it can act like tuning the learning rate. AdamC makes weight decay scale with the learning rate schedule to keep the norm equilibrium constant.Q: What is the Hyperball optimizer?A: Take a base update such as AdamW or Muon, normalize it, step, then project the weights back onto a ball whose radius is the Frobenius norm at initialization, leaving embeddings, norm gains and the output head unprojected. AdamH and MuonH were consistently better at scale and gave easier hyperparameter transfer.Chapters:0:00 Why optimization matters in deep learning3:09 Anatomy of SGD: LR, batch, preconditioning8:06 Momentum: heavy ball and Nesterov11:12 AdamW recap and decoupled weight decay13:39 Deep learning vs convex optimizers22:03 The noisy quadratic model (NQM)27:32 Steady-state loss and critical batch size30:40 Momentum: overdamped vs underdamped41:33 Momentum helps only at large batch sizes45:41 Preconditioning tradeoffs in the NQM49:43 Limits of the quadratic mental model55:00 Why parameter norms grow: layer norm59:28 Norm growth and effective learning rate1:08:42 Hyperball: projecting weights to a sphereAbout the speaker:Tatsunori Hashimoto is an Assistant Professor of Computer Science at Stanford University and a faculty affiliate of the Stanford Institute for Human-Centered Artificial Intelligence (HAI). His research uses tools from statistics to make machine learning systems more robust and reliable, especially for language. He also teaches CS336: Language Modeling from Scratch. He was a postdoc at Stanford with John Duchi and Percy Liang, earned his PhD at MIT, and studied statistics and math at Harvard.Readings:- Zhang et al. (2019), Which Algorithmic Choices Matter at Which Batch Sizes?: https://arxiv.org/abs/1907.04164- Weight decay blog: https://whenwen.github.io/wd_blog/public/weight-decay-part-2.html- Hyperball: https://arxiv.org/abs/2606.16899Course website: https://deep-learning-alchemy.github.io/Watch the full CS312 playlist: https://www.youtube.com/playlist?list=PLXRTcAYPI4AURecorded October 1, 2026, in CS312: Deep Learning Alchemy, a Stanford University course taught by Tatsunori Hashimoto and Suhas Kotha.#DeepLearning #Optimization #MachineLearning