3.2.2 · D5Training Deep Networks
Question bank — Mini-batch gradient descent
Symbols this page leans on (defined before use)
Before the traps, pin down every symbol so nothing is used unearned. The picture below anchors them.

The figure shows all three: a cloud of individual gradient arrows (spread ) around the true gradient , and the tighter batch-averaged arrow whose spread has shrunk to .
True or false — justify
Each line states a claim. Decide true/false and give the reason.
The mini-batch gradient is an unbiased estimate of the true gradient .
True — since each index is drawn uniformly, ; on average we step in the exactly correct direction, the noise cancels over many steps.
If a single mini-batch step increases the loss, something has gone wrong with training.
False — is only an estimate of the true gradient, so an unlucky batch can point uphill for that step. Judge progress by the epoch/running average, not one step.
Quadrupling the batch size cuts the gradient noise to a quarter.
False — noise falls as , so the batch only halves the noise. That law is exactly why huge batches waste compute.
Full-batch gradient descent () always finds a better final solution than mini-batch.
False — it computes an exact gradient but is noiseless, so it can settle in sharp minima; mini-batch noise nudges solutions toward flatter minima that often generalise better, see Generalization and Flat Minima (picture a marble settling in a wide valley vs a narrow crack — the second figure sketches this).
Shuffling the data before each epoch is optional cosmetics — the examples are identical.
False — without shuffling every epoch sees the same batches in the same order, giving correlated (biased-in-sequence) gradients; if data is class-sorted the model sees one class at a time and the i.i.d. assumption behind unbiasedness breaks.
Larger batches let you safely use a larger learning rate.
True — a bigger batch gives a lower-variance gradient, so a bigger step is less likely to overshoot; the linear scaling rule multiplies by when is multiplied by (with warmup). See Learning Rate Scheduling.
The variance-of-a-mean derivation requires the per-example gradients to be independent.
True — the cross-terms vanish only under independence; that's why shuffling (approximate i.i.d. sampling) matters for the clean noise scaling.
Setting (pure SGD) is strictly worse than mini-batch because it is noisier.
False — the extra noise can be a feature: it helps escape saddle points and shallow minima, and it is the cheapest possible step. See Stochastic Gradient Descent.
Spot the error
Each line contains a flawed statement or reasoning. Name the flaw.
"Since , every mini-batch gradient equals the true gradient."
Confuses the expectation with a sample: individual batches (e.g. gradients then around a true value of ) are each wrong; only the ensemble average is exact.
"To halve the noise, just double the batch size."
Wrong scaling — noise , so halving noise needs a batch, not .
", gives exactly updates per epoch."
Forgets the remainder — ; the leftover examples form a final (smaller) batch unless
drop_last is set."Bigger batches always improve generalisation because the gradient is more accurate."
A more accurate gradient does not imply better generalisation; large batches remove the helpful regularising noise and tend to find sharp minima, often hurting test accuracy.
"."
Missing the average — without it the estimate is times too large, changing its scale (and effective learning rate) with batch size.
"Because SGD is a descent method, the loss curve should be monotonically decreasing."
The descent guarantee holds for the true gradient; with a noisy batch gradient the per-step loss can rise, so a jittery-but-downward-trending curve is expected.
"The variance of is ."
Sign of the exponent is inverted — averaging reduces variance to ; multiplying by would describe a sum, not a mean.
Why questions
Answer the "why" with a mechanism, not a restatement.
Why does mini-batch GD exist at all instead of always using the full dataset?
The true gradient is an average over examples; computing it over costs a full forward+backward pass before one step. Averaging a random sample estimates it cheaply, giving many fast steps.
Why is the mini-batch estimate unbiased?
Each uniformly-drawn index has , and averaging such unbiased terms keeps the mean unchanged.
Why does gradient noise fall as rather than ?
Variance of a mean of independent terms is , and the standard deviation is its square root, giving .
Why can gradient noise actually help training?
It acts like a mild random kick that lets the optimiser hop out of saddle points and sharp/shallow minima, empirically steering toward flatter, better-generalising solutions.
Why should you scale the learning rate up when you increase batch size?
A larger batch lowers gradient variance , so a bigger step is safer; keeping fixed underuses the cleaner signal and makes big-batch training needlessly slow.
Why must you shuffle every epoch and not just once?
A single shuffle fixes one batch partition forever, so gradients across epochs are correlated; reshuffling keeps successive batches approximately i.i.d., preserving the unbiasedness argument.
Why do optimisers like Adam pair naturally with mini-batch GD?
They smooth the batch-to-batch noise using running averages of the gradient, damping the jitter that mini-batching introduces; see Momentum and Adam (imagine a heavy ball ignoring each small sideways nudge and keeping its overall heading).
Edge cases
Boundary and degenerate scenarios — say what happens and why.
What is mini-batch GD when ?
It becomes full-batch (exact) gradient descent — noiseless, smooth path, but one slow, memory-heavy update per epoch; see Gradient Descent.
What is mini-batch GD when ?
It becomes pure stochastic gradient descent — maximally noisy per step but cheapest, good at escaping bad minima; see Stochastic Gradient Descent.
What happens to the noise as ?
The estimator variance keeps shrinking toward zero (with sampling-without-replacement it is , which hits exactly at ) — so the batch gradient converges to the exact gradient and noise vanishes entirely.
If is not divisible by , what does the last batch look like?
It is a smaller remainder batch of examples (e.g. for ); you either use it or drop it with
drop_last=True.If every per-example gradient is identical, what is the mini-batch variance?
Zero — with the estimate for any , so every batch already returns the exact gradient and batch size is irrelevant.
What happens if the batch is not drawn randomly (e.g. always the first sorted examples)?
The unbiasedness fails because the sample no longer represents the whole dataset, biasing every step toward that fixed subset.
How does the connection to the Bias-Variance Tradeoff show up here?
Same estimator math — the mini-batch gradient's variance falls with sample size exactly like any sample-mean estimator, while remaining unbiased.
Recall
Recall One-line trap-busters
- Does the loss have to drop every step? ::: No — batch noise can push it up for a step; watch the running average.
- batch → how much less noise? ::: Half (noise ), not a quarter.
- Is a sum or a mean? ::: A mean — the keeps its scale fixed as changes.
- What is here? ::: The per-example gradient variance — the spread of one example's about .
- Why reshuffle each epoch? ::: To keep batches approximately i.i.d. so unbiasedness holds.
Connections
- Mini-batch gradient descent — the parent topic these traps sit under.
- Stochastic Gradient Descent — the edge case.
- Gradient Descent — the edge case.
- Learning Rate Scheduling — the linear scaling rule.
- Momentum and Adam — noise-smoothing optimisers.
- Batch Normalization — depends on batch statistics.
- Bias-Variance Tradeoff — estimator-variance analogy.
- Generalization and Flat Minima — why batch-noise helps.