Cosine Learning Rate Schedule › Cosine Schedule Parameters
Language AI HandbookAll chapters Cosine Learning Rate Schedule › Cosine Schedule ParametersOne section · Sections in this chapter7 / 14 ↓
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
A cosine schedule has four tunable parameters. Understanding what each controls helps you set them deliberately rather than by guessing.
Maximum Learning Rate
The maximum learning rate determines the initial optimization speed. In a warmup-plus-cosine schedule (by far the most common configuration in large model training), is the peak the warmup ramps toward. Setting this value follows the same guidelines as setting a fixed learning rate: too large and gradients explode, too small and training stalls. Linear scaling with batch size (multiply by a factor of when increasing batch size from to ) is a common heuristic, though the right value for a given model ultimately requires some experimentation.
For AdamW-based LLM training, values in the range have been widely used at scales from a few hundred million parameters up to the tens of billions. Smaller learning rates around are typical for fine-tuning, where the model is already near a good solution and large steps risk destroying the pretrained representations.
Minimum Learning Rate
The minimum learning rate is the floor the cosine curve decays toward. In many implementations this is simply 0, meaning the learning rate completely vanishes at the end of training. However, setting to a small positive value like or can improve final performance by allowing the optimizer to keep making small corrections through the last steps. In LLaMA, for example, is set to , meaning the final learning rate is 10% of the peak.
The choice of has a subtle but real effect on the final model quality. Setting it to exactly zero creates a situation where the optimizer effectively stops learning in the final steps, which can be desirable if you want the model to fully converge to a minimum. Setting it to a non-zero value keeps a residual update signal alive, which helps when the training data has been partially exhausted and the model is in danger of overfitting. Many practitioners use as a safe default that avoids both extremes.
Total Steps and Decay Horizon
The parameter represents the total number of steps over which the cosine decay runs. In a single-cycle schedule this equals the full training duration. In a warmup-plus-cosine schedule, typically spans from the end of warmup to the end of training, though it can extend slightly beyond the actual training duration as a practical trick. If is set smaller than the actual training length, the learning rate will linger at for the remaining steps, which is effectively the same as turning off the optimizer. Setting slightly larger than training means the schedule has not fully decayed at the end, keeping the learning rate from reaching zero.
One subtle design choice is whether to count warmup steps as part of . In some frameworks, refers to the total training steps including warmup, and the cosine decay starts from zero alongside the warmup. In others, warmup is treated as a separate phase and cosine decay begins after warmup ends, with counting only the post-warmup steps. The difference matters: if you set but warmup takes 1000 steps, you want to be explicit about whether the cosine curve should span 10000 or 9000 steps. Many practitioners prefer setting equal to the total training budget and letting the warmup logic handle the first phase separately, which is the pattern we follow in our implementation below.
Cycle Length for Warm Restarts
When using warm restarts, (the first cycle length) and together determine the restart pattern. Short cycles with create frequent restarts that help exploration but may prevent the model from converging deeply into any minimum. Long initial cycles with start with a substantial refinement phase and progressively lengthen subsequent cycles, which often performs better for large models. A common starting point for language model training is to skip restarts entirely and use a single long cosine cycle, reserving restarts for computer vision tasks where snapshot ensembling benefits are more established.
When you do use restarts, the cycle length should be at least long enough for the model to make meaningful progress within each cycle. For typical LLM fine-tuning runs of 5,000-20,000 steps, values between 500 and 2000 are common. For pretraining runs of hundreds of thousands of steps, values of 10,000-50,000 steps are more appropriate.