betaFeedback

WorksComputer Science

Why Does Adaptive Batching Help LLM Pretraining? A Perspective from Unbounded Variance

Abstract

Increasing the batch size during training is a common practice in large language model (LLM) pretraining, yet the theoretical justification behind its success is not well understood. Analyses of stochastic optimization often assume uniformly bounded stochastic gradient variance, yet recent evidence suggests that this assumption fails in many practical nonconvex problems. The Blum–Gladyshev (BG-00) noise model relaxes this assumption by allowing the variance to grow quadratically with the distance from initialization, suggesting that batch size schedulers can help by controlling the variance growth during training. However, this growth can be overly conservative in practice. We empirically investigate variance growth in LLM pretraining and observe that a generalized BG model with a tunable growth exponent provides a tighter description of practical noise behavior. Motivated by this observation, we introduce the generalized BG-aa noise model, which interpolates between bounded variance (a=0a=0) and BG-00 noise (a=2a=2). Under LL-smoothness, we derive an information-theoretic lower bound with growth-dependent oracle complexity Ω(ε−(4+a))Ω(ε^{-(4+a)}) and establish a matching upper bound in εε-dependence by increasing the batch size as the iterates move away from initialization. Finally, we propose an adaptive batch scheduler that controls variance growth through dynamic batch size adjustments during training. In pretraining OLMo2 models of up to 1B parameters on C4, our scheduler achieves a lower validation loss than both small and large batch training under matched token budgets, while using less than 10% of the iterations of small batch training.

Introduction

With the growing scale of training datasets, particularly in language model pretraining, large batch training is increasingly important for exploiting data parallelism. However, using a very large batch from initialization can reduce token efficiency, motivating schedules that begin with smaller batches and increase them as training progresses (Merrill et al., 2026). Such schedules are already used in large scale training, e.g., GPT-3 gradually increased its batch size during the initial phase of pretraining (Brown et al., [7]). Existing adaptive batch schedulers commonly guide batch selection through gradient noise scale (GNS) estimates (McCandlish et al., 2018; Naganuma et al., 2026). However, Merrill et al. (2026) show that this connection relies on assumptions about the optimizer and curvature that need not hold in deep learning, and find GNS can be an unreliable proxy in practice. They instead estimate the critical batch size directly through additional branched training runs at different training stages. Despite the success of these schedules in practice, the theoretical justification for why increasing the batch size during training helps LLM pretraining is not well understood. In this work, we study this question from the perspective of stochastic gradient noise, where the variance grows as the iterates move away from initialization.

Classical optimization theory does not directly account for this behavior, as the convergence analysis of stochastic gradient methods commonly combines LL-smoothness of the objective with a uniformly bounded variance assumption on the stochastic gradient oracle ([3 Shamir &] [10] (Zhang 2013). For an unbiased estimator g(x,ξ)g(x,\xi) of ∇f(x)\nabla f(x), this assumption requires Eξ∥g(x,ξ)−∇f(x)∥2≤σ2\mathbb{E}_{\xi}\lVert g(x,\xi)-\nabla f(x)\rVert^2 \le\sigma^2 for every xx, where σ\sigma is constant and independent of the iteration. However, this assumption is often unrealistic because smoothness directly controls the changes in the population gradient, not the variance of its stochastic estimates. As a result, the bounded variance assumption need not hold even for unconstrained least squares problems ([1, 9] (Upadhyay et al. 2026)), where differences between sample gradients and the population gradient can grow linearly with the parameters, causing variance to grow quadratically. As a remedy, researchers have analyzed the Blum–Gladyshev (BG-0) noise model ([5, 11]) which accommodates this behavior by allowing Eξ∥g(x,ξ)−∇f(x)∥2≤B2∥x−x0∥2+G2\mathbb{E}_{\xi}\lVert g(x,\xi)-\nabla f(x)\rVert^2 \le B^2\lVert x-x_0\rVert^2 + G^2, where x0x_0 is a fixed reference point, and BB, GG are problem dependent constants. For smooth nonconvex optimization under this unbounded variance oracle, Fazla et al. [9] establish an Ω(ϵ−6)\Omega(\epsilon^{-6}) stochastic first-order oracle lower bound for finding an ϵ\epsilon-stationary point and provide matching upper bounds for stochastic gradient descent (SGD) with dynamic batching. Their results show that distance-dependent noise incurs an intrinsic complexity penalty relative to the classical bounded variance rate of Θ(ϵ−4)\Theta(\epsilon^{-4}) ([2]).

Although BG-0 relaxes the bounded variance assumption, its quadratic dependence on distance can overestimate the variance growth encountered in practice. As illustrated in Figure 1, we find that the empirical variance growth in LLM pretraining is subquadratic, with fitted exponents a∈[0.98,1.49]a \in[0.98, 1.49] that increase with model size, and we observe a similar behavior for the vision models we study. Motivated by these observations, we introduce the generalized BG-aa noise model, Eξ∥g(x,ξ)−∇f(x)∥2≤B2∥x−x0∥a+G2\mathbb{E}_{\xi}\lVert g(x,\xi)-\nabla f(x)\rVert^2 \le B^2\lVert x-x_0\rVert^a + G^2, which interpolates between uniformly bounded variance at a=0a = 0 and classical quadratic BG noise (a=2a = 2, denoted as BG-0 in prior works ([9] (Upadhyay et al. 2026)). For LL-smooth nonconvex objectives, we establish matching lower and upper bounds with Θ(ϵ−(4+a))\Theta(\epsilon^{-(4+a)}) dependence for finding an ϵ\epsilon-stationary point for a∈[0,2]a \in[0,2]. Thus, the rate at which stochastic gradient noise grows with distance directly governs the oracle complexity, while recovering the bounded variance and BG-0 rates as the two endpoints.

Figure 1. Empirical stochastic-gradient noise of OLMo2 models on C4 as a function of displacement from initialization. For each radius rr, we evaluate x=x0+rux = x_0 + ru along ten independently sampled, normalized Gaussian directions and plot the corresponding minibatch variance estimates. The dashed red curve in each panel is the fitted BG-aa model, (B2∥x−x0∥a+G2)(B^2 \lVert x-x_0\rVert^a + G^2). The fitted parameters are: (a) OLMo2-100M: B=0.379B = 0.379, G=5.41G = 5.41, a=0.98a = 0.98; (b) OLMo2-600M: B=0.132B = 0.132, G=8.64G = 8.64, a=1.38a = 1.38; and (c) OLMo2-1B: B=0.0916B = 0.0916, G=9.77G = 9.77, a=1.49a = 1.49. Across all three model sizes, the fitted curve captures both the initial noise floor governed by G2G^2 and the distance-dependent growth governed by B2∥x−x0∥aB^2\lVert x-x_0\rVert^a, with the fitted exponent aa increasing with model size. The corresponding results for the vision models are provided in Appendix § 11.2.1.

One direct way to control distance-dependent noise is to increase the batch size as the iterates move far from initialization. Accordingly, Fazla et al. [9] use dynamic batching to control the minibatch variance under BG-0 noise, which extends to the BG-aa model, where the corresponding batch size requirement scales with B2∥xt−x0∥a+G2B^2\lVert x_t-x_0\rVert^a + G^2. We show that this dynamic batching strategy under the BG-aa model yields a matching O(ϵ−(4+a))O(\epsilon^{-(4+a)}) oracle complexity for SGD. Thus, we provide a theoretical explanation for increasing batch size during training: small batches are sufficient near initialization, where noise is small, while larger batches are needed to control variance growth as iterates move away from initialization. However, directly scaling batch sizes with noise level can lead to large per-iteration batch requirements as displacement grows. To alleviate this issue and make the method more flexible and practical, we extend the dynamically batched SGD analysis to SGD with momentum (SGDM) under BG-aa noise. Our analysis shows that momentum provides an additional form of averaging over time, reducing the sufficient per-iteration batch size at the cost of additional iterations while preserving the optimal O(ϵ−(4+a))O(\epsilon^{-(4+a)}) oracle complexity. This establishes a theoretical trade-off between batch size and iteration count under distance-dependent noise.

Together, these results offer a theoretical perspective on why increasing the batch size during pretraining works, complementary to empirical approaches based on GNS and critical batch size estimation. In particular, our BG-aa analysis connects the growth of the batch size to the growth of stochastic gradient noise, prescribing batch sizes that control variance growth as the iterates move away from initialization. To examine this perspective in practice, we translate the resulting variance control condition into an adaptive batch scheduler. In our LLM pretraining experiments, our scheduler achieves a lower validation loss than both small and large batch training under matched token budgets. We also provide experiments on image classification tasks, and discuss the role of adaptive batching in offline, multi-epoch training in Appendix § 11.§ 2.

We summarize our contributions as follows:

  • We empirically study the stochastic gradient noise in LLM pretraining and demonstrate that its variance grows subquadratically with the distance from initialization. We formalize this phenomenon by introducing the BG-aa oracle, which interpolates between bounded variance and BG-0 noise.

  • For LL-smooth nonconvex optimization, we establish an Ω(ϵ−(4+a))\Omega(\epsilon^{-(4+a)}) lower bound on the stochastic first-order oracle complexity for a∈[0,2]a \in[0, 2], characterizing how distance-dependent noise growth degrades the sample complexity of finding an ϵ\epsilon-stationary point.

  • We establish matching O(ϵ−(4+a))O(\epsilon^{-(4+a)}) oracle complexity bounds for both SGD and SGDM under dynamic batching schedules. We identify momentum as a mechanism to reduce the required batch size at the expense of additional iterations, all while maintaining the optimal dependence on ϵ\epsilon.

  • We instantiate our theoretical variance control analysis into a practical adaptive batch scheduler that scales batch sizes according to displacement from initialization and can be readily used in practice. In OLMo2 pretraining on C4, our scheduler achieves a lower validation loss than both small and large batch training under matched token budgets, while using less than 10% of the iterations of small batch training.

Gradient Noise Grows with Distance in LLM Pretraining

Before developing our theoretical results, we first examine the behavior of stochastic gradient noise in LLM pretraining. Specifically, we study how the gradient variance grows as the model parameters move away from initialization and assess how tightly the quadratic distance dependence assumed by the BG-0 oracle captures this growth. We then investigate whether allowing a tunable growth exponent yields a tighter characterization of the observed variance.

We study language modeling with OLMo2-100M, OLMo2-600M, and OLMo2-1B models (Team OLMo et al., 2024) on C4 (Raffel et al., 2020). To study the effect of displacement on noise growth without following an optimizer generated trajectory, we evaluate the model at randomly perturbed parameter states, without performing training. Starting from a randomly initialized anchor point x0x_0, we construct evaluation points as

x=x0+ru,u=Dz∥Dz∥,z∼N(0,I),x = x_0 + ru,\qquad u = \frac{Dz}{\lVert Dz\rVert},\qquad z \sim\mathcal{N}(0,I),

where r>0r > 0 is the distance from initialization and DD is a diagonal matrix specifying the relative perturbation scales. We set the diagonal entries of DD to 2 for parameters of the LM head and 1 for all remaining parameters. Thus, we double the Gaussian perturbation scale of the LM head before globally normalizing the direction, preserving ∥x−x0∥=r\lVert x - x_0\rVert= r. For each model, we consider 50 logarithmically spaced radii and sample 10 independent directions at each radius.

This modeling choice is motivated by our observation that the LM head exhibits the largest weight changes among all parameter groups in our pretraining runs. This observation agrees with prior work that identifies a gradient bottleneck at the LM head (Godey & Artzi, 2026) and highlights heterogeneous output layer gradients and, hence, larger effective learning rates for the LM head weights (Glentis et al., [12]). We use a factor of two as a simple way to reflect this behavior, so that the perturbation directions more closely resemble how the parameters move during training.

At each evaluation point xx, we estimate the variance of stochastic gradients around a fixed large batch reference gradient ∇f~(x)\nabla\tilde{f}(x), which is computed before the evaluation process and used as an approximation to the population gradient. Specifically, we approximate the stochastic gradient variance Eξ∥∇f(x;ξ)−∇f(x)∥2\mathbb{E}_{\xi}\lVert\nabla f(x;\xi)-\nabla f(x)\rVert^{2} using 1M∑i=1M∥gb(i)(x)−∇f~(x)∥2\frac{1}{M}\sum_{i=1}^{M}\lVert g_b^{(i)}(x)-\nabla\tilde{f}(x)\rVert^{2}, where gb(i)(x)=1b∑j=1b∇f(x;ξi,j)g_b^{(i)}(x)=\frac{1}{b}\sum_{j=1}^{b}\nabla f(x;\xi_{i,j}). For all OLMo2 models, we use a reference batch of 512 sequences and M=32M=32 stochastic batches, each containing 4 sequences, where sequence length is set as 2048.

Figure 1 shows the distribution of individual variance measurements across the three OLMo2 models, together with the best fitting curves of the form B2∥x−x0∥a+G2B^{2}\lVert x-x_{0}\rVert^{a}+G^{2}, subject to B,G≥0B,G\ge0 and a∈[0,2]a\in[0,2]. The fitted exponents are approximately a=0.98a=0.98, 1.381.38, and 1.491.49 for OLMo2-100M, OLMo2-600M, and OLMo2-1B, respectively. These results indicate that the distance from initialization is a useful predictor of gradient noise growth. Across the sampled points, the proposed BG-aa condition closely captures the observed increase in variance as the iterates move farther from initialization. Moreover, allowing the exponent aa to adapt to the observed noise-growth behavior provides a better fit than the BG-0 condition of Alacaoglu et al. [1]; Fazla et al. [9]; Upadhyay et al. (2026), which fixes the corresponding exponent to 2. Figure 2 further shows how the fitted parameters change with model size: as the model grows, the growth exponent aa and the noise floor GG increase, while BB decreases. We observe a similar subquadratic noise growth for ResNet50 on image classification tasks, which we report in Appendix § 11.2.1.

Figure 2. Estimated BG-aa noise-model parameters across OLMo2 model sizes. We observe that as model size increases, (a) BB tends to decrease, while (b) GG and (c) aa tend to increase.

These observations motivate the BG-aa noise model, which we formalize and analyze in the next section, and an adaptive batch size scheduler that increases the batch size as the iterates move farther from initialization, thereby controlling variance growth throughout training.

Theoretical Analysis under the BG-aa Oracle

Preliminaries

For a given random variable XX, we write E[X]\mathbb{E}[X] to denote the expectation with respect to all randomness introduced by the algorithm. ∥⋅∥\lVert\cdot\rVert denotes the Euclidean norm, and ⟨⋅,⋅⟩\langle\cdot,\cdot\rangle denotes the Euclidean inner product. The notation O(⋅)O(\cdot) suppresses numerical constants that are independent of the target accuracy ϵ\epsilon. We use Ft\mathcal{F}_t to denote the history of the algorithm up to iteration tt, which contains the initialization and all samples used at iterations 0,…,t−10,\ldots,t-1. We denote the corresponding conditional expectation by Et[⋅]=E[⋅∣Ft]\mathbb{E}_t[\cdot]=\mathbb{E}[\cdot\mid\mathcal{F}_t]. In assumptions involving an oracle sample, Eξ\mathbb{E}_{\xi} denotes expectation only with respect to the sample ξ\xi, with the query points held fixed.

We consider the stochastic optimization problem min⁡x∈Rdf(x)\min_{x\in\mathbb{R}^{d}}f(x), f(x):=Eξ[f(x;ξ)]f(x):=\mathbb{E}_{\xi}[f(x;\xi)]. Here, f:Rd→Rf:\mathbb{R}^{d}\to\mathbb{R} is differentiable, nonconvex, and bounded below by finf⁡:=inf⁡xf(x)>−∞f_{\inf}:=\inf_{x}f(x)>-\infty. We denote the initialization query point with x0x_{0} and use Δ=f(x0)−finf⁡≥0\Delta=f(x_{0})-f_{\inf}\ge0.

The convergence criterion that we consider is the average expected squared gradient norm along the iterates x0,…,xT−1x_0,\ldots,x_{T-1},

1T∑t=0T−1E∥∇f(xt)∥2≤ϵ2.(1)\frac{1}{T}\sum_{t=0}^{T-1}\mathbb{E}\left\|\nabla f(x_t)\right\|^2 \leq\epsilon^2. \tag*{(1)}

Equivalently, returning xτx_\tau with τ\tau drawn uniformly from {0,…,T−1}\{0,\ldots,T-1\} yields E∥∇f(xτ)∥2≤ϵ2\mathbb{E}\|\nabla f(x_\tau)\|^2 \leq\epsilon^2. Given a query point xx, the stochastic first-order oracle (SFO) returns a stochastic gradient ∇f(x;ξ)\nabla f(x;\xi). We measure the computational complexity by the total number of SFO calls. At iteration tt, the algorithms we consider query the oracle btb_t times at xtx_t and form the minibatch gradient

gt=1bt∑i=1bt∇f(xt;ξt,i),(2)g_t=\frac{1}{b_t}\sum_{i=1}^{b_t}\nabla f(x_t;\xi_{t,i}), \tag*{(2)}

where the batch size btb_t is chosen based on Ft\mathcal{F}_t before sampling, and the samples ξt,1,…,ξt,bt\xi_{t,1},\ldots,\xi_{t,b_t} are drawn independently of each other and of Ft\mathcal{F}_t. Hence, iteration tt uses btb_t SFO calls. We next state the assumptions used in our work.

Assumptions

Assumption 1 (LL-smoothness of ff). The objective function ff is globally LL-smooth with L>0L>0 such that:

∥∇f(x)−∇f(y)∥≤L∥x−y∥for all x,y∈Rd.\|\nabla f(x)-\nabla f(y)\|\leq L\|x-y\| \qquad\text{for all } x,y\in\mathbb{R}^d.

References

  1. [1]Ahmet Alacaoglu, Yura Malitsky, and Stephen J Wright. Towards weaker variance assumptions for stochastic optimization. arXiv preprint arXiv:2504.09951, 2025.arxiv.org/abs/2504.09951
  2. [2]Yossi Arjevani, Yair Carmon, John C. Duchi, Dylan J. Foster, Nathan Srebro, and Blake Woodworth. Lower bounds for non-convex stochastic optimization. Mathematical Programming, 199(1): 165–214, 2023.
  3. [3]Francis Bach and Eric Moulines. Non-asymptotic analysis of stochastic approximation algorithms for machine learning. In Advances in Neural Information Processing Systems, volume 24, 2011.
  4. [4]Lukas Balles, Javier Romero, and Philipp Hennig. Coupling adaptive batch sizes with learning rates. In Gal Elidan, Kristian Kersting, and Alexander Ihler (eds.), Proceedings of the Thirty-Third Conference on Uncertainty in Artificial Intelligence, UAI 2017, Sydney, Australia, August 11-15, 2017. AUAI Press, 2017. URL http://auai.org/uai2017/proceedings/papers/141.pdf.arxiv.org/abs/1612.05086
  5. [5]Julius R Blum. Approximation methods which converge with probability one. The Annals of Mathematical Statistics, pp. 382–386, 1954.DOI
  6. [6]Raghu Bollapragada, Richard Byrd, and Jorge Nocedal. Adaptive sampling strategies for stochastic optimization. SIAM Journal on Optimization, 28(4):3312–3343, 2018.
  7. [7]Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020.arxiv.org/abs/2005.14165
  8. [8]Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. ImageNet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pp. 248–255. Ieee, 2009.
  9. [9]Arda Fazla, Ege C Kaya, Antešh Upadhyay, and Abolfazl Hashemi. Lower bounds and proximally anchored SGD for non-convex minimization under unbounded variance. arXiv preprint arXiv:2604.16620, 2026.arxiv.org/abs/2604.16620
  10. [10]Saeed Ghadimi and Guanghui Lan. Stochastic first-and zeroth-order methods for nonconvex stochastic programming. SIAM journal on optimization, 23(4):2341–2368, 2013.arxiv.org/abs/1309.5549
  11. [11]EG Gladyshev. On stochastic approximation. Theory of Probability & Its Applications, 10(2): 275–278, 1965.DOI
  12. [12]Athanasios Glentis, Dawei Li, Chung-Yiu Yau, and Mingyi Hong. Revisiting the Adam-SGD gap in LLM pre-training: The role of large effective learning rates. arXiv preprint arXiv:2605.17787, 2026.arxiv.org/abs/2605.17787

Paper details

vlnc:W_sxm4quaq
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Not recorded for this paper

View statement
Looking for related papers…
Contents