µP & Muon: Scaling Optimizers to Infinite Width | Stanford CS312 Lecture 4 with Tatsunori Hashimoto

µP & Muon: Scaling Optimizers to Infinite Width | Stanford CS312 Lecture 4 with Tatsunori Hashimoto — Stanford Online

Stanford Online

AI-assisted summary of µP & Muon: Scaling Optimizers to Infinite Width | Stanford CS312 Lecture 4 with Tatsunori Hashimoto — original source. Check the original for full context.

Source published:

Key ideas

  • Maximal update parameterization (µP) balances output scaling, initialization variance, and learning rates to preserve both activation stability and active feature learning as width approaches infinity, enabling zero-shot learning rate transfer across model sizes. (43:17)
  • The neural tangent kernel (NTK) limit maintains stability but exhibits zero feature learning due to vanishing weight updates, resulting in near-zero accuracy on word analogy tasks. (8:21)
  • Muon formulates matrix optimization as steepest descent constrained within an operator-norm ball, replacing gradients with orthogonalized UV^T matrices computed via GPU-friendly quintic Newton-Schulz iterations. (49:28)
  • Empirical studies reveal Muon's primary benefit stems from aggressively boosting small, neglected singular values into a full-rank update rather than adhering strictly to theoretical operator-norm isometry. (61:56)

Detailed notes

## Background Published on YouTube by Stanford Online on November 27, 2026, this video features Assistant Professor Tatsunori Hashimoto delivering Lecture 4 of the Stanford CS312: Deep Learning Alchemy course. The lecture investigates infinite-width scaling limits, derives maximal update parameterization (µP) using abc-parameterizations to enable hyperparameter transfer, and examines the theoretical foundations and empirical mechanics of the Muon optimizer.

## TL;DR Tatsunori Hashimoto analyzes how neural network optimizers behave as width approaches infinity, contrasting the feature-less collapse of the Neural Tangent Kernel (NTK) limit against parameterizations that maintain non-trivial representation learning. Using the abc-parameterization framework, he derives conditions for activation, gradient, and dynamic stability, demonstrating how µP enables zero-shot learning rate transfer across model sizes. Moving from Frobenius-norm trust regions to operator-norm steepest descent, Hashimoto introduces the Muon optimizer, which uses a GPU-efficient quintic Newton-Schulz iteration to orthogonalize updates. Finally, he reviews large-scale deployments like Kimi K2 and experimental variants, arguing that Muon's practical performance stems from boosting neglected small singular values rather than strict spectral orthogonalization.

## Atmosphere & style The lecture combines rigorous asymptotic derivation with an unpretentious, candid tone, where Hashimoto openly demystifies the 'alchemy' of deep learning by admitting where math uses simplifying assumptions and joking with colleagues that 'it's all a lie.' The pacing shifts dynamically from blackboard-style inductive proofs of activation bounds to practical hardware insights about GPU-friendly GEMM operations. Watching it feels like sitting in an intimate, cutting-edge seminar where high-level theoretical physics perspectives and messy empirical engineering tricks meet to explain modern large-scale model training.

## Bulletin - [43:17](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=2597s) Maximal update parameterization (µP) balances output scaling, initialization variance, and learning rates to preserve both activation stability and active feature learning as width approaches infinity, enabling zero-shot learning rate transfer across model sizes. - [08:21](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=501s) The neural tangent kernel (NTK) limit maintains stability but exhibits zero feature learning due to vanishing weight updates, resulting in near-zero accuracy on word analogy tasks. - [49:28](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=2968s) Muon formulates matrix optimization as steepest descent constrained within an operator-norm ball, replacing gradients with orthogonalized UV^T matrices computed via GPU-friendly quintic Newton-Schulz iterations. - [01:01:56](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=3716s) Empirical studies reveal Muon's primary benefit stems from aggressively boosting small, neglected singular values into a full-rank update rather than adhering strictly to theoretical operator-norm isometry.

## Key takeaways - [00:05](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=5s) First-principles mechanical scaling limits explain why optimal learning rates shift across model widths, moving beyond empirical power-law curve fitting. - [03:44](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=224s) Asymptotic analysis isolates width m as the primary scaling variable while holding network depth, training step count, and input dimension fixed. - [06:09](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=369s) A valid infinite-width scaling parameterization must simultaneously satisfy activation stability (bounded at O(1)) and non-triviality (evolving representations during training). - [08:21](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=501s) Under an O(1) learning rate and 1/sqrt(m) output scaling, the NTK limit collapses representation learning into linear regression over static initial gradient features. - [14:28](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=868s) The abc-parameterization framework assigns layer-wise width exponents to output multipliers, initialization variance, and learning rates to deduce stable, non-trivial regimes. - [17:27](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=1047s) Standard Kaiming and Glorot initializations directly satisfy intermediate-layer activation and cotangent gradient stability at step zero. - [26:05](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=1565s) Adam updates can be modeled asymptotically as sign SGD, normalizing coordinate magnitudes and decoupling update sizes from gradient scales. - [27:34](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=1654s) Alignment exponents between activations and weights drift from 0.5 (uncorrelated random projections) toward 1.0 (collinear alignment) over the course of training. - [39:02](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=2342s) Asymptotic scaling derivations rely on physicists' assumptions that leading-order terms do not catastrophically cancel, trading intractable exact constant tracking for actionable rules. - [43:17](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=2597s) Adhering to µP constraints eliminates costly grid searches on massive models by allowing optimal learning rates tuned on small models to transfer zero-shot. - [49:14](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=2954s) Idealized Muon redefines optimization as steepest descent under an operator-norm trust region instead of the Frobenius norm used by standard gradient descent. - [54:28](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=3268s) Steepest descent in operator norm analytically replaces gradient singular values with ones (UV^T), which is implemented purely using dense matrix multiplications via Newton-Schulz iteration. - [59:14](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=3554s) Hybrid optimizer architectures pair Muon for 2D internal weight matrices with AdamW for 1D biases and normalization gains, scaling updates with calibrated factors. - [01:01:56](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=3716s) Muon's five-step quintic iteration does not strictly converge to 1.0; its performance advantage arises from rapidly amplifying small, unloved singular directions to full rank. - [01:07:00](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=4020s) Theoretical abstractions must be selected to match specific empirical bottlenecks, recognizing when traditional quadratic models fail to capture high-dimensional matrix behavior.

## Detailed walkthrough ### [00:05](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=5s) Optimizers in the Infinite-Width Limit

Tatsunori Hashimoto opens the lecture by framing the day's focus: parameterization, preconditioners, and training dynamics. In deep learning, scaling up model sizes entails high stakes, requiring that gigantic networks train stably, reliably, and efficiently. Rather than simply treating scaling as an empirical curve-fitting exercise on learning rates or batch sizes, Hashimoto advocates analyzing the system from first principles by taking the model size to infinity. He asserts that whatever optimization algorithm we choose must remain sane in the infinite limit: “whatever optimization algorithm we're using should be sane in that infinite model limit, right? Like no matter how big my models get, I better have reasonable behavior of my optimizers.”

Hashimoto connects this to prior discussions where students fit power laws to compute budgets and optimal hyperparameters. While empirical tricks can patch instabilities, a first-principles mechanical explanation is needed to explain why optimal learning rates must change as models widen and training runs lengthen. The overarching roadmap is to write down an aggressively simplified neural network—analogous to the noise quadratic model (NQM)—identify the available knobs (such as learning rate, initialization scale, and layer multipliers), study their three-way interaction with width scaling, and ultimately derive rules of thumb applicable to practical architectures like Transformers.

- Grounding text: The lecture builds primarily on Everett et al. (2024), *Scaling Exponents Across Parameterizations and Optimizers*, praising its readable appendix and massive compute spent mapping exponent spaces. - Pedagogy note: Hashimoto mentions that after teaching Maximal Update Parameterization ($\mu\text{P}$) using Greg Yang's Tensor Programs exposition in CS336 for two years, this new approach provides the cleanest presentation yet.

[03:44](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=224s) The Simplified MLP Model from Everett et al.

To analyze infinite-width behavior tractably, Hashimoto introduces the simplified model from Everett et al. The analysis restricts its focus to scaling width ($m$) to infinity, colloquially termed "width $\mu\text{P}$." Every other dimension is held constant: depth is fixed, training steps are fixed, input dimensions are bounded, and loss gradients are assumed to remain $O(1)$ relative to width. Width is the sole asymptotic variable in this dimensional analysis.

```mermaid flowchart LR accTitle: Simplified Layer Architecture accDescr: Data flow through a single layer of the simplified multilayer perceptron model. subgraph Layer["Layer l"] direction LR IN["Input h_(l-1)"] --> MM["Matmul W_l"] MM --> SC["Scale gamma_l"] SC --> ACT["Activation sigma"] ACT --> OUT["Output h_l"] end OUT --> READ["Readout (L+1)"] READ --> LOSS["Loss"] ```

Rather than wrestling with the architectural nuances of Transformers, the model is stripped down to an $L$-layer stack of basic multilayer perceptron (MLP) operations: 1. Matrix multiplication by weight matrix $W_l$. 2. Scaling by an explicit scalar constant $\gamma_l$. 3. Element-wise application of a non-linearity $\sigma$. 4. A final readout layer at layer $L+1$ mapping activations into output logits, which directly feed into the objective loss function.

Hashimoto emphasizes that although this MLP model is an extreme simplification, solving the optimization dynamics for this setup provides direct, indispensable intuition for scaling modern architectures like Transformers.

[06:09](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=369s) Two Goals: Stability and Non-Triviality

A complete theoretical characterization of deep network dynamics is practically impossible. Therefore, the analysis narrows down to guaranteeing two minimal, fundamental properties as width $m \to \infty$:

1. **Stability:** As width scales toward infinity, hidden activations throughout the network must remain at a consistent scale rather than exploding. Specifically, hidden activations and the final logits must stay bounded at $O(1)$ relative to width. Hashimoto connects this directly to standard initialization schemes: “Now this stability notion is very important if you want to not have your model immediately blow up. And we've seen this idea show up in initialization, right? Kaiming Glorot that those initializations have the stability idea built in.” 2. **Non-Triviality:** Stability alone is trivial to achieve—one could trivially set all weights, initializations, or learning rates to zero. A viable parameterization must be non-trivial: the model's outputs must actively change and evolve over training steps as width goes to infinity, rather than freezing at initialization.

[08:21](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=501s) The Neural Tangent Kernel (NTK) Warning

Hashimoto provides historical and theoretical context by cautioning against parameterizations that achieve stability at the expense of genuine representation learning. The primary example is the Neural Tangent Kernel (NTK) regime. In a simple two-layer MLP setup with an input, hidden activations, and an output layer, one can achieve mathematical stability as width grows by scaling the final output by $1/\sqrt{m}$ while keeping weight initializations and learning rates at standard $O(1)$ scales. However, this parameterization causes the weights to barely move during gradient descent, trapping the network in a regime where no features are learned.

[08:51](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=531s) The Neural Tangent Kernel: Stable but Useless for Feature Learning

When scaling network width to infinity while keeping learning rates at $O(1)$ and applying standard $1/\sqrt{m}$ output scaling, the resulting optimization dynamics undergo a dramatic collapse. Because the width grows arbitrarily large while the overall learning rate remains fixed, the actual weights move less and less. Optimization degenerates into an extremely localized exploration directly around the random initialization. As width approaches infinity, a Taylor expansion around the initialization reveals that the model behaves as a Neural Tangent Kernel (NTK). In this regime, the system no longer behaves like an adaptive neural network; instead, it reduces mathematically to linear regression performed over static features defined by the model’s initial gradients.

```mermaid flowchart LR accTitle: NTK Collapse vs Feature Learning accDescr: Diagram showing how O(1) learning rates with 1/sqrt(m) scaling lock features at initialization compared to rich representation learning.

subgraph NTK["NTK Regime (m → ∞)"] A["Weights W_0"] -->|"O(1) LR, 1/√m scale"| B["Weights barely move"] B --> C["Features stay frozen"] C --> D["Linear regression on fixed gradients"] end

subgraph Rich["Goal: Non-Trivial Regime"] E["Weights W_0"] -->|"Balanced scaling"| F["Weights move meaningfully"] F --> G["Representations evolve"] G --> H["Learned semantic features"] end ```

While theoretical machine learning researchers were initially thrilled by this reduction—because transforming a deep network into a tractable convex regression problem opened the door to rigorous proofs—the practical reality of the NTK limit is dismal. Drawing on empirical results from Greg Yang's work on maximal update parameterization ($\mu\text{P}$), Tatsunori Hashimoto points out that frozen weights prevent any feature learning from taking place across composed layers. In word embedding experiments under the NTK limit, models score effectively 0% on standard word analogy benchmarks, and the learned embedding spaces show zero semantic structure, leaving cities, states, and concepts hopelessly overlapped. Normal neural network training, by contrast, cleanly separates semantic categories. Hashimoto drives home that theoretical stability alone is an inadequate design target:

> “Don't read too much into this other than to say, you know, there are stable limits that are not useful at all. This is why we really really need to care about non-triviality. That's a very core concern if we're going to do analysis of neural networks.”

- In the NTK limit, weights move infinitesimally ($o(1)$), reducing network dynamics to a linear model over fixed gradient features at initialization. - Word embeddings trained under the NTK regime achieve approximately 0% accuracy on analogy benchmarks due to the complete lack of feature representation updates. - Stability without non-trivial feature learning fails to capture the empirical benefits of deep learning architectures.

---

[11:15](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=675s) The Core Question and Motivation: Physicists vs. Engineers

Having established that the NTK limit is degenerate, Hashimoto frames the central problem of scaling limits. To achieve an infinite-width limit that is simultaneously stable (no exploding or vanishing activations/gradients) and non-trivial (features continue to update meaningfully), three distinct scaling knobs can be adjusted: 1. The output scale of each block or matrix multiplication before the activation function. 2. The scale of the parameter initialization. 3. The per-layer learning rate multiplier.

When a student asks why researchers specifically obsess over scaling laws and infinite-width limits rather than alternative properties, Hashimoto and the room contrast two complementary viewpoints: the physicist's perspective versus the engineer's perspective.

The physicist approaches the system with scientific curiosity about fundamental asymptotes: when physical or mathematical systems are scaled up, natural objects should not explode or collapse into trivial degeneracies in the limit. Because parameterization choices are arbitrary human artifacts—what matters is the function and predictions computed—the scaling behavior should be well-behaved and non-degenerate as $n \to \infty$.

An audience member and Hashimoto then articulate the engineer’s pragmatic argument: hyperparameter tuning on massive production models is prohibitively expensive. If an architecture satisfies correct infinite-width scaling principles, the optimal learning rate and hyperparameter configuration tuned cheaply on a small model will directly transfer to a multi-billion parameter model without retuning. Hashimoto summarizes this practical payoff:

> “That's the engineer's argument that like if we want to get direct hyperparameter transfer without doing any scaling, then we want to find some rule that lets us have a base learning rate that's always the same and then some scaling constants that are hidden underneath that sort of vary this automatically would scale.”

- The width $n$ of hidden layers is sent to infinity while input and output dimensions $d$ remain fixed (such as fixed tokenizer vocabulary or embedding dimensions of $O(1)$). - Activation stability concerns scaling width $n \to \infty$, rather than scaling depth across sequential layers.

---

[14:28](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=868s) The abc-Parameterization Framework

