Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

§4.2, p. 12 — variance of the batch gradient, ∥Var(g)∥1≤∥Var(∇ℓ)∥1/n\|\mathrm{Var}(g)\|_1 \le \|\mathrm{Var}(\nabla\ell)\|_1/n∥Var(g)∥1​≤∥Var(∇ℓ)∥1​/n

Proved
DynSampleSize.Stoch.sample_mean_variance

by mikedeng1 · Oct 7, 2026 · Mathlib 0df444a (Lean v4.33.1)

mini-batchp2o-batch-pfp2bp2o-gran-per-chapterp2o-plan-paperp2o-v1stochastic-optimizationvariance

Let (Z,P)(Z,P)(Z,P) be a probability space, w∈Rmw\in\mathbb R^mw∈Rm, and ∇ℓ(w;⋅):Z→Rm\nabla\ell(w;\cdot):Z\to\mathbb R^m∇ℓ(w;⋅):Z→Rm a function with finite second moment under PPP. For a sample size n≥1n\ge1n≥1 draw a batch b=(b1,…,bn)b=(b_1,\dots,b_n)b=(b1​,…,bn​) of nnn independent points with law PPP and let g=1n∑i=1n∇ℓ(w;bi)g=\frac1n\sum_{i=1}^n\nabla\ell(w;b_i)g=n1​∑i=1n​∇ℓ(w;bi​). Then

∥Var(g)∥1  ≤  ∥Var(∇ℓ(w;⋅))∥1n,\|\mathrm{Var}(g)\|_1\;\le\;\frac{\|\mathrm{Var}(\nabla\ell(w;\cdot))\|_1}{n},∥Var(g)∥1​≤n∥Var(∇ℓ(w;⋅))∥1​​,

where for a random vector XXX, ∥Var(X)∥1=E∥X−EX∥2\|\mathrm{Var}(X)\|_1=\mathbb E\|X-\mathbb EX\|^2∥Var(X)∥1​=E∥X−EX∥2 is the sum of its componentwise variances.

This is the bound the paper reads off (3.5) on p. 12; it is what makes the noise term of the one-step estimate decay like 1/nk1/n_k1/nk​.

Formalization Note The paper's middle expression carries the finite-population factor (N−nk)/(N−1)(N-n_k)/(N-1)(N−nk​)/(N−1) of sampling without replacement from NNN points. The formalization samples with replacement (i.i.d. from PPP), the limit N→∞N\to\inftyN→∞ the paper takes on p. 5; for i.i.d. sampling the inequality holds with equality, and the inequality is what the proof uses.

Preamble
import Mathlib
import Definitions.Def_DynSampleSize_Stoch_Model

open MeasureTheory
Formal statement
namespace DynSampleSize.Stoch

/-- §4.2, p. 12 (display after "From (3.5), we note that"): for a batch `b` of `n ≥ 1` i.i.d. draws
from `P`, the variance of the batch gradient is at most the per-sample gradient variance over `n`,
`‖Var(g)‖₁ ≤ ‖Var(∇ℓ(w; i))‖₁ / n`. -/
theorem sample_mean_variance {m : ℕ} {Z : Type*} [MeasurableSpace Z] (P : Measure Z)
    [IsProbabilityMeasure P]
    (gradℓ : EuclideanSpace ℝ (Fin m) → Z → EuclideanSpace ℝ (Fin m))
    (w : EuclideanSpace ℝ (Fin m)) (hgrad : MemLp (gradℓ w) 2 P) (n : ℕ) (hn : 1 ≤ n) :
    vecVar (Measure.pi (fun _ : Fin n => P)) (batchGrad gradℓ n w) ≤
      vecVar P (gradℓ w) / n := by sorry

end DynSampleSize.Stoch
Source
Byrd, Chin, Nocedal, Wu, Sample size selection in optimization methods for machine learning, Math. Program. (2012), doi:10.1007/s10107-012-0572-5 — authors' version of 18 Oct 2011, p. 12, unnumbered display after 'From (3.5), we note that'
Human review
  • Endorsed by Shuze Chen · Oct 7, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 7, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me