An amber cord zigzags down an elongated steel trough beside a straight reference path to the same basin.

In a two-variable experiment I rotated the same quadratic loss landscape by 45 degrees. With its usual settings, Adam took 17 times as many steps to reach the same loss. Newton’s method did not notice the rotation. The difference is in how these algorithms transform the gradient. In this last part I connect gradient descent, Newton, BFGS, Adam and Muon through that single question, then look at what the updates cost at LLM scale.

Numerical Optimization series. This is Part 4 of four. The others are Part 1, loss, constraints and minima; Part 2, Pareto fronts and weighted losses; and Part 3, choosing an optimizer. The series starts from chapter I of my 2008 PhD thesis and applies it to LLM training.

Why is gradient descent slow?

Gradient descent is slow when the function is much steeper in one direction than in another. One step length has to serve all directions. It must be short enough for the steepest one, so progress along the flattest one crawls. The gradient tells you which way is downhill from where you stand. It does not tell you how far to go.

The method repeats one operation. Call θ the list of variables (the weights of a model, the shape parameters of a wing). At step k, compute the gradient at the current point, then move a little in the opposite direction:

θk+1 = θk − η ∇F(θk)

  • θk is the current point, and θk+1 is the next one.
  • ∇F(θk) is the gradient: one slope per variable. The minus sign makes the step go downhill.
  • η (eta) is a positive number you choose: the step length factor. Machine learning calls it the learning rate. It multiplies the slope, so the same η gives large moves on steep ground and small moves on flat ground.

A two-variable example shows the trap. Take a valley that is 25 times more curved along the second variable than along the first:

F(θ) = ½ (θ1² + 25 θ2²)

Its gradient is (θ1, 25 θ2), so one step multiplies each variable by a constant:

θ1 → (1 − η) θ1

θ2 → (1 − 25 η) θ2

The second factor must stay between −1 and 1, or θ2 grows at every step. That requires η < 2/25 = 0.08. With such a small η, the first factor stays close to 1, and θ1 shrinks by less than 8% per step. Starting from (1, 1), here is what each choice of η gives:

Learning rate ηθ1 is multiplied byθ2 is multiplied bySteps until F < 0.001
0.010.990.75310
0.040.96077
0.077 (best for the worst direction)0.923−0.92360
0.0790.921−0.975187
0.10.90−1.5diverges

The negative factors are the zigzag in the figure: θ2 changes sign at every step and bounces between the walls. In the figure, the steep variable θ2 is horizontal. The ratio of curvatures is the same, with another start.

Paths of gradient descent, momentum and Newton in an elongated valley.
Steps to bring the loss below 0.001 on a quadratic with condition number 25, with tuned step sizes.

The general rule uses the Hessian, the matrix of second derivatives, whose eigenvalues λ measure the curvature in each principal direction. On a quadratic with positive curvatures, the condition number is their ratio:

κ = λmax / λmin

Gradient descent diverges if η exceeds 2/λmax, and for a given accuracy the worst-case number of steps grows in proportion to κ. Here κ = 25.

In practice you almost never know the Hessian. Often you have the gradient at best, and sometimes only an approximation of it. Gradient descent itself never needs κ. The condition number explains why the method is slow, and you meet it through symptoms:

  • The loss oscillates or blows up: η is too large for the steepest direction. Reduce it.
  • The loss falls steadily but very slowly, and any larger η makes it unstable: the problem is badly conditioned. Rescaling the variables or a better algorithm helps more than tuning η.
  • You need a number: two successive gradients already measure curvature along the last step, through the ratio ‖∇F(θk+1) − ∇F(θk)‖ / ‖θk+1 − θk‖. On a quadratic it never exceeds λmax. BFGS, below, builds on the same differences of gradients.

So η is chosen by trial. Engineers usually run a line search, which tries several step lengths along the same direction at each iteration. Deep learning usually tests a few values on short runs and follows a schedule.

Momentum softens the problem without the Hessian. It moves along v, a running sum of past gradients, with a factor β between 0 and 1 that forgets the old ones:

vk+1 = β vk + ∇F(θk)

θk+1 = θk − η vk+1

The moves along the valley floor point the same way and add up, while the moves across it alternate and partly cancel. The path can still swing widely at first, as in the figure, but it arrives in 22 steps instead of 70. With well-chosen η and β, the number of steps on a quadratic grows like √κ instead of κ.

Neural networks add a twist. Cohen and colleagues (2021) observed that with full-batch gradient descent, the largest curvature typically rises until it hovers just above 2/η. The training loss then moves up and down over short periods and still falls over long ones. The learning rate shapes the landscape you visit.