To analyze these three degrees of freedom mathematically, Hashimoto introduces the formal $abc$-parameterization framework (derived from Greg Yang's Tensor Programs literature and Everett et al.). The parameterization assigns explicit width-scaling exponents to every layer $l$ of an MLP:

```mermaid flowchart TD accTitle: abc-Parameterization Layer Architecture accDescr: Computational flow of a single layer showing the placement of the a, b, and c scaling exponents.

subgraph Layer["Layer l Computation"] X["Input x (O(1))"] --> MatMul["W_l ~ N(0, n^(-2 b_l))"] MatMul --> PreAct["n^(-a_l) · W_l x"] PreAct --> Act["Nonlinearity ϕ(·)"] Act --> Out["Hidden State h_l"] end

subgraph Update["Optimizer Update"] Grad["dL / dW_l"] --> LR["LR multiplier: n^(-c_l) · η"] LR --> DeltaW["ΔW_l = - η n^(-c_l) ∇_l"] end ```

The model architecture consists of an input layer of dimension $n \times d$, middle hidden layers of dimension $n \times n$, and an output layer of dimension $d \times n$. The width $n$ is scaled toward infinity under the assumption that the input vectors $x$ remain $O(1)$ (reflecting fixed token representations that do not grow arbitrarily with network capacity). Each layer $l$ is governed by three exponents: - **Output scaling exponent ($a_l$):** The output of the matrix multiplication is multiplied by a scalar $n^{-a_l}$ before passing into the activation function $\phi$. - **Initialization exponent ($b_l$):** Weight entries are drawn independently from a Gaussian distribution with variance scaled by $n^{-2b_l}$ (meaning the standard deviation scales as $n^{-b_l}$). - **Learning rate exponent ($c_l$):** The per-layer learning rate scales as $\eta \cdot n^{-c_l}$, where $\eta$ is an overall base learning rate.

The explicit challenge is to solve for the set of exponents $\{a_l, b_l, c_l\}$ across all layers such that activations and gradient updates remain both stable and non-trivial as $n \to \infty$.

---

[16:19](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=979s) Warm-Up: Deriving Activation Stability at Initialization

Hashimoto prepares the class for the algebraic derivations by stepping into an intuitive warm-up: analyzing activation stability strictly at initialization ($t = 0$), before any gradient steps are taken. This baseline recovers classical heuristics that practitioners take for granted, such as Xavier/Glorot and Kaiming/He initialization schemes.

The analysis proceeds by mathematical induction through the network layers. For the base case at the very first layer ($l = 1$), an input vector $x \in \mathbb{R}^d$ has fixed size $d$ and entries of magnitude $O(1)$. It multiplies the weight matrix $W_1 \in \mathbb{R}^{n \times d}$, whose entries are drawn i.i.d. from a normal distribution with variance $n^{-2b_1}$. The result is then scaled by the pre-activation factor $n^{-a_1}$. By tracking how the sum over the fixed dimension $d$ behaves when scaled by $n^{-a_1}$ and $n^{-b_1}$, one establishes the exact balance required between $a_1$ and $b_1$ to guarantee that the first layer's pre-activations remain $O(1)$ rather than vanishing to zero or blowing up to infinity as width $n$ grows. Hashimoto emphasizes the foundational nature of this setup:

> “The warm-up is something we're already very familiar with. Um, and this is activation stability, right? So the Kaiming initialization, the Glorot initialization, those are all about activation stability, right?”

[17:29](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=1049s) Base Case: Activation Stability at the Input Layer

Tatsunori Hashimoto begins by working through the base case of activation stability at initialization for the first layer ($l=1$). Consider the vector-vector product between the input vector $x$ and the weight matrix $W_1$. The input dimension $d$ is fixed and does not scale with width, making each individual product $O(d)$, which is treated as a constant $O(1)$ with respect to width $n$. From the initialization parameterization, the weights scale with standard deviation $n^{-b_1}$ (dropping the square term because the discussion focuses on standard deviation rather than variance). Therefore, the typical entry size—measured by the root-mean-square (RMS) norm—scales as $n^{-b_1}$.

When this output is scaled by the layer's output scalar multiplier $\alpha_1 = n^{-a_1}$, the resulting activation vector $z_1$ scales as: $$z_1 \sim n^{-(a_1 + b_1)}$$

To keep the entries of $z_1$ stable at $O(1)$ as width $n \to \infty$, the exponent must vanish: $$a_1 + b_1 = 0$$

```mermaid flowchart LR accTitle: Forward pass through the first layer accDescr: Dimensional scaling of input vector through first weight matrix and layer multiplier to compute activation z1. subgraph L1["Layer 1 Forward Pass"] X["Input x (dim d = O(1))"] -->|"x W1 (scale n^-b1)"| P["Pre-scale Vector (RMS ~ n^-b1)"] P -->|"x alpha_1 (scale n^-a1)"| Z1["Activation z1 (scale n^-(a1+b1))"] end ```

Hashimoto explicitly notes a deliberate mathematical simplification: “Oh, and the last thing, this is, you know, one of many sketchy things that we will do today. I'm going to ignore all non-linearities.” He explains that if features are sufficiently random, activations like ReLUs will zero out roughly half the units, contributing a constant factor of approximately $1/2$. Because exact accounting for non-linearities would require “an incredible amount of work,” it is omitted in order to preserve the clean asymptotic scaling intuition.

When an audience member asks whether constant scaling factors matter over hundreds of layers, Hashimoto clarifies that the asymptotic analysis is strictly focused on the infinite-width limit where $n \to \infty$, meaning constants independent of $n$ are factored out. In response to a follow-up question regarding bounded non-linearities such as $\tanh$, he acknowledges the simplification: “In that case, yes, it really, really does matter. Um, one of many places where, you know, you do simplifying things to get the right answer.”

[19:55](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=1195s) Inductive Step: Intermediate Layers and Kaiming Initialization

Moving from the base case to the hidden layers, Hashimoto frames the derivation as standard induction: “You know, $\mu$P arguments are basically all just induction, right? You prove stability at one step and then you, you know, bootstrap that stability for the rest of the time.” Assuming by induction that the incoming activation to layer $l$ has an entry-wise RMS norm of $O(1)$, he evaluates the scaling of $z_l$.

Unlike the first layer where the input dimension $d$ was fixed, hidden layers involve square weight matrices of size $n \times n$. Multiplying an $n \times n$ random matrix by an $n$-dimensional vector introduces an inner product over $n$ coordinates, producing an expansion factor of $\sqrt{n} = n^{1/2}$. Combining this dimension growth with the matrix initialization scale $n^{-b_l}$ and the output multiplier $n^{-a_l}$ yields: $$z_l \sim n^{-a_l - b_l + 1/2}$$

For the activations of intermediate layers to remain bounded at $O(1)$, the exponent must equal zero: $$a_l + b_l = \frac{1}{2}$$

For the terminal layer, where the matrix contracts back from width $n$ to a fixed output dimension, Hashimoto notes that the output does not strictly need to equal $O(1)$, yielding an inequality constraint rather than an exact equality.

Hashimoto then connects this result to standard Kaiming (He) and Xavier initializations. In standard Kaiming initialization, weights are sampled from a Gaussian scaled by the square root of the fan-in ($1/\sqrt{n}$), corresponding to $b_l = 1/2$ and $a_l = 0$. Plugging these values into the derived stability constraint gives $0 + 1/2 = 1/2$, which exactly matches the intermediate layer requirement. While this proves that Kaiming initialization maintains activation stability at step zero, Hashimoto highlights the substantial hurdles remaining in red: - Maintaining activation stability across intermediate layers throughout the entire training trajectory. - Ensuring non-triviality so that logits undergo updates of constant scale $O(1)$ rather than vanishing or exploding.

[23:26](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=1406s) Gradient Stability at Initialization

To reason about updates and feature learning throughout training, Hashimoto transitions to analyzing gradients at initialization. He points out that while gradient calculations look intimidating, at initialization they are almost identical to activations under the chain rule: “So you know, gradients kind of seem scary at first glance, but at initialization, gradients are basically as simple as activations to deal with, right?” Because non-linearities are omitted, backpropagation consists simply of multiplying cotangents by transposed weight matrices.

Assuming a well-behaved loss function that does not scale with width $n$, the backward pass unwinds in reverse: 1. **Terminal layer backpropagation:** Flowing backward through the rectangular terminal layer mirrors the input layer, scaling with $a_L + b_L$ without the extra $1/2$ factor. 2. **Intermediate layer backpropagation:** Passing cotangents backward through square $n \times n$ matrices involves an inner product over expanding dimension $n$, contributing a factor of $n^{1/2}$ and scaling as $a_l + b_l - 1/2$. 3. **Weight gradient evaluation:** When differentiating with respect to the weight parameter $W_l$, the incoming cotangent is multiplied by the scalar factor $n^{-a_l}$, but there is no final matrix multiplication against $W_l$, meaning the term $b_l$ does not appear.

Because activation stability already established that $a_l + b_l = 1/2$ for all hidden layers, the intermediate growth factors $a_l + b_l - 1/2$ completely cancel out to zero during backpropagation. Consequently, backward stability introduces no conflicting hidden-layer constraints, requiring only minor boundary constraints at the terminal layers with respect to $a_l$. This guarantees that gradients remain stable and well-scaled at initialization.

[26:05](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=1565s) Modeling Update Dynamics: SGD vs. Adam

With gradient scaling established, the discussion shifts from static snapshots to dynamic behavior across training steps. Hashimoto notes that training dynamics are determined by two interacting components: the gradients themselves and how the optimizer acts upon those gradients. Because real-world Adam includes complex mechanics like running averages for momentum and second moments, Hashimoto emphasizes that analytical tractability demands aggressive simplification:

> “Adam is very complicated, right? There's these momentum terms, second moment terms. So, as with everything else, we're going to aggressively simplify the behavior of this optimizer, like really really aggressively simplify them.”

```mermaid flowchart TD accTitle: Simplified parameter update sizes across optimizers accDescr: Diagram contrasting how parameter update magnitudes depend on gradient and learning rate exponents in SGD versus sign SGD approximation for Adam.

subgraph SGD["Stochastic Gradient Descent (SGD)"] direction TB G_SGD["Gradient size: n^(-g_l)"] LR_SGD["Learning rate: n^(-c_l)"] Up_SGD["Update magnitude: ΔW_l ~ n^(-(g_l + c_l))"] G_SGD --> Up_SGD LR_SGD --> Up_SGD end

subgraph Adam["Adam (Modeled as Sign SGD)"] direction TB G_Adam["Gradient signs: ±1 (O(1) entries)"] LR_Adam["Learning rate: n^(-c_l)"] Up_Adam["Update magnitude: ΔW_l ~ n^(-c_l)"] G_Adam --> Up_Adam LR_Adam --> Up_Adam end ```

For standard SGD, the parameter update $\Delta W_l$ simply scales directly with the gradient size and the learning rate, decaying as $n^{-(g_l + c_l)}$, where $g_l$ is the gradient exponent and $c_l$ is the learning rate exponent. For Adam, Hashimoto models the behavior using the standard heuristic that Adam acts effectively like sign SGD. Taking entrywise signs normalizes gradient magnitudes so each coordinate becomes roughly $+1$ or $-1$, meaning the gradient entries are $O(1)$. Consequently, gradient magnitudes vanish from the scaling expression, and the typical step size for Adam is governed entirely by the learning rate parameter: $\Delta W_l \sim n^{-c_l}$.

- SGD update scaling: $\Delta W_l \sim n^{-(g_l + c_l)}$ - Adam coordinate behavior: $\mathrm{sign}(\nabla W) \in \{-1, +1\}$, yielding an $O(1)$ entry size - Adam update scaling: $\Delta W_l \sim n^{-c_l}$

---

[27:34](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=1654s) Activation Dynamics and the Four-Term Expansion

Hashimoto warns the class that they have reached the most technically demanding segment of the lecture before moving into conceptual takeaways. To maintain training stability, activation vectors must remain stable ($O(1)$) across all updates, not just at initialization. Omitting the activation nonlinearity to expose the core linear algebra, the post-update pre-activations at layer $l$ decompose into the sum of initialized values and subsequent cumulative shifts:

$$z_l = \left(W_l^{(0)} + \Delta W_l\right) \left(z_{l-1}^{(0)} + \Delta z_{l-1}\right)$$

Expanding this product produces four distinct interaction terms:

$$z_l = \underbrace{W_l^{(0)} z_{l-1}^{(0)}}_{\text{Term 1: Init}} + \underbrace{W_l^{(0)} \Delta z_{l-1}}_{\text{Term 2}} + \underbrace{\Delta W_l z_{l-1}^{(0)}}_{\text{Term 3}} + \underbrace{\Delta W_l \Delta z_{l-1}}_{\text{Term 4}}$$

Term 1 is the state at initialization ($W_l^{(0)} z_{l-1}^{(0)}$), which has already been controlled via initialization scaling. The remaining three cross-terms track the evolving interaction between frozen weights and activation drifts, weight updates and initial activations, and weight updates interacting with activation drifts.

Because standard matrix-vector bounds fail if the vectors become correlated with the matrices, Hashimoto defines three alignment exponents ($\omega_l$, $\alpha_l$, and $\mu_l$) to measure whether these matrix-vector multiplications align or remain incoherent. Hashimoto characterizes these variables as external correction terms:

> “And these exponents are essentially assumptions or like, you know, external observations that tell us how much bigger is this going to get than something naive like just putting the exponents together, right? So that's why I'm defining these three terms. They're just here to absorb sort of these three variables that I don't know how to deal with.”

A student interrupts to ask whether standard derivations must assume that a weight matrix $W$ and its transpose $W^T$ are mutually independent random variables, and where that shows up in the gradient step. Hashimoto responds that while independence assumptions between evolving matrices and vectors become necessary—and at times conceptually unsettling—during training dynamics, he does not believe an independence assumption between $W$ and $W^T$ is required for the forward gradient calculations, offering to check the precise condition after class.

---

[31:38](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=1898s) Inductive Stability Bounds Across Layers Under Adam

To establish global stability under Adam, Hashimoto sets up an induction across network depth. Starting with the first layer ($l=1$), the input $x$ is invariant ($\Delta z_0 = 0$), leaving only the shift in the input weights:

$$z_1 = \left(W_1^{(0)} + \Delta W_1\right) x = W_1^{(0)} x + \Delta W_1 x$$

Since the initial activation $W_1^{(0)} x$ is $\Theta(1)$, maintaining stability without causing activations to blow up requires that the perturbation $\Delta W_1 x$ cannot be of larger order than $O(1)$:

> “At the very least, it cannot be larger order, right? Like if if I have something that's $O(N)$, this thing is going to like really blow you up, right? So I do know that it probably should be low order.”

Because $\Delta W_1$ scales as $n^{-c_1}$ under Adam and carries an overall layer output multiplier exponent $a_1$, keeping this first-layer update $O(1)$ introduces the inequality constraint:

$$a_1 + c_1 \ge 0$$

Moving inductively to general intermediate hidden layers $l$, Hashimoto applies the three alignment exponents to account for how matrix-vector products scale relative to coordinate sizes: - $\omega_l$ parameterizes the alignment between the initial weights $W_l^{(0)}$ and activation drift $\Delta z_{l-1}$. - $\alpha_l$ parameterizes the alignment between weight updates $\Delta W_l$ and initial activations $z_{l-1}^{(0)}$. - $\mu_l$ parameterizes the alignment between weight updates $\Delta W_l$ and activation drift $\Delta z_{l-1}$.

By setting each term to be at most $O(1)$, these expansions generate explicit inequality constraints on the learning rate exponents $c_l$, layer multipliers $a_l$, and alignment exponents. Hashimoto notes that the final logits follow identical inductive logic, with the only modification being that output layers drop the standard $1/2$ dimension-averaging exponent present in square hidden layers.

[34:59](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=2099s) Alignment Exponents, Hand-Waving, and Leading Order Assumptions

Tatsunori Hashimoto begins by clarifying a small difference in the recurrent activation inequality: the factor of $1/2$ drops out because there is no natural cancellation from the initialization of the final weight layer $W_L$. When initializing earlier layers for activation stability, the scaling terms balanced out to $1/2$, but here the derivation yields analogous inequalities where layer index $l$ is simply replaced by $L + 1$.

```mermaid flowchart TD accTitle: Regimes of Alignment Exponents accDescr: Diagram showing how alignment exponents transition from random independence at one half to full correlation at one. subgraph Regimes["Alignment Regime Bounds"] Half["Exponent = 1/2<br>(No Alignment / Independent)"] One["Exponent = 1<br>(Full Alignment / Correlated)"] end Half -->|"Gradients accumulate dependencies"| One Half -.->|"Matrix-vector product scales as √N"| Half One -.->|"Collinear vectors scale as 1/N"| One ```

When a student asks for clarification on what $\omega$, $\alpha$, and $r$ represent, Hashimoto steps back to define their roles. The variable $r$ (or $r_l$) acts as a placeholder shorthand representing the exponent governing the magnitude of activation updates $\Delta z_l$. To prevent activation changes from diminishing to zero as width $N \to \infty$, one wants feature learning, which means $r_l$ should be zero so updates stay $\Theta(1)$. In contrast, $\omega$, $\alpha$, and $u_l$ are structural assumptions describing the alignment between vectors and matrices during training:

- **Independent / Random regime ($\text{exponent} = 1/2$):** If activations and weight matrices behave as independent random variables, a random matrix-vector product with Gaussian-like entries scales as $\sqrt{N}$, corresponding to an exponent of $1/2$. - **Correlated / Aligned regime ($\text{exponent} = 1$):** If vectors point in the exact same direction without randomness, the inner products scale as $1/N$, yielding an exponent of $1$. - Realistic alignment exponents generally sit between $1/2$ and $1$, quantifying whether intermediate quantities behave like uncorrelated random projections or aligned, low-rank features.

Hashimoto addresses the mathematical rigor of these derivations, acknowledging that the derivations rely on a necessary amount of hand-waving. Practitioners often treat terms that are $\Theta(N)$ and $O(N)$ as though their difference remains $\Theta(N)$, implicitly assuming that leading-order terms do not catastrophically cancel each other out to leave lower-order remainders. While fully calculating the exact constants to guarantee non-cancellation is essentially impossible, this style of asymptotic physics analysis proves surprisingly effective. As Hashimoto explains: “You save yourself an incredible amount of analysis that is probably intractable. And then in the end, you end up with very interesting answers that are in practice very useful.”

[39:02](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=2342s) Non-Triviality and the Table of $abc$-Parameterizations

To guarantee non-triviality—ensuring that the model genuinely updates its representations rather than freezing in the infinite-width limit—the last-layer logit dynamics must not vanish. Because the logit expression consists of three distinct terms, Hashimoto enforces non-triviality by requiring at least one of these terms to be $\Theta(1)$ with respect to width $N$. Under the assumption of no catastrophic cancellation, this guarantees non-vanishing training dynamics.

This framework yields a comprehensive table of constraints cataloging the landscape of valid $abc$-parameterizations. Once an engineer sets the alignment parameters ($\omega, \alpha, u$) and fixes $r_l = 0$ for feature learning, any trio of initialization exponents ($a$), multiplier scales ($b$), and learning rates ($c$) satisfying the system of inequalities produces a stable, non-trivial scaling family.

| Regime | Alignment Exponents ($\alpha, u$) | Behavior | |:--- |:--- |:--- | | **No Alignment** | $\alpha = u = 1/2$ | Matrices and vectors act independently, like random Gaussian projections. | | **Full Alignment** | $\alpha = u = 1$ | Activations and weights are strongly correlated and point in aligned directions. |

When asked which alignment regime one should select in practice, Hashimoto candidly shares an exchange from right before class: “Right before, you know, this this lecture, I was talking to [a colleague] and we were saying it's all a lie.” In reality, empirical measurements from Everett et al. show that alignment changes dynamically across training. It starts strictly at $0.5$ at initialization because random weights share no correlation with data, but as gradient steps update weights in directions aligned with activations, dependencies accumulate. Alignment climbs over training, plateauing below $1$ at different levels depending on the layer and architecture. Consequently, neither $0.5$ nor $1$ holds across the entire training run. Asked whether one could dynamically adjust optimizer hyperparameter exponents as alignment drifts during training, Hashimoto notes that while nobody does this because measuring alignment online is cumbersome, “if you were really committed to the $\mu\text{P}$ stable scaling, you know, belief, then you would really maybe want to change the alignment variable as as you might.”

[43:17](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=2597s) $\mu\text{P}$, Tensor Programs, and Learning Rate Transfer

Hashimoto frames this broad class of $abc$-parameterizations as the foundation for the specific maximal update parameterization ($\mu\text{P}$) introduced by Greg Yang and collaborators under the theoretical framework of Tensor Programs. The breakthrough appeal of $\mu\text{P}$ was resolving a fundamental headache of empirical deep learning: hyperparameter retuning across scales.

In standard parameterizations, whenever a practitioner widens a neural network, the optimal learning rate drifts, forcing costly grid searches on large models. By enforcing stability and non-trivial feature learning simultaneously at infinite width, $\mu\text{P}$ ensures that the optimal learning rate discovered on a tiny toy model transfers directly to massive networks without modification.

[43:50](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=2630s) Empirical Validation of µP: Stable Dynamics and Per-Layer Learning Rates

The practical payoff of maximal update parameterization ($\mu\text{P}$) is evident in the empirical behavior of neural network training across varying widths. In standard parameterizations, wider networks display dramatic variations in their intermediate behaviors: logits, attention logits, and input embeddings drift sharply away from initialization as the number of optimization steps increases. Under $\mu\text{P}$, by contrast, activations and logits exhibit consistent deviations from initialization regardless of width. The network behaves essentially identically step-for-step across different scales, providing a coherent framework for analyzing the scaling limits of deep learning architectures.

```mermaid flowchart LR accTitle: Standard vs abc Parameterization across Width accDescr: Diagram contrasting how standard parameterization causes learning rate drift while abc-parameterization maintains stable per-layer rates across widths.

subgraph Standard ["Standard Parameterization"] direction TB S1["Width Scaling"] --> S2["Global Learning Rate"] S2 --> S3["Drifting Dynamics & Unstable Logits"] end

subgraph ABC ["abc-Parameterization (µP)"] direction TB A1["Width Scaling"] --> A2["Per-Layer Scaled Learning Rates"] A2 --> A3["Constant Optimal LR & Stable Activations"] end ```

The experimental findings in Everett et al. illustrate this stability across a vast range of widths. Prior to that work, conventional wisdom held that standard parameterization inherently suffered from drifting optimal learning rates as models grew. However, by adhering to the $abc$-parameterization framework and assigning scaled, per-layer learning rates, multiple parameterizations can be made well-behaved:

> “And so it's quite important to have these like scaling learning rates that let you control different aspects of the network.”

Rather than attempting to fit empirical scaling laws whose underlying equations remain opaque, practitioners can perform leading-order-of-magnitude calculations to deduce how layer multipliers, initializations, and learning rates must scale. When per-layer learning rates are properly calibrated to respect the $abc$ constraints, various parameterizations converge to similarly high-performing, stable regimes, outperforming models constrained to a single global learning rate.

- Logits, attention logits, and input embeddings maintain stable trajectories relative to initialization under $\mu\text{P}$. - Optimal learning rates remain fixed across large width sweeps when per-layer scaling rules are applied. - Applying per-layer learning rate schedules derived from order-of-magnitude constraints eliminates the performance degradation typically seen with width scaling.

---

[46:22](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=2782s) Macroscopic Scaling and the Threat of Catastrophic Cancellation

Reflecting on the core philosophy of $\mu\text{P}$, Tatsunori Hashimoto draws a parallel to the Non-linear Quality Model (NQM) framework discussed in earlier lectures. The goal of this mathematical analysis is not to craft an exact micro-level representation of every floating-point operation, but rather to isolate the macroscopic order-of-magnitude constraints that govern stability and non-trivial feature learning.

> “We're not looking for, you know, the right model and to hit it with like some really hard math. We're really trying to get the high level macroscopic behaviors of the system.”

In response to a student question about whether $\mu\text{P}$ involves a speed or step-count trade-off, Hashimoto clarifies that $\mu\text{P}$ is not universally superior at every specific width. Rather, scaling per-layer learning rates in accordance with this analysis allows virtually all standard architectures to match peak performance and prevents the degradation typical of single global learning rates.

Another student inquires why cancellations between terms can be catastrophic. Hashimoto explains that in stability proofs, terms canceling each other out merely creates lower-order remainders, which is benign. However, for non-triviality and feature learning, the activation delta must satisfy $\Delta z_l = \Theta(1)$. If leading terms undergo catastrophic cancellation, the actual updates collapse to an $o(1)$ order of magnitude that shrinks to zero as width $n \to \infty$. In that regime, the network ceases to learn features altogether. Because big-$O$ exponents cannot simply be manipulated algebraically without accounting for exact phase and alignment, these asymptotic scalings require disciplined derivation.

---

[49:14](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=2954s) Motivating Muon: Operator Norm Descent and Spectral Optimization

While $\mu\text{P}$ achieves activation stability and maximal update sizes by fine-tuning scalar coefficients ($a_l, b_l, c_l$) across layers, an alternative strategy exists: redesigning the optimizer itself so that updates naturally lie within a geometric neighborhood that enforces activation stability. To develop this intuition, Hashimoto revisits the classical formulation of gradient descent as a proximal operator:

$$\Delta W = \arg\min_{\Delta W} \left\{ \langle \nabla f(W), \Delta W \rangle + \frac{1}{2\eta} \|\Delta W\|_F^2 \right\}$$

Standard gradient descent defines its trust region using an $L_2$ (Frobenius) norm penalty on weight updates. However, unconstrained parameter-space $L_2$ norms fail to capture the true functional effect of a matrix multiplication on intermediate representations. Within the three terms governing $\Delta z_l$ in $\mu\text{P}$, the update term is:

$$n^{-a_l} \Delta W_l z_{l-1}$$

If $\Delta W_l$ acts as an isometry—or more generally, if its singular values are all fixed to 1—its operator norm $\|\Delta W_l\|_{\text{op}}$ equals 1. Under such a transformation, the scale of the output directly mirrors the norm of the input activation, eliminating uncontrolled amplification:

> “If I have what's called an isometry, if my change in my weights, right, is um operator norm one, or actually in fact if its singular values are all ones, then you know what I'm going to have on the other side is that this is going to have norm equal to $Z$ of $L$, right?”

```mermaid flowchart TD accTitle: Comparison of Descent Geometries accDescr: Flowchart contrasting standard gradient descent in Frobenius norm with idealized Muon operator-norm steepest descent.

subgraph GD ["Standard Gradient Descent"] G1["Linearized Objective: ⟨∇f(W), ΔW⟩"] G2["Frobenius Penalty: (1/2η) ||ΔW||_F²"] G1 & G2 --> G3["Update proportional to -∇f(W)"] end

subgraph Muon ["Idealized Muon Descent"] M1["Linearized Objective: ⟨∇f(W), ΔW⟩"] M2["Operator Norm Constraint: ||ΔW||_op ≤ 1"] M1 & M2 --> M3["Update sets singular values to 1: -U Vᵀ"] end ```

Rather than regularizing in $L_2$ space, one can define a steepest descent problem bounded inside an operator-norm ball:

$$\min_{\|\Delta W\|_{\text{op}} \le 1} \langle \nabla f(W), \Delta W \rangle$$

By constraining the operator norm rather than the Frobenius norm, the optimizer acts within a natural trust region where matrix multiplications cannot arbitrarily expand or distort activation magnitudes. This operator-norm formulation serves as the theoretical foundation for "idealized Muon" and the broader family of spectral optimizers.

[52:57](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=3177s) Idealized Muon and Operator Norm Steepest Descent

Tatsunori Hashimoto explains the underlying mechanics of Muon by connecting it back to the operator norm constraints motivated by µP. If the objective is to constrain how activations shift by restricting weight updates within an operator norm ball, the optimization problem can be solved analytically through the duality between the operator norm and the nuclear norm. The exact closed-form solution is to compute the singular value decomposition (SVD) of the gradient matrix $G = U \Sigma V^\top$, discard the singular values $\Sigma$ entirely, and take the update direction as $U V^\top$ scaled by a neighborhood radius parameter $\rho$.

```mermaid flowchart TD accTitle: Idealized Muon Parameter Split accDescr: Diagram showing how parameters are split between Muon and AdamW based on tensor dimensionality.

subgraph Input["Model Parameters"] P["All Trainable Parameters"] end

subgraph Split["Parameter Partitioning"] M["Matrix-Valued Parameters\n(e.g., hidden layer projections)"] S["Scalar / Vector Parameters\n(e.g., RMSNorm gains, biases)"] end

subgraph Optimizers["Optimizer Allocation"] Muon["Muon Update\nDrop singular values: ρ · U Vᵀ"] Adam["AdamW Update\nStandard element-wise scaling"] end

P --> M P --> S M --> Muon S --> Adam ```

Hashimoto terms this conceptual formulation "idealized Muon." In this baseline formulation, every internal matrix-valued weight parameter is updated along the $U V^\top$ direction. However, modern architectures still contain scalar and vector-valued parameters—such as RMSNorm scale gains or biases—that do not have a two-dimensional matrix structure to decompose. These non-matrix parameters cannot simply be dropped; instead, they are updated using a conventional scalar-valued optimizer such as standard gradient descent or, in practice, AdamW.

> “Idealized Muon takes every matrix value parameter on the inside of my neural network, and I'm just going to update them using a step size of $\rho$ with $U V^\top$ where I sort of SVD my gradients and then I drop the singular values.” — Tatsunori Hashimoto

[54:28](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=3268s) Practical Muon: Momentum, AdamW, and Newton-Schulz Iteration

Moving from the theoretical formulation to a real-world implementation requires several critical adaptations. First, because large-batch neural network training benefits heavily from momentum, Muon applies momentum directly to the gradients prior to any orthogonalization rather than stepping on raw gradients. Second, running an exact SVD on high-dimensional weight matrices at every optimization step is computationally prohibitive on hardware, so the exact decomposition is replaced by a hardware-friendly approximation called Newton-Schulz iteration (specifically a quintic polynomial variant, Newton-Schulz 5). Finally, AdamW is retained to manage all scalar and 1D parameters across the network.

The code and logic, adopted directly from Keller Jordan's original blog post, form an algorithm that takes the gradient, updates a momentum buffer, applies Newton-Schulz iteration to replace the singular values with ones, and adds the resulting matrix update to the weights.

```mermaid flowchart LR accTitle: Muon Pipeline for Matrix Parameters accDescr: Step-by-step pipeline from raw gradients to weight updates in the practical Muon optimizer.

Grad["Gradient G"] --> Mom["Momentum Buffer"] Mom --> NS["Newton-Schulz 5\n(Matmul Fixed-Point)"] NS --> Norm["Orthogonalized Direction\n(Approx. U Vᵀ)"] Norm --> Step["Weight Update\nW ← W - η · Step"] ```

Hashimoto then breaks down how Newton-Schulz avoids full matrix decompositions. Assuming square matrices $G$ for notational convenience (noting that rectangular matrices are handled by appropriate transpositions), the operator $U V^\top$ can be expressed as:

$$G (G^\top G)^{-\frac{1}{2}}$$

In scalar terms, replacing $G$ with its singular value $\lambda$ yields $\lambda (\lambda^2)^{-\frac{1}{2}} = \text{sign}(\lambda)$, demonstrating that this mathematical form maps every positive singular value to $1$.

Because calculating an explicit matrix inverse square root is poorly suited for GPU hardware, Newton-Schulz uses a fixed-point iteration. A cubic variant can be formulated as:

$$Y_{k+1} = Y_k \left( \frac{3}{2} I - \frac{1}{2} Y_k^\top Y_k \right)$$

Plugging the target matrix $G (G^\top G)^{-\frac{1}{2}}$ into the iteration verifies that it is a stationary fixed point of the system. In practice, Muon implements a quintic iteration with carefully tuned coefficients ($a, b, c$) rather than the simple cubic iteration, allowing it to converge rapidly in only a few steps composed strictly of dense matrix multiplications (GEMMs).

> “Instead of doing SVD and dropping the singular values, I'm going to do something called Newton-Schulz 5... Notice it's all just matmuls, right? And this is very, very, very, very fast on the GPUs. We always want things to be very simple matrix multiplications.” — Tatsunori Hashimoto

- SVD runtime cost is completely bypassed in favor of iterative matrix multiplications. - The iteration acts purely on the spectrum, preserving left and right singular vectors while collapsing singular values toward unity. - Scalar parameters are maintained entirely under AdamW to ensure numerical stability across normalization layers.

[59:14](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=3554s) Scaling Muon to Production: NanoGPT Speedruns to Kimi K2

Despite the extra matrix multiplications performed on each step, Muon has demonstrated substantial wall-clock speedups in empirical settings. Keller Jordan initially demonstrated its capability during the NanoGPT speedrun competitions, proving that Muon could reach target validation loss thresholds faster in raw wall-clock time than standard AdamW baselines. This was notable because higher-order and spectral optimizers often suffer from excessive per-step computational overhead that cancels out any theoretical convergence gains.

The optimizer has also been validated at massive industrial scale. Hashimoto highlights the Moonshot AI team's technical report, *Muon is Scalable for LLM Training*, which demonstrated significant convergence improvements when training large models like Kimi K2 with Muon. Adapting Muon to frontier models required several practical engineering modifications:

| Modification | Implementation Detail | Purpose | |:--- |:--- |:--- | | **Weight Decay** | Explicit decoupled weight decay added to parameter updates | Controls weight norm growth in the absence of specialized spherical/hyperbolic constraints. | | **Learning Rate Matching** | Matched AdamW and Muon update magnitudes using matrix shapes and a $0.2\times$ factor | Harmonizes update scales between 2D parameters (Muon) and 1D parameters (AdamW). | | **Model Stabilization** | Architectural safeguards and scaling adjustments | Prevents gradient explosion and numerical instability during long large-scale pretraining runs. |

Hashimoto points out that by tuning the relative learning rate between Muon and AdamW with their scaling factor, the Kimi team achieved strictly superior loss curves compared to both baseline AdamW and out-of-the-box Muon.

> “Muon, which is this very advanced kind of spectral optimizer, let's call it, is actually effective at scale and gives you some gains as proven out in things like Kimi K2.” — Tatsunori Hashimoto

[01:01:56](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=3716s) The Empirical Realities of Muon vs. Operator-Norm Theory

Tatsunori Hashimoto steps back from the formal derivation connecting $\mu$P, operator-norm steepest descent, and polar decomposition, acknowledging that this theoretical narrative represents a “very sanitized presentation.” He points out that Keller Jordan's original Muon blog post presents a far more empirical perspective on why the optimizer works. While the theoretical argument relates to Jeremy Bernstein and Jonas Newhouse’s analysis of Shampoo and descent on the Stiefel manifold, Jordan and other practitioners approach the problem from a pragmatic, observational angle: standard gradient updates are overwhelmingly low rank, discarding much of the matrix's capacity. From an empirical standpoint, Muon's primary benefit might simply be that by discarding low singular values, it forces updates to become full rank. Hashimoto highlights this recurring tension in deep learning between elegant mathematical frameworks and raw empirical alchemy:

> “And so there's this interesting tension here that I want to point out about kind of how you know it's very nice to find these like clean mathematical formulations, but also in some ways there's these like very much more deeply alchemical, let's call it, empirical intuitions behind some of these models.”

```mermaid flowchart TD accTitle: Theoretical vs Empirical View of Muon accDescr: Contrast between the operator-norm formulation and the empirical full-rank update hypothesis for Muon. subgraph Theory["Theoretical Perspective"] T1["Operator Norm Steepest Descent"] --> T2["Stiefel Manifold Descent (Bernstein & Newhouse)"] T2 --> T3["Exact Polar Decomposition (UV^T)"] end subgraph Alchemy["Empirical Perspective (Keller Jordan)"] E1["Standard Updates Are Low Rank"] --> E2["Muon Forces Full-Rank Matrix Updates"] E2 --> E3["Rapidly Amplifies Small Singular Values"] end ```

[01:03:06](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=3786s) The Muon Quintic: Deliberate Non-Convergence and Spectral Boosting

Hashimoto complicates the neat polar decomposition story by detailing what Muon's Newton-Schulz implementation actually computes. Rather than running the classic third-order fixed-point iteration, Muon implements a quintic polynomial whose coefficients have been deliberately altered. In standard Newton-Schulz iterations, singular values below $1.0$ monotonically increase and those above $1.0$ monotonically decrease toward $1.0$, which serves as a true fixed point. In contrast, Muon's modified quintic does not converge to $1.0$ at all; it overshoots, oscillates, and behaves dynamically across iterations.

Within five iteration steps, standard Newton-Schulz leaves small singular values far below $1.0$, whereas Muon's tuned quintic aggressively rockets small values upward and allows them to oscillate around $1.0$. Hashimoto emphasizes that the iteration does not aim for exact spectral normalization:

> “Well, you know, it's not exactly making things all 1.0. It's just, you know, very rapidly shoving very small singular values all the way up near one, right? You're amplifying these kind of like unloved directions to try to get good optimizer updates.”

Recent empirical studies further undermine the idea that exact spectral whitening or mapping singular values to $1$ (a power of zero on singular values) is optimal: - **Intermediate spectral powers:** Altering singular values by raising them to intermediate powers between $0$ and $1$ reveals that taking the square root (power $1/2$) outperforms taking the sign (power $0$). - **Randomized and deformed singular values:** Works exploring variants dubbed "Kahn" and "Freeon" show that replacing singular values with random values or passing them through arbitrary non-standard curves still yields Muon-like convergence. - **The operational takeaway:** The performance gain does not hinge on enforcing an exact operator-norm step size of $1$; rather, the true driver of Muon's success is aggressively boosting small, “unloved” singular values to ensure large updates along directions that are otherwise neglected.

[01:07:00](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=4020s) Takeaways for the Optimization Unit

Concluding the lecture and wrapping up the course's introductory optimization unit, Hashimoto underscores that while moving from $\mu$P update constraints to spectral-norm optimization and Newton-Schulz polar decompositions provides a powerful toolkit, practitioners must remain cautious about over-relying on any single clean story. Deep learning theory is rarely absolute, and recognizing where models break down is just as critical as knowing when they apply:

> “And then finally, you know, I don't want you to to overfit on this story or even any aspect of today's lecture, um because there's many aspects of today's story that like are broadly accurate, but they're not perfect, right?”

Hashimoto outlines three foundational methodological takeaways for navigating deep learning optimization:

1. **Identify the core phenomenon:** Pinpoint the underlying driver causing training behavior—such as weight norm drift, gradient alignment, or mini-batch noise—and isolate it. 2. **Choose the appropriate abstraction:** Match the phenomenon with the right theoretical lens, whether using noisy quadratics, norm-invariant losses, or infinite-width scaling limits ($\mu$P), and design algorithms to address the isolated dynamics. 3. **Determine where abstractions fail:** Acknowledge the boundaries of each theoretical construct. For instance, classical noisy quadratic models would never predict the necessity of matrix spectral normalization, requiring broader abstractions like Muon to capture matrix-specific dynamics.

## Notable quotes > [59:14](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=3554s) Muon, which is this very advanced kind of spectral optimizer, let's call it, is actually effective at scale and gives you some gains as proven out in things like Kimi K2. — Tatsunori Hashimoto

> [00:05](https://www.youtube.com/watch?v=bZCbIoeY1fQ&t=5s) whatever optimization algorithm we're using should be sane in that infinite model limit, right? Like no matter how big my models get, I better have reasonable behavior of my optimizers. — Tatsunori Hashimoto

## Mentioned Tatsunori Hashimoto, Everett et al., Greg Yang, Keller Jordan, Jeremy Bernstein, Jonas Newhouse, Maximal Update Parameterization (µP), Tensor Programs, Neural Tangent Kernel (NTK), Kaiming / He initialization, Glorot / Xavier initialization, Adam, SGD, AdamW, Muon, NanoGPT, Moonshot AI, Kimi K2, Shampoo, Kahn, Freeon

## Video description Browse Stanford's online courses in deep learning: https://stanford.io/4zhLWFN

What should an optimizer do as a model gets wider and wider? In this Stanford CS312: Deep Learning Alchemy lecture, Assistant Professor Tatsunori Hashimoto works through scaling limits and feature learning from first principles. He shows why the neural tangent kernel limit is stable but learns no features, derives µP through abc-parameterization so the optimal learning rate transfers across width, and reframes µP as steepest descent in an operator-norm ball. That view leads to Muon, its Newton-Schulz iteration, evidence that it works at scale, and why its benefit may come from boosting small singular values.

Key questions answered in this lecture: Q: What is µP (maximal update parameterization) and why does it matter? A: Hashimoto frames µP as picking per-layer output multipliers, initialization scales, and learning rates so a network stays both stable and non-trivial (still learning features) as width goes to infinity. The practical payoff is that the optimal learning rate stays put as you scale width.

Q: Why is the neural tangent kernel limit not useful for deep learning? A: With an O(1) learning rate and 1/sqrt(m) output scaling, the weights barely move as width grows, so the network reduces to a regression on fixed gradient features with no feature learning. In the word embedding example, it scores basically 0% on word analogies.

Q: What does alignment mean in µP and which alignment should you assume? A: Alignment exponents sit between 1/2 (weights and activations behave like independent random objects) and 1 (fully correlated). Everett et al. measure that alignment starts at 0.5 and rises during training before stabilizing below 1, so Hashimoto says the right choice is not clear.

Q: How does the Muon optimizer work? A: For each matrix parameter, Muon takes momentum, then replaces the gradient's singular values with ones (UV transpose), which is steepest descent inside an operator-norm ball. It skips the slow SVD by running a quintic Newton-Schulz iteration made of matmuls, and uses AdamW for scalar parameters.

Q: Why does Muon work so well? A: Hashimoto notes Muon's tuned quintic does not converge to 1 but oscillates near it, rapidly pushing small singular values up. Follow-up work finds a power of 1/2 beats the sign and randomized singular values still train well, so the key seems to be boosting small, hard-to-update directions rather than exact orthogonalization.

Chapters: 0:00 Optimizers in the infinite-width limit 3:44 Simplified MLP model from Everett et al. 6:09 Two goals: stability and non-triviality 8:21 Neural tangent kernel: stable but no features 11:29 abc-parameterization: scale, init, learning rate 16:27 Activation stability at init and Xavier 23:26 Gradient stability and SGD vs Adam updates 27:45 Training dynamics and alignment exponents 43:17 µP and Tensor Programs: learning rate transfer 49:33 From µP to Muon: operator norm descent 54:28 Muon in practice: Newton-Schulz iteration 59:14 Muon at scale: NanoGPT speedrun and Kimi 1:01:56 Why Muon works: boosting small singular values 1:07:22 Takeaways for the optimization unit

About 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: - Everett et al. (2024), Scaling Exponents Across Parameterizations and Optimizers: https://arxiv.org/abs/2407.05872 - Tensor Programs V: https://arxiv.org/abs/2203.03466 - Muon: https://kellerjordan.github.io/posts/muon/

Course website: https://deep-learning-alchemy.github.io/ Watch the full CS312 playlist: https://www.youtube.com/playlist?list=PLXRTcAYPI4AU

Recorded October 6, 2026, in CS312: Deep Learning Alchemy, a Stanford University course taught by Tatsunori Hashimoto and Suhas Kotha.

#DeepLearning #Muon #Optimization"

[Source](https://www.youtube.com/watch?v=bZCbIoeY1fQ)

Reading summary

Tatsunori Hashimoto argues that robust deep learning optimization requires analyzing training dynamics in the infinite-width limit, where maximal update parameterization and spectral optimizers like Muon stabilize activations and allow hyperparameter transfer across model scales. Balancing Stability and Feature Learning in Width Limits (6:09) When analyzing neural networks as width scales toward infinity, optimization schemes must satisfy two core requirements: stability and non-triviality. Stability ensures that hidden layer activations and final logits remain bounded at an order of one rather than exploding. Hashimoto highlights the Neural Tangent Kernel regime as an example of stability achieved at the expense of performance. By scaling outputs by the reciprocal of the square root of width while keeping learning rates constant, the network remains mathematically stable, but weight trajectories freeze near initialization. Under this regime, the architecture collapses into linear regression over fixed initial gradient features, preventing representation learning across layers. Citing Greg Yang's experimental findings, Hashimoto notes that word embeddings trained under this limit fail to separate semantic concepts and score near zero on analogy benchmarks, demonstrating that mathematical stability without non-trivial feature updates is useless in practice. The abc-Parameterization and Zero-Shot Hyperparameter Transfer (14:28) To identify regimes that preserve feature learning, Hashimoto introduces the abc-parameterization framework, which assigns width-scaling exponents to layer pre-activation multipliers, weight initializations, and learning rates. For intermediate hidden layers, maintaining activation stability at initialization requires the sum of the multiplier and initialization exponents to equal one half, recovering the standard scaling used in Kaiming initialization. In training dynamic derivations, Adam is simplified as sign SGD, fixing parameter update magnitudes strictly to the learning rate exponent. Analyzing post-update activations decomposes network states into initial projections and drift terms modulated by matrix-vector alignment exponents. By enforcing that logit dynamics remain of constant order across optimization steps, maximal update parameterization guarantees non-vanishing representation learning. Crucially for engineering workflows, this mathematical balance enables direct hyperparameter transfer: optimal base learning rates determined on small, cheap models apply directly to multi-billion parameter networks without expensive retuning sweeps. Idealized Muon and Operator Norm Descent (49:14) While maximal update parameterization stabilizes networks via coordinated scalar multipliers, Hashimoto outlines an alternative approach: restructuring the optimizer so updates inherently respect activation stability. Standard gradient descent minimizes updates under a Frobenius norm penalty, which does not reflect the functional impact of matrix multiplication on hidden representations. If an update matrix instead acts as an isometry with an operator norm of one, the magnitude of output activations naturally mirrors input scales. Constraining steepest descent within an operator-norm ball leads analytically to a polar decomposition update. Computing the singular value decomposition of the gradient and discarding the singular values entirely yields an orthogonal update direction. In idealized Muon, all two-dimensional internal weight matrices are updated along this direction, while scalar and vector parameters such as normalization scales and biases are delegated to AdamW. Newton-Schulz Iteration and Empirical Spectral Boosting (54:28) Because exact singular value decomposition is computationally impractical for high-dimensional matrices during training, practical implementations of Muon use Newton-Schulz polynomial iterations. By relying entirely on dense matrix multiplications, this iteration rapidly maps singular values toward unity on GPU hardware after gradient momentum is applied. Hashimoto points out that this method delivered wall-clock training speedups in competitive settings like NanoGPT benchmarks and scaled to production in Moonshot AI's Kimi K2 model after incorporating decoupled weight decay and learning-rate calibration. However, Hashimoto cautions that the theoretical operator-norm narrative does not entirely match Muon's empirical mechanics. Practical Muon employs a quintic iteration whose altered coefficients cause singular values to oscillate rather than converge to an exact isometry. Instead of strictly enforcing a norm constraint of one, Muon's performance gains appear driven by aggressively amplifying small, underutilized singular values into full-rank updates, a conclusion supported by experiments showing comparable convergence when singular values are randomized or replaced by intermediate power curves. Hashimoto concludes that optimization research requires matching specific empirical phenomena with suitable theoretical abstractions, such as infinite-width limits or operator-norm trust regions, while recognizing the practical boundaries where formal mathematical models give way to empirical adjustments.

Source quotes

[59:14] Tatsunori Hashimoto: Muon, which is this very advanced kind of spectral optimizer, let's call it, is actually effective at scale and gives you some gains as proven out in things like Kimi K2. [0:05] Tatsunori Hashimoto: whatever optimization algorithm we're using should be sane in that infinite model limit, right? Like no matter how big my models get, I better have reasonable behavior of my optimizers.

Original transcript

[0:05] So, we're going to talk about [0:07] parameterization and preconditioners [0:09] today. [0:10] We're going to get into some training [0:11] dynamic stuff, which will be exciting. [0:13] Okay, great. So, if there's no other [0:15] logistics questions, I'll get started on [0:17] the content of today's [0:20] Okay, good. All right. So, [0:23] we're doing optimization, but we're [0:25] going to do kind of two different [0:26] things. [0:27] We're going to be thinking about scaling [0:29] still. Scaling is very very important [0:30] just in general in deep learning, [0:33] but we really want to get things right, [0:34] right? And as models get bigger and the [0:36] stakes get very [0:37] very high, right? We want to make sure [0:39] that when we make these like gigantic [0:41] models, our models train in very stable, [0:43] reliable ways and that our training is [0:45] very efficient. [0:47] Now, there's kind of some interesting [0:49] principles by which to think about what [0:51] to do when models get larger. [0:54] And so, we're going to start with what I [0:55] think is a important class of of [0:57] conceptual ways of thinking about this [0:59] problem. [1:01] And the first thing to ask is to say, [1:04] okay, we're going to make models bigger [1:05] and bigger and bigger, but you know, we [1:07] can also take limits, right? We can make [1:08] models that are like almost infinitely [1:10] big, right? Just arbitrarily big. And [1:13] whatever optimization algorithm we're [1:14] using should be sane in that infinite [1:17] model limit, right? Like no matter how [1:18] big my models get, I better have [1:20] reasonable behavior of my optimizers. [1:23] And we're going to reason through what [1:24] that means, like what is the right, you [1:26] know, way in which to think about this [1:27] and that will be a whole thing. And [1:29] after we do that, we'll gain some [1:30] insights into thinking about, you know, [1:32] what gives us stability during [1:34] large-scale optimization. And stability [1:36] is very very important. [1:38] And so, that notion of stability then [1:40] will inform us in what kinds of [1:43] optimization steps we should be taking. [1:45] This is going to be abstract right now, [1:47] but we're going to, you know, make that [1:49] precise as I go through this very first [1:51] part of like, you know, what's this like [1:53] infinite [1:54] sort of model limit. [1:56] Okay. So, so far, the way that you've [1:58] thought about these questions is to [2:00] think about scaling laws, right? So in [2:02] both the assignments, um you know, the [2:04] games that we're playing are you know, [2:06] things like, okay, I'm going to have my [2:07] flops and as I change my flops, I'm [2:09] going to try to look at my optimal batch [2:11] sizes or look at my optimal learning [2:13] rates and fit these power laws or [2:14] whatever other functional forms uh that [2:17] I want to. [2:18] And we saw in the previous lecture [2:20] that we can do some interventions that [2:22] will make these hyperparameters a little [2:23] bit more stable, right? But [2:26] ideally we have a way of reasoning about [2:29] sort of from first principles, like what [2:30] is happening here? Why is it that when I [2:32] make my models bigger and train for [2:34] longer and do all these things, why is [2:36] it that my learning rate has learning [2:37] rates have to change at all, right? [2:39] There what is the mechanical explanation [2:42] behind that process? [2:44] And so our game plan is uh simple. I [2:47] mean, there's going to be a lot of sort [2:49] of nitty-gritty details as we go through [2:51] this process, but our game plan at a [2:53] high level is very very simple. We're [2:54] going to write down a simple model of [2:56] neural network training, like a very [2:58] very simplified model, much like a NQM. [3:01] And we're going to sort of think about, [3:02] okay, like in this simple model, what [3:04] are the knobs? What are the sort of [3:05] parameters that we can mess with, right? [3:08] Learning rate is obviously going to be [3:09] one of them, but there's other knobs [3:11] that we're going to have. And then we're [3:13] going to study as we make this model [3:15] bigger and bigger, how does the behavior [3:17] of optimization in this simple model [3:19] change as I sort of change these knobs, [3:22] right? So I'm going to study the [3:23] relationship between scaling, these [3:25] interventions, and the behavior of the [3:26] model, right? That three-way [3:28] interaction. And then finally we're [3:29] going to kind of like reason about [3:30] transformers and so on and then we'll [3:32] get some very useful kind of rules of [3:34] thumb um you know, in actually building [3:37] uh language models. [3:39] Um so this lecture is going to basically [3:42] build off of this paper up here um [3:44] Everett at all. Um this is a lovely [3:46] paper. Um Google folks spent kind of a [3:49] really astounding amount of compute to [3:51] just like search the space of like [3:53] scaling exponents or things, but [3:54] actually maybe more importantly their [3:56] appendix has a pretty readable uh [3:59] exposition of the kinds of techniques [4:01] that I'm going to talk about here. [4:02] There's also another paper um that I [4:05] have liked in the past by Greg Yang and [4:06] others. [4:08] I've given this exposition in in my [4:10] other class, CS 336, but I actually like [4:11] this paper better. So I'm going to go [4:13] with this one this time. This is my [4:15] third year trying to teach mu P, and I [4:17] think finally this is the exposition [4:19] that I'm pretty happy with. So we'll go [4:21] with that. [4:23] So we're going to work with a really [4:25] simple model, right? A really really [4:26] simple model. I'm not going to scale all [4:28] the parameters that might be relevant in [4:29] the world. [4:30] I'm only going to scale width out to [4:32] infinity, right? And this is what people [4:34] colloquially call width mu P because [4:36] we're scaling width. [4:38] And I'm going to fix basically [4:40] everything else. I'm going to fix my [4:41] depth. I'm going to fix my steps. I'm [4:44] going to fix the size of the inputs that [4:46] are going to come in. So like imagine, [4:47] you know, I don't have like inputs that [4:49] are like enormously large or enormously [4:51] small or scaled with my width. [4:53] And my loss gradients I'm going to [4:54] assume are are fixed. To be more [4:56] precise, we're assuming that all of [4:58] these quantities are like big O of one [5:00] relative to width, right? Width is the [5:01] only variable that I care about in my [5:03] sort of dimensional analysis that I'm [5:05] going to be doing here. And what's the [5:06] model that we care about? Well, [5:08] transformers and stuff are just a little [5:10] bit complicated. We don't want to deal [5:11] with all those complexities. So much [5:13] like with the NQM, we're going to make [5:14] a, you know, very aggressive series of [5:16] simplifications. And that simplification [5:19] is is this sort of network on the right. [5:21] This network is really just a series of [5:23] stacked, you know, MLPs, right? We've [5:25] got a map mole, we've got a scalar, we [5:28] scale it up and down by a single [5:29] constant. We have a nonlinearity, and [5:31] then we just, you know, repeatedly apply [5:33] this like map mole nonlinearity process. [5:36] And then in the end I have a readout [5:37] layer at L plus one that takes my final [5:39] activation and sort of spits out let's [5:41] say logits or something, right? And that [5:42] feeds into the loss, right? It's kind [5:44] of, you know, you can imagine this being [5:46] very similar to a transformer, but we've [5:47] just abstracted everything out into a [5:49] MLP. [5:50] Very simple model, but if we could solve [5:52] optimization in this model, you could [5:54] imagine how that is a very very useful [5:56] intuition for things like transformers, [5:58] right? So this is the game that we're [5:59] going to play, and we're going to try to [6:01] not fully understand this, but [6:02] understand this enough to be able to [6:04] some useful scaling things in our world. [6:08] Okay. So now what is the goal? Um, you [6:11] know, if you've followed deep learning [6:14] theory in any level of detail, you kind [6:17] of know that, you know, a full [6:18] characterization of even a simple simple [6:20] system like this one over here, that is [6:22] basically impossible, right? So we're [6:24] not even going to hope for full [6:25] characterization of the system. Um, [6:27] we're just going to hope for some two [6:29] extremely basic properties. And even [6:31] this will be very difficult to prove. [6:34] Um, but we will get there, right? So we [6:36] want two properties. Um, one property is [6:38] that things are stable. As I take my [6:41] width out to infinity, this model gets [6:43] bigger and bigger and bigger, it had [6:44] better be the case that the activations [6:47] that I have, you know, are going to [6:49] remain at the same scale. They're not [6:51] going to blow up even if I'm width goes [6:53] to infinity. And sort of my output [6:55] logits are big O of one. So you know, [6:57] they can actually diminish if they want [6:59] to, but they stay at most at scale O of [7:01] one, right? They don't blow up with uh [7:03] width. [7:05] Now this stability notion is very [7:07] important if you want to not have your [7:09] model immediately blow up. And we've [7:11] seen this idea show up in [7:12] initialization, right? Kaiming Glorot [7:15] that those initializations have the [7:16] stability idea built in. [7:18] Now stability alone is not enough. [7:20] Stability just means that you don't blow [7:22] up. That doesn't mean you train, right? [7:25] The other important thing that we have [7:26] here is an idea called non-triviality, [7:29] right? Non-triviality means that you're [7:31] not setting all of your learning rates [7:32] to zero, right? Because you can get a [7:33] stable system by set your learning rates [7:36] to zero or set your initializations to [7:38] zero, right? And that is not an [7:39] interesting thing to do. It just means [7:41] you have a trivial network. So [7:42] non-trivial means that, you know, as I [7:45] scale up my width, you know, my logits, [7:47] my outputs continue to change for some [7:51] time step, right? So it doesn't stay at [7:52] the exact same point as a function of [7:55] time, right? This is very weak [7:57] condition. It doesn't mean that you're [7:58] doing well. It just means that your [7:59] model does something non-trivial at all, [8:01] right? That 's why we call it [8:02] non-triviality. [8:04] Great. Um, and an important sort of [8:06] partially historical note here is that [8:09] the reason why we are this non-trivial [8:11] thing is so important is that because [8:13] there is another sort of set of models, [8:15] so to speak, um that [8:19] you know, achieve stability, but is not [8:21] very useful. And this is the NTK or [8:23] neural tangent kernel. Um [8:26] so we can have, you know, as a sort of [8:27] warm up a very very simple version of [8:29] this where something is stable with the [8:31] width. [8:32] So imagine I have a two-layer MLP, [8:34] right? I have inputs, I have some [8:35] activations, I have some outputs. [8:37] Um and you know, my model I can write as [8:39] this one equation here. And we have, you [8:41] know, one layer, so it's very simple. Um [8:43] and then I keep, you know, my [8:46] you know, output and my input sort of [8:47] weights O of one and then I scale this, [8:51] you know, as I take my width size to [8:52] infinity. Um so what happens if I keep [8:55] my learning rates at O of one and then I [8:57] scale this in sort of this one over [8:59] square root M way for my outputs? Well [9:02] as I have lots and lots of weights, as [9:04] my width grows, [9:05] right? The weights are going to change [9:07] less and less and less, right? Notice [9:09] that one over square root M at the top [9:10] over there, right? And my learning rate [9:12] is O of one. So since the weights change [9:14] very little, right? It's sort of like, [9:16] you know, whatever you do is going to be [9:18] a very local exploration of my [9:20] initialization, right? I move less and [9:22] less and less as my width gets bigger [9:23] and bigger and bigger um as if I keep my [9:26] learning rate fixed. And it turns out [9:28] that you can kind of tailor expand [9:29] around your initialization and you'll [9:31] get something called a neural tangent [9:33] kernel, which actually doesn't really [9:34] even behave like a neural network. It [9:36] behaves like a linear regression or a [9:38] regression of some kind where your [9:40] features are the gradient of, you know, [9:42] this function, right? [9:45] Now that's kind of cool, right? The fact [9:46] that you can reduce something that is a [9:48] neural network in a certain limit to a [9:50] regression problem excited theorists a [9:52] lot. They were like, wow, you know, we [9:54] can actually, you know, analyze this [9:56] thing. Um but you know, I think in [9:58] basically every analysis of the NTK, you [10:01] very quickly find that the NTK is just [10:03] not very useful. Like it's not not the [10:05] object that we want. Um I've taken these [10:07] plots um from the Greg Yang like muP [10:10] paper. [10:12] But really in NTK, what's happening is [10:15] that, you know, because the weights [10:16] don't move, the features of my model are [10:18] basically the same, you know, no matter [10:19] what I do. [10:21] And because I don't do any feature [10:22] learning, I don't get any of the [10:23] benefits of a neural network. In some [10:25] sense, the whole point of a neural [10:26] network is to have not non-trivial [10:28] changes in your activations, right? So [10:30] you can learn some features, you can [10:31] learn some complex things by composing [10:33] different layers. And so if you run [10:35] experiments like, you know, I'm going to [10:36] learn word embeddings using neural [10:38] networks. And if I have this NTK limit, [10:41] you know, I basically get 0 [10:43] % performance on, you know, word analogy [10:46] tests for word embeddings. And [10:48] similarly, if you actually look at the [10:49] embeddings that you get, you know, the [10:50] NTK has learned zero semantic structure, [10:53] you know, cities and states are all [10:54] overlapping each other, whereas, you [10:55] know, normal neural network training [10:57] would actually give you separation over [10:59] these features. Don't read too much into [11:00] this other than to say, you know, there [11:02] are stable limits that are not useful at [11:04] all. This is why we really really need [11:05] to care about non-triviality. That's a [11:07] very core concern if we're going to do [11:10] analysis of neural networks. [11:14] Okay. [11:15] Good. [11:17] So now, you know, we know that the NTK [11:19] limit is bad. Now what we're going to do [11:22] is we are going to, [11:24] you know, vary three different things, [11:26] right? We're going to vary the output [11:27] scale of each block or layer, right? So [11:30] after, you know, I do my matmul, I can [11:32] scale that up or down before I hit it [11:34] with the nonlinearity. I can change the [11:36] scale of my initialization, and I can [11:38] change my learning rates, right? I can [11:40] scale them up or down. Now if we're [11:42] willing to manipulate all three of these [11:43] variables, can we get a network that is [11:46] both stable and non-trivial? Right? This [11:48] is the core question that we are asking [11:50] here, right? And I think this is [11:51] hopefully a [11:54] reasonable set of questions and a [11:55] natural question given sort of the setup [11:56] that we have. And this is, you know, if [11:58] you've heard the words muP, this is [12:00] exactly kind of the premise of this [12:02] style of analysis. We are asking, you [12:04] know, given certain kinds of variables, [12:06] is it possible to get something to be [12:08] stable in the limit of infinite width or [12:10] depth or whatever, right? [12:12] Okay. [12:13] Um can pause here if anyone has [12:14] questions about the setup. I'm going to [12:15] go kind of into the weeds for a couple [12:18] of slides cuz we have to talk about [12:19] parameterization and math and all these [12:21] other things. [12:22] Yes. [12:23] >> Why specifically do we care about like [12:25] the scaling laws of these as opposed to [12:27] like some other property? [12:30] >> What do you mean by sort of scaling [12:31] laws? Um [12:32] >> Or it's like the uh like in the game [12:35] slide um [12:36] we [12:37] like [12:38] uh focus with a simple model we we we [12:40] change things and then like we scale [12:42] them up to see how they change or like [12:45] >> Yeah, right. I guess the whole premise [12:47] of muP is in some sense, you know, you [12:50] want to I mean you could think about [12:52] this just like sort of like the [12:53] physicist scientific curiosity. You [12:55] know, we are making models bigger. [12:57] What's the right way to make models [12:58] bigger? You might expect that the right [13:00] way would be non-degenerate in the [13:01] limit. I feel like these are standard [13:02] ways that physicists think about these [13:04] problems. Like natural objects don't [13:06] blow up as you take things out to [13:07] infinity. That should be the case here [13:09] as well, right? Cuz the parameterization [13:11] is in some sense arbitrary, right? We [13:12] don't care about the actual parameters. [13:13] We only care about the predictions that [13:15] these functions make. [13:16] Um that's one [13:17] >> I guess there's another motivation, [13:18] right? You know, like if you want to be [13:20] you're going to always [13:21] hyperparameter, so you can either tune [13:23] it at the large scale or you can instead [13:24] tune it at the small scale and transfer [13:26] it to the large scale. That's the nice [13:27] thing about [13:27] >> That's the that's the engineer's [13:29] argument that like if we want to get [13:30] direct hyperparameter transfer without [13:32] doing any scaling, then we want to find [13:34] some rule that lets us have a base [13:36] learning rate that's always the same and [13:38] then some scaling constants that are [13:39] hidden underneath that sort of vary this [13:41] automatically would scale. That's kind [13:42] of what ends up happening in muP. Yes. [13:45] >> Um [13:46] the width is constant with the number of [13:48] layer width [13:50] the layer, right? [13:51] >> The the width is constant or [13:52] >> Width layers don't have [13:54] different [13:55] >> Oh yeah, the the number the [13:57] >> to infinity, but [13:59] all the layers have the same [14:00] >> Yes. Uh kind of. Um so the input and the [14:03] outputs, you know, have different [14:04] dimensions. They have D dimensions on [14:06] the output and D dimensions on the [14:07] input, but all every other dimension is [14:09] N, right. Yes. [14:12] Yes. [14:13] >> When we say the activations we want them [14:14] to be constant, that's like as we scale [14:16] with, right? Not across layers. [14:19] >> Yeah, that's right. Activation is stable [14:22] as we take n to infinity. [14:24] We don't really care about other uh [14:25] variables here. Yeah. [14:27] Okay, good. Uh [14:29] This is the right one. Okay, so um you [14:32] know, to formalize this idea of having [14:34] different knobs um you know, this is [14:36] what uh is [14:37] referred to when when someone says [14:39] something like ABC parameterization. ABC [14:41] parameterization uh means that you know, [14:44] I have three different parameters that [14:46] I'm kind of willing to tweak. In this [14:47] case per layer, although that difference [14:49] is not too super material. Um so A is an [14:53] exponent on the uh parameter output. So [14:55] you can see on the equation on the [14:56] right, every layer has an output scalar [14:59] n to the negative uh A and this sort of [15:01] allows us to scale sort of the outputs [15:03] of each of the layers. I have an [15:05] initialization, right? So this is n to [15:07] the negative 2 BL, right? Um so B [15:10] controls you know, how much I'm scaling [15:12] up or down the parameter [15:13] initializations. And then I have a per [15:15] layer learning rate um or a per layer [15:18] learning rate scalar which is n to the [15:20] negative CL, right? And in addition in [15:22] addition to this, there's a base [15:23] learning rate that's multiplying this. [15:25] That's why there's a proportionality [15:26] constant, right? But across the layers I [15:28] have a scaling of n to the negative CL. [15:31] As I said before, you know, I have some [15:32] basic assumptions such as the inputs are [15:34] O of 1 because otherwise, you know, if [15:36] the inputs can grow with your width, you [15:37] got some problems, right? We're assuming [15:39] that for example, you have fixed you [15:41] know, tokenizers, tokens are always the [15:43] same so they're O of 1, right? No matter [15:44] how big of a model that I'm making. [15:46] Um so now, you know, this is the more [15:48] specific version. I want to find [15:49] constants A, B, and C um you know, which [15:53] uh such that we get stable and [15:55] non-trivial limits. And if we can find [15:56] such things, then we're in very good [15:58] shape, right? That means that our [15:59] training uh is going to be stable no [16:02] matter how big the width of our network [16:04] gets. Um and I already mentioned the [16:06] dimensions, right? But the first and [16:07] last layers are n by d uh or d by n and [16:11] then the middle layers are all n by n [16:12] and I'm scaling n out to infinity here. [16:17] Um so as a warm up, we are going to go [16:20] through progressively more and more [16:22] derivations, um, some of which will feel [16:24] unnatural to you, especially if you want [16:26] the kinds of like rigorous step-by-step [16:28] math, but I'll kind of explain the [16:30] sketchy parts as I go. Um, but I think I [16:32] want you to understand this at like [16:34] different layers. I want you to [16:35] understand the warm-up pretty well. The [16:36] warm-up is something we're already very [16:38] familiar with. Um, and this is [16:40] activation stability, right? So the [16:41] Kaiming initialization, the Glorot [16:43] initialization, those are all about [16:45] activation stability, right? [16:47] So now, um, we're going to derive [16:49] activation stability at initialization, [16:52] and then we're going to show that that [16:53] corresponds or or, you know, Kaiming's [16:55] initialization is a is a instance of [16:57] this stable initialization. Okay, so [17:00] we're going to do induction. We're going [17:02] to do induction a lot today. And how [17:03] we're going to do this is we're going to [17:04] look at kind of the base case to start [17:06] with, right? This is the very first [17:07] layer, and we have our initialization. [17:10] Now let's look at what's happening in [17:11] this base case. Well, in this base case, [17:13] I have a X which is O of 1, and it [17:15] multiplies W 1, which is a Gaussian with [17:18] scale N to the, uh, -2 B 1 as my my sort [17:23] of variance term, and then I scale it up [17:25] by N to the -A 1, right? And so I know [17:27] these facts, and so I can step through [17:29] each of my arguments. So the first one [17:31] is that well, I have a vector-vector [17:32] product, and each of these products is [17:35] of size O of D. This is constant, right? [17:36] Because D doesn't scale. Um, and then, [17:39] you know, from my initialization, each [17:41] of these vector-vector products are [17:43] scaling as N to the B 1, right? I drop [17:45] the the square term over here, uh, [17:47] because it's standard deviation, not [17:48] variance, right? [17:50] Um, thus the typical size of an entry in [17:53] my vector-vector product, which is also, [17:55] you know, what I'm going to refer to as [17:56] the RMS norm, is N to the B 1. I scale [18:00] this up by, oh, actually I forgot [18:01] negatives here. So N to the -B 1 and the [18:03] -B 1. The alpha scalar is N to the -A 1, [18:06] and so I multiply these two guys, um, [18:09] and I'm going to get that Z 1 is on the [18:11] order of N to the -A 1 - B, right? So we [18:14] can do these kinds of dimensional [18:15] analyses to get kind of constraints. So [18:18] if A + B is equal to 0, then this thing [18:21] will kind of cancel out and I'll be O of [18:22] one, right? So that's my condition for [18:24] stability in the very, very, very first [18:27] layer. Oh, and the last thing, this is, [18:28] you know, one of many sketchy things [18:30] that we will do today. I'm going to [18:31] ignore all non-linearities. Um, you can [18:33] kind of convince yourself that if things [18:35] are random enough, then like a value [18:37] will, you know, randomly be on each [18:38] side. This is roughly going to be a [18:40] factor of half. We can just ignore this [18:41] for scaling analyses. Um, doing this [18:43] precisely would be an incredible amount [18:45] of work, uh, so we're just going to [18:47] ignore it for today. [18:49] Okay, question about this this very [18:50] basic warm-up base case. [18:54] Good. Okay. [18:55] Um, so now, you know, now we Oh, sorry, [18:57] yes. [18:59] >> When would we care about like things [19:01] that scale by a constant even if we have [19:03] like hundreds of layers for example or [19:05] >> When would we care about things that [19:06] scale by a constant? Um, we would care [19:09] about things that scale by a constant, [19:11] but not as a function of n, right? Like [19:12] so they would either blow up at n of one [19:15] or not, if that makes sense. The only [19:16] variable that we're taking limits of is [19:18] n. So we can drop all their dependences, [19:21] uh, for the purpose of at least this [19:22] analysis. You are right, the stability [19:24] properties do depend on constants. [19:26] Um, [19:27] Oh, yes. [19:28] >> Doesn't the analysis depend on what [19:30] non-linearity we have like if it's a [19:32] damage then it's sort of bounded, right? [19:34] >> Yes, yes. It does depend on I mean, you [19:36] know, this is this is a slightly [19:37] hand-wavy argument. For upper bounds, [19:39] you don't really care about this. You [19:40] know, I think you can push the arguments [19:41] through. We do actually need both upper [19:43] and lower bounds because we're looking [19:44] at kind of like, you know, big theta of [19:46] one, not big O of one in a lot of these [19:48] cases. In that case, yes, it really, [19:49] really does matter. Um, one of many [19:51] places where, you know, you do [19:52] simplifying things to get the right [19:54] answer. [19:55] Um, okay, great. So now we do the [19:57] inductive case. You know, mu p arguments [19:59] are basically all just induction, right? [20:01] You prove stability at one step and then [20:03] you, you know, bootstrap that stability [20:04] for the rest of the time. Now assume [20:06] that, you know, coming into my layer L [20:09] is, you know, RMS O of one. So the [20:11] typical size of my entry doesn't depend [20:13] on my width. [20:14] Now, you know, I claim that Z of L is [20:17] has this dependence, n to the negative A [20:19] L minus B L plus one half. So the same [20:21] thing as before, but with a plus one [20:23] half. Okay. What's the argument for [20:24] this? Well, now, remember that I don't [20:27] actually have a rectangular matrix of n [20:30] by d. I now have a square matrix n by n [20:33] that is growing in size, right? So So [20:34] because of this, both dimensions are [20:36] growing. Um because this is growing, [20:38] well, uh inner product of a of a random [20:41] Gaussian matrix with a vector is roughly [20:43] going to be uh square root of n, right? [20:46] So that's going to be kind of the the [20:48] expansion factor. Um and then, you know, [20:50] I combine it with the scale of the [20:52] matrix, which is n to the negative BL, [20:54] and then the output scale n to the [20:55] negative AL. And then so I combine all [20:57] three of these terms, and I get the [20:59] quantity above, right? So the main [21:00] difference here is just I have a square [21:02] matrix that's growing in both dimensions [21:04] rather than a rectangular one in just [21:06] one, and therefore I get this extra n to [21:07] the one half there, right? Um and so I [21:10] can basically go through all of these [21:11] analyses for all the layers. I'll skip [21:13] the the terminal layer. It's basically [21:14] the same analysis as before. [21:16] Um and then you're going to end up with [21:18] three different constraints, right? We [21:19] saw that we have n to the negative A1 [21:21] B1. So A1 plus B1 must equal zero. And [21:24] then in the middle layers, they have to [21:25] equal half. And then in the terminal [21:27] layer, um actually we don't necessarily [21:30] need them to be like exactly um O of [21:33] one. So here, you know, you have an [21:35] inequality instead. But that's sort of a [21:36] minor detail, right? [21:38] Um so now let's compare this to the [21:40] Kaiming initialization. Um we've seen, [21:43] you know, the Xavier initialization, and [21:44] one of the things that it did that was [21:45] nice is if you follow this nice like [21:47] square root over width scaling rule, um [21:50] what you end up with is that all the [21:51] activations kind of have the same [21:53] Gaussian shape as you go through the [21:54] layers, right? [21:56] Now what are we getting? Well, in the [21:57] Kaiming initialization, it's this thing, [21:59] right? Gaussian of of the fan-in or the [22:01] square root of the fan-in. Um and so [22:03] remember what do we need? We need n [22:05] [laughter] [22:05] Uh let me go back one slide. I didn't [22:07] write an n, right? We do need for the [22:09] intermediate layers uh AL plus BL uh is [22:12] equal to one half. These are exponents, [22:14] right? And we are picking essentially AL [22:16] equals one and BL equals half because [22:18] that's the square root, and now [22:20] [clears throat] that's equal to half, [22:21] right? So this ha satisfies the [22:22] stability property of activation [22:24] stability uh initialization, right? So [22:26] this is um hopefully clear. This is um [22:29] uh [22:30] basically a warm-up. Now, we've proven [22:32] the standard like, you know, thing that [22:34] people know, which is that the Kaiming [22:35] init is stable at initialization. [22:39] Um so that's great and hopefully you all [22:41] followed that. That's kind of the easy [22:43] version of of everything that we're [22:44] going to do today. Um the techniques are [22:46] basically the same just with more [22:47] formulas. [22:49] Um but we know that we have only proven [22:51] a very very very small slice of what we [22:53] need to do, right? So I have let put in [22:55] red all the things that we need to still [22:57] do, which is that we need to deal with [22:59] the activation stability throughout [23:01] training. That seems complicated. Um we [23:04] also need to deal with non-triviality [23:06] that the logits need to update um at [23:08] constant scale. Um so these are both [23:11] very tricky, right? I need to reason [23:12] about updates. I need to uh sort of [23:15] propagate this through the training [23:16] trajectory. Both of these are are kind [23:18] of unpleasant things uh to have to deal [23:21] with. [23:22] Um so now we're basically going to walk [23:25] through the remaining components of [23:26] this. In order to deal with uh sort of [23:28] updates, we need to reason about [23:30] gradients. So we're going to do the same [23:31] analysis but for gradients. A lot of the [23:33] formulas will look familiar. Um and if [23:36] you really want to work through each of [23:37] the individual like arithmetic steps, [23:39] you can look through appendix B of the [23:41] paper that I uh referred to. It's also [23:43] on the website if you want to click on [23:44] it. Um but you know, I'll give you kind [23:46] of the really high-level rough version [23:48] that you can kind of follow the [23:49] intuition and then maybe you can go back [23:51] and check the paper uh for the more [23:52] careful calculation. [23:54] So you know, gradients kind of seem [23:56] scary at first glance, but at [23:57] initialization, gradients are basically [23:59] as simple as activations to deal with, [24:01] right? So we have the chain rule, right? [24:03] And for, you know, we're ignoring the [24:05] the activations. And so for a series of [24:07] matmuls, right? You know, all that [24:08] happens is that you transpose the [24:10] matrix, right? And so what happened in [24:12] the forward is basically just going to [24:13] happen in the backwards once again. Um [24:15] so you know, as an assumption, I'm going [24:17] to assume that my loss function is nice [24:19] and that the loss function itself does [24:21] not blow up with with with with That [24:24] seems fine. It's not like I'm changing [24:25] the vocabulary with with. [24:27] Um [24:28] for the same reason as the sort of [24:29] forward case, you know, we can basically [24:32] um define something that looks very very [24:34] similar. So, working backwards, you [24:36] know, with using the same logic as the [24:38] input layer, I have a rectangular matrix [24:40] at the very end, right? That matrix is [24:42] going to have a A + B dependence. [24:44] There's no 1/2 because I'm scaling a [24:45] rectangular matrix, right? So, this is [24:47] the same calculation as before. As I [24:49] work backwards through these partial [24:51] derivatives, um what's happening is now [24:53] I'm taking my cotangents going backwards [24:56] in the gradients, um and I'm going to be [24:58] multiplying them with these square [24:59] matrices that are growing. That's [25:01] exactly the same calculation as before. [25:03] So, now I have AI + BI - 1/2, right? So, [25:05] this is the same square root N [25:07] calculation as before. Um and then [25:09] finally I'm going to hit sort of the [25:10] parameter that I'm differentiating. Um [25:13] and the only difference is that I'm [25:14] going to have a AL term, right? Because [25:15] as I come in on the back prop, I'm going [25:17] to multiply with N to the negative AL at [25:19] the very end. So, that's a scalar. But [25:21] then I don't have a B term because I'm [25:23] differentiating with respect to the [25:24] parameter WL. So, I don't have a final [25:26] matrix multiplication, right? Hopefully [25:28] that's clear. Um [25:30] [snorts] so this gives us, you know, [25:31] additional constraints. Actually, if I [25:33] have initialization activation [25:35] stability, remember that AI + BI is [25:37] already 1/2, so these all cancel out. [25:40] And so actually, to make my gradient [25:42] stable, the only additional constraints [25:44] that I incur are just a few additional [25:46] constraints having to do with um sort of [25:49] the terminal layers and their [25:51] relationship to A of L. Um but as long [25:54] as I fulfill these guys, you know, I'm [25:55] going to have sort of gradient stability [25:57] um as well. [26:03] Okay. So, now we have the gradients. And [26:05] now with the gradients, we can start to [26:07] reason about dynamics, right? So, what [26:09] are the ingredients we need to to reason [26:10] about how the model's behavior? Well, [26:12] the model's behavior is a combination of [26:14] the gradients and the action of the [26:16] optimizer on those gradients, right? Um [26:19] Adam is very complicated, right? There's [26:21] these momentum terms, second moment [26:22] terms. So, as with everything else, [26:24] we're going to aggressively simplify the [26:26] behavior of this optimizer, like really [26:27] really aggressively simplify them. [26:29] Um and so for SGD, you know, this is [26:32] this one's actually pretty [26:33] straightforward because the algorithm [26:34] itself is straightforward. The change in [26:36] my parameters I'm going to model as, you [26:38] know, just a scaled-up version of my [26:41] gradients, right? That's almost [26:42] definitional, and that's going to have a [26:43] dependence [26:45] uh that depends with g of l. This is my [26:47] gradient exponent, right? We've defined [26:48] that in the previous slide, and c of l [26:50] is my learning rate, right? Um, in the [26:52] case of Adam, what's happening with [26:54] Adam? Remember, I told you Adam is kind [26:56] of like sign SGD, right? That's always [26:58] good intuition to have in mind. If Adam [27:00] is just like sign SGD, what's happening [27:02] is it's just going to turn each entry [27:04] into one or minus one, right? The signs. [27:07] And so what's the typical size of the [27:08] resulting update? Well, the typical size [27:10] of the resulting update is roughly O of [27:12] one, right? So, you know, basically the [27:14] size of the gradients just go away. We [27:16] don't have to worry about those guys [27:17] anymore. The size of the change in my [27:19] parameters at each step is roughly going [27:21] to be controlled just by the size of uh [27:24] my my step sizes, which is n to the [27:26] negative c l, right? This is by [27:27] definition of my uh learning rates. [27:31] K. [27:32] Um, and then [27:34] this is the hairiest part of the whole [27:35] exposition, and after this, I believe [27:39] uh after we, you know, unpack and go [27:40] through all three of these terms, um I [27:42] think I'm not going to have much math [27:44] for the rest of the lecture, but this is [27:46] kind of the big thing that we now have [27:47] to deal with, okay? [27:49] So this is basically the remaining [27:51] really hard part. And the remaining [27:52] really hard part is I'm going to train [27:55] my model, right? And as I train my [27:56] model, my activations are going to [27:58] change as I do training, right? The hard [28:00] thing is I have to control the [28:02] activations of my model during training, [28:04] you know, the whole time, right? Because [28:05] I'm saying I have to be stable during [28:07] all updates, right? So how do I do that? [28:09] Well, let's look at what happens during [28:11] training. I have my z of l. This is [28:12] activations at layer l. Um, and I can [28:15] represent this in this following way. So [28:17] this first equality is just rewriting [28:19] it. I have my weights at initialization. [28:21] I have how much the weights moved since [28:23] initialization, and I multiply that with [28:26] um the activations at init of late the [28:28] previous layer l minus one plus how much [28:31] my activations changed over training of [28:33] my previous layer + 1. Right? This is [28:35] definitional, right? Because uh you [28:37] know, ZL, if we drop the nonlinearity, [28:40] is exactly my current weight times my [28:42] previous activation, right? [28:44] Now I can expand this term, and what we [28:46] will see is that there are four terms, [28:48] right? Four terms in this expression. Um [28:51] one of these is actually great. We've [28:52] already solved this guy. This is the [28:54] very first term. This is the uh behavior [28:57] at initialization, and we know that's [28:59] stable. We already solved for that, so [29:00] that's good. We don't have to deal with [29:01] it. Now the remaining three terms, these [29:04] are actually pretty annoying to deal [29:06] with, but we have to deal with them. Um [29:08] they have to do with essentially how [29:10] closely aligned are two things. One of [29:12] them is the weights, the other one is [29:13] the activation differences. That's the [29:15] first term. This one's the change in [29:17] weight times the initial activation, and [29:19] the last one is the change in weight [29:21] times the change in activation, right? [29:23] So this is just kind of expanding all [29:25] the possibilities here. Um [29:27] and just for shorthand, I'm going to [29:29] define three exponents, alpha L, omega [29:32] L, and U of L. These are going to [29:35] correspond to essentially um how well [29:38] aligned each of these two sort of [29:41] products are. So what what am I trying [29:43] to do here? Well, each of these [29:45] exponents is trying to tell me how much [29:47] bigger or smaller are each of these [29:50] terms compared to just multiplying the [29:52] exponents of their constituents, right? [29:54] So ideally ideally, right, what I would [29:56] like to do is just ignore the fact that [29:59] these are matrix vector multiplications, [30:01] and I would just love to look at the [30:02] size of W in the size of this delta Z [30:05] and say, okay, I know the sizes, I know [30:07] the size of the product, right? But I [30:09] can't just do that because they are [30:10] actual matrix vector products. So I have [30:12] these exponents, and these exponents are [30:14] essentially assumptions or like, you [30:16] know, external observations that tell us [30:19] how much bigger is this going to get [30:21] than something naive like just putting [30:22] the exponents together, right? So that's [30:24] why I'm defining these three terms. [30:25] They're just here to absorb sort of [30:27] these three variables that I don't know [30:28] how to deal with. [30:30] Okay. So that's kind of the setup. [30:33] And now what I'm going to do Oh, yes. [30:37] >> When people derive this sort of stuff, [30:38] they [30:38] >> they have to at some point assume that [30:40] the transpose and the original matrix [30:42] are independent of each other uh [30:45] which [clears throat] you should have [30:46] done in the gradient step where [30:48] that show up. [30:49] >> Sorry, what uh what what and what isn't [30:50] tied in with each other? I couldn't hear [30:51] you. [30:52] >> So like there's a [30:54] seemingly nonsensical thing that you [30:55] have to assume which is that like uh W [30:58] and W transpose are independent random [31:01] variables. [31:03] >> W and W transpose are independent random [31:05] variables. [31:07] I don't know if you have to assume that [31:09] in the derivation that I've done so far. [31:13] I do know that you do have to assume [31:15] that now. You do have to assume that [31:17] these guys are random variables and they [31:19] do all sorts of strange things that can [31:20] actually happen. Um I don't know if the [31:23] transpose thing shows up in the gradient [31:25] calculation. I don't think it should. [31:27] >> What? [31:29] >> Yeah. Okay, I I'll I'll look into it and [31:31] get back to you, but I don't think the [31:32] gradient calculation necessarily does. [31:38] Um okay, so let's get back to here. Um [31:41] so we do actually need to for example [31:43] assume that these two are independent in [31:45] ways that are slightly concerning. I'll [31:47] talk about that later. Um so now we're [31:50] going to do the same induction argument. [31:51] Now this time with activation Z. Um [31:53] we're just going to work sort of [31:55] upwards. Um in this one we're just going [31:57] to work out the second step. There's [31:58] some additional complexities with the [31:59] third step. Uh but I'm not going to go [32:01] through it because it's not [32:02] pedagogically useful in my mind. Um you [32:05] can kind of look at the appendix B if [32:06] you would like to. It's basically more [32:08] bookkeeping. [32:09] Um so for the second step what's going [32:11] to happen? Well, in the first layer you [32:13] know I have this very familiar looking [32:15] formula. X isn't different, right? My [32:17] input's always the same. The only thing [32:18] that changes is the weights. So I [32:20] distribute the X's and I have you know I [32:22] have my Z 1's and I have my Z 0's. This [32:24] is my Z pre and post update and then I [32:27] have sort of the delta, how much I [32:28] change in the meantime on the second [32:31] term over here. [32:32] Now you know I know that I want that you [32:35] know this Z 1 my after my update is [32:37] state of 1 and I know that Z before my [32:40] update is state of one. [32:42] Now what I would what I'm going to [32:44] assert is that the change here must be [32:46] low order in order for this to be true. [32:48] At the very least, it cannot be larger [32:50] order, right? Like if if I have [32:51] something that's O of N, this thing is [32:53] going to like really blow you up, right? [32:55] So I do know that it probably should be [32:56] low order. It does not guarantee that [32:58] this is state of one. I'll talk about [33:00] that later, but this is a necessary [33:02] condition for this to be true, right? So [33:04] if I work through this, what does this [33:06] say? It says that well, this change must [33:08] be O of one. And so if that's true, then [33:11] it adds a new constraint that A one plus [33:13] C one has to be greater than or equal to [33:15] zero. And if that's true, this will be O [33:17] of one. And if that's O of one, then [33:19] we're in good shape, right? This delta [33:21] W, remember, is N to the negative C one [33:23] for something like atom. [33:27] Good. [33:29] Okay. So now, you know, we once again, [33:31] you know, invoke induction. We have [33:33] layer one that's controlled. Now we go [33:35] up to layer L, right? And if we're going [33:37] to do this, we see this three part [33:38] decomposition once again. [33:41] And we can work through each one of [33:42] these. And this is all definitional now [33:44] that we've defined the variables, right? [33:46] So we look at the size of WL of zero. We [33:49] look at the size of, you know, delta Z L [33:51] minus one and one. And then we multiply [33:53] it with an additional exponent omega of [33:55] L, right? Remember, omega of L is kind [33:57] of this fudge factor for how different [33:59] this product is from its constituents, [34:01] right? And we can compute the [34:02] constituents because we sort of defined [34:04] it. RL minus one is the size of delta Z [34:06] L minus one. And WL zero is exactly this [34:10] WL zero times N to the negative AL is N [34:13] to the negative one half. [34:15] So we can go through each of these [34:16] calculations and we'll get each of these [34:18] bounds. [34:19] And once again, each of these terms you [34:20] see kind of what I'm going to call the [34:21] alignment variables omega, alpha, and U [34:24] representing, you know, how aligned [34:26] these things are. And if our optimizer [34:28] is atom, then now this is going to give [34:30] us three new constraints. One [34:31] corresponding to each one of these sort [34:33] of big O terms, right? And we know that, [34:36] you know, these have to be O of one. And [34:40] if they're they're greater than O of [34:41] one, then we're in trouble. So they give [34:42] us once again these inequality [34:44] constraints that have to be fulfilled. [34:47] And then finally, just for completeness, [34:49] right? Um we can do the same analysis [34:51] for the final logit. They're no [34:53] different almost at all. Um the only [34:55] only thing that's different um is that [34:57] we had a one half over here. We no [34:59] longer have a one half over here. Um and [35:01] that's because we don't have a natural [35:03] sort of cancellation from just the [35:05] initialization of W L. Um before, just [35:07] from how we defined W L for stable [35:10] initial activations, um those two things [35:12] canceled out into one half. We do not [35:14] have that here. Um but otherwise, this [35:16] is exactly the same calculation as [35:17] before. We end up with very similar [35:19] looking inequalities just with little L [35:21] replaced with capital L plus one. [35:24] So we have a bunch of constraints um and [35:26] hopefully you can kind of see uh what's [35:28] happening um here. [35:30] Um so I do want to like spend one slide [35:33] talking Oh yes, question. [35:34] >> Sorry. Uh [35:36] I think the interpretation of like A, B, [35:38] and C makes sense to me. Could you go [35:39] over just like one sentence in terms of [35:41] like what are omega and alpha? [35:44] >> Yes. Yes, yes, yes, yes, yes. [35:46] >> I didn't miss that. Sorry. [35:47] >> Um so R is actually a slightly strange [35:50] variable. Um and let's just call it a [35:52] placeholder for now. Um R is a shorthand [35:56] notation that represents the exponent, [35:59] the size of delta L Z L, right? And R [36:03] ideally is not something that is like, [36:06] you know, uh greater than uh [36:09] zero. If it's greater than zero, then [36:11] this diminishes with N and will [36:13] eventually become zero, right? So this [36:14] is the size of my activation updates [36:16] over time, and we want this to roughly [36:18] be one. So R of L should be zero, right? [36:21] But this is a placeholder variable for [36:22] now. It's a variable that defines how [36:25] much is Z L changing. The other three [36:27] variables, these three are sort of kind [36:30] of assumptions, right? One way of [36:31] thinking about this is I'm going to [36:32] write down these variables, and I could [36:35] assert that alpha is one, omega is a [36:37] half, and U L is one, right? I can just [36:39] assert that now and then do the rest of [36:41] the analysis. These have to do with, you [36:43] know, um, how aligned are these two [36:46] variables. And let me give you a little [36:47] bit of extra intuition. This is in the [36:48] assignment handout as well. [36:50] Let's say these two are like random [36:52] variables. They have no dependence on [36:54] each other. If they do, uh, then all [36:56] these quantities are one half. Why is [36:58] that? Well, a random matrix vector [37:00] product on a Gaussian is going to be [37:02] like square root n, right? We already [37:03] talked about that. And the square root [37:05] has an exponent of half, right? Now, [37:07] what if they were fully correlated, [37:09] right? If they're fully correlated, like [37:10] they're in the same direction, there's [37:12] no randomness, uh, then this will be one [37:14] over n, right? And that would be [37:16] exponent of one. So these numbers in [37:18] general you should expect to be between [37:19] half and one. They represent whether [37:21] you're more like a random independent [37:23] matrix vector product that's like [37:24] totally unrelated or if z and w have [37:27] very strong dependence, they're kind of [37:29] pointing in the same direction and you [37:30] have one over n, right? Um, so those are [37:32] the two possible regimes. Hopefully [37:34] that's helpful, um, in sort of thinking [37:36] about what what's happening here. Great. [37:38] Um, perfect. [37:41] Okay. So the last thing that I'll say is [37:43] that there are many parts of this [37:44] derivation that I think, um, you know, [37:47] you're you're going to have to do some [37:48] hand waving, um, and that's kind of [37:50] okay, um, in some ways. Um, you know, [37:53] I've been kind of saying in this [37:54] previous slide, you know, uh, I have [37:57] these big o terms. And if these big o [37:59] terms are o of one, then everything is [38:01] good, right? Like things will be okay in [38:03] terms of our update size. But really, [38:05] implicitly I'm doing something like [38:07] this. I have a term that's, you know, [38:09] theta of n. I have a term that's o of n. [38:12] And then I've subtracted them and I'll [38:14] get something that's, you know, theta of [38:16] n. But that's not true. The leading [38:18] order terms of these quantities can [38:20] cancel out, leaving you with lower order [38:22] terms, right? This is a possibility. Um, [38:24] and if we wanted to like really do this [38:25] rigorously, then you would need to [38:27] compute out the constants for these. [38:29] Except computing out the constants for [38:31] these is basically impossible. Um, and [38:33] so, you know, one of the I think [38:35] interesting things about mu p and this [38:37] style of analysis is that in some sense [38:39] you're making assumptions about no [38:40] catastrophic cancellations. You save [38:43] yourself an incredible amount of [38:44] analysis that is probably intractable. [38:47] And then in the end, you end up with [38:48] very interesting answers that are in [38:50] practice very useful. Um, and you know, [38:52] some some areas of physics do use these [38:54] kinds of like leading order term [38:55] calculations where you just like don't [38:57] you know, you basically assume that [38:58] leading order term cancellations can't [39:00] happen. [39:01] Um, [39:02] okay. So the last thing is [39:04] non-triviality, right? Um, it seemed [39:06] like maybe non-triviality would be a [39:07] really hard constraint. You have to have [39:09] some update, but basically we have [39:11] everything we need to do non-triviality [39:13] with all the calculations we have [39:15] because we already have the last layer [39:16] logic behavior, right, throughout [39:18] training. So all we need to do is to [39:20] make sure this is going to be moving at [39:22] some point during training. And to do [39:24] that, you know, I'm going to make one of [39:25] these three terms uh big theta of one, [39:28] and that means it's going to be, you [39:29] know, non-vanishing in as a function of [39:32] width. And if one of these is [39:33] non-vanishing and I don't have [39:34] cancellation, this term is going to be [39:36] non-vanishing, right? Um, and so that's [39:38] all that we need. Um, [39:41] and so this leads to a big big table of [39:44] different constraints. And you know, if [39:45] you believe this kind of like mu P [39:47] scaling style analysis, you know, uh [39:50] on faith, then what you end up with is [39:52] to say, okay, if I pick um any set of [39:55] variables, like so my omegas, alphas, [39:57] and u's, these are like parameters, I [39:59] have to fill them in manually. Um, r I'm [40:02] going to set to be zero because I want [40:03] feature learning. Um, and then any a b c [40:06] trio that satisfies this series of uh [40:09] constraints is going to be uh kind of [40:12] scaling stable family. And you know, the [40:14] authors uh have this very nice table [40:17] where they kind of show you all the [40:18] different parametrizations that are [40:20] possible. You know, they show you uh [40:22] depending on how you want to [40:23] parameterize uh your inits, you know, [40:26] you can correspondingly change either [40:28] your parameter multiplier scaling um and [40:30] or your learning rate to essentially [40:32] fulfill um the constraints above. And [40:35] here you actually have two sets of [40:36] tables here, you know, it's called full [40:38] alignment and no alignment corresponding [40:40] to different assumptions about what [40:43] alpha and u is. Um, if you have alpha [40:46] equals u equals one, then you're in a [40:47] full alignment mode. If you're in the [40:49] half case, you're in no alignment mode. [40:51] Remember what I said about, you know, [40:52] random matrices? That's kind of in this [40:55] regime, right? [40:56] Um, and of course we're minimizing RL, [40:58] we're just setting it to zero so that we [41:00] get feature learning uh in all these [41:02] regimes. [41:03] Um, okay. So that's roughly all the sort [41:06] of derivations part of mu P. Um, [41:09] hopefully that was like at least at a [41:11] high level clear for everybody. Um, let [41:14] me know if you have questions. I'll I'll [41:15] move on to some more empirical stuff uh [41:17] over the next few slides. [41:23] Oh, yes. [41:24] >> Um, how do we know which alignment [41:26] situation we want to pick? [41:27] >> Ah, very good question. Um, right before [41:30] um, you know, this this lecture, I was I [41:33] was talking to [41:34] and we were [41:36] saying it's all a lie. Um, not not [41:38] really. But, you know, there is a sense [41:40] in which this alignment variable is [41:42] actually really really tricky. So the [41:43] nice thing about, you know, this paper, [41:44] the Everett paper, is they do [41:45] empirically measure all these variables. [41:47] Um, and the really unfortunate thing in [41:49] my mind is that this guy changes during [41:51] training, right? Um, so the alignment [41:53] variable starts, of course, at 0.5. This [41:55] is definitional, right? Cuz at the [41:57] initialization you've randomized [41:58] everything, so there can be no [41:59] correlation. I mean, that's not [42:00] technically true. The backwards can have [42:02] correlation, but it's very hard to have [42:04] correlation, right? So you have 0.5. Um, [42:06] but as you train you're going to start [42:07] building up a lot of correlation, right? [42:09] Because your gradients are changing the [42:11] weights and they're of course, you know, [42:13] changing in the in ways that are [42:14] correlated with the activations, right? [42:16] So now you have dependencies between [42:17] these variables. Your alignment [42:19] variables go up and up and up. Um, and [42:21] depending on which sort of part of the [42:23] network you are, they go up in different [42:24] ways, but they go up and up and up. And [42:25] they don't, you know, go all the way up [42:26] to one, they just kind of stabilize out. [42:28] So different kinds of training will give [42:30] you different kinds of alignment and [42:32] different parameterizations and so on. [42:33] But the point here is not super clear [42:36] what the right alignment to choose is. [42:38] If you just want the initialization to [42:39] be good, then I guess 0.5 is always [42:41] good. But of course later in training [42:44] that's not a good assumption, right? [42:46] Yes. [42:47] >> Is there a reason you like or can you [42:49] just change that variable dynamically as [42:51] training goes on? [42:52] >> Um, [42:53] as far as I know, that has not really [42:55] been done. I guess even measuring this [42:57] thing is kind of annoying. Um, but in [42:59] principle you could, yeah. I mean, I [43:01] think if you were really uh committed to [43:03] the the mu P stable scaling, you know, [43:06] belief, then you would really maybe want [43:07] to change the alignment variable as as [43:09] you might. [snorts] [43:13] Good. Okay. Let me go back. [43:17] Um, so this, you know, idea, I gave the [43:19] more general presentation for this like [43:21] wider range of what's called ABC [43:23] parameterizations. Um, a particular one [43:26] called mu P um was proposed by Greg Yang [43:28] and others. You know, he's got this [43:29] whole line of work called tensor [43:31] programs um where he sort of builds out [43:33] this theory. Um, and this was really, [43:35] you know, at the time um a really [43:38] impressive piece of work because what [43:39] they showed was that, you know, you [43:41] could get this like kind of learning [43:42] rate transfer as a function of width. [43:43] These are sort of in simple toy models, [43:45] but you see that as you increase the [43:47] width of the network, normally you have [43:48] to change your learning rate. You know, [43:50] mu P gives you stability. Great. [43:52] Um, you also see that, you know, the [43:54] training is just generally much more [43:56] stable. Um, things like the logits or [43:59] the attention logits um or the input [44:01] embeddings, all of these are much more [44:03] sort of, you know, reasonable in terms [44:05] of their, you know, deviation from [44:07] initialization um and their variation um [44:10] as a function of how many steps you [44:12] take, right? So no matter the width, [44:14] sort of the steps that you take sort of [44:15] behave the same way, whereas if you look [44:17] at sort of the more standard [44:18] parameterization, [44:19] you definitely see that, you know, um [44:22] sort of wider networks behave very [44:24] differently in the logits than sort of [44:26] uh smaller networks. And so this was [44:28] really cool um and, you know, I think [44:30] has really taken off as a kind of way of [44:32] thinking about uh scaling limits of [44:35] neural networks. [44:37] Um, the other paper has quite a few [44:39] really interesting experiments. Um, I'll [44:41] just explain uh a few of them and sort [44:43] of try to get across why this is an [44:45] interesting thing to do. Um, one of the [44:47] things is that, you know, they show [44:49] generally uh stability of the optimal [44:51] learning rate as a function of depth. [44:53] They have a huge range of depth here, [44:56] uh, [44:57] sorry, of of width here. Um, and they [45:00] see that, you know, the learning rate [45:02] stable even as you scale up. Um, and [45:05] maybe more importantly, before this [45:07] paper, what, you know, was generally [45:09] believed was that, for example, the [45:10] standard parameterization was sort of [45:12] inherently going to have these like [45:13] drifting learning rates. Um, but if you [45:15] scale all the ABC parameterization [45:17] correctly and you have these like nice [45:19] per layer learning rates, it's possible [45:21] to get all of these different [45:22] parameterizations that behave quite [45:24] nicely. Um, and so it's quite important [45:26] to have these like scaling learning [45:27] rates that let you control different [45:30] aspects of the network. [45:32] And this is a table summary of the same [45:34] plot that was being shown in the [45:36] previous slide. Um, but what you can [45:38] basically see is that, you know, for [45:40] different optimizers, for different sort [45:41] of parameterizations of the network, as [45:43] long as you kind of respect kind of this [45:45] ABC parameterization and you set the [45:47] learning rates appropriately as you [45:49] scale, you can get very nice sort of [45:51] stable and and high performance results [45:53] that are much better than if you try to [45:55] fit a single global learning rate. So, [45:58] you know, this is this is maybe [45:59] unsurprising. We do know that different [46:01] parts of the network behave differently, [46:03] but the nice thing is kind of this we [46:04] have a now way of thinking about this [46:06] scaling analysis, right? Instead of [46:08] trying to like fit these scaling laws [46:10] that are inscrutable to us, we can try [46:11] to do this like leading order of [46:13] magnitude calculation um, and then try [46:15] to solve out what the right way to, uh, [46:19] you know, do learning rates or [46:20] initializations. [46:22] Okay. So that's muP. Um, and the main [46:25] thing that we want here is we want, you [46:27] know, two things at once, right? We want [46:28] stability and sort of non-triviality or [46:30] feature learning as we scale whatever we [46:32] scale. In this case, we analyzed width. [46:35] Um, and what we really want is these [46:37] kinds of really rough order of magnitude [46:40] calculations. And there's a kind of [46:42] analogy, not analogy, but connection to [46:44] the NQM lecture that I gave, which is [46:46] that we're not looking for, you know, [46:48] the right model and to hit it with like [46:49] some really hard math. We're really [46:51] trying to get the high level macroscopic [46:54] behaviors of the system. And to do that, [46:56] the right way to get to it is to look at [46:58] these like leading order of magnitude [46:59] calculations rather than like solving [47:01] everything out. [47:02] Um, and once again, you know, if we turn [47:04] the crank, then we get these very [47:06] practical scaling constraints on the [47:08] model, which are very interesting and [47:10] and sometimes very practically useful, [47:12] right? So these width parameterizations [47:13] are very helpful, um, and allow you to [47:15] train, you know, models much more [47:17] reliably than if you were trying to [47:18] just, you know, train models without uh [47:21] doing any sort of scaling. [47:23] Okay. Um, any questions on mu P before I [47:25] move on? Yeah. [47:26] >> Does this come with some kind of [47:28] tradeoff like the speed of [47:29] the number of steps to achieve a [47:30] particular target or [47:32] just just [47:33] learning in terms for [47:34] >> Yeah, it's it's not the case that um you [47:37] know, for example, the mu P [47:38] parameterization is always better. Like [47:40] if you look at these plots, um, you [47:42] know, it's not the case that mu P is [47:44] always at the bottom, but one thing that [47:45] you do see is that, you know, the [47:47] implied the best configuration under [47:49] this analysis, which is to scale up per [47:51] layer learning rates, um, you do end up [47:54] with most parameterizations perform [47:55] similarly and they're better than, you [47:57] know, for the most part than if you try [47:59] to do a global learning rate. So that's [48:00] generally better, right? [48:05] Cool. Yes. [48:06] >> Sorry, this is not a silly question, but [48:08] could you explain why it's so [48:10] catastrophic if they like [48:15] >> Yeah, so um [48:17] in many places in the analysis, for [48:19] stability for example, uh we don't care [48:21] as much if they cancel out per se [48:23] because you'll get lower order terms. [48:25] That's generally okay. Where this is [48:27] very bad is if we want something like [48:30] non-triviality, then this is not very [48:32] good, right? Because what we really want [48:34] is we want this thing on the left to be [48:37] uh big theta of one, right? And if I [48:40] have catastrophic cancellation, I can [48:41] end up with a lower order term than big [48:43] theta of one, and actually, you know, [48:45] you would diminish with N and you would [48:47] actually get something that doesn't [48:48] learn at all, right? That would be quite [48:49] bad. [48:51] And in general, like you know, you can't [48:53] just add big O terms together, right? [48:55] Especially the exponents of big O terms. [48:57] Like that's that's how the math works. [48:59] And so we do have to be very careful [49:00] about what's being done when we kind of [49:02] sweep things under the rug here. Even [49:03] though I think it's the only way I would [49:05] say to get this kind of analysis done. [49:07] Like doing it precisely is just totally [49:09] intractable. [49:12] Okay. [49:14] All right. So now we're going to move on [49:16] to the other part [49:18] of this lecture, which is, you know, we [49:19] thought about mu P. Mu P is a very [49:21] particular set of ideas about [49:23] controlling the movement of activations [49:25] in certain ways as we scale, right? Now, [49:28] if we want our activations and logits to [49:30] be what you call stable and maximal, [49:33] right? The story here is that we want to [49:35] control delta Z of L, right? This is the [49:38] thing. [49:39] Now, what's interesting is that in the [49:41] mu P section, we went through all this [49:43] effort like messing with these scaling [49:44] constants to make delta Z [49:47] equal to theta of one. But maybe there's [49:50] a easier way. Maybe when we take our [49:51] gradient steps, instead what we could do [49:54] is we could find some parameter updates [49:56] within a ball where the ball [49:59] has this property that everything in the [50:00] ball, you know, keeps these activations [50:02] close. If we could do that, then life is [50:05] like in some ways kind of good. This is [50:07] one one way of justifying [50:09] mu mu on and sort of its related family [50:13] of spectral [50:14] optimizers. [50:16] So to do that, I'm going to step back [50:17] first and I'm going to ask, you know, [50:18] what is gradient descent? Well, gradient [50:20] descent, you know, you could write as [50:22] sort of this like proximal operator. So [50:24] gradient descent is the solution to like [50:26] a repeated argument problem where I'm [50:28] solving, you know, minimization of a [50:30] linearization plus, you know, L2 [50:34] regularized, right? So this is, you [50:35] know, simple way of rewriting what [50:37] gradient descent is. But here notice [50:40] that, you know, I've picked this L2 [50:41] neighborhood and this L2 neighborhood is [50:43] what's telling us, you know, what the [50:45] sort of trust region, so to speak, is [50:47] within my optimization process. And so, [50:50] you know, one thing that we might want [50:51] to do, I guess we want to do two things. [50:53] One of them is I want to change the L2 [50:55] because I don't really think L2 in [50:57] parameter space is a super useful [50:58] notion. This is related to [51:00] preconditioning. And the other thing I [51:01] want to do is maybe I don't want to like [51:03] move uh sort of arbitrarily. I want to [51:05] move a very fixed amount, like hyperball [51:07] almost. [51:08] So now let's go back to mu P. What does [51:11] mu P have to say about what the right [51:13] metric is for parameter updates? Well, [51:15] we spent a lot of time and effort trying [51:16] to control all of these different terms [51:19] in my Z uh my activations, right? Um it [51:23] turns out that one of these three terms [51:24] I can control really precisely and [51:26] easily just by the action of the [51:28] optimizer. Um and that is this term, [51:31] which is the change in weight times the [51:33] activation um scaled up by N to the [51:35] negative AL, right? If I have what's [51:37] called an isometry, if my change in my [51:40] weights, right, is um uh operator norm [51:44] one, or actually in fact if it's [51:45] singular values are all ones, then you [51:48] know what I'm going to have on the other [51:49] side is that this is going to have norm [51:51] equal to Z of L, right? So I can control [51:53] this norm very very easily if I sort of [51:56] more precisely manipulate delta W of L. [52:00] Now um you know the one way of thinking [52:03] about this is maybe I should just write [52:04] down an optimization problem like this. [52:06] I'm going to say okay, instead of [52:07] descending in this regularized L2 space, [52:11] which is of course natural in some [52:12] cases, I'm going to pick a very [52:14] different geometry. And the geometry I'm [52:15] going to pick is I'm going to pick um uh [52:18] descent where I'm going to you know go [52:19] down in some ball where my ball is [52:22] defined by the operator norm. And of [52:24] course the operator norm is going to [52:26] keep any sort of vector, you know, [52:28] bounded in length, right? And sort of [52:30] I'm going to take the inner product with [52:32] the gradient. So this is very analogous [52:34] to my derivation of the the gradient [52:35] before. Um you know it's very very [52:37] similar, but with you know two changes. [52:39] I'm doing kind of a trust region kind of [52:40] a thing and also um I'm looking at the [52:43] operator norm rather than L2 squared. [52:47] Good for everybody? [52:48] Um [52:49] and so this is going to turn into what [52:51] I'm going to call idealized muon. [52:53] Idealized muon is not a you know good or [52:56] reasonable algorithm. It's just like the [52:57] idea of muon. Um and so you know I wrote [53:01] down what I had before and we sort of [53:02] got to that through somewhat mu P [53:05] arguments, but I wanted to move the [53:06] activation in very specific ways. [53:09] Um, if my if I'm doing that, then well, [53:11] you know, there's this kind of duality [53:13] between the operator and nuclear norms, [53:15] I can solve this exactly, right? You [53:16] don't need to know that, but the [53:18] solution to this is to take the SVD of [53:20] G, which is my, you know, variance. Um, [53:23] and then drop the singular values [53:25] entirely, um, and then just take UV [53:27] transpose and then scale that up by my [53:30] sort of neighborhood radius row, right? [53:32] And that's my update. [53:34] Um, and so this is you know, what I'm [53:36] what I'm going to call idealized mu on. [53:37] Idealized mu on takes every matrix value [53:40] parameter on the inside of my of my uh [53:43] neural network, and I'm just going to [53:45] update them using uh step size of row [53:47] with UV transpose where I sort of SVD my [53:50] gradients and then I drop the singular [53:52] values. Um, I still have scalar valued [53:55] parameters like RMS gains and all these [53:56] other things. Um, I can't just ignore [53:58] those, and so I'm just going to run [54:00] normal gradient descent of some kind on [54:02] those parameters, right? Of course, in [54:04] practice, I'm going to run Adam, right? [54:06] I'm going to do all sorts of other [54:06] sophisticated things, but hopefully this [54:08] gives you a rough idea behind what we [54:10] would um kind of do. Like we would uh [54:13] you know, basically take matrix valued [54:15] parameters and do this kind of [54:16] decomposition, whereas for scalar valued [54:18] ones, we would still use a scalar valued [54:20] um optimizer. [54:22] Okay. Um, any questions so far on kind [54:25] of this motivation? [54:28] Cool. Okay. [54:30] Um, in practice, you know, I don't [54:33] actually run this um for two reasons. [54:36] Actually, there's there's many reasons. [54:37] Um, first of all, we already know from [54:39] the previous lectures that momentum is [54:41] very useful in large batch settings. So [54:44] of course we're going to use momentum, [54:45] right? We're not just going to update [54:46] directly on the gradient. Um, the next [54:48] thing that we is that the SVD is very [54:50] very expensive, right? Like you never [54:52] want to take a singular value [54:54] decomposition in the middle of your [54:56] gradient steps, right? That's going to [54:57] be an enormous computational cost, so we [54:59] don't do that. Instead of doing SVD and [55:01] dropping the singular values, I'm going [55:03] to do something called Newton Schultz 5. [55:04] I'll explain what that is, right? It's a [55:06] different way of getting at the same uh [55:08] thing, but is much more adapted to the [55:10] hardware we use. [55:12] Um finally, you know, instead of using [55:14] SGD, we're going to use Adam W for all [55:16] the scalar parameters, right? Um and [55:19] that's going to be sort of helpful [55:20] because we're going to have a lot of [55:21] scalar parameters um still. And that's [55:23] really exactly it, right? So we see [55:25] idealized muon in this, you know, uh [55:28] pseudo code. This is from taken straight [55:29] from uh Keller Jordan's blog. You take [55:32] the gradients, turn it into momentum, we [55:35] do Newton Schultz, which basically drops [55:36] the singular values, and then we update [55:39] using that parameter straight up, right? [55:40] Very simple algorithm, very effective um [55:43] despite how simple it is. [55:48] Okay, so now what is Newton Schultz? Um [55:51] Newton Schultz is very fun and it's a [55:53] little bit wild. Um you know, really [55:56] we don't want to do the SVD, right? The [55:58] SVD is very very very slow. It's very [56:00] numerically accurate, but we do not want [56:01] to do that. Um so instead of doing the [56:04] SVD, um consider kind of the following [56:07] transformation. Oh uh one caveat is I'm [56:09] assuming all the matrices are square [56:11] throughout my presentation, just for [56:12] simplicity. You can do all the arguments [56:15] for rectangles um if you transpose them [56:17] in the right ways. Um I'm going to [56:18] ignore those just for not having to deal [56:20] with the notation. So everything G is [56:22] square uh throughout. [56:23] Okay, so imagine um I take my G and then [56:27] I compute the following transformation, [56:29] right? G transpose G to the matrix [56:31] inverse square root times G itself, [56:33] right? Okay, so what does that do? Well, [56:35] all of these operations are going to act [56:38] on the singular values. So what is the [56:39] scalar version of this? Like imagine I [56:41] replace G with the leading eigen value [56:44] lambda, [56:45] the leading singular value lambda. Um [56:47] you're going to end up with lambda [56:48] squared um negative square root uh times [56:52] lambda. And so that's going to be the [56:53] sign, right? So you can see that this [56:55] formula over here is going to act on the [56:57] singular values and it's going to turn [56:59] them all into the sign of that singular [57:01] value, right? And so this is going to do [57:03] exactly U V transpose as I talked about [57:06] before. Um so now, you know, I've [57:08] replaced the SVD with this kind of [57:10] horrible looking object, g g transpose g [57:13] to the negative one half. Um, how do we [57:15] compute that efficiently? Well, um, you [57:18] know, that's where Newton Schulz comes [57:19] in. Uh, you know, this is an iterative [57:21] kind of fixed point method. So a fixed [57:23] point method is something you just apply [57:24] repeatedly and you eventually just [57:26] converge to the solution. Um, and it's [57:28] kind of this following equation, right? [57:30] You have this iteration where you [57:31] repeatedly multiply by g transpose g y k [57:34] squared, y k, y k plus one. [57:37] You can see that if I plug in sort of [57:40] the ansatz above, like this equation of [57:42] g times g transpose g negative one half [57:44] into y k, you will get exactly the same [57:47] solution back out, right? That's the [57:48] fixed point of this equation. So if I [57:50] put in the solution, you know, then I'm [57:52] going to have, you know, uh, no change [57:54] to my y of k. So if I just run this [57:56] iteration repeatedly, I'm eventually [57:58] going to get that map above where I get, [58:01] uh, u v transpose. [58:03] Okay. So, uh, this is, uh, great. It's [58:05] all matmuls. Notice that, you know, this [58:07] thing had this inverse square root. This [58:09] is still hard to implement in hardware. [58:11] Down here, this y k thing, notice it's [58:13] all just matmuls, right? And this is [58:15] very, very, very, very fast on the GPUs. [58:18] We always want things to be very simple, [58:20] uh, matrix multiplications. Right? So [58:21] this is the basic idea of Newton Schulz. [58:24] The idea of Newton Schulz is that we [58:26] take this SVD, instead of doing the SVD, [58:28] we rewrite it as this inverse square [58:30] root. Instead of doing the inverse [58:31] square root, we write this fixed point [58:33] equation and we run it, you know, [58:35] several steps and we get an [58:36] approximation to the actual solution [58:39] that we want, right? This is the cubic [58:41] version just for simplicity. Um, you [58:43] know, the actual muon, you know, [58:44] pseudocode is going to use a quintic [58:46] expansion on the bottom here with some, [58:48] uh, modified coefficients a b c. Um, but [58:51] the idea is the same, right? The idea is [58:53] that we want to go through this process [58:54] and we want to solve this fixed point [58:55] equation. [58:57] Okay. [58:58] So this is the basic idea of muon. And [59:00] once you do this Newton Schulz, this [59:02] decomposition becomes very, very [59:04] practical and that allows you to go and [59:07] run this thing on real, you know, time [59:10] constrained, uh, language modeling [59:12] workloads. Um [59:14] and Jordan Keller, who, you know, we've [59:16] talked about before from his CIFAR 10 [59:18] experiments, sort of a really [59:20] interesting follow-up in terms of the [59:21] research that he does, um you know, had [59:23] went to the NanoGPT speed run um and [59:26] then, you know, showed that Muon was [59:28] very very very fast at optimizing uh [59:31] these kinds of language modeling [59:32] workloads even on a wall clock basis. So [59:34] even though he's doing all this extra [59:35] Newton Schultz steps, it turns out it [59:37] converges sufficiently fast has to be [59:39] very useful. And then he sort of went [59:41] and scaled this up and the sort of [59:43] results held up even at larger scales, [59:45] which is really kind of amazing. A lot [59:47] of these more sophisticated optimizers [59:49] don't end up sort of being a wall clock [59:51] win because you spend so much time uh [59:53] trying to do these fancy like SVD-like [59:56] operations. [59:58] And Muon does, you know, work at scale. [60:00] It's it's kind of amazing, right? A lot [60:01] of people just use this now. Um Kimi had [60:04] this paper uh Muon is scalable uh for LM [60:06] training um and they have, you know, [60:08] this lovely plot where they show, you [60:10] know, even at very very large scale uh [60:12] Muon gives you very significant gains uh [60:15] in sort of [60:16] uh optimizing these models. And, you [60:18] know, their latest models like Kimi K2 [60:20] and so on actually use Muon uh to do uh [60:23] optimization. [60:25] Um at large scale, there are some [60:27] changes that they make just for [60:28] practicality and ease of handling. Um [60:31] they put in weight decay. You know, norm [60:32] control is still very important. Um and [60:35] I don't think they were using anything [60:36] like Hyperball and so they need to add [60:37] weight decay to control the the weight [60:39] norms. Um and the other thing they do [60:41] is, you know, there's a lot of AdamW uh [60:44] optimizers controlling all these scalar [60:46] parameters. They want the learning rates [60:47] to kind of behave the same between the [60:49] two. So they measure sort of the update [60:52] size of AdamW. They measure the update [60:54] size of Muon and they sort of match it [60:56] in various ways. They match it by [60:58] scaling uh the updates according to the [61:00] shape of the matrix for rectangular [61:02] matrices and they multiply it by a sort [61:04] of magic number of 0.2, which they say [61:06] like puts the the scales roughly [61:08] together. [61:09] Once you do all those, um they show [61:11] that, you know, they get significant [61:12] gains beyond the baseline Muon by sort [61:14] of getting this like slightly more [61:16] adjusted [61:17] uh learning rate that brings mu-on and [61:19] Adam W step sizes uh closer. [61:22] If you look at sort of Kim and K2's [61:23] report, you'll also see that they had to [61:25] add or they added certain other like [61:27] stabilizing properties to the model in [61:29] order to prevent mu-on from like blowing [61:30] up their model in various ways. [61:32] But you know, putting all this together, [61:34] maybe my point is that it's very cool [61:36] that mu-on which is this very advanced [61:38] kind of spectral optimizer, let's call [61:40] it, um is actually effective at scale [61:42] and gives you some gains as proven out [61:44] in things like uh Kim and K2. [61:48] Cool. [61:48] Now, [61:50] you might ask why does mu-on work? Um [61:53] and I think this is like kind of an [61:55] interesting question. I've given you [61:56] this like very sanitized presentation [61:59] where we've gone from mu-P. I've given [62:01] you this like story about updates um and [62:03] then I've told you, oh, we want to [62:05] optimize the operator norm. And Keller [62:07] Jordan in his blog has this kind of [62:09] section of like why does it work, right? [62:11] Um and the explanation that I gave you [62:13] um about operator norms is close to you [62:16] know what he's referring to as Bernstein [62:18] and Newhouse's analysis of shampoo and [62:20] this idea of um [62:21] uh descent in the in the Stiefel uh [62:24] manifold. But I think you know Keller [62:26] Jordan and others I think are much more [62:28] empiricists and you know basically he [62:31] says, well, if we look at the updates, [62:33] the updates are really low rank and [62:36] isn't it kind of a shame that we're [62:37] throwing away a lot of the rank of the [62:38] gradient? Wouldn't it be better if the [62:40] updates were more full rank? You know [62:42] this mu-on thing forces it to be full [62:44] rank because we throw away all the low [62:46] singular values. Maybe that works [62:48] better, right? And so there's this [62:49] interesting tension here that I want to [62:50] point out about kind of how you know [62:53] it's very nice to find these like clean [62:55] mathematical formulations, but also in [62:57] some ways there's these like very much [62:59] more deeply alchemical, let's call it, [63:01] uh empirical intuitions behind some of [63:03] these uh models. [63:06] Maybe adding to this, you know I'm going [63:07] to end you know this lecture on kind of [63:10] a uh not a mixed note, but a note that [63:12] just makes things more complicated. Um [63:15] so mu-on has this very very interesting [63:17] property least to me, um that I told you [63:20] what does Muon actually do? It doesn't [63:22] run this like third order [63:25] fixed point equation that I showed you [63:26] in the slide. It runs this like quintic. [63:28] And not only does it run this like [63:29] quintic, which is more accurate, it [63:31] actually fudges with the parameters of [63:33] the quintic. And it fudges with them in [63:35] a way that makes it no longer converge [63:37] to the actual fixed point. [63:39] So this is a visualization of the fixed [63:40] point equation. [63:42] So let's say I have as my input a [63:44] particular singular value, let's say [63:45] between zero and one. And then, you [63:48] know, on the y-axis is my output [63:49] singular value. [63:51] The way that, you know, Newton Schulz [63:52] works classically is you look at this [63:54] green line over here. And this green [63:56] line says if I'm below 1.0 [64:00] what's going to happen is that let's say [64:02] at 0.6 I'm going to get mapped to 0.8 [64:04] and I sort of grown, right? So I'm above [64:06] this blue line. So every time I'm below [64:08] 1.0 my number keeps increasing until I [64:11] eventually converge to 1.0, right? Same [64:13] thing if I'm above I'm below this [64:15] diagonal line so I'm going to decrease [64:16] until I converge to 1.0, right? So 1.0 [64:18] is a fixed point as you can see. [64:20] Now the Muon quintic [64:22] does not have a fixed point at 1.0 as [64:25] you can kind of see. This thing's a [64:25] little wild and it goes above and below [64:27] 1.0. It certainly amplifies these very [64:30] small numbers into big numbers, but it's [64:32] kind of also going to oscillate in these [64:34] like kind of interesting and crazy ways. [64:37] And if you look at, you know, kind of [64:38] how this iteration is actually going to [64:40] behave you'll see exactly this. Like let [64:43] say I have a family of singular values [64:46] and I apply [64:47] you know the classic Newton Schulz [64:49] you're going to get these dashed lines. [64:50] These small singular values will get [64:52] slowly bigger over my iterations [64:54] [clears throat] and eventually they're [64:55] all going to converge to 1.0. But at [64:57] five steps I'm, you know, very far from [65:00] 1.0. On the other hand this like kind of [65:02] quintic with the wavy line it very [65:05] rapidly shoots up and then it oscillates [65:07] around 1.0 in this very interesting [65:09] pattern, right? And so, you know, what [65:12] is this Newton Schulz thing doing? Well, [65:14] you know, it's not exactly making things [65:15] all 1.0. It's just, you know, very [65:18] rapidly shoving very small singular [65:20] values all the way up near one, right? [65:22] You're amplifying these kind of like [65:24] unloved directions to try to get good [65:27] optimizer updates. And there's been [65:29] interesting empirical work following up [65:31] all this stuff as well. [65:32] You know, there's this work that looks [65:34] at essentially [65:36] Sorry. [65:37] powers of the singular values. So [65:40] instead of taking the sign, which would [65:41] be taking the singular values to the [65:43] power of zero, [65:46] you know, you can have singular values [65:48] taken to different powers, you know, and [65:49] multiplied by the sign. [65:51] You know, and then you can find that [65:52] actually, you know, doing the sign [65:54] transformation is not the optimal power. [65:56] There's actually some intermediate power [65:58] between zero and one that is actually [66:00] better. In this case, apparently one [66:01] half you know, turns out to be you know, [66:03] slightly better than taking power of [66:05] zero. So it's not really about perfectly [66:08] you know, normalizing the spectrum of [66:09] the matrix. [66:11] And there's another paper which is maybe [66:12] even more interesting in trying to like [66:14] you know, falsify, let's call it, this [66:16] like perfect spectral whitening [66:18] argument, which is that they try things [66:20] like randomizing all of the singular [66:23] values. And then they also try [66:25] transforming them like by like weird [66:26] curves that are not, you know, mapping [66:28] them all to one. [66:30] And both of these that they call Cahn [66:32] and Freeon turn out to converge pretty [66:34] well as well, kind of muon-like. And so, [66:37] you know, really maybe the the thing [66:39] that's most consistent across these [66:41] papers is that you know, it is important [66:43] to take our unloved small singular [66:45] values and to like boost them up to be [66:47] very big, right? That turns out to give [66:49] you big updates in these like directions [66:51] that are hard to update. But is it [66:53] really important to like get exactly a [66:55] step size of one in the operator norm? [66:57] Well, not really. [67:00] Okay. So to put it all together, [67:03] you know, we kind of transition from [67:04] UP's like update constraints to this [67:06] natural idea for a new type of an [67:09] optimizer that operates in the spectral [67:11] norm. [67:12] And polar decompositions, [67:12] [clears throat] [67:13] which you know, just take UV transpose, [67:15] are a very like nice and practical way [67:18] of doing optimization, especially with [67:20] Newton-Schulz iterations. [67:22] And then finally, you know, I don't want [67:24] you to to overfit on this story or even [67:26] any aspect of today's lecture, um [67:28] because there's many aspects of today's [67:30] story that like are broadly accurate, [67:33] but they're not perfect, right? They're [67:34] not 100% right. And so, you know, we [67:36] want to sort of have the right sort of [67:38] boundaries of where this theory is true [67:40] and where it falls apart and so on. [67:42] Um so to wrap up sort of the the unit, [67:45] let's call it, um optimization is super [67:47] complex. Like this was the basic [67:49] lecture. Um and even for that, I feel [67:51] like we had a lot of really interesting [67:52] phenomena. Um and here's like three [67:54] different kind of rough takeaways for [67:56] this start of the class unit, right? So [67:59] one of the things that we've seen is to [68:01] ask like what's the core phenomena, [68:02] right? Like, you know, weight norms, um [68:05] you know, the noisiness of the batch. [68:06] Like we usually think about what the [68:07] core phenomena at play is, and then we [68:10] isolate and model and and sort of deal [68:12] with this, right? And then we think [68:13] about the right abstraction is, right? [68:14] Whether that be the quadratic or these [68:16] kinds of like norm invariant losses or [68:18] these scaling limits. And based on these [68:20] like abstractions, we try to build out [68:22] algorithms and the right way to deal [68:23] with these things. And then finally, you [68:25] know, we start to think about like, [68:27] okay, when do these things break? And we [68:28] we've seen several examples of when [68:31] these things, you know, break. For [68:32] example, the noisy quadratic model would [68:34] never suggest something like muon, [68:36] right? We need to look at something more [68:37] advanced in order to go from quadratics [68:39] to something that would tell us, oh, you [68:40] need to look at the spectrum of your [68:42] your matrices. [68:44] Great. So I'll see you all on Thursday.