Prompts Forms Resume Reports ★ Saved ★ Saved★ + Submit a tool
Core concepts

Gradient Descent

About 1470 characters Updated Nov 30, 2026 36 views AI wiki

Gradient descent is the core algorithm for training every neural network. Simply put, it teaches the model "in which direction to adjust parameters so that the error becomes smaller".

An intuitive analogy

Imagine standing blindfolded on a hillside, wanting to reach the valley floor. You feel which side under your feet is steeper, take a step that way, feel again, and step again. Repeating this, you eventually reach the bottom.

Here the "hillside" is the loss function, the "steepness" is the gradient, and the "step size" is the learning rate.

Mathematical essence

The gradient is the partial derivative of the loss function with respect to each parameter, pointing in the direction in which the function value rises fastest. So you walk in the opposite direction, and the parameter update formula is:

new parameter = old parameter - learning rate x gradient

Three variants

  • Batch gradient descent (BGD): compute the gradient with all data, accurate direction but slow
  • Stochastic gradient descent (SGD): use only one sample each time, fast but highly oscillatory
  • Mini-batch gradient descent: a compromise using a small batch (such as 32 or 64 samples) each time, the standard practice in real training

Evolution of optimizers

Plain gradient descent oscillates and converges slowly, so improved versions appeared:

  • Momentum: adds inertia, like a ball rolling downhill
  • AdaGrad / RMSprop: adaptive learning rates for different parameters
  • Adam: combines both, the most widely used
  • AdamW: fixes weight decay, the standard for large-model training

The importance of the learning rate

Too large and it overshoots and oscillates; too small and convergence is extremely slow. So training commonly uses "learning rate warmup plus cosine annealing".