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:

θ = θ - α∇J(θ)

Where θ represents model parameters and ∇J(θ) is the gradient of the loss function.

Impact on Training

Learning Rate Schedules

Fixed Learning Rate

Constant learning rate throughout training:

learning_rate = 0.001 # Fixed value

Simple but often suboptimal for complex problems.

Step Decay

Reduce learning rate at specific epochs:

if epoch % 30 == 0: learning_rate *= 0.1

Exponential Decay

Continuous exponential reduction:

learning_rate = initial_lr * exp(-decay_rate * epoch)

Cosine Annealing

Cosine-shaped learning rate schedule:

learning_rate = min_lr + (max_lr - min_lr) * (1 + cos(π * epoch / max_epochs)) / 2

Adaptive Learning Rates

AdaGrad

Adapts learning rate based on historical gradients:

RMSprop

Exponentially weighted moving average of squared gradients:

Adam

Combines momentum and RMSprop:

Learning Rate Tuning Strategies

Grid Search

Test predefined learning rate values:

learning_rates = [0.1, 0.01, 0.001, 0.0001]

Log Scale Search

Search on logarithmic scale:

learning_rates = [10**x for x in range(-4, 0)] # 0.0001 to 1.0

Cyclical Learning Rates

Vary learning rate cyclically during training:

Best Practices

Starting Values

Monitoring

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

Learning Rate Too Low

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.