Draft: this page is not listed anywhere and may change without notice.

Adam, Muon and friends

Introduction to adaptive methods

Samuel Vaiter

· · draft · AI 3/4 (co-written) · #optimization · PDF · LaTeX · Markdown

Abstract

In these lecture notes, I introduce adaptive methods from the simple perspective of the choice of a descent direction in a specified geometry. This allows us to cover Adam(W), SignSGD and Muon.

In the previous lectures, we saw some foundations behind gradient descent (and accelerated version of it), proximal methods, and stochastic gradient descent (and variance reductions methods). In the deep learning “era”, i.e., post-2015, most large networks have been trained with more complicated versions known as Adam(W), and recently with the advent of LLMs, new optimizers such as Shampoo, Scion, and Muon are taking an important place. The goal of this notes is to take a principled way to present most of these optimizers from a single point-of-view. Note that we are not going to cover convergence guarantees of these methods, but merely try to understand their behavior from a qualitative perspective.

1 Local-model step

1.1 Gradient descent step as minimization problem

Gradient descent can be thought as a multi-step linear approximation + a quadratic penalty. More precisely, given a previous iterate x_{t} and a learning-rate \eta>0, we have

x_{t+1}=x_{t}-\eta\nabla f(x_{t})\quad\Longleftrightarrow\quad x_{t+1}-x_{t}=\arg\min_{d}\Big\{\langle\nabla f(x_{t}),\,d\rangle+\frac{1}{2\eta}|\!|d|\!|_{2}^{2}\Big\}. (1)

You can think of the quantity in the argmin as the sum of two terms:

  • •

    The first term predicts (by linearization) how much the loss changes if we move by d.

  • •

    The second term says: do not trust that prediction far away (d becoming large).

All the optimizers that we are going to consider are going to be a variation of this interpretation. We are going to essentially see three possible modifications:

  • •

    what we linearize: for GD, we use the “raw” gradient \nabla f(x_{t}). Other possibilities includes stochastic gradient, averaged past gradients, etc.

  • •

    we we pay for a “bad” prediction: Instead of the Euclidean norm |\!|d|\!|_{2}^{2} we could have a different norm or something involving a more complicated value.

  • •

    how we solve the argmin problem: solving exactly or approximately leads to different complexity requirements.

1.2 Definition of a local model

Let us be more concrete and express gradient descent, Forward-Backward and stochastic gradient descent this way.

Gradient descent: As stated above, the direction d_{t}=-\eta\nabla f(x_{t}) minimizes the linear + quadratic term on the right-hand side of (1).

Forward-backward: Let F=f+R with R convex but potentially nonsmooth (say lower semicontinuous and proper). Forward-backward is a linearization of the smooth part f of F:

d_{t}=\arg\min_{d}\Big\{\langle\nabla f(x_{t}),\,d\rangle+R(x_{t}+d)+\frac{1}{2\eta}|\!|d|\!|_{2}^{2}\Big\}.

Solving exactly this gives us the proximal operator (of level \eta) applied to a gradient step x_{t+1}=\operatorname{prox}_{\eta R}(x_{t}-\eta\nabla f(x_{t})). Here instead of just looking of the displacement |\!|d|\!|_{2}^{2} we also have the nonsmooth part.

Stochastic gradient descent: The step is as (1) with the difference that the gradient is replaced by the stochastic version.

d_{t}=\arg\min_{d}\Big\{\langle h_{t},\,d\rangle+\frac{1}{2\eta}|\!|d|\!|_{2}^{2}\Big\}.

where h_{t} is a stochastic estimate of \nabla f(x_{t}), i.e., \mathbb{E}[h_{t}\mid x_{t}]=\nabla f(x_{t}).

To summarize this, we are going to define local-model step as follows.

Definition 1

Given an input vector g_{t}, a learning rate \eta_{t}>0 and a convex cost of moving \Psi_{t}, the local-model step associated is

d_{t}\in\arg\min_{d}\Big\{\langle g_{t},\,d\rangle+\frac{\Psi_{t}(d)}{\eta_{t}}\Big\}. (2)

To summarize the discussion above, we have:

  • •

    GD: g_{t}=\nabla f(x_{t}), \Psi_{t}=\tfrac{1}{2}|\!|\cdot|\!|_{2}^{2}.

  • •

    SGD: g_{t}=h_{t} with the same \Psi_{t}.

  • •

    FB: g_{t}=\nabla f(x_{t}), \Psi_{t}(d)=\tfrac{1}{2}|\!|d|\!|_{2}^{2}+\eta_{t}R(x_{t}+d).

Note that i) \Psi_{t} may depends from the past, ii) it is not guaranteed that (2) has a solution (take \Psi_{t}=0).

h_t
sample
h_t=\nabla f(x_t)
h_t, with \mathbb{E}[h_t\mid x_t]=\nabla f(x_t)
h_t, with \mathbb{E}[h_t\mid x_t]=\nabla f(x_t)
h_t=\nabla f(x_t)
h_t=\nabla f(x_t)
history
g_t
filter
g_t=h_t
g_t=h_t
g_t=m_t=\beta m_{t-1}+(1-\beta)h_t
g_t=h_t
g_t=h_t
\Psi_t,\eta_t
d_t
solve local model
\Psi_t=\tfrac12|\!| \cdot |\!|_2^2, so d_t=-\eta_t g_t
\Psi_t=\tfrac12|\!| \cdot |\!|_2^2, so d_t=-\eta_t g_t
\Psi_t=\tfrac12|\!| \cdot |\!|_2^2, so d_t=-\eta_t m_t
\Psi_t(d)=\tfrac12|\!| d |\!|_2^2+\eta_t R(x_t+d)
\Psi_t(d)=\tfrac12\langle H_t d,\,d\rangle, so d_t=-\eta_t H_t^{-1}g_t
x_t+d_t
x_{t+1}
update
x_{t+1}=x_t+d_t
x_{t+1}=x_t+d_t
x_{t+1}=x_t+d_t
x_{t+1}=\operatorname{prox}_{\eta_t R}(x_t-\eta_t\nabla f(x_t))
x_{t+1}=x_t+d_t

