Mini-Batch Gradients and Sampling Noise

Derive when a mini-batch average estimates the full training gradient and compare estimator variance with update cost.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. An unbiased draw preserves the mean direction
  2. Larger batches cost more work per update

An unbiased draw preserves the mean direction

For a fixed parameter vector, draw a training index uniformly and take its example gradient. Its expectation is the full empirical mean gradient. An average of \(b\) independent such draws has the same expectation and variance in each coordinate divided by \(b\). Drawing without replacement changes the variance through dependence. Nonuniform sampling may change the expected direction unless the estimator accounts for selection.

Larger batches cost more work per update

A larger batch can use hardware efficiently while reducing the number of parameter updates per pass through the data. Learning rate and sampling effects together govern training. Examples of different lengths can also change whether the objective weights examples or individual tokens. Adaptive optimizers transform noisy gradient sequences. Federated learning adds client sampling and heterogeneity to the question of what gradient an update represents.[1]

References

  1. Ian Goodfellow, Yoshua Bengio and Aaron Courville, Deep Learning ↩