# Optimizers and Learning Rate Schedules

> SGD with momentum, Adam and AdamW, warmup and decay schedules, and how to find a learning rate that works. Free notes, key concepts, resources and a mini...

Canonical: https://www.internhack.in/roadmaps/tracks/machine-learning/deep-learning-optimizers
Last updated: 2026-11-28

SGD with momentum, Adam and AdamW, warmup and decay schedules, and how to find a learning rate that works.

Intermediate · about 4 hours · difficulty 3/5

Learn first: [Activation and Loss Functions](https://www.internhack.in/roadmaps/tracks/machine-learning/activations-and-losses), [Optimization and Gradient Descent](https://www.internhack.in/roadmaps/tracks/machine-learning/optimization)

The optimizer and learning rate decide whether a network trains fast, slowly or not at all. Most practitioners use a small set of well-understood defaults.

### Optimizers

- **SGD with momentum**: accumulates a velocity to smooth noisy gradients; still strong for vision with good schedules.
- **RMSProp**: per-parameter step sizes from recent gradient magnitudes.
- **Adam**: momentum plus adaptive scaling; robust default.
- **AdamW**: Adam with decoupled weight decay; the standard for transformers.

### Learning rate

- The single most important hyperparameter. Typical Adam starting points are around 1e-3 for small nets and 1e-4 or lower for fine-tuning large pretrained models.
- **LR range test**: increase the rate exponentially over a short run and pick a value just before the loss blows up.
- **Schedules**: step decay, cosine annealing, one-cycle, and **linear warmup** for large models.

### Batch size

Larger batches give smoother gradients and better hardware utilization but may need a higher learning rate and can generalize slightly worse. Use gradient accumulation to simulate large batches on small GPUs.

**Good enough to move on** when you can run an LR range test, pick an optimizer and schedule, and justify the choice from loss curves.

## Key concepts

- **SGD with momentum**
- **Adam and AdamW**
- **Learning rate range test**
- **Cosine, step and one-cycle schedules**
- **Warmup**
- **Batch size and gradient accumulation**

## Mini project

Train a small CNN on CIFAR-10 with SGD+momentum, Adam and AdamW, each with and without a cosine schedule, and compare validation accuracy after a fixed epoch budget.

## Check yourself

What is the practical difference between L2 regularization in Adam and decoupled weight decay in AdamW?

## Free resources

- [Dive into Deep Learning: Optimization Algorithms](https://d2l.ai/chapter_optimization/index.html) (d2l.ai)
- [PyTorch torch.optim](https://pytorch.org/docs/stable/optim.html) (PyTorch)

Previous: [Activation and Loss Functions](https://www.internhack.in/roadmaps/tracks/machine-learning/activations-and-losses) · Next: [Regularization, Initialization and Normalization](https://www.internhack.in/roadmaps/tracks/machine-learning/regularization-and-normalization)

## More in Neural Network Fundamentals

- [Perceptrons and Multilayer Networks](https://www.internhack.in/roadmaps/tracks/machine-learning/neural-networks-basics)
- [Backpropagation and Autograd](https://www.internhack.in/roadmaps/tracks/machine-learning/backpropagation)
- [Activation and Loss Functions](https://www.internhack.in/roadmaps/tracks/machine-learning/activations-and-losses)
- [Optimizers and Learning Rate Schedules](https://www.internhack.in/roadmaps/tracks/machine-learning/deep-learning-optimizers)
- [Regularization, Initialization and Normalization](https://www.internhack.in/roadmaps/tracks/machine-learning/regularization-and-normalization)
- [Debugging and Running Training Experiments](https://www.internhack.in/roadmaps/tracks/machine-learning/training-debugging)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Machine Learning Engineer Roadmap](https://www.internhack.in/roadmaps/tracks/machine-learning)
