3.2.2 · D3Training Deep Networks

Worked examples — Mini-batch gradient descent

2,235 words10 min readBack to topic

The scenario matrix

Every question this topic can throw at you falls into one of these case classes. Each row names the class; the last column says which worked example covers it.

# Case class What makes it tricky Covered by
A Steps-per-epoch, clean divide ( whole) none — warm-up Ex 1
B Steps-per-epoch, remainder batch ( not whole) ceiling vs floor, drop_last Ex 2
C Noise scaling across two batch sizes the law, diminishing returns Ex 3
D Degenerate: (pure SGD limit) max noise, cheapest step Ex 4
E Degenerate: (full-batch limit) zero mini-batch noise, one update/epoch Ex 4
F Unbiasedness by enumeration (all batches averaged) each batch wrong, ensemble right Ex 5
G Linear scaling rule (change , change ) keep effective step comparable Ex 6
H Word problem (real training budget) translate wall-clock into updates Ex 7
I Exam twist: how big must be for target noise? invert the law Ex 8
Figure — Mini-batch gradient descent

Worked Examples

Ex 1 — Clean divide (cell A)


Ex 2 — Remainder batch (cell B)


Ex 3 — Noise scaling across batch sizes (cell C)


Ex 4 — The two degenerate limits (cells D and E)


Ex 5 — Unbiasedness by full enumeration (cell F)


Ex 6 — Linear scaling rule (cell G)


Ex 7 — Word problem: a real training budget (cell H)


Ex 8 — Exam twist: invert the noise law (cell I)


Recall

Recall Which formula does each cell use?

Steps per epoch ::: (round up if there's a remainder batch). Noise (std) of the batch gradient ::: . Quadruple → noise does what? ::: Halves (only improvement). Linear scaling rule ::: multiply by → multiply by . Smallest for std ≤ target ::: .


Connections