TL;DR
The critical batch size is the number of examples per gradient step above which making the batch bigger stops paying off. Below it, doubling the batch roughly halves the number of steps you need. Above it, doubling the batch barely reduces the steps, so you pay for twice the examples and get almost nothing back.
It is set by the noise in the gradient. When the gradient from a batch is very noisy, a bigger batch averages that noise away and helps; once the noise is already small compared with the true signal, more examples add cost without adding information.
Where you'll see it: in deciding how large a batch to use when training a large language model on many GPUs, where the choice trades wall-clock time against total compute.
Intuition
Tasting soup
Imagine checking whether a large pot of soup needs salt. One spoonful tells you a little, but it could come from a salty corner. Take a few spoonfuls from different places and your estimate gets much better. Take a hundred more and you have learned almost nothing new, because the soup is already well mixed and your estimate was good enough several spoonfuls ago.
Training a model with stochastic gradient descent works the same way. Each step needs an estimate of the direction to move, and that estimate is the average gradient over a batch of examples. A small batch gives a noisy direction, so the model needs many steps. A large batch gives a clean direction, so each step is more reliable, but each step also reads more examples and costs more time and memory.
The question is where to stop. The critical batch size is the point where the extra cleanliness of the direction stops being worth the extra examples.
Why the answer depends on the training run
The right batch size is not a fixed property of a model architecture. It changes as training proceeds. Early on, when the model is far from good, the gradient points the same way for most examples and is relatively clean, so the critical batch is small. Later, when the loss is low, the remaining useful signal is small compared with the noise, and the critical batch grows. This is why a batch size that was sensible at the start of a run can become wasteful near the end.
The math
Gradient noise
Take a batch of examples and let be the average of their per-example gradients. Let be the true gradient over the whole data distribution, the thing every batch is trying to estimate. Write , where is the noise, with .
Let be the covariance matrix of a single example's gradient. Averaging independent examples divides the covariance by , so the noise has covariance . The expected squared length of the batch gradient is then
Here is the Euclidean length, is the trace (the sum of the diagonal entries, which is the total variance across all parameters), and the cross term between and vanishes because the noise has zero mean. The formula says that the squared size of a batch gradient is a constant signal part plus a noise part that shrinks like .
Define the gradient noise scale
It is the ratio of noise to signal, measured in examples. When the noise dominates. When the signal dominates and extra examples do little.
Steps against examples
Let be the number of steps and the number of examples processed. McCandlish and colleagues found, empirically, that across many training runs the trade between steps and examples is described well by
where is the number of steps needed with a very large batch, and is the number of examples needed with a very small batch. The critical batch size is the batch at which the two terms are equal, and it is approximately . Solving the relation for and gives
Both formulas show the trade in one place. Make small and steps go up. Make large and examples go up. At both the step count and the example count are exactly twice their minimums.
- steps needed (relative to minimum)
- examples used (relative to minimum)
Worked examples
Take a run where the best possible step count is and the critical batch size is examples. Then examples.
- Batch . Steps: . Examples: .
- Batch . Steps: . Examples: .
- Batch . Steps: . Examples: .
Interpretation: going from batch 10 to batch 100 is a tenfold larger batch that cuts steps by 5.5 times, for only 1.8 times the examples. Going from 100 to 1000 is another tenfold batch, but steps fall only from 2000 to 1100 while examples grow 5.5 times (from 200,000 to 1,100,000). The sweet spot is near 100.
You can estimate and without knowing them in advance. Measure the squared gradient length for two batch sizes. Suppose gives and gives .
- From the formula, , so we have two equations: and .
- Subtract the second from the first: , so .
- Substitute back: , so .
- The noise scale is .
Interpretation: a batch of about 100 examples is where the noise and signal balance. In practice, a team would run a few batch sizes around this and pick the one that gives the best trade. These noisy measurements are usually averaged over many batches, because a single pair of norms is a poor estimate.
Tradeoffs and failure modes
Batch size is a choice with three costs. The first is wasted hardware or wasted time when the batch is far below the critical size, because the run is limited by the number of sequential steps. The second is wasted compute when the batch is far above it, because extra examples add cost without shortening the run much. The third is a training-dynamics problem: a larger batch usually needs a learning rate change to stay stable, and it is easy to forget that step.
| Situation | What goes wrong | Better choice |
|---|---|---|
| Batch well below the critical size | Steps are the bottleneck; many more sequential steps are needed, and parallel hardware sits idle | Increase the batch toward the critical size, scaling the learning rate with it |
| Batch well above the critical size | Examples and compute are wasted; step count barely drops | Keep the batch near the critical size and spend spare hardware on other work |
| Fixed batch for a whole run | Critical size rises as loss falls, so the batch that was right early becomes wasteful late | Ramp the batch size up during training |
| Larger batch without retuning the learning rate | Training becomes unstable or converges to a worse result | Use warmup and a learning rate that scales with batch size, as in Goyal et al. |
| Tiny model on one device | Memory or the dataset limits the batch long before the critical size is reached | Ignore the critical batch size; it matters only when batch size can really be chosen |
A recurring caveat is generalization. Several studies have reported that very large batches can reach a higher training score yet generalize worse on held-out data. The effect depends on the setup, so treat the critical batch size as a guide for optimization speed, and check the final quality separately.
History
The idea of a gradient noise scale grew out of a 2017 observation by Samuel Smith, Quoc Le and colleagues that increasing the batch size can play the role of decaying the learning rate. In 2017, Priya Goyal and colleagues at Facebook trained ImageNet with very large batches in about an hour, using a linear learning rate scaling rule and a warmup period. That work made large batches a practical tool.
In 2018 Sam McCandlish, Jared Kaplan, Dario Amodei and colleagues at OpenAI wrote down the gradient noise scale and the steps-against-examples relation above, and showed it predicted the best batch size across many tasks. In the same year, Christopher Shallue and colleagues at Google ran a large, systematic study of data parallelism across several neural networks and reported that the best batch size depends strongly on the training setup and the target loss. Both lines of work shaped how large language models are trained today.
Check yourself
QuestionRecall: in one sentence, what does the critical batch size mean?Show answer
It is the batch size at which making the batch bigger stops cutting the number of steps much. Below it, doubling the batch roughly halves the steps. Above it, doubling the batch mainly doubles the examples used for little gain in steps.
QuestionComputation: with and , how many steps and how many examples does a batch of 50 need?Show answer
Steps: . Examples: . Check: . The batch of 50 is below the critical size, so steps are the cost.
QuestionWhy: why does doubling the batch above the critical size barely reduce the number of steps?Show answer
Above the critical size the gradient estimate is already dominated by signal. Extra examples in a batch reduce the remaining noise only a little, and the step direction was already close to the true gradient. Each step is more accurate, but the run needs roughly the same number of steps, so the extra examples are mostly spent for no benefit in step count.
QuestionApplied: a team doubles their GPUs and doubles the batch from 512 to 1024, but training takes the same number of steps as before. What probably happened, and what should they do?Show answer
The batch is probably now above the critical size, so the extra examples are not shortening the run. They should measure the gradient noise scale or check how the step count changes at a few batch sizes. If the batch is past the critical size, they should keep it near that size and use the extra GPUs for something else, such as a larger model or more experiments, rather than for a bigger batch.
Sources
- McCandlish, Kaplan, Amodei and the OpenAI Dota team, "An Empirical Model of Large-Batch Training" (2018): https://arxiv.org/abs/1812.06162
- Shallue et al., "Measuring the Effects of Data Parallelism on Neural Network Training" (2018): https://arxiv.org/abs/1811.03600
- Goyal et al., "Accurate, Large Minibatch SGD: Training ImageNet in 1 Hour" (2017): https://arxiv.org/abs/1706.02677
- Stochastic gradient descent (Wikipedia): https://en.wikipedia.org/wiki/Stochastic_gradient_descent