Optimizers
Methods that update weights from gradients: SGD, momentum, Adam, AdamW, and more.
AdaBeliefAdaBelief is an optimizer that replaces Adam's denominator, the average of the squared gradient, with the average of the squared deviation of the gradient from its prediction. It takes large steps when gradient directions are consistent and small steps when they fluctuate, aiming to combine Adam's speed with generalization close to SGD.
AdaDeltaAdaDelta is an optimizer that sets the step size by dividing by the moving average of squared gradients and also multiplying by the magnitude of past updates. It does not require a hand-tuned learning rate, and its step size does not keep shrinking as in AdaGrad.
AdafactorAdafactor approximates Adam's average of squared gradients using only the row sums and column sums of each weight matrix and drops momentum, greatly reducing optimizer memory. Update clipping and a step size proportional to the weight scale keep training stable, and it matched Adam on a Transformer for machine translation.
AdaGradAdaGrad is an optimizer that keeps, for each parameter, the running sum of squared gradients and divides by its square root to set the step size. It can move features that rarely receive gradients by large amounts, which makes it strong on sparse data, but because its step size keeps shrinking, it tends to stall in long training runs.
AdamAdam is an optimizer that estimates the mean of the gradient and the mean of the squared gradient with exponential moving averages and automatically adjusts the update size for each parameter. Because training progresses on many tasks even with the default settings, it is one of the most widely used optimizers in deep learning.
AdamWAdamW is an optimizer that decouples weight decay from the Adam update and pulls every weight toward 0 by the same fraction. It generalizes better than Adam with L2 regularization and lets the learning rate and the weight decay strength be tuned separately, which has made it standard for training large models.
AdanAdan (Adaptive Nesterov Momentum) is an optimizer that replaces the look-ahead of Nesterov acceleration with "the difference between the current and previous gradients" and incorporates it into an Adam-style method. It speeds up convergence without extra gradient computation and achieves higher accuracy than AdamW and LAMB on ViT and large-batch training.
AMSGradAMSGrad is an optimizer that replaces the average of squared gradients that Adam divides by with its running maximum, so that per-parameter step sizes never grow back. It was proposed in a paper that showed examples where Adam fails to converge to the optimum even on simple convex problems, and it guarantees convergence on convex problems.
LAMBLAMB is an optimizer that normalizes the Adam update to unit size per layer and then scales it by the size of that layer's weights. Training stays stable even with very large batches, and it scaled BERT pre-training up to a batch size of 32K without losing accuracy, cutting training time from 3 days to 76 minutes.
LARSLARS is an optimizer that sets a learning rate for each layer from the ratio of the weight norm to the gradient norm, matching the update size to the size of the weights. Training stays stable with large learning rates at large batch sizes, and ResNet-50 was trained at a batch size of 32K with almost no loss in accuracy.
LionLion (EvoLved Sign Momentum) is an optimizer that uses only the sign of a mix of momentum and gradient, moving every parameter by the same magnitude. It was discovered through program search, uses less memory than AdamW, and achieves equal or better accuracy on models such as ViT.
LookaheadLookahead is a method that keeps a separate set of "slow weights" and moves them a little toward the "fast weights" advanced k steps by an optimizer such as SGD or Adam. It works simply by wrapping the original optimizer, reduces the variance of training, and makes the choice of hyperparameters more robust.
MomentumMomentum is an optimizer that keeps a fixed fraction of the previous update direction and adds the current gradient to move the parameters. Like a heavy ball rolling down a slope, it cancels the zigzag in long, narrow valleys and moves quickly along the valley floor, so it converges in fewer iterations than gradient descent.
MuonMuon (MomentUm Orthogonalized by Newton-Schulz) is an optimizer for the weight matrices of hidden layers: it takes the update produced by SGD momentum, replaces it with the nearest orthogonal matrix via Newton-Schulz iteration, and then applies it. In language model training, it has been reported to reach the same loss as AdamW with less compute.
NadamNadam is an optimizer that replaces Adam's momentum with the form of Nesterov's accelerated gradient, using the momentum of the next step in the current step ahead of time. With almost the same computation and memory as Adam, it improves the update direction and, depending on the task, converges faster and to better results than Adam.
Nesterov's Accelerated GradientNesterov's accelerated gradient is an optimizer that measures the gradient at the point reached by moving ahead with the momentum and corrects the velocity from there. Because it notices overshooting immediately and turns back, it oscillates less than momentum and trains stably even with a large momentum coefficient.
RAdamRAdam (Rectified Adam) is an optimizer that fixes the problem of Adam's adaptive learning rate having too much variation (variance) early in training, using a term that estimates and rectifies the variance. Without tuning the warmup length, it performs on par with Adam with warmup and is also robust to the choice of learning rate.
RMSpropRMSprop is an optimizer that keeps a moving average of squared gradients for each parameter and sets the step size by dividing the gradient by its square root. Because the step size rises and falls with the magnitude of recent gradients, it does not keep shrinking as in AdaGrad, and it stays stable when training with mini-batches.
Schedule-FreeSchedule-Free is an optimization method that, instead of a schedule that decreases the learning rate, uses weight averaging together with a trick of computing gradients at a point between the average and the base weights. Without fixing the number of training steps in advance, it matches or exceeds schedules such as cosine.
SGD (Stochastic Gradient Descent)SGD (stochastic gradient descent) is the most basic optimizer: it computes the gradient of the loss on a randomly chosen mini-batch and moves the parameters a little in the opposite direction. Each computation is cheap, it scales well with more data, and it is still widely used with additions such as momentum.
ShampooShampoo is an optimizer that keeps a small preconditioner matrix for each dimension of a weight matrix (or tensor) and conditions the gradient by multiplying it from the left and right. It provides preconditioning close to full-matrix AdaGrad with far less memory and computation, and can reduce the loss faster than SGD or Adam.
Sharpness-Aware Minimization (SAM)SAM (Sharpness-Aware Minimization) computes the gradient at a point where the weights have been shifted slightly in the direction that increases the loss the most, and uses that gradient to update the original weights. By seeking flat minima where the loss stays low in the surrounding neighborhood, it improves generalization.
SophiaSophia is a second-order optimizer that divides a moving average of gradients by a moving average of a diagonal Hessian (curvature) estimate computed only once every few steps, and clips the result elementwise before updating. In pretraining GPT-2-scale language models, it reached the same loss as Adam in about half the number of steps.
