What is weight decay?

Weight decay is a regularisation technique that pulls model weights slightly towards zero at each update during neural network training, penalising large weight values in order to reduce overfitting.

Regularisation names all methods reducing overfitting; weight decay is one of them. With plain gradient descent it matches adding a penalty proportional to squared weights to the loss, but with adaptive optimisers such as Adam that equivalence breaks, so Adam with decoupled weight decay applies decay separately from the gradient update.

Topic
Machine learning, models and training
Also known as
L2 penalty

How weight decay works

  1. A weight decay coefficient is chosen before training.
  2. At each update, weights shrink by a small amount tied to this coefficient alongside the gradient step.
  3. With adaptive optimisers, decay is applied directly to weights, independent of gradient scaling.
  4. The coefficient is tuned against validation performance; too high a value can stop the model learning.

In more detail

Its current role in large models

Weight decay is used in LLM pre-training even in single-epoch runs without repeated data; there its role is less about curbing memorisation and more about keeping weight norms bounded to shape training dynamics and helping prevent sudden loss spikes in mixed-precision training such as BF16. In LoRA fine-tuning it applies only to the trainable low-rank adapter weights.

Commonly confused terms

TermHow it differs
DropoutDropout randomly zeroes out neuron activations during training to prevent co-adaptation, whereas weight decay shrinks weight magnitudes continuously on every update step.
Gradient clippingGradient clipping caps the norm or value of gradients to stabilise exploding steps without permanently pulling weights toward zero, whereas weight decay directly shrinks parameter values at every step.

Why weight decay matters for on-premises AI

Datasets organisations use for fine-tuning are often small, so a model can easily memorise them. Weight decay is one of the basic settings that, together with learning rate and early stopping, reduces this risk. The optimiser matters: the same coefficient can act differently across optimisers. The coefficient and optimiser details are logged in the experiment record so training can be reproduced.

ON-PREMISES EXAMPLE

Fine-tuning its internal knowledge assistant on a limited set of question and answer pairs, a healthcare provider tries several weight decay coefficients, logging the best value on the validation set with its optimiser settings.

Common questions

Are weight decay and L2 regularisation the same?

With plain gradient descent they give the same result. They diverge with adaptive optimisers such as Adam, which is why AdamW applies decay separately.

How is the weight decay coefficient chosen?

Several values are tried and one is chosen by validation performance. Too high weakens learning; too low has no effect.

Sources

In the glossary: Glossary, R to Z

What does this term mean for your infrastructure?

We can work out together in a technical assessment how it maps onto your data, hardware and security requirements.

Request a technical assessment →

This site sets no cookies. Visitor numbers are counted in aggregate using a cookieless method that does not identify anyone. See the Privacy Policy for details.