Weight Decay › Choosing the Weight Decay Coefficient
Language AI HandbookAll chapters Weight Decay › Choosing the Weight Decay CoefficientOne section · Sections in this chapter6 / 11 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Selecting is a hyperparameter tuning problem, but there are well-established conventions and principles that narrow the search space considerably.
Typical Value Ranges
The weight decay coefficient is typically set in the range to , with being a common default for many transformer training runs.
The BERT paper used weight decay of . GPT-3 used . Many recent models use values in the to range. The right value depends on the dataset size, model size, and how much regularization is needed:
- Small datasets, large models: Higher weight decay (closer to ) because the model has more capacity to overfit.
- Large datasets, appropriately sized models: Lower weight decay (closer to ) because the data itself provides strong regularization.
- Very large pretraining runs: Weight decay is often moderate ( to ) since the sheer volume of data already prevents significant overfitting, but the penalty helps maintain parameter regularity.
Setting (no weight decay) is a valid and sometimes correct choice. If you are fine-tuning a large pretrained model on a small downstream task, the pretrained weights already encode a strong prior about what good representations look like. Aggressive weight decay can hurt by pulling carefully learned features back toward zero. In such fine-tuning scenarios, a modest around or no weight decay at all is often appropriate. Treat zero weight decay as a baseline to test against, not an oversight.
The Interaction with Learning Rate
When using AdamW, the effective weight decay per step is , where is the learning rate. This means weight decay and learning rate are coupled in their effect: if you increase the learning rate by , the weight decay effect per step also increases by .
This coupling is why some researchers prefer to think about normalized weight decay defined as or to schedule weight decay alongside the learning rate. If your learning rate follows a cosine decay schedule, and weight decay is held constant, the effective regularization per step decreases as the learning rate decreases. Some training setups adjust weight decay to compensate for this, though it is not universally done.
A useful way to think about this: during the warmup and peak learning rate phase of training, your model experiences the strongest regularization per step. As the learning rate decays, regularization weakens. This provides a reasonable inductive bias: early in training, strong regularization prevents the model from memorizing noise in the early data it sees. Later in training, as the model converges, lighter regularization allows it to fine-tune toward the optimal weights without constant shrinkage pressure fighting against it.
In practice, the simplest approach is to tune jointly with the learning rate during a hyperparameter search, or to use values from published configurations as starting points and adjust from there.
Weight Decay in Fine-Tuning
Fine-tuning deserves special attention because the regularization goals are different from pretraining. When you pretrain a language model from scratch, you want weight decay to prevent memorization and encourage general representations. When you fine-tune a pretrained model on a specific task, you want to preserve the pretrained representations while adapting them to the new task.
This creates a tension. Aggressive weight decay during fine-tuning pulls the weights back toward zero, not toward the pretrained values. The pretrained weights are not at zero; they encode rich, learned features at various magnitudes. Decay toward zero can erase valuable pretrained representations faster than the fine-tuning gradient can reinstate them.
There are two approaches to handling this. The first is to use a very small or zero weight decay during fine-tuning. The second, more principled approach is L2-SP (L2 starting point regularization), which penalizes deviation from the pretrained weights rather than from zero:
This preserves the pretrained representations while still preventing large unconstrained updates. We covered catastrophic forgetting in the finetuning fundamentals chapters; L2-SP is one technique that directly addresses it. Standard weight decay does not distinguish between "moving away from zero" and "moving away from the pretrained values," which is why it can hurt fine-tuning when applied naively.
In practice, most practitioners fine-tune with a very small weight decay (around to ) rather than zero or full L2-SP, accepting a small regularization bias toward zero as a tradeoff for implementation simplicity. The choice matters more for small downstream datasets (a few hundred to a few thousand examples) where the fine-tuning gradient is weak. For larger downstream datasets (tens of thousands of examples or more), the fine-tuning gradient is strong enough to override the small decay pressure, and the distinction between standard weight decay and L2-SP becomes less important.