Why is the mini-batch gradient considered an unbiased estimator of the true dataset gradient?

Quick Overview

Asks why the average gradient over a randomly sampled mini-batch equals the full-dataset gradient in expectation. Tests the linearity-of-expectation argument, the role of uniform sampling, how variance scales with batch size, and when batching choices introduce bias.

Why is the mini-batch gradient considered an unbiased estimator of the true dataset gradient?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: easy

Interview Round: Other

Why is the mini-batch gradient considered an unbiased estimator of the true dataset gradient? ```hint Write it as an average Write the full-dataset gradient as an average over examples, then ask what the expected gradient of one uniformly sampled example is. ``` ### What a Strong Answer Covers - The full gradient written as an average and the linearity-of-expectation argument over a uniformly sampled index - The sampling assumption, for both sampling with and without replacement - The difference between unbiased and exact, with how the variance scales with batch size - The cases where the estimate becomes biased (data ordering, non-uniform sampling, batch-dependent layers) - The difference between the training-loss gradient and the population risk gradient ### Follow-up Questions - How does the variance of the mini-batch gradient change with batch size, and why do larger batches give diminishing returns? - You sample hard examples more often with importance sampling. How do you keep the gradient unbiased? - After the first epoch, is the mini-batch gradient still an unbiased estimate of the population risk gradient? - Does clipping the mini-batch gradient keep the estimator unbiased?

Overview: Asks why the average gradient over a randomly sampled mini-batch equals the full-dataset gradient in expectation. Tests the linearity-of-expectation argument, the role of uniform sampling, how variance scales with batch size, and when batching choices introduce bias.

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

Why is the mini-batch gradient considered an unbiased estimator of the true dataset gradient?

What a Strong Answer Covers Guidance

  • The full gradient written as an average and the linearity-of-expectation argument over a uniformly sampled index
  • The sampling assumption, for both sampling with and without replacement
  • The difference between unbiased and exact, with how the variance scales with batch size
  • The cases where the estimate becomes biased (data ordering, non-uniform sampling, batch-dependent layers)
  • The difference between the training-loss gradient and the population risk gradient

Follow-up Questions Guidance

  • How does the variance of the mini-batch gradient change with batch size, and why do larger batches give diminishing returns?
  • You sample hard examples more often with importance sampling. How do you keep the gradient unbiased?
  • After the first epoch, is the mini-batch gradient still an unbiased estimate of the population risk gradient?
  • Does clipping the mini-batch gradient keep the estimator unbiased?