Does the cost grow with the number of variables?

On a noise-free quadratic, it grows with the condition number, and the number of variables matters only through κ. My thesis quoted a result of Jameson and Vassberg (1999): steepest descent needs a number of evaluations proportional to n², and quasi-Newton methods need about n. They measured it on a path problem (the brachistochrone), where refining the path also worsens the conditioning.

I separated the two effects. The first problem is a chain of n coupled variables, whose condition number grows like n². The second keeps κ = 10 at every size.

Variables nGradient descent, chainConjugate gradient, chainGradient descent, κ fixed at 10
10319 steps1066
404,242 steps4063
16061,817 steps16060
Steps against number of variables for three cases: one grows quadratically, one linearly, one stays flat.
On noise-free quadratics, the number of variables alone does not slow gradient descent. The condition number does.

Neural networks are further from this model. Their Hessians can be indefinite and have many near-zero eigenvalues, so a single positive-definite condition number may not even be meaningful. What carries over is that the step count depends on the curvature spectrum and the noise, and only indirectly on the parameter count. Llama 3 405B used a schedule of 1.2 million steps. Normalization layers, residual connections, careful initialization and adaptive optimizers can make the optimization problem easier.

What do Newton and BFGS buy you?

Newton’s method uses the Hessian H, the matrix of second derivatives, to choose both the direction and the length of the step d. That buys far fewer iterations, at the price of a Hessian you rarely have. Each iteration solves one linear system:

solve H d = −∇F(θk), then θk+1 = θk + d

On a positive-definite quadratic, a full exact Newton step reaches the minimum. Near a good minimum, the number of correct digits roughly doubles at each step. This quadratic convergence assumes a smooth function and a Hessian with no zero eigenvalue there.

Five reasons keep the plain version out of LLM training:

  • Cost to compute. Before you store a Hessian, you have to obtain it. Differencing exact gradients takes one extra gradient per variable, so 405 billion backward passes for a single Newton step on Llama 3 405B. The next section looks at this cost.
  • Size. The Hessian also has n² entries. For 405 billion weights in 32-bit floats, that is 6.6 × 1023 bytes, or 656 zettabytes. Hessian-free methods avoid the storage with Hessian-vector products, and each step then needs many of them.
  • Saddle points. Newton looks for a zero gradient, so it is attracted to saddle points and maxima as well as minima.
  • Distance. Far from a minimum, the full step can increase the loss. Damping, line search or a trust region fixes this.
  • Noise. The inverse Hessian amplifies gradient noise in flat directions.

Quasi-Newton methods such as BFGS avoid the Hessian. They build an approximation from successive gradients, then choose the step length with a line search. L-BFGS keeps only the last few gradient pairs, so memory stays proportional to n. Both need gradient differences they can trust. With minibatches, two gradients differ because the data changed as much as because the weights moved, which corrupts the estimate.

What if derivatives come from finite differences?

The iterations you save are usually paid back in function evaluations. Without an adjoint or backpropagation, one gradient costs about n extra function evaluations, and a dense Hessian about n²/2. Methods that use more derivative information take fewer steps, and each step costs more. Compare the total number of function evaluations, because the iteration count hides the price.

I counted it on the chained Rosenbrock function, a smooth curved valley, from 11 random starts close to the minimum, until the value falls below 10-6. With exact derivatives, I charge 4 evaluations per gradient and 4n per Hessian. With forward differences, every function call counts.

MethodIterations, 40 variablesTotal, exact derivatives, 40 variablesTotal, finite differences, 2 variables10 variables40 variables
Gradient descent7,411109,46162,985160,640376,902
BFGS39210603291,650
Newton10 (11 with differences)1,658606989,955
CMA-ES, no derivativesnot comparablenot applicable3662,68013,005

Newton needs about four times fewer iterations than BFGS on 40 variables, and six times more evaluations once its Hessian comes from differences. They tie on 2 variables and Newton falls behind as n grows. Against CMA-ES, a derivative-free method, its lead shrinks from 7.8 times with exact derivatives to 1.3 times.

BFGS holds up better, because it builds its curvature from gradients alone. Its lead over CMA-ES still drops from 62 times to 8 times. This test also favors derivatives: the function is smooth, noise-free and started near the answer. With a noisy simulation, the difference step has to balance truncation error against noise, and second differences divide the noise by the square of the step. With many local minima, the expensive descent may also end in the wrong valley. The table ignores sparsity, which can make some Hessians much cheaper to difference.