No noise and no memory: the local model is the linearization plus the Euclidean cost of moving.

Only the first stage changes: a cheap, unbiased but noisy sample of the gradient.

The filter averages the recent samples to reduce their noise, at the price of a slower reaction.

The nonsmooth part is not linearized: it enters the cost of moving, and solving the local model is a proximal step.

Only the cost of moving changes: moving in steep directions costs more.

Figure 1. Local-model step allows use to think of gradient-like methods as a four-step recipe. i) we sample the true gradient (h_{t}). ii) we eventually filter the history of these samples (g_{t}). iii) we solve a local model (d_{t}). iv) we update our iterate (x_{t+1}).

1.3 Beyond Euclidean cost-of-moving

Why would you use a different cost, despite instances like partial minimization as in the forward-backward interpretation? Remark that the quadratic cost \frac{1}{2\eta}|\!|d|\!|_{2}^{2} is isotropic: moving in each direction of the ambient space has exactly the same cost. This could be a bad assumptions if the loss is much steeper in a direction w.r.t the others. Consider the following example

Example 2: An ill-conditioned quadratic

Let f(x)=\tfrac{1}{2}(x_{1}^{2}+25x_{2}^{2}). Gradient descent multiplies x_{1} by 1-\eta and x_{2} by 1-25\eta at each step. It is stable only if |1-25\eta|<1, i.e., \eta<2/25=0.08. With \eta=0.075, the steep coordinate x_{2} flips sign at every step (factor −0.875), while the flat coordinate x_{1} shrinks by only 7.5\% per step. After 25 steps from (-8,2) we are still at x_{1}\approx-1.14 (see Figure 2).

Circles: gradient descent; squares: preconditioned with H = diag(1, 25). Drag on the plot to move the initial point. Gradient descent diverges for η ≥ 2/25 = 0.08; the preconditioned method, for η ≥ 2.

Figure 2. Gradient descent on f=\frac{1}{2}(x_{1}^{2}+25x_{2}^{2}) zigzags across the valley. Charging more for moving in the steep direction, with H=\operatorname{diag}(1,25), sends the iterates faster to the minimizer.

The learning rate is limited by the steepest direction, and progress is limited by the flattest one. The number of steps grows like the condition number. A fix is to make moving in steep directions more expensive: replace \tfrac{1}{2}|\!|d|\!|_{2}^{2} by a weighted cost. Consider any symmetric positive definite matrix H_{t} and consider the cost-of-moving \Psi_{t}=\tfrac{1}{2}\langle H_{t}d,\,d\rangle. Then, the step defined in (2) has a unique solution d_{t}=-\eta_{t}H_{t}^{-1}g_{t} (check it!).

In Example 2, H=\operatorname{diag}(1,25) makes the step -\eta(x_{1},x_{2}): both coordinates now shrink at the same rate, and \eta=1 would jump to the minimizer in one step. This is Newton’s method since H is the Hessian! In deep learning we cannot afford the Hessian1, and the next sections build H_{t} from gradients (samples) instead.

Beyond the preconditioned version, two others choices are interesting for us:

  • •

    Constrained cost-of-moving: Instead of a scalar penalty, we impose a constraint2 \Phi_{t}=\iota_{\eta_{t}B}. Thus, (2) becames minimization of a linear function overs a constraints. We will later that sign descent and Muon are of this type XXX.

  • •

    Bregman cost: We could use a Bregman divergence as a cost-of-moving, see Exercice XXX

2 Momentum

Several way are existing to introduce momentum. Let us concentrate on the case when we deal with SGD. With SGD, the linear term \langle h_{t},\,d\rangle is computed in practice on a unbiased minibatch \mathbb{E}[h_{t}\mid x_{t}]=\nabla f(x_{t}). However, the variance may much larger than the squared norm of the true gradient, hence the direction may be quite noisy. A natural idea is thus to average recents gradients at the price of making the reaction slower when there is a true change of direction. This is the idea of momentum.

2.1 Exponential Moving Average (EMA)

Arithmetic average puts too much importance to old samples. A possible way to alleviate this is to exponential averaging. Let \beta\in(0,1) and m_{0}=0, and define

m_{t}:=\beta m_{t-1}+(1-\beta)h_{t}=(1-\beta)\sum_{s=1}^{t}\beta^{t-s}h_{s}. (3)

The newest gradient has weight 1-\beta, the one before (1-\beta)\beta, and so on. The weights decay geometrically. As a rule of thumbs, it means3 that m_{t} remembers roughly the last 1/(1-\beta) gradients.

Momemtum SGD is using this construction g_{t}=m_{t} with the same cost-of-moving than regular SGD, i.e., \Psi_{t}=\tfrac{1}{2}|\!|\cdot|\!|_{2}^{2}.

Dots: samples ht; dashed: their mean; solid: the moving average mt. A larger β smooths the noise out but reacts later to the jump.

Figure 3. Noisy gradients whose mean jumps from 1 to −1 at t=60, with noise of standard deviation 1.5, and their exponential moving average with \beta=0.9.

