What is gradient descent?
Gradient descent is an optimisation method that reduces a model's loss function by repeatedly updating its parameters in small steps opposite to the gradient of the loss.
It differs from backpropagation in which half of the job it does: backpropagation computes each parameter's gradient, while gradient descent uses those gradients to update the parameters. Its classic full-batch form uses all training data per step; stochastic gradient descent is the variant using small batches.
- Topic
- Machine learning, models and training
- Also known as
- Steepest descent, batch gradient descent
- Origin
- 1847, Cauchy, the method of steepest descent
How gradient descent works
- The model predicts with current parameters and the loss function measures how far the prediction is from the target.
- The partial derivative of the loss with respect to each parameter, its gradient, is computed; it points where loss rises fastest.
- Each parameter is reduced by the gradient times the learning rate; with a learning rate of 0.01 and a gradient of 2 the parameter falls by 0.01 × 2 = 0.02.
- The loop repeats until loss is small enough or a set number of steps is reached.
In more detail
Momentum, AdamW and learning rate schedules
Modern gradient-based optimisation rarely uses a constant learning rate. Training typically pairs an optimiser like AdamW (which combines momentum, adaptive per-parameter scaling and decoupled weight decay) with a learning rate schedule, such as linear warmup followed by cosine decay, to stabilise early updates and settle cleanly near a minimum.
Differentiability and feature scaling
Gradient descent requires the loss function to be differentiable (or sub-differentiable) with respect to parameters and is sensitive to feature scaling: unnormalised inputs create elongated, ill-conditioned loss valleys that cause zig-zagging and slow convergence unless input normalisation or adaptive optimisers are applied.
Commonly confused terms
| Term | How it differs |
|---|---|
| Gradient ascent | Gradient descent minimises a loss or cost function by moving opposite to the gradient, whereas gradient ascent maximises an objective (such as log-likelihood or policy reward in reinforcement learning) by moving along the gradient. |
Why gradient descent matters for on-premises AI
Any in-house fine-tuning or training from scratch runs on some form of gradient descent; learning rate and step count shape both training time and quality. Too large a learning rate makes loss oscillate or explode, while too small a rate drags training out and wastes GPU time. In practice small-batch variants and adaptive optimisers such as Adam replace the plain form.
A manufacturer trains a fault prediction model on line sensor data on in-house servers, watching the loss curve and lowering the learning rate when it starts to oscillate.
Common questions
How does gradient descent differ from stochastic gradient descent?
Gradient descent computes the gradient from all training data at each step. Stochastic gradient descent uses one example or a small batch, which is noisier but much faster.
Does gradient descent always find the best solution?
No. Neural network loss surfaces are non-convex, so it can stall at saddle points, flat regions or local minima. In practice a good solution is usually enough.
Related terms
- Stochastic gradient descent
- Learning rate
- Loss function
- Optimiser
- Backpropagation
- Adam optimiser
- Model training
Sources
- Ruder, An overview of gradient descent optimization algorithms, 2016
- Goodfellow, Bengio and Courville, Deep Learning, 2016
In the glossary: Glossary, E to L