Optimizer

An optimizer is the part of a training setup that uses the gradients of the loss to update a model's parameters at each step; SGD, Adam and AdamW are standard choices.

Training a model means adjusting its parameters again and again to lower the loss. Backpropagation works out which way each parameter should move; the optimiser decides how far to move it and makes the change. Google's machine learning glossary defines an optimiser as a specific implementation of the gradient descent algorithm. In PyTorch, an optimiser is an object that holds its own running state and updates the parameters from the computed gradients.

The loop looks the same whatever optimiser is used. PyTorch's documentation shows it: clear the previous gradients, run the model on a batch, compute the loss, compute the gradients, then call the optimiser's step to apply the update. The size of each update is governed by the learning rate, a key setting for every optimiser.

Optimisers differ in how they turn gradients into updates. Plain stochastic gradient descent, or SGD, moves each parameter in proportion to its gradient, optionally with momentum to smooth the path. Adam, introduced in December 2014 by Diederik Kingma and Jimmy Ba, adapts the step size for each parameter using running estimates of its recent gradients. In November 2017 Ilya Loshchilov and Frank Hutter showed that the usual way of adding weight decay, a regularisation technique, behaved differently in Adam than in SGD, and proposed decoupling the two. The result, AdamW, improved Adam's generalisation and was adopted in TensorFlow and PyTorch.

The range of options keeps growing. In late 2026 PyTorch's built-in optimisers included Adadelta, Adafactor, Adagrad, Adam, AdamW, Adamax, ASGD, L-BFGS, Muon, NAdam, RAdam, RMSprop, Rprop and SGD, among others.

The choice of optimiser rarely makes headlines, but it affects how fast and how stably a model trains, and so what a training run costs. When a lab credits a new optimiser for efficiency gains, the claim is worth reading alongside the settings it was compared against, since a poorly tuned baseline makes any newcomer look good.

Common questions

What does an optimizer do in machine learning?

It updates a model's parameters during training. After each batch, backpropagation calculates the gradient of the loss for every parameter, and the optimiser uses those gradients, the learning rate and its own running statistics to decide how much to change each parameter.

What is the difference between Adam and SGD?

SGD applies the same learning rate to every parameter, moving each in proportion to its gradient. Adam keeps running estimates of each parameter's gradients and adapts the step size individually, which often makes training faster and less sensitive to the learning rate. SGD with momentum remains competitive for some tasks.

What is the difference between Adam and AdamW?

They differ in how weight decay is applied. A 2017 paper showed that the usual implementation in Adam mixed weight decay into the adaptive update, which weakened it. AdamW applies weight decay separately from the gradient step, which the authors found improved generalisation.

Is an optimizer the same as an optimization algorithm?

Closely related. Optimisation algorithm is the general mathematical term. Optimiser usually refers to the software component in a framework such as PyTorch or TensorFlow that implements one of those algorithms to update model weights.

Finding more

Search for "Adam vs SGD", "AdamW weight decay" or "PyTorch optimizers" to understand the common choices. The most reliable sources are framework documentation from PyTorch and TensorFlow, the original papers on arXiv and Google's Machine Learning Glossary. Treat blog benchmarks of optimisers with care, since results depend heavily on learning rates and other settings.

Working out what this means for your business?

Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.