Comparison

Batch vs Stochastic vs Mini-Batch Gradient Descent

Batch gradient descent uses the entire dataset of size NN as a single batch. It produces low-noise gradient estimates and takes large, reliable steps toward the minimum, but requires considerable time per iteration and significant memory. Stochastic gradient descent (SGD) uses a batch size of 1. It is memory-efficient, but extremely noisy because individual examples may point in poor directions, causing SGD to oscillate rather than converge directly. Minibatch gradient descent uses a batch size between 1 and NN. It offers a practical compromise by balancing convergence speed and computational efficiency. Although SGD converges faster than batch gradient descent in terms of examples processed, computing the gradient example-by-example is computationally inefficient. Minibatch gradient descent leverages hardware optimization (such as vectorization), allowing intermediate batch sizes (e.g., 100) to often outperform both extremes in overall wall-clock runtime.

Image 0

0

2

Updated 2026-06-27

Tags

Data Science

D2L

Dive into Deep Learning @ D2L

Machine Learning Yearning @ DeepLearning.AI

Deep Learning

Machine Learning

Supervised Learning