TL;DR
Lion is an optimizer for training neural networks. It keeps a single momentum vector for each parameter, mixes the current gradient into that momentum, and moves every parameter by the same fixed size in the direction of the sign of the mix. It was not designed by hand: an automated search over small update programs found it, and its authors then simplified the result. Because it stores less state than the usual adaptive optimizers, it uses less memory, and on the paper's image benchmarks it matched or beat AdamW.
Builds on: Momentum, AdamW Optimizer · Leads to: the Lion paper
Where it's used
Training image models. Vision Transformers such as ViT-B/16, trained from scratch on ImageNet, are the main test case in the paper. Lion matched or improved on AdamW in its reported runs, for example about 0.65 points higher top-1 accuracy for ViT-B/16 trained from scratch on ImageNet, which made the optimizer a candidate for large image jobs.
Training very large models under a memory limit. A model with hundreds of millions of parameters keeps two optimizer vectors per parameter with Adam-style methods. Lion keeps one. The paper gives a concrete case: training ViT-B/16 with a batch of 4,096 needs at least 16 TPU v4 chips with AdamW and 8 with Lion, both using bfloat16 momentum.
Large-batch data parallel training. Teams that scale training by adding data-parallel workers use very large batches. The paper reports that Lion's advantage over AdamW grows as the batch size grows, which fits that setting.
How it works
Lion has one state vector per parameter, called the momentum . The learning rate is the step scale, and and are two decay factors between 0 and 1. The paper's defaults are and .
Trace one parameter with three gradients, using , no weight decay, and . The gradients are , and .
- Start with and . The first gradient is . Mix it with the old momentum: . Check: the mix is positive, so its sign is .
- Step the parameter by the sign: . Check: the step is even though the gradient was . Only the sign was used.
- Update the momentum with a slower average: . Check: the momentum has moved only a little, because is large.
- The second gradient is . Mix again: . Check: the old momentum pulls up, but the new gradient is larger in size, so the mix is negative and its sign is .
- Step the parameter: . The parameter moved back. Check: the step was again exactly in size.
- Update the momentum: . Check: the momentum is still positive, so it remembers the first gradient.
- The third gradient is , so , sign , and .
The diagram shows the same loop for every step.
flowchart LR G["gradient g_t"] --> M["mix: c_t = β1 m_t-1 + (1 - β1) g_t"] M --> S["sign(c_t)"] S --> T["θ_t = θ_t-1 - η sign(c_t)"] G --> U["momentum: m_t = β2 m_t-1 + (1 - β2) g_t"] U -. "used at the next step" .-> M
Two things stand out. Every parameter moves by the same amount, , whatever its gradient was, so the scale of the gradient does not matter. And the momentum does two jobs: it is mixed into the direction, and it is updated with the gradient for the next step. The mix uses , so the direction follows recent history closely, while the stored momentum uses , so it remembers about a hundred steps.
The math
At step , with gradient of the loss at the parameters , Lion computes a mixed direction , takes its sign, and moves each parameter by times that sign plus a weight-decay term. Then it updates the momentum . The rules are
where is the decoupled weight decay coefficient and is for positive , for negative , and for .
Step 1 in symbols: the gradient
The gradient is the vector of partial derivatives of the loss, taken element by element over the parameters. It is the same Gradient used in Stochastic Gradient Descent, computed here on a mini-batch.
Step 2 in symbols: the mixed direction
The mix is an Exponential Moving Average style blend of the old momentum and the new gradient, with weights and that add to one. With , the old momentum has weight and the new gradient . In the walkthrough, because the momentum started at zero.
Step 3 in symbols: the sign step
Only the sign of enters the step. For every coordinate , the update of is or . The sign operation is the only nonlinear part of the rule. It is why every parameter moves by about the same size, and it is also why Lion's update is larger in norm than an SGD step with the same learning rate. The paper notes that the update has a large norm and that a sign-based step adds a kind of noise that helps generalisation.
Step 4 in symbols: the momentum
The momentum uses a second decay factor . Its update is an exponential average of the gradients with a long memory. The effective window is about steps for , against about 10 for . This is the reason the paper describes Lion as remembering a longer history for the momentum while putting more weight on the current gradient in the update.
Step 5 in symbols: no bias correction
Adam divides its averages by a correction factor at the start, because they begin at zero. Lion does not, and the paper argues this is safe. At the mix is , which is a positive multiple of , so its sign is the sign of the gradient. The correction would only rescale a quantity whose sign is what is used.
Step 6 in symbols: the weight decay term
Write the weight-decay part on its own: when the sign term is small. Each step shrinks a parameter by the fraction . This product, not alone, is the effective decay strength, which the next section uses.
Worked examples
Let , , , , . The first gradient is .
- Mix: .
- Signs: .
- Step: .
Interpretation: the first parameter had a gradient ten thousand times larger than the second, and both moved by the same . Lion discards the scale of the gradient and keeps only its direction, so a parameter with a tiny gradient is not held back.
The paper reports that Lion needs a smaller learning rate than AdamW and a larger weight decay to compensate. Its ViT-B/16 settings are with for Lion, and with for AdamW.
- Lion's per-step decay: .
- AdamW's per-step decay: .
- The two products are equal, so each optimizer shrinks a weight by the same fraction per step from weight decay.
- Take a weight equal to . Each step removes from it through decay in both optimizers.
- The difference lies in the gradient part. Lion adds a step of size in each coordinate, and AdamW adds a step of size about scaled by its own normalisation.
Interpretation: when moving from AdamW to Lion, changing the learning rate alone would change the decay too, so the two must be tuned together.
Table 2 of the paper compares ViT-B/16 trained from scratch on ImageNet, using top-1 accuracy averaged over three runs. The values are AdamW 80.12 and Lion 80.77.
- Gap in accuracy: percentage points.
- Relative error: the error rate falls from to percent.
- Relative reduction in error: , about 3.3 percent.
- Memory check from the same paper: for ViT-B/16 at batch size 4,096, AdamW needs at least 16 TPU v4 chips and Lion needs 8.
- Interpretation: in this setting Lion gives a small accuracy gain and halves the chips, so the trade is favourable. A gap of under one point is within the noise of many training runs, so the result is best read as "at least as good" rather than "clearly better".
Try it: the paper's ViT-S/16 row in the same table reports AdamW 78.89 and Lion 79.46. What is the gap in percentage points? Answer: percentage points.
Common mistakes and tradeoffs
It is tempting to think that Lion is a free upgrade over AdamW. In fact the paper's gains are small, a fraction of a point to a point or so in its image tasks, and they depend on tuning. Treat Lion as a strong option to test, not as a guaranteed win.
It is tempting to think that the learning rate can be copied from AdamW. In fact the sign update has a larger norm than AdamW's update, so the learning rate should be smaller, and the weight decay larger to keep the effective decay the same, as Example 2 showed.
It is tempting to think that a sign step means every parameter moves by one unit. In fact the step is the learning rate , not 1. The unit is set by , and that is why the size of matters so much.
It is tempting to think that Lion has no momentum because it has no second moment. In fact it has the momentum , and the step uses a mix of it with the current gradient. What it drops is the second vector that Adam keeps.
When to use it. Use Lion when memory is the limit, when batches are large, or when you want to test a sign-based method on image or language models, and tune and together.
When not to. Be careful with small batches. The paper reports that the advantage over AdamW grows with batch size, so with small batches AdamW may be as good, and it is the better-studied default.
Alternatives. AdamW Optimizer remains the usual default, with well-known settings. Plain Stochastic Gradient Descent with Momentum uses less memory than either and is strong for convolutional networks, but it needs careful tuning of the learning rate schedule, as explained in Cosine Annealing.
History
Adam appeared in 2014. In 2017 Ilya Loshchilov and Frank Hutter proposed AdamW, which applies weight decay directly to the weights rather than inside the gradient, and it became the common default. Sign-based methods are much older. Rprop, published by Martin Riedmiller and Heinrich Braun in 1993, used the sign of the gradient to adapt each weight's step size.
In 2023 Xiangning Chen and colleagues published "Symbolic Discovery of Optimization Algorithms". Their method searched over small programs that compute an update, scored each candidate by training cost and accuracy on proxy tasks, and kept the best. The program that won was simplified by hand into a short rule with a single sign operation, which they named Lion, for EvoLved Sign Momentum. The result caught on because the rule is short, stores less state than AdamW, and works on several large vision models.
Recap
- Lion keeps one momentum vector per parameter and does not keep the second moment that Adam uses.
- Each step mixes the momentum with the gradient using , takes the sign, and moves every parameter by the learning rate.
- Because the step has a fixed size, the learning rate is smaller than for AdamW (ten times smaller in the paper's ViT-B/16 settings), and the weight decay is larger.
- The momentum update uses , which gives it a long memory.
- Read next: Symbolic Discovery of Optimization Algorithms, which gives the search, the full benchmarks and the tuning advice, and AdamW Optimizer, the baseline it is measured against.