Skip to main content
QUICK REVIEW

[Paper Review] The Impact of the Mini-batch Size on the Variance of Gradients in Stochastic Gradient Descent

X. Qian, Diego Klabjan|arXiv (Cornell University)|Apr 27, 2020
Stochastic Gradient Optimization TechniquesComputer Science35 references29 citations
TL;DR

This paper theoretically analyzes how mini-batch size affects the variance of stochastic gradients in SGD for linear models and two-layer linear networks. It proves that gradient variance decreases with larger batch sizes, showing it is a polynomial in 1/b with no constant term, and provides recursive relationships linking gradient norms to initial weights, offering insights into SGD dynamics and generalization behavior.

ABSTRACT

The mini-batch stochastic gradient descent (SGD) algorithm is widely used in training machine learning models, in particular deep learning models. We study SGD dynamics under linear regression and two-layer linear networks, with an easy extension to deeper linear networks, by focusing on the variance of the gradients, which is the first study of this nature. In the linear regression case, we show that in each iteration the norm of the gradient is a decreasing function of the mini-batch size $b$ and thus the variance of the stochastic gradient estimator is a decreasing function of $b$. For deep neural networks with $L_2$ loss we show that the variance of the gradient is a polynomial in $1/b$. The results back the important intuition that smaller batch sizes yield lower loss function values which is a common believe among the researchers. The proof techniques exhibit a relationship between stochastic gradient estimators and initial weights, which is useful for further research on the dynamics of SGD. We empirically provide further insights to our results on various datasets and commonly used deep network structures.

Motivation & Objective

  • To theoretically analyze the impact of mini-batch size on gradient variance in stochastic gradient descent (SGD).
  • To establish that gradient variance decreases with increasing batch size in linear regression and two-layer linear networks.
  • To derive a recursive relationship between gradient norms and initial model weights to support theoretical analysis.
  • To provide a framework for understanding SGD dynamics beyond convergence, focusing on variance and generalization.
  • To empirically validate theoretical findings across multiple datasets and network architectures.

Proposed method

  • Theoretical analysis of gradient variance in linear regression using norm-based properties of stochastic gradient estimators.
  • Derivation of a recursive relationship between gradient norm and initial weights at each SGD iteration.
  • Proof that in two-layer linear networks with L2 loss, gradient variance is a polynomial in 1/b with non-negative leading coefficient.
  • Use of conditional variance and moment-generating functions to characterize gradient behavior under random sampling.
  • Extension of results to deeper linear networks via structural similarity in gradient dynamics.
  • Empirical validation using synthetic data, MNIST, and Yelp datasets with multiple runs per configuration to ensure statistical significance.

Experimental results

Research questions

  • RQ1Does the variance of the stochastic gradient estimator decrease as the mini-batch size increases in linear models?
  • RQ2What is the functional form of gradient variance as a function of mini-batch size in two-layer linear networks?
  • RQ3How are the initial model weights related to the norm of the gradient in SGD iterations?
  • RQ4Can the variance of the gradient estimator be expressed as a polynomial in 1/b for deep linear networks?
  • RQ5Does a smaller mini-batch size lead to lower training loss due to higher gradient variance?

Key findings

  • In linear regression, the norm of any linear combination of sample-wise gradients is a decreasing function of the mini-batch size b.
  • For two-layer linear networks with L2 loss and normally distributed inputs, gradient variance is a polynomial in 1/b with no constant term, proving it decreases for large b.
  • The leading coefficient of the polynomial in 1/b is non-negative, ensuring monotonic decrease in variance for sufficiently large batch sizes.
  • The recursive relationship between gradient norm and initial weights enables computation of gradient-related quantities at any iteration based on initial conditions.
  • Empirical results across linear regression, two-layer networks, MNIST, and XLNet confirm that smaller batch sizes yield lower training loss and higher gradient variance.
  • The theoretical framework reveals structural dependencies between gradient variance, batch size, and initial weights, supporting future analysis of SGD dynamics.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.