What Lion is
Lion (EvoLved Sign Momentum) was found by a program search over optimizer update rules. It keeps one momentum per weight, like SGD, and moves every weight by exactly the learning rate in the direction of the sign of a blend of that momentum and the new gradient. It needs half of AdamW's optimizer memory and no square roots.
This tab trains the explainer's small GPT (16,081,664 parameters) on TinyStories for 2,000 steps with the same data, initial weights and schedule as the other optimizer tabs, and records Lion's state for a corner of block 2's attention value projection at the steps in the toolbar.
The interpolated momentum and its sign
Lion uses two coefficients. The step takes the sign of a blend that leans towards the new gradient; the momentum carried to the next step is a slower average:
with and , the paper's defaults. The new gradient thus counts ten times as much in the step as in the memory, which remembers about steps. The first row of the panel draws , (with small above the blend), in two flat colours, the step and the new weights for a 64 × 64 corner; the second row draws the slower momentum update.
Steps of a fixed size
Because , every weight of every tensor moves by (plus its decay), whatever its gradient's size. The update's RMS equals the learning rate exactly, larger than AdamW's ratio, which is at most about 1 and usually smaller (on at step 1,000 its RMS is 0.197); so Lion needs a learning rate several times smaller than AdamW's and, to keep the shrinkage comparable, a larger weight decay. Here the sweep chose a peak of 5 × 10⁻⁴ against AdamW's 4 × 10⁻³, with against AdamW's 0.1.
Which of the two sets the sign changes during the run. At step 10 the momentum still carries the first, larger gradients: agrees with the sign of for 85.9 % of 's weights and with the batch gradient's for 71.3 %. Later, steps of a fixed size cannot shrink as a weight nears the bottom of its valley, so weights overshoot back and forth: over steps 500 to 1,000 the eight weights of The same weight over every step see their gradient change sign from one step to the next 74 % of the time (correlation −0.64 between consecutive gradients), and the momentum averages them to almost nothing. On at step 1,000 its RMS is 2.1 × 10⁻⁶ against 1.8 × 10⁻⁴ for the gradient, and agrees with the gradient's sign for 95.4 % of the weights but with the momentum's for only 44.0 %. The Every recorded step table follows both through the run. At step 1, and the step is simply . Click a cell to see its blend, sign and step worked out against the recording.
Sign descent and Adam
Taking only the sign of a gradient is an old idea: Bernstein and colleagues analysed signSGD in 2018, partly because one bit per weight is cheap to communicate between machines. Adam is close to it too: with its step is , a sign. Kunstner and colleagues found that sign-like updates explain most of Adam's advantage over SGD on transformers, which fits Lion matching AdamW with one state instead of two. The Every weight tensor panel shows Lion's relative steps: equal absolute steps give small tensors (the LayerNorm gains, near 1) and large ones the same per-entry movement.
In this run
After 2,000 steps Lion reaches a validation loss of 2.190, against 1.908 for AdamW, 3.059 for SGD and 1.729 for Muon; the Learning-rate sweep chart shows how its best rates lie about 8× below AdamW's.
Where it came from
Chen and colleagues (2023) searched a space of programs built from basic tensor operations, scoring candidates on small proxy tasks and simplifying the winners; Lion was the rule that survived, and it matched or beat AdamW on image classification, diffusion and language models. The AdamW tab shows the per-weight scale Lion drops, and the Muon tab a different way of fixing the size of a step: per matrix, by orthogonalizing it.
Papers
- Symbolic Discovery of Optimization Algorithms Lion, found by program search: the sign of an interpolated momentum, with a slower momentum update.
- signSGD: Compressed Optimisation for Non-Convex Problems Sign descent with and without momentum, its convergence and its one-bit communication.
- Noise Is Not the Main Factor Behind the Gap Between SGD and Adam on Transformers, but Sign Descent Might Be Sign-based updates close most of the gap between SGD and Adam on transformers.
- Decoupled Weight Decay Regularization Decoupled weight decay, which Lion applies the same way.
- TinyStories: How Small Can Language Models Be and Still Speak Coherent English? The dataset all four optimizer runs train on.