# SGD

- **Canonical URL:** https://getaimath.com/dictionary/sgd/
- **Topics:** [Model Training & Optimization](https://getaimath.com/dictionary/category/model-training-and-optimization/)
- **Last updated:** 2026-11-25

## What is SGD?

**In one sentence:** SGD, or Stochastic Gradient Descent, updates a model's weights using gradients from small random batches instead of the whole dataset.

"Stochastic" means random. Rather than calculating the error over every example before each step, SGD takes a quick step after each small batch. The steps are a bit noisy, but there are many more of them, so learning is much faster overall.

![How an AI Goes to School: 3 Steps from Bookworm to Assistant — Simple 3-step cartoon showing an AI 1. Reading the whole library (Pre-training) to become a Bookworm, 2. Practicing polite Q&A with a teacher (Fine-tuning), and 3. Getting thumbs-up and thumbs-down feedback from humans (RLHF).](https://getaimath.com/diagrams/model-training-and-optimization.png)
*Napkin Diagram (Model Training & Optimization): First the model reads the internet to learn facts; next it practices answering questions; finally humans coach its manners.*

## What is an example of SGD?

Training an image classifier by updating after each batch of 64 random photos uses SGD.

## Why does SGD matter?

SGD is the classic training method that many other optimizers are built on.

## Related Concepts

- [AdamW](https://getaimath.com/dictionary/adamw/): AdamW is a version of Adam that handles weight decay in a cleaner way, which usually leads to better models.
- [Momentum](https://getaimath.com/dictionary/momentum/): Momentum is an optimizer trick that keeps a model moving in the direction it has been going, smoothing out jumpy updates.
- [Adam](https://getaimath.com/dictionary/adam/): Adam is a popular optimizer that adjusts the step size for each weight automatically, using its past gradients.
- [Learning Rate Scheduler](https://getaimath.com/dictionary/learning-rate-scheduler/): A learning rate scheduler changes the learning rate during training, usually starting larger and getting smaller over time.
- [Optimizer](https://getaimath.com/dictionary/optimizer/): An optimizer is the algorithm that decides exactly how to update a model's weights using the gradients.
- [Warmup](https://getaimath.com/dictionary/warmup/): Warmup is a short period at the start of training where the learning rate slowly rises from very small to its normal value.

---
Source: The AI Math Dictionary (https://getaimath.com/dictionary/sgd/)