For Llama 3 405B with function values alone, one gradient would take 405 billion forward passes and one Hessian about 8 × 1022. So the memory of the Hessian is the second obstacle, and computing it is the first. Cheap gradients from reverse mode are what make gradient methods competitive in high dimension. Without them, count evaluations again before you choose.

Why does gradient noise change the rules?

With noisy gradients, a constant learning rate can produce a steady-state error rather than convergence to an exact minimum. Smaller steps typically reduce this floor at the cost of slower progress. Minibatch size, gradient variance and curvature jointly determine the useful learning rate.

Below a critical batch size, noise control dominates. Above it, conditioning dominates, which is where better preconditioners pay: they keep larger batches useful. On the simple quadratic below, the full undamped Newton step fares particularly badly under noise.

I minimized ½x² per variable over 100 variables with unit noise on every gradient. The minimum is zero. The curvature is 1 in every direction, so the Newton and gradient directions coincide, and the table isolates the effect of the step size.

Step rule (20,000 steps)Average loss per variable over the last 1,000 steps
Full step, η = 1 (a Newton step here)0.50
Constant η = 0.10.026
Constant η = 0.010.0025
Decaying η = 1/(k + 10)0.00003

The floor follows η / (2(2 − η)) on this problem, so cutting the rate by ten cuts the floor by about ten. Llama 3 405B used a linear warmup over 8,000 steps, then a cosine decay from 8 × 10-5 to 8 × 10-7. The warmup protects the early phase, when curvature and optimizer statistics are still unstable.

What does Adam do to the gradient?

Adam divides each component of the averaged gradient by the square root of its own averaged square. Every weight gets its own step size, and multiplying one component of the gradient by a constant leaves the update unchanged, up to ε. It is a diagonal method: it handles a badly scaled axis and has no way to see a valley that runs diagonally across several weights.

With g the current gradient, each step computes, for every weight separately (the arrow means “is replaced by”):

m ← β1 m + (1 − β1) g

v ← β2 v + (1 − β2) g²

θ ← θ − η m̂ / (√v̂ + ε)

Here m is the averaged gradient, and v is now the averaged squared gradient, a different quantity from the v of momentum above. β1 and β2 set how long the averages remember (0.9 and 0.999 by default), and ε is a tiny number that avoids a division by zero. The hats mark the bias correction of the first steps. I tested it on a valley with κ = 10,000, first aligned with the axes, then rotated by 45 degrees. The table gives the median steps to loss below 10-6 over 11 matched starts, without noise, with Adam’s learning rate tuned separately for each orientation.

MethodAligned valleyRotated valley
Gradient descent52,95652,956
Momentum905905
Adam (tuned)1442,462
Newton11

Gradient descent, momentum and Newton do not notice the rotation. Adam slows down by a factor of 17. Rotated Adam is still 21 times faster than gradient descent here, and tuned momentum beats it. The factor depends on the angle and on the averaging parameter β1, and 45 degrees is the worst angle I tested:

Slowdown of tuned AdamRotated by 5 degreesRotated by 45 degrees
β1 = 0.9 (usual default)3.8 times17 times
β1 = 0.952.1 times8.8 times
β1 = 0.991.1 times2.4 times

Part of the smaller factor is a slower start: with β1 = 0.99, Adam already needs 1,162 steps on the aligned valley. Three more facts help in practice:

  • Adam is not invariant to a change of units. The step stays close to η in whatever units the weight has, so the parametrization of the network matters.
  • Adam is sometimes called an approximate second-order method. It uses squared gradients, with a square root, and no second derivative. Bernstein and Newhouse (2024) show that Adam without its averages is steepest descent under another norm.
  • Adam stores two extra values per weight. For 405 billion weights in 32-bit floats, that is 3.2 TB of optimizer state to shard across GPUs.

AdamW keeps the same update and decouples the weight decay from it.

What does Muon change?

Muon treats a weight matrix as a matrix. It approximately orthogonalizes the momentum matrix, reducing the spread of its nonzero singular values. A few matrix multiplications do the job, through a Newton-Schulz-style iteration, which suits GPUs. In the original design, Muon updates the 2D hidden weights, and AdamW handles the rest.

The idea comes from a family. K-FAC (2015) and Shampoo (2018) approximate a huge preconditioner with two small matrices per layer. For a 4096 by 4096 layer, the full matrix would have 2.8 × 1014 entries, and two factors have 33.6 million.

I ran the basic cubic iteration on a random 64 by 64 matrix X scaled to unit Frobenius norm, as Muon does:

X ← 1.5 X − 0.5 X XT X

