Why is mini-batch gradient descent the standard choice over pure SGD on modern hardware?

Quick Overview

Asks why deep learning training uses mini-batch gradient descent instead of single-example SGD on GPUs and TPUs. Tests understanding of hardware parallelism, gradient variance and batch size, learning-rate scaling, and the limits of very large batches.

Why is mini-batch gradient descent the standard choice over pure SGD on modern hardware?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

Why is mini-batch gradient descent the standard choice over pure SGD on modern hardware? Here pure SGD means updating the parameters after every single example (batch size 1), and mini-batch means averaging the gradient over a batch of B examples before each update. ```hint Two separate effects Think separately about how a GPU or TPU executes one example versus 64 at once, and about what averaging B gradients does to the variance of the update. ``` ### What a Strong Answer Covers - Why batching uses accelerator hardware well: parallel cores, matrix-matrix products, and fixed per-step overhead. - The statistical effect of averaging over a batch on gradient variance and on the usable learning rate. - Why mini-batch sits between pure SGD and full-batch on cost per step, number of updates, and memory. - How it fits batch normalization and data-parallel training. - The limits of making the batch ever larger. ### Follow-up Questions - If you multiply the batch size by 8, how would you change the learning rate, and why might you need a warmup? - How would you train with an effective batch of 2,048 on a GPU that only fits 256 examples at once? - Why can very large batches generalize worse, and what helps? - When does a batch size of 1 still make sense?

Overview: Asks why deep learning training uses mini-batch gradient descent instead of single-example SGD on GPUs and TPUs. Tests understanding of hardware parallelism, gradient variance and batch size, learning-rate scaling, and the limits of very large batches.

General logo
General
Nov 25, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

Why is mini-batch gradient descent the standard choice over pure SGD on modern hardware?

Here pure SGD means updating the parameters after every single example (batch size 1), and mini-batch means averaging the gradient over a batch of B examples before each update.

What a Strong Answer Covers Guidance

  • Why batching uses accelerator hardware well: parallel cores, matrix-matrix products, and fixed per-step overhead.
  • The statistical effect of averaging over a batch on gradient variance and on the usable learning rate.
  • Why mini-batch sits between pure SGD and full-batch on cost per step, number of updates, and memory.
  • How it fits batch normalization and data-parallel training.
  • The limits of making the batch ever larger.

Follow-up Questions Guidance

  • If you multiply the batch size by 8, how would you change the learning rate, and why might you need a warmup?
  • How would you train with an effective batch of 2,048 on a GPU that only fits 256 examples at once?
  • Why can very large batches generalize worse, and what helps?
  • When does a batch size of 1 still make sense?