Figure 3 shows the trade-off we will are going to quantify: larger \beta means less noise and more lag.

2.2 Bias and momentum

The following proposition shows that under stationarity: i) momentum induced a bias, ii) it is easy fixable by bias-correction, and will be the basis of (Section 3.3).

Proposition 3

Suppose the gradients have a fixed mean, h_{s}=\mu+\varepsilon_{s}, with independent centered noise \varepsilon_{s} of covariance \Sigma. Then for t\geq 1

\mathbb{E}m_{t}=(1-\beta^{t})\mu,\qquad\operatorname{Cov}(m_{t})=\frac{1-\beta}{1+\beta}(1-\beta^{2t})\,\Sigma.

The bias-corrected average \widehat{m}_{t}=m_{t}/(1-\beta^{t}) has mean \mu and covariance

\operatorname{Cov}(\widehat{m}_{t})=\frac{1-\beta}{1+\beta}\cdot\frac{1+\beta^{t}}{1-\beta^{t}}\,\Sigma.
Proof

The mean follows directly from (3) and \sum_{s=1}^{t}(1-\beta)\beta^{t-s}=1-\beta^{t}. By independence, \operatorname{Cov}(m_{t})=(1-\beta)^{2}\sum_{s=1}^{t}\beta^{2(t-s)}\Sigma=(1-\beta)^{2}\frac{1-\beta^{2t}}{1-\beta^{2}}\Sigma, and 1-\beta^{2}=(1-\beta)(1+\beta). For \widehat{m}_{t}, divide by (1-\beta^{t})^{2} and use 1-\beta^{2t}=(1-\beta^{t})(1+\beta^{t}).

3 Adaptive methods: learning the cost of moving

3.1 Principle

Example 2 showed that a single learning rate is a bad idea when directions have very different curvature. Neural networks make this worse, indeed, parameters in different layers can receive gradients whose might differ by orders of magnitude.

Computing the Hessian is out of the question for millions of parameters. Adaptive methods choose a diagonal H_{t}, one scale \text{scale}_{t} per coordinate4, and estimate that scale from the gradients we have already seen. All methods in this section are of the form

H_{t}=\operatorname{diag}(\text{scale}_{t}+\varepsilon\mathbf{1}),\qquad d_{t}=-\eta_{t}H_{t}^{-1}g_{t},

where \varepsilon>0 is a small constant that avoids division by zero. They differ in how they compute the scale and what they use as g_{t}.

3.2 AdaGrad and RMSProp

AdaGrad Duchi et al., 2011 was designed for online learning with sparse features. Its scale5 is the root of the sum of all past squared gradients:

a_{t}=\sum_{s=1}^{t}h_{s}^{\odot 2},\qquad d_{t}=-\eta_{t}\frac{h_{t}}{\sqrt{a_{t}}+\varepsilon}.

A coordinate that has seen large gradients gets a small coefficient; a coordinate that is rarely active keeps a large one, so rare features still learn.

The main weakness is that a_{t} only grows. Indeed, with a fixed \eta the coefficient \eta/(\sqrt{a_{t,i}}+\varepsilon) of each coordinate i can only decrease. If a coordinate always sees h_{s,i}=c\neq 0, then \sqrt{a_{t,i}}=|c|\sqrt{t} and thus shrink like 1/\sqrt{t}. And we are back to classical decreasing stepsizes! This behaviour is what gives AdaGrad its good regret bounds in convex online learning, but in deep learning the gradient scale changes over training and old gradients become irrelevant.

RMSProp Hinton, 2012 replaces the sum by an exponential average, i.e., momentum but on squared gradients:

v_{t}=\beta_{2}v_{t-1}+(1-\beta_{2})h_{t}^{\odot 2},\qquad d_{t}=-\eta_{t}\frac{h_{t}}{\sqrt{v_{t}}+\varepsilon}.

Now the scale follows the recent gradient size: for a constant value c, v_{t,i}=(1-\beta_{2}^{t})c^{2}\to c^{2} instead of growing like tc^{2}. If a coordinate’s gradients become small, v_{t,i} decreases and its coefficient grows again.

3.3 Adam

Adam Kingma & Ba, 2015 combines the two ideas we have: average the gradients (momentum, Section 2) and divide by an average of their squares (RMSProp). Both averages start at zero, so both are bias-corrected (Proposition 3):

\displaystyle m_{t} \displaystyle{}=\beta_{1}m_{t-1}+(1-\beta_{1})h_{t}, \displaystyle v_{t} \displaystyle{}=\beta_{2}v_{t-1}+(1-\beta_{2})h_{t}^{\odot 2},
\displaystyle\widehat{m}_{t} \displaystyle{}=\frac{m_{t}}{1-\beta_{1}^{t}}, \displaystyle\widehat{v}_{t} \displaystyle{}=\frac{v_{t}}{1-\beta_{2}^{t}},
\displaystyle d_{t} \displaystyle{}=-\eta_{t}\frac{\widehat{m}_{t}}{\sqrt{\widehat{v}_{t}}+\varepsilon}.

Note that v_{t} is an average of squared gradients, i.e., a second order moment (and not a variance). Typical values are \beta_{1}=0.9, \beta_{2}=0.999, \varepsilon=10^{-8}. Table 1 compares SGD, AdaGrad, RMSProp and Adam viewed as perturbation of a quadratic cost.