After five steps, the median singular value went from 0.10 to 0.66 and the smallest from 0.001 to 0.009. That is too slow. Muon uses a fifth-order polynomial with a steeper slope at zero, 3.44 instead of 1.5. On the same matrix, five steps of it brought the smallest singular value to 0.57, the median to 0.81 and the largest to 1.20. Muon accepts values near one.

Two panels showing the minimum, median and maximum singular values over five cubic and quintic orthogonalization iterations on the same matrix.
On the same normalized random matrix, Muon’s quintic iteration brings the smallest singular value much closer to one in five steps. Shaded bands show the full singular value range.
OptimizerRescales byExtra state per weightCorrects a badly scaled valleyTypical use
SGD with momentumnothing1 valueno, and rotation changes nothingvision models
Adam, AdamWeach weight2 valuesif aligned with the axesdefault for LLMs
Shampoo, K-FACrows and columnsabout 2 values for a square layer, more with cached inversespartly, inside each matrixresearch, some large runs
Muonsingular values of the update1 valuepartly, inside each matrixhidden layers of recent LLMs
Newtonfull curvaturen values per weightyessmall problems

Muon is often called second order. Bernstein and Newhouse show that Shampoo without its averages is steepest descent under the spectral norm, and Muon applies the same kind of orthogonalized update, with first derivatives only.

Is Muon faster than AdamW for LLMs?

Published evidence says yes, by a margin that depends on who measures it and at which scale. Moonshot AI reports about 2 times the computational efficiency of AdamW. A study of ten optimizers with equal tuning effort found 1.4 times at 0.1 billion parameters and 1.1 times at 1.2 billion. The same study found that the fastest optimizers all precondition with matrices.

Adoption is real: Kimi K2 was pretrained on 15.5 trillion tokens with a variant called MuonClip. The remaining question is the price of a step. NVIDIA published training throughput on GB300 in April 2026:

ModelAdamW (TFLOP/s per GPU)Muon, totalMuon, model partMuon, Newton-Schulz partModel part vs AdamW
Kimi K2 (256 GPUs)1,0511,0801,029512.1% lower
Qwen3 30B-A3B (8 GPUs)713721686353.8% lower

Counting the Newton-Schulz matrix multiplications, the GPUs do slightly more arithmetic per second with Muon. Counting only the arithmetic that trains the model, they do 2% to 4% less. NVIDIA does not give the formula, but the two parts add up to the total, so they appear to share the same step time, and the loss then already includes the Newton-Schulz work. At equal computation per step, Muon breaks even when it saves at least that share of the steps. A different parallel layout, or communication and checkpointing outside this measurement, can move the end-to-end figure.

Distribution is the engineering problem. AdamW works element by element, so its state can be cut anywhere. Muon needs whole matrices, so Megatron Core assigns whole layers to each data-parallel rank, and the preconditioning needs no extra communication.

Compare optimizers with the same tuning budget, at the end of training, at your scale. Rankings can flip when the learning rate decays. I would report at least four quantities: held-out loss at equal tokens, wall-clock time to a fixed loss, peak memory and communication overhead. A lower step count only wins when the savings survive all four.

Optimizer FAQ for LLM training

Is Adam a second-order optimizer?

No. Adam uses first derivatives only. It divides the averaged gradient by the square root of the averaged squared gradient, which is a diagonal rescaling. The squared gradient is related to a diagonal of the empirical Fisher matrix, and the square root makes it differ from a Newton step. Second-order methods use or approximate the Hessian or the Fisher matrix itself.

Why not use Newton’s method or BFGS to train an LLM?

The Hessian of a model with n weights has n² entries. Computing it takes about n extra gradients, and storing it is out of reach for billions of weights. Hessian-vector products avoid both, at the price of many extra passes per step. Newton’s method is attracted to saddle points, and minibatch noise corrupts the gradient differences used by BFGS. K-FAC and Shampoo approximate a preconditioner per layer at an acceptable cost.

What is the difference between Adam and Muon?

Adam rescales each weight on its own, using the history of its squared gradient. Muon orthogonalizes the whole momentum matrix of a layer, so all its singular values become close to one. Muon stores one momentum value per weight where Adam stores two, adds matrix multiplications at each step, and in its original design applies to 2D hidden weights only.

Why do learning rates warm up and then decay?

Warmup keeps the first steps small while curvature and optimizer averages are unstable. Decay lowers the noise floor: with noisy gradients and a constant rate η, the loss settles at a level roughly proportional to η. A schedule that starts high and ends low gets fast progress early and a lower floor at the end.

Related research posts

Sources


0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *