Learning Rate Schedules
Visualize how learning rate decay schedules impact optimization convergence and stability.
Learning Rate Schedules
Concept Overview
In training neural networks and other machine learning models, the learning rate controls how much to change the model in response to the estimated error each time the model weights are updated. Using a fixed learning rate often poses a dilemma: a large rate helps the model learn quickly but may cause it to overshoot the optimal solution and diverge, while a small rate ensures stable convergence but takes an impractically long time to train and risks getting stuck in local minima.
Learning rate schedules address this by systematically adjusting the learning rate over time (typically by decaying it as training progresses). This allows the model to take large steps initially for rapid exploration, and smaller steps later for fine-grained exploitation near the global minimum.
Mathematical Definition
A learning rate schedule defines the learning rate α at a given epoch t. Several common schedules exist:
1. Constant
Keeps the learning rate fixed throughout training. Simple but requires careful manual selection.
2. Step Decay
Reduces the learning rate by a factor γ every k epochs.
3. Exponential Decay
Continuously reduces the learning rate by an exponential factor.
4. Cosine Annealing
Gradually decays the learning rate following a cosine curve over T total epochs, often to a minimum value near zero.
Key Concepts
Exploration vs. Exploitation
High initial learning rates encourage the optimizer to explore the loss landscape, potentially escaping poor local minima or saddle points. As the learning rate decays, the optimizer transitions to exploitation, taking smaller steps to settle precisely into the bottom of a deep loss basin.
Warmup
Modern schedules often include a "warmup" phase where the learning rate starts near zero and linearly increases to a peak value (α0) over the first few epochs. This prevents early divergence when the network weights are initialized randomly and gradients might be massive.
Restarts (Cyclical Learning Rates)
Variations like Cosine Annealing with Warm Restarts (SGDR) periodically reset the learning rate to its maximum value. This abrupt increase helps the model jump out of a local minimum and find a potentially better, wider minimum, often improving generalization.
Historical Context
The necessity of decaying learning rates dates back to the early theoretical work on stochastic approximation by Robbins and Monro in 1951, who established that a decreasing sequence of step sizes is required for stochastic gradient methods to converge almost surely.
In the deep learning era, heuristic schedules like step decay became standard practice (e.g., AlexNet in 2012 reduced the learning rate by 10x when validation error stopped improving). Later, Loshchilov and Hutter introduced SGDR (Cosine Annealing with Warm Restarts) in 2016, which quickly became a popular standard, especially in computer vision, due to its ability to train models faster and reach better minima without manual step-tuning.
Real-world Applications
- Training Large Language Models (LLMs): Foundation models like GPT use complex schedules, typically consisting of a linear warmup followed by cosine decay, which is crucial for stability during massive-scale distributed training.
- Computer Vision: Training ResNets and Vision Transformers heavily relies on cosine annealing or step decay to achieve state-of-the-art accuracy on ImageNet.
- Hyperparameter Optimization: Schedulers are often combined with early stopping in automated ML systems to kill unpromising training runs early, saving compute resources.
Related Concepts
- Gradient Descent — The fundamental optimization algorithm that utilizes learning rates.
- Optimization Landscape — Understanding the loss surface helps explain why dynamic learning rates are necessary to navigate saddle points and ravines.
- Backpropagation — Provides the gradient information that the optimizer scales by the learning rate to update weights.
Experience it interactively
Adjust parameters, observe in real time, and build deep intuition with Riano’s interactive Learning Rate Schedules module.
Try Learning Rate Schedules on Riano →