Method input g_{t} cost H_{t}
SGD h_{t} I
AdaGrad h_{t} \operatorname{diag}(\sqrt{a_{t}}+\varepsilon\mathbf{1})
RMSProp h_{t} \operatorname{diag}(\sqrt{v_{t}}+\varepsilon\mathbf{1})
Adam \widehat{m}_{t} \operatorname{diag}(\sqrt{\widehat{v}_{t}}+\varepsilon\mathbf{1})
Table 1. From SGD to Adam. AdaGrad \to RMSProp changes the cost. RMSProp \to Adam changes the input and adds bias correction to the cost. Note that Adam with \beta_{1}=0 is not RMSProp: its denominator still contains the factor 1/(1-\beta_{2}^{t}).
Example 4: Qualitative differences between AdaGrad, RMSProp, and Adam

Let f(x)=\sqrt{1+x^{2}}-1, whose gradient h=x/\sqrt{1+x^{2}} is close to 1 for x\gg 1 and to x near 0, and start from x_{0}=10 with exact gradients, \eta=0.5 and \beta_{2}=0.99 (Figure 4).

  • •

    AdaGrad: far from the minimizer |x_{t}|\gg 1, we have h_{t}\approx 1, so a_{t}\approx t and the step is about \eta/\sqrt{t}. After t steps it has travelled about 2\eta\sqrt{t} instead of \eta t: it needs about 100 steps to reach the bottom.

  • •

    RMSProp: v_{1}=(1-\beta_{2})h_{1}^{2}, so the first step has length \eta/\sqrt{1-\beta_{2}}=10\eta=5. The early steps are far too large and the iterate overshoots the minimizer. Near 0, the iterates fall into a cycle x_{t}=\pm\eta/2 (modulo \varepsilon): there |h_{t}| is constant, so v_{t}\to h_{t}^{2} and every step has length \approx\eta.

  • •

    Adam: bias correction makes the first steps of length \eta, as on the slope, and \widehat{v}_{t} remembers the larger gradients of the slope, so the steps shrink once h_{t} does. Momentum makes it overshoot once, then the alternating signs cancel in m_{t} and the iterates settle at 0.

Loss f(x)=\sqrt{1+x^2}-1, gradient h=x/\sqrt{1+x^2}, no noise. Dashed: AdaGrad; thin with dots: RMSProp; thick: Adam. β₂ is shared by RMSProp and Adam. With β₁ = 0, Adam is RMSProp with bias correction.

Figure 4. AdaGrad, RMSProp (without bias correction) and Adam on f(x)=\sqrt{1+x^{2}}-1 from x_{0}=10, with \eta=0.5, \beta_{1}=0.9 and \beta_{2}=0.99. AdaGrad slows down on the slope, RMSProp overshoots and then bounces between \pm\eta/2, Adam walks down at speed \eta and settles.

An interesting property of Adam is that it is (almost) scale invariant. When \varepsilon=0, multiplying f by a constant leaves invariant the trajectory. Note that: i) it is false for \varepsilon>0, and ii) it is only “contrast” invariant (scalar multiplication) and not true for a general linear operator.

3.4 Alternative interpretation of Adam and SignSGD

Heuristic for stationary case. Consider one coordinate and imagine that, over the averaging window, the gradient has roughly constant mean \mu and variance \sigma^{2}. If the moving averages are representative of these moments, then, neglecting \varepsilon,

\widehat{m}_{t}\approx\mu,\qquad\widehat{v}_{t}\approx\mu^{2}+\sigma^{2},\qquad d_{t}\approx-\eta_{t}\frac{\mu}{\sqrt{\mu^{2}+\sigma^{2}}}.

This suggests two regimes. When the mean dominates the fluctuations, |\mu|\gg\sigma, the normalization nearly cancels the magnitude: the step is approximately -\eta_{t}\operatorname{sgn}(\mu). When fluctuations dominate, |\mu|\ll\sigma, the signed gradients largely cancel in the numerator while their squares accumulate in the denominator, giving a much smaller step.

Limit case: signSGD. This is a heuristic picture, to be more precise, set \beta_{1}=\beta_{2}=0. Then, coordinatewise,

\widehat{m}_{t}=h_{t},\qquad\widehat{v}_{t}=h_{t}^{\odot 2},\qquad d_{t,i}=-\eta_{t}\frac{h_{t,i}}{|h_{t,i}|+\varepsilon}.

As \varepsilon tends to zero, this becomes

d_{t}=-\eta_{t}\operatorname{sgn}(h_{t}),

with \operatorname{sgn}(0)=0. This is signSGD: every nonzero coordinate moves by the same amount, regardless of the gradient’s magnitude. signSGD is thus a degenerate, memoryless version of Adam. It isolates the effect of coordinatewise normalization.

Interpretation as local-step model. This simplified update has a direct interpretation in our local-model framework. Suppose we allow every coordinate to move by at most \eta_{t}. Minimizing the linear model gives

-\eta_{t}\operatorname{sgn}(g_{t})\in\arg\min_{|d|\infty\leq\eta_{t}}\langle g_{t},d\rangle.

Indeed, each term g_{t,i}d_{i} is minimized by moving to the endpoint opposite to the sign of g_{t,i}. When g_{t,i}=0, any displacement in the allowed interval is optimal. Taking g_{t}=h_{t} gives SignSGD. Taking g_{t}=m_{t} gives its momentum variant, Signum.

3.5 Weight decay

Weight decay is an important tool for training models. With SGD, adding \tfrac{\lambda}{2}|\!|x|\!|^{2} to the loss and shrinking the weights by a factor 1-\eta\lambda at each step are the same thing (check it!). With an adaptive method they are not like Adam, and this matters in practice.

Adding the L_{2} term to the loss gives the current gradient to be g_{t}+\lambda x_{t}, thus the iterates reads:

