Learning Rate Hyperparameters: Complete Guide
Learn about learning rate hyperparameters in machine learning. Understanding learning rate schedules, optimization, and best practices.
Introduction
Learning rate is one of the most critical hyperparameters in machine learning. It controls the step size during optimization and significantly impacts model convergence, training speed, and final performance. Understanding how to tune learning rate parameters is essential for successful model training.
What is Learning Rate?
Definition
Learning rate (α) determines how much the model parameters are updated during each training iteration. It's a scalar value that scales the gradient before applying it to the parameters:
Where θ represents model parameters and ∇J(θ) is the gradient of the loss function.
Impact on Training
- Too High: Overshooting, instability, divergence
- Too Low: Slow convergence, getting stuck in local minima
- Just Right: Stable, fast convergence to good solution
Learning Rate Schedules
Fixed Learning Rate
Constant learning rate throughout training:
Simple but often suboptimal for complex problems.
Step Decay
Reduce learning rate at specific epochs:
Exponential Decay
Continuous exponential reduction:
Cosine Annealing
Cosine-shaped learning rate schedule:
Adaptive Learning Rates
AdaGrad
Adapts learning rate based on historical gradients:
- Larger updates for infrequent parameters
- Smaller updates for frequent parameters
- Can lead to premature convergence
RMSprop
Exponentially weighted moving average of squared gradients:
- Addresses AdaGrad's diminishing learning rates
- Good for non-stationary objectives
- Popular for recurrent neural networks
Adam
Combines momentum and RMSprop:
- Adaptive learning rates for each parameter
- Bias correction for first and second moments
- Generally robust default choice
Learning Rate Tuning Strategies
Grid Search
Test predefined learning rate values:
Log Scale Search
Search on logarithmic scale:
Cyclical Learning Rates
Vary learning rate cyclically during training:
- Helps escape local minima
- Can find better solutions
- Requires careful tuning of cycle length
Best Practices
Starting Values
- Deep learning: 0.001 to 0.01
- Traditional ML: 0.01 to 0.1
- Start with literature values
- Adjust based on problem complexity
Monitoring
- Watch loss curves
- Monitor gradient norms
- Check for exploding/vanishing gradients
- Validate on held-out data
Key Insight
Learning rate is often the most important hyperparameter to tune. Start with adaptive optimizers like Adam, then fine-tune the learning rate. Consider learning rate schedules for better convergence.
Common Issues
Learning Rate Too High
- Loss oscillates or increases
- Gradients explode
- Model doesn't converge
- Solution: Reduce learning rate
Learning Rate Too Low
- Very slow convergence
- Gets stuck in poor local minima
- Training takes too long
- Solution: Increase learning rate
Frequently Asked Questions
What is learning rate in machine learning?
Learning rate controls how much model parameters are updated during training. It's a scalar that scales the gradient before applying it to parameters: θ = θ - α∇J(θ).
How do I choose the right learning rate?
Start with literature values (0.001-0.01 for deep learning), monitor loss curves, use learning rate finder, or try adaptive optimizers like Adam that handle learning rate automatically.
What happens if learning rate is too high?
High learning rates cause loss to oscillate or increase, gradients to explode, and model to fail to converge. Reduce learning rate to fix these issues.
What happens if learning rate is too low?
Low learning rates cause very slow convergence, getting stuck in poor local minima, and excessively long training times. Increase learning rate to improve convergence.
Should I use fixed or adaptive learning rates?
Adaptive optimizers (Adam, RMSprop) often work better than fixed learning rates. They automatically adjust learning rates per parameter and are more robust to poor initial choices.