x_{t+1}=x_{t}-\eta_{t}H_{t}^{-1}(g_{t}+\lambda x_{t}).

So coordinates with a large H_{t} entry (large past gradients) are barely regularized. AdamW Loshchilov & Hutter, 2019 applies the decay outside the preconditioner,

x_{t+1}=(1-\eta_{t}\lambda)x_{t}-\eta_{t}H_{t}^{-1}\widehat{m}_{t},

and its moment buffers see only loss gradients. So this is not equivalent anymore to just adding \tfrac{\lambda}{2}|\!|x|\!|^{2} to the loss.

4 Steepest descent in a norm

During our encounter with adaptive methods, we saw two kinds of local-step:

  • •

    Gradient descent-like penalizes \tfrac{1}{2}|\!|d|\!|_{2}^{2} and moves along -g.

  • •

    Sign descent constrains |\!|d|\!|_{\infty}\leq\eta and moves along -\operatorname{sgn}(g).

We can observe that they differ at least in two way: the norm that is used \ell_{\infty} vs \ell_{2}, and the fact one is a constraint wheras the other not. This section is dedicated to provide some general theory around these choices, before going to matrix spaces.

4.1 Reminders on dual norms and support directions

Let N be any norm. Moving by a step u with N(u)\leq 1 changes the linear model by \langle g,u\rangle. The largest possible change is the dual norm of g, and the steps that achieve it are the support directions:

N_{*}(g)=\max_{N(u)\leq 1}\langle g,\,u\rangle,\qquad\mathcal{U}(g)=\arg\max_{N(u)\leq 1}\langle g,\,u\rangle.

The maximum exists because the unit ball in finite dimension is compact. Directly from the definition, |\langle g,\,d\rangle|\leq N_{*}(g)N(d) for all g,d (Hölder’s inequality for general norms). Note that for g\neq 0, each support direction has N(u)=1.

Some examples:

  • •

    N=\ell_{2}: N_{*}=\ell_{2} and \mathcal{U}(g)=\{g/|\!|g|\!|_{2}\}.

  • •

    N=\ell_{\infty}: N_{*}=\ell_{1} and \operatorname{sgn}(g)\in\mathcal{U}(g) (any value is allowed where g_{i}=0).

  • •

    N=\ell_{1}: N_{*}=\ell_{\infty} and \operatorname{sgn}(g_{j})e_{j}\in\mathcal{U}(g) for any j with |g_{j}|=|\!|g|\!|_{\infty}.

4.2 Local-model step: length and direction

One can thinks of steepest-descent step in a given norm as a a direction times a length. The norm N will control the direction (a support direction). The form of the cost chooses the length (\eta for a hard budget, \eta N_{*}(g) for a squared penalty). More precisely:

Proposition 5

Let g\neq 0 and \eta>0.

  1. 1.

    Hard budget. \displaystyle\arg\min_{N(d)\leq\eta}\langle g,\,d\rangle=-\eta\,\mathcal{U}(g), with minimum value -\eta N_{*}(g).

  2. 2.

    Squared penalty. \displaystyle\arg\min_{d}\Big\{\langle g,\,d\rangle+\frac{N(d)^{2}}{2\eta}\Big\}=-\eta N_{*}(g)\,\mathcal{U}(g), with minimum value -\tfrac{\eta}{2}N_{*}(g)^{2}.

At g=0, every point of the ball solves (1.) and d=0 is the unique solution of (2.).

Proof

(1.) Substitute d=-\eta u. (2.) Fix a length r\geq 0. By (i) with radius r, the smallest value of \langle g,\,d\rangle with N(d)\leq r is -rN_{*}(g), reached exactly on -r\,\mathcal{U}(g), whose points have N(d)=r. So among steps of length r, the objective is at least \phi(r)=-rN_{*}(g)+r^{2}/(2\eta), with equality exactly on -r\,\mathcal{U}(g). The scalar function \phi has its unique minimum at r^{\star}=\eta N_{*}(g), with value -\tfrac{\eta}{2}N_{*}(g)^{2}. So every minimizer has length r^{\star} and lies in -r^{\star}\,\mathcal{U}(g).

For the Euclidean norm the two forms give -\eta g/|\!|g|\!|_{2} (normalized gradient descent) and -\eta g (plain gradient descent). For \ell_{\infty} they give -\eta\operatorname{sgn}(g) and -\eta|\!|g|\!|_{1}\operatorname{sgn}(g).

Euclidean · ℓ₂

Box · ℓ∞

Diamond · ℓ₁

The solid arrow is a minimizing step d for a unit budget. The dashed line touches the ball where the linear model is smallest. A thick edge marks multiple minimizers. Try g₁ = g₂ or set one component to zero.

Figure 5. Steepest descent with the same gradient g=(3,1) and three unit balls. Slide the dashed level line of \langle g,\,d\rangle downhill until it last touches the ball; the touching point is the step. Euclidean: along -g. Box: every coordinate moves fully. Diamond: only the largest coordinate moves.

4.3 Steepest descent for matrices

Most parameters of a neural network are in fact weight matrices W\in\mathbb{R}^{m\times n}. Adam (and sign descent) treat W as a vector of mn numbers: each entry gets its own scale, and the geometry ignores that W represents a linear map. If we want to take into account this geometry, we need to use an appropriate norm6. If we consider an input a, the output changes by Da can be controlled by

|\!|Da|\!|_{2}\leq|\!|D|\!|_{\text{op}}|\!|a|\!|_{2},\qquad|\!|D|\!|_{\text{op}}=\sigma_{1}(D)=\max_{|\!|a|\!|_{2}=1}|\!|Da|\!|_{2}.

So the operator norm (largest singular value) measures the worst-case effect of D on the layer’s output. This suggests steepest descent with a hard budget on |\!|D|\!|_{\text{op}}:

\min_{D}\ \langle G,\,D\rangle\quad\text{subject to}\quad|\!|D|\!|_{\text{op}}\leq\eta, (4)

where G is the gradient with respect to W. We now discuss how to solve (4).

A key component of the analysis is the so-called polar factor of a matrix.

Definition 6: Polar factor

For G=U_{r}\Sigma_{r}V_{r}^{\top} the singular value decomposition of a matrix G, the polar factor of G is defined as \operatorname{Pol}(G)=U_{r}V_{r}^{\top}, with the convention \operatorname{Pol}(0)=0.

Polar decomposition keeps the singular directions of G and replace every positive singular value by 1. Geometrically, G maps the unit sphere to an ellipsoid with semi-axes \sigma_{i}. \operatorname{Pol}(G) maps it to a sphere, with the same axes (Figure 6). If G is square and invertible, \operatorname{Pol}(G) is the orthogonal matrix closest to G in Frobenius norm (that is why computing it is often called “orthogonalizing” G). Remark that \langle G,\,\operatorname{Pol}(G)\rangle=\operatorname{tr}(V_{r}\Sigma_{r}U_{r}^{\top}U_{r}V_{r}^{\top})=\sum_{i}\sigma_{i}=|\!|G|\!|_{\text{nuc}}.

G: directions and stretching

Pol(G): directions without stretching

G = Rθ diag(σ₁, σ₂). Dashed: the input unit circle, shown as a reference in each panel. Solid: its image under the map. The arrows show the images of the coordinate unit vectors e₁ and e₂; their directions are preserved by the polar factor. Try σ₂ = 0.

Figure 6. The polar factor preserves singular directions and replaces positive singular values by one. Initially, G=R_{30^{\circ}}\operatorname{diag}(2,0.6) maps the unit circle to an ellipse, while \operatorname{Pol}(G)=R_{30^{\circ}} maps it to the unit circle. If a singular value is zero, it stays zero, then the image is then a line segment.

We are now equipped to solve (4).

Theorem 7

Let G=U_{r}\Sigma_{r}V_{r}^{\top} and \eta>0. The minimum of (4) is -\eta|\!|G|\!|_{\text{nuc}}, and it is attained at D=-\eta\operatorname{Pol}(G). More precisely, D is a minimizer if, and only if

D=-\eta\operatorname{Pol}(G)+(I-U_{r}U_{r}^{\top})\,C\,(I-V_{r}V_{r}^{\top})

for some C with |\!|(I-U_{r}U_{r}^{\top})C(I-V_{r}V_{r}^{\top})|\!|_{\text{op}}\leq\eta. In particular the minimizer is unique when G has full rank.

Idea of the proof. Write G as a sum of rank-one pieces \sigma_{i}u_{i}v_{i}^{\top}. The inner product \langle G,\,D\rangle becomes \sum_{i}\sigma_{i}\,u_{i}^{\top}Dv_{i}. Each number u_{i}^{\top}Dv_{i} can be at most |\!|D|\!|_{\text{op}} in absolute value, so the best we can do is make every one of them equal to -\eta, and D=-\eta\sum_{i}u_{i}v_{i}^{\top} does exactly that.

Proof of Theorem 7

With G=\sum_{i=1}^{r}\sigma_{i}u_{i}v_{i}^{\top}, \langle G,\,D\rangle=\sum_{i}\sigma_{i}u_{i}^{\top}Dv_{i}\geq-\eta\sum_{i}\sigma_{i} whenever |\!|D|\!|_{\text{op}}\leq\eta, since |u_{i}^{\top}Dv_{i}|\leq|\!|D|\!|_{\text{op}}. The bound is attained by D=-\eta U_{r}V_{r}^{\top}.

To prove that every minimizer has the stated form, fix a minimizer D. Then, u_{i}^{\top}Dv_{i}=-\eta for each i. Since |\!|Dv_{i}|\!|_{2}\leq\eta, equality in Cauchy–Schwarz forces Dv_{i}=-\eta u_{i}; likewise D^{\top}u_{i}=-\eta v_{i}. So DV_{r}=-\eta U_{r} and U_{r}^{\top}D=-\eta V_{r}^{\top}. With P_{U}=U_{r}U_{r}^{\top} and P_{V}=V_{r}V_{r}^{\top}, split

D=P_{U}DP_{V}+P_{U}D(I-P_{V})+(I-P_{U})DP_{V}+(I-P_{U})D(I-P_{V}).

The first term is U_{r}(U_{r}^{\top}DV_{r})V_{r}^{\top}=-\eta U_{r}V_{r}^{\top}. The second is -\eta U_{r}V_{r}^{\top}(I-P_{V})=0, and the third is -\eta(I-P_{U})U_{r}V_{r}^{\top}=0. Define the residual C:=D+\eta\operatorname{Pol}(G)\in\mathbb{R}^{m\times n}. The decomposition above gives C=(I-P_{U})D(I-P_{V}), hence (I-P_{U})C(I-P_{V})=C. Since orthogonal projections have operator norm at most one, |\!|C|\!|_{\text{op}}\leq|\!|D|\!|_{\text{op}}\leq\eta. Thus this choice of C gives the claimed representation and satisfies its norm bound.

Conversely, let C\in\mathbb{R}^{m\times n} satisfy |\!|(I-P_{U})C(I-P_{V})|\!|_{\text{op}}\leq\eta, and define D=-\eta\operatorname{Pol}(G)+(I-P_{U})C(I-P_{V}). Then \langle G,\,D\rangle=-\eta|\!|G|\!|_{\text{nuc}}, and since the two pieces of D act between orthogonal pairs of subspaces, |\!|D|\!|_{\text{op}} is the larger of their norms, at most \eta. Therefore D is a minimizer. If G has full rank, I-P_{U} or I-P_{V} is zero and the free part vanishes.

The polar step keeps singular directions and replaces positive singular values by one. It therefore gives weak and strong singular directions the same step size, while leaving the kernel unchanged. For example,

G=\operatorname{diag}(4,1,0)\quad\Longrightarrow\quad-\eta\operatorname{Pol}(G)=-\eta\operatorname{diag}(1,1,0).

Remark that applying Proposition 5, the squared-penalty version has the step -\eta|\!|G|\!|_{\text{nuc}}\operatorname{Pol}(G). Indeed, \max_{|\!|D|\!|_{\text{op}}\leq 1}\langle G,\,D\rangle=|\!|G|\!|_{\text{nuc}} because the nuclear norm is the dual of the operator norm, and \operatorname{Pol}(G) is a support direction.

The following tabular summarizes the link between sign and polar decomposition.

budget steepest-descent step interpretation
vectors |\!|d|\!|_{\infty}\leq\eta -\eta\operatorname{sgn}(g) every nonzero coordinate moves by \eta
matrices |\!|D|\!|_{\text{op}}\leq\eta -\eta\operatorname{Pol}(G) every nonzero singular direction moves by \eta

5 Muon

We now have most of the ingredients to discuss Muon. Muon (Jordan, 2024) is the local-model step with

  • •

    input: a momentum average of the matrix gradient (Section 2), to reduce variance.

  • •

    cost: a hard constraint on the operator norm (Section 4.3), so the step is a polar factor.

  • •

    solver: a few iterations of a matrix polynomial instead of a SVD (we are going to discuss it later Section 5.2).

Jordan (Jordan, 2024) reports training speed records: from 3.3 to 2.6 A100-seconds for 94% accuracy on CIFAR-10, and a 1.35\times speedup for reaching a validation loss of 3.28 on FineWeb in the NanoGPT speedrun. Liu et al. (Liu & others, 2025) report roughly 2\times compute efficiency over AdamW in compute-optimal training.

5.1 Muon iterations

With the exact polar map, no decay and s_{t}>0 a scaling factor (Section 3.1), each local step solves

\min_{D}\langle B_{t},\,D\rangle\quad\text{subject to}\quad|\!|D|\!|_{\text{op}}\leq\eta_{t}s_{t}

by Theorem 7. For a weight matrix W_{t}\in\mathbb{R}^{m\times n} at time t with raw gradient G_{t}:

\displaystyle M_{t} \displaystyle{}=\beta M_{t-1}+(1-\beta)G_{t}, \displaystyle M_{0} \displaystyle{}=0,
\displaystyle B_{t} \displaystyle{}=M_{t}\quad\text{or}\quad B_{t}=(1-\beta)G_{t}+\beta M_{t} \displaystyle{}\text{ (``Nesterov'' option)},
\displaystyle W_{t+1} \displaystyle{}=(1-\eta_{t}\lambda)W_{t}-\eta_{t}s_{t}\,\widetilde{Q}(B_{t}),

where \widetilde{Q} approximates the polar operator \operatorname{Pol}, and \lambda\geq 0 is decoupled weight decay as in AdamW (Section 3.5). The second choice of B_{t} puts more weight on the current gradient, which reduces the lag of the average7.

Muon is meant for the weight matrices of hidden layers (feedforward networks and attention). In the reference implementation Jordan & contributors, , biases and normalization gains use AdamW, and so do the embedding and output layers, for which the operator-norm geometry does not make sense.

The factor s_{t} adjusts the update to the matrix shape. To control the change in the layer’s output, measure inputs and outputs by their RMS size. For D\in\mathbb{R}^{m\times n},

\sup_{a\neq 0}\frac{|\!|Da|\!|_{2}/\sqrt{m}}{|\!|a|\!|_{2}/\sqrt{n}}=\sqrt{\frac{n}{m}}\,|\!|D|\!|_{\mathrm{op}}.

A budget of \eta on this ratio gives D=-\eta\sqrt{m/n}\,\operatorname{Pol}(B). The reference implementation (Jordan & contributors, ) uses s_{t}=s=\sqrt{\max(1,m/n)}, i.e., the same factor when m\geq n, and 1 otherwise.

5.2 Computing the polar factor without an SVD

The elephant in the room is that computing a SVD is costly! Can we compute \operatorname{Pol}(B), or something close to it, with matrix products only? The key idea is to remember that we can act on matrices with polynomials, with explicit link to the eigenvalues/singular values. In particular, the following lemma shows this for odd polynomials of degree \leq 5.

Lemma 8

Let \varphi(s)=as+bs^{3}+cs^{5} and X=U_{r}\operatorname{diag}(s_{i})V_{r}^{\top}. Then

U_{r}\operatorname{diag}(\varphi(s_{i}))V_{r}^{\top}=aX+b(XX^{\top})X+c(XX^{\top})^{2}X.
Proof

XX^{\top}=U_{r}\operatorname{diag}(s_{i}^{2})U_{r}^{\top}, hence (XX^{\top})^{j}X=U_{r}\operatorname{diag}(s_{i}^{2j+1})V_{r}^{\top}.

So applying the polynomial keeps the singular vectors and applies \varphi to each singular value separately. To approximate \operatorname{Pol}(B)=U_{r}V_{r}^{\top}, we need a scalar iteration s\mapsto\varphi(s) that sends every positive starting value to 1 and keeps 0 at 0. The matrix problem has become a one-dimensional problem!

We want to map s to 1=s\,(s^{2})^{-1/2}. Write s^{2}=1-u, where u is the error towards our objective to be 1. For small u, (1-u)^{-1/2}\approx 1+u/2, so a natural update is

s\ \mapsto\ s\Big(1+\frac{1-s^{2}}{2}\Big)=\tfrac{1}{2}s(3-s^{2})=:p(s).

In matrix form, this is the classical Newton–Schulz iteration (Higham, 2008)

X_{j+1}=\tfrac{1}{2}X_{j}(3I-X_{j}^{\top}X_{j})=\tfrac{3}{2}X_{j}-\tfrac{1}{2}(X_{j}X_{j}^{\top})X_{j}.
Theorem 9: Convergence of the cubic iteration

For every nonzero real matrix B, the iterates started at X_{0}=B/|\!|B|\!|_{F} converge to \operatorname{Pol}(B). For each positive singular value, the error u_{j}=1-s_{j}^{2} satisfies

u_{j+1}=\tfrac{1}{4}u_{j}^{2}(3+u_{j}),

and zero singular values stay zero.

Proof

By Lemma 8 it suffices to study s_{j+1}=p(s_{j}) with s_{0}\in(0,1]. With s^{2}=1-e,

p(s)^{2}=\tfrac{1}{4}(1-e)(2+e)^{2}=\tfrac{1}{4}(4-3e^{2}-e^{3}),\qquad\text{so}\qquad 1-p(s)^{2}=\tfrac{1}{4}e^{2}(3+e).

For e\in[0,1) we get 0\leq e_{j+1}\leq e_{j}\cdot\tfrac{e_{j}(3+e_{j})}{4}<e_{j}, and p(s)>0. So (e_{j}) decreases to a limit e^{\star}\in[0,1) with e^{\star}=\tfrac{1}{4}e^{\star 2}(3+e^{\star}), whose only solution in [0,1) is 0. Hence s_{j}\to 1. Since p(0)=0, zero singular values stay at zero.

The error recursion tells us how the iteration behaves. Near the target, u_{j+1}\approx\tfrac{3}{4}u_{j}^{2}, i.e., the number of correct digits roughly doubles at each step. Far from the target, for a tiny singular value s, p(s)\approx 1.5s so it grows only by 50\% per step. So small directions may be badly estimated (Figure 7).

(Jordan, 2024)’s nice idea is to give up exact convergence. Instead, choose a quintic q(s)=as+bs^{3}+cs^{5} with the largest possible slope a=q^{\prime}(0), so that small singular values grow fast, under the constraint that after a few steps all values land roughly in [0.7,1.3] instead of exactly at 1. The coefficients used in practice are

q(s)=3.4445\,s-4.7750\,s^{3}+2.0315\,s^{5}.

Figure 7 show the difference of behavior between the ”exact” choice and Jordan’s coefficients.

Solid line and circles: cubic. Dashed line and squares: quintic. Dotted line: target 1 for positive singular values. The shaded range [0.7, 1.3] is a reference, not a guaranteed bound. The initial-value slider uses a logarithmic scale; moving it exits the zero case.

Figure 7. Both scalar iterations from s_{0}=0.01. The cubic first comes within 1\% of 1 after fourteen steps; the quintic enters [0.7,1.3] after four steps, then oscillates near 1, sometimes leaving this interval.

References

  • Bernstein, J., & Newhouse, L. (2024). Modular duality in deep learning. https://arxiv.org/abs/2410.21265
  • Bernstein, J., & Newhouse, L. (2024). Old optimizer, new norm: An anthology. https://arxiv.org/abs/2409.20325
  • Duchi, J., Hazan, E., & Singer, Y. (2011). Adaptive subgradient methods for online learning and stochastic optimization. Journal of Machine Learning Research, 12, 2121–2159.
  • Higham, N. J. (2008). Functions of matrices: Theory and computation. SIAM.
  • Hinton, G. (2012). Neural networks for machine learning. Lecture 6, slides 29–30.
  • Jordan, K., & contributors. (n.d.). Muon reference implementation. https://github.com/KellerJordan/Muon
  • Jordan, K. (2024). Muon: An optimizer for hidden layers in neural networks. https://kellerjordan.github.io/posts/muon/
  • Kingma, D. P., & Ba, J. (2015). Adam: A method for stochastic optimization. International Conference on Learning Representations.
  • Liu, J., & others. (2025). Muon is scalable for LLM training. https://arxiv.org/abs/2502.16982
  • Loshchilov, I., & Hutter, F. (2019). Decoupled weight decay regularization. International Conference on Learning Representations.

Footnotes

  1. You are going to study Newton & quasi-Newton methods in a further lecture for non-deep applications. ↩

  2. Remember that \iota indicates the convex indicator of a set, i.e., zero inside, +\infty outside. ↩

  3. To see that, observe that their average age is \sum_{k\geq 0}k(1-\beta)\beta^{k}=\beta/(1-\beta). ↩

  4. Note that this choice can be seen as arbitrary, and particular, may not be optimal from a theoretical perspective, see for instance the discussion on Francesco Orabona blog. ↩

  5. Every operations here should be considered coordinatewise. ↩

  6. Bernstein & Newhouse (2024b); Bernstein & Newhouse (2024a) develop this “choose the norm from the layer’s role” view in detail ↩

  7. There is no theory at the moment providing an acceleration theorem like classical Nesterov method. ↩