Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

MLP: fluctuation of the second-layer metric (eq. 4.40)

Proved
DeepLearningTheory.mlp_metric_fluctuation_two_point

by LG · Sep 23, 2026 · Mathlib 0df444a (Lean v4.33.1)

deep-learning-theorymachine-learningprobability

For an MLP at initialization with a measurable activation σ\sigmaσ of polynomial growth and n1≥1n_1\ge1n1​≥1, let

ΔG^α1α2(2)=CW(2) 1n1∑j=1n1(σj;α1(1)σj;α2(1)−⟨σα1σα2⟩G(1)),σj;α(1)=σ(zj;α(1)),\widehat{\Delta G}^{(2)}_{\alpha_1\alpha_2}=C_W^{(2)}\,\frac1{n_1}\sum_{j=1}^{n_1}\Big(\sigma^{(1)}_{j;\alpha_1}\sigma^{(1)}_{j;\alpha_2}-\langle\sigma_{\alpha_1}\sigma_{\alpha_2}\rangle_{G^{(1)}}\Big),\qquad\sigma^{(1)}_{j;\alpha}=\sigma\big(z^{(1)}_{j;\alpha}\big),ΔGα1​α2​(2)​=CW(2)​n1​1​j=1∑n1​​(σj;α1​(1)​σj;α2​(1)​−⟨σα1​​σα2​​⟩G(1)​),σj;α(1)​=σ(zj;α(1)​),

be the fluctuation of the stochastic second-layer metric around its mean. Then for inputs xα1,…,xα4x_{\alpha_1},\dots,x_{\alpha_4}xα1​​,…,xα4​​,

E[ΔG^α1α2(2)ΔG^α3α4(2)]=1n1(CW(2))2[⟨σα1σα2σα3σα4⟩G(1)−⟨σα1σα2⟩G(1)⟨σα3σα4⟩G(1)]=1n1V(α1α2)(α3α4)(2).\mathbb{E}\Big[\widehat{\Delta G}^{(2)}_{\alpha_1\alpha_2}\widehat{\Delta G}^{(2)}_{\alpha_3\alpha_4}\Big]=\frac1{n_1}\big(C_W^{(2)}\big)^2\Big[\langle\sigma_{\alpha_1}\sigma_{\alpha_2}\sigma_{\alpha_3}\sigma_{\alpha_4}\rangle_{G^{(1)}}-\langle\sigma_{\alpha_1}\sigma_{\alpha_2}\rangle_{G^{(1)}}\langle\sigma_{\alpha_3}\sigma_{\alpha_4}\rangle_{G^{(1)}}\Big]=\frac1{n_1}V^{(2)}_{(\alpha_1\alpha_2)(\alpha_3\alpha_4)}.E[ΔGα1​α2​(2)​ΔGα3​α4​(2)​]=n1​1​(CW(2)​)2[⟨σα1​​σα2​​σα3​​σα4​​⟩G(1)​−⟨σα1​​σα2​​⟩G(1)​⟨σα3​​σα4​​⟩G(1)​]=n1​1​V(α1​α2​)(α3​α4​)(2)​.
Preamble
import Mathlib
import Definitions.Def_DLT_DeepLinearNetwork
import Definitions.Def_DLT_MLPInit

open MeasureTheory ProbabilityTheory
open scoped NNReal
Formal statement
namespace DeepLearningTheory

theorem mlp_metric_fluctuation_two_point {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω)
    [IsProbabilityMeasure P] (n : ℕ → ℕ) (Cb CW : ℕ → ℝ≥0) (σ : ℝ → ℝ)
    (b : Ω → ℕ → ℕ → ℝ) (W : Ω → ℕ → ℕ → ℕ → ℝ) (hinit : IsMLPInit P n Cb CW b W)
    (hσm : Measurable σ) (hσ : HasPolyGrowth σ) (hn₁ : 0 < n 1) (x : Fin 4 → ℕ → ℝ) :
    ∫ ω, ((CW 2 : ℝ) * (1 / (n 1 : ℝ)) * ∑ j ∈ Finset.range (n 1),
          (σ (mlpPreact n σ (b ω) (W ω) (x 0) 1 j) * σ (mlpPreact n σ (b ω) (W ω) (x 1) 1 j)
            - gaussAvg (firstLayerMetric (Cb 1) (CW 1) (n 0) x) (fun u => σ (u 0) * σ (u 1)))) *
        ((CW 2 : ℝ) * (1 / (n 1 : ℝ)) * ∑ j ∈ Finset.range (n 1),
          (σ (mlpPreact n σ (b ω) (W ω) (x 2) 1 j) * σ (mlpPreact n σ (b ω) (W ω) (x 3) 1 j)
            - gaussAvg (firstLayerMetric (Cb 1) (CW 1) (n 0) x) (fun u => σ (u 2) * σ (u 3)))) ∂P
      = (1 / (n 1 : ℝ)) * (CW 2 : ℝ) ^ 2 *
          (gaussAvg (firstLayerMetric (Cb 1) (CW 1) (n 0) x)
              (fun u => σ (u 0) * σ (u 1) * σ (u 2) * σ (u 3))
            - gaussAvg (firstLayerMetric (Cb 1) (CW 1) (n 0) x) (fun u => σ (u 0) * σ (u 1)) *
              gaussAvg (firstLayerMetric (Cb 1) (CW 1) (n 0) x) (fun u => σ (u 2) * σ (u 3))) := by sorry

end DeepLearningTheory
Source
Daniel A. Roberts and Sho Yaida (with Boris Hanin), *The Principles of Deep Learning Theory*, arXiv:2106.10165v2, https://arxiv.org/abs/2106.10165, §4.2, p. 81, eqs. (4.36)–(4.40) (page numbers are the book's printed page numbers)
Read-back

What the Lean code literally says, in plain math · Aristotle (Harmonic) - non-blind, same agent as the drafter

Non-blind read-back. This read-back was written by the same agent that drafted the Lean statement, with full knowledge of the source text and of the intended meaning. It is not independent testimony and must not be mistaken for a blind audit; reviewers should compare the Lean code against the source themselves.

Let (Ω,P)(\Omega,P)(Ω,P) be a probability space, n:N→Nn:\mathbb{N}\to\mathbb{N}n:N→N widths, Cb,CW:N→R≥0C_b,C_W:\mathbb{N}\to\mathbb{R}_{\ge0}Cb​,CW​:N→R≥0​, σ:R→R\sigma:\mathbb{R}\to\mathbb{R}σ:R→R any function, and b,Wb,Wb,W random bias/weight fields satisfying IsMLPInit (all biases bi(ℓ)b^{(\ell)}_ibi(ℓ)​ and weights Wij(ℓ)W^{(\ell)}_{ij}Wij(ℓ)​ with ℓ≥1\ell\ge1ℓ≥1, i<nℓi<n_\elli<nℓ​, j<nℓ−1j<n_{\ell-1}j<nℓ−1​ mutually independent; bi(ℓ)∼N(0,Cb(ℓ))b^{(\ell)}_i\sim\mathcal{N}(0,C_b^{(\ell)})bi(ℓ)​∼N(0,Cb(ℓ)​), Wij(ℓ)∼N(0,CW(ℓ)/nℓ−1)W^{(\ell)}_{ij}\sim\mathcal{N}(0,C_W^{(\ell)}/n_{\ell-1})Wij(ℓ)​∼N(0,CW(ℓ)​/nℓ−1​)). Write zi(ℓ)(x)z^{(\ell)}_i(x)zi(ℓ)​(x) for the MLP preactivation at (b(ω),W(ω))(b(\omega),W(\omega))(b(ω),W(ω)) and G(1)G^{(1)}G(1) for the first-layer metric Gαβ(1)=Cb(1)+CW(1)1n0∑j<n0xα(j)xβ(j)G^{(1)}_{\alpha\beta}=C_b^{(1)}+C_W^{(1)}\frac1{n_0}\sum_{j<n_0}x_\alpha(j)x_\beta(j)Gαβ(1)​=Cb(1)​+CW(1)​n0​1​∑j<n0​​xα​(j)xβ​(j) of the listed inputs. Assume moreover that σ\sigmaσ is measurable and has polynomial growth (∣σ(u)∣≤C(1+∣u∣)k|\sigma(u)|\le C(1+|u|)^k∣σ(u)∣≤C(1+∣u∣)k). Assume n1>0n_1>0n1​>0. For four inputs x0,…,x3x_0,\dots,x_3x0​,…,x3​ with 4×44\times44×4 first-layer metric G(1)G^{(1)}G(1), define for a,c∈{0,1,2,3}a,c\in\{0,1,2,3\}a,c∈{0,1,2,3} the random variable Δac=CW(2)1n1∑j<n1(σ(zj(1)(xa))σ(zj(1)(xc))−⟨σ(ua)σ(uc)⟩G(1))\Delta_{ac}=C_W^{(2)}\frac1{n_1}\sum_{j<n_1}\big(\sigma(z^{(1)}_j(x_a))\sigma(z^{(1)}_j(x_c))-\langle\sigma(u_a)\sigma(u_c)\rangle_{G^{(1)}}\big)Δac​=CW(2)​n1​1​∑j<n1​​(σ(zj(1)​(xa​))σ(zj(1)​(xc​))−⟨σ(ua​)σ(uc​)⟩G(1)​). Then ∫Δ01Δ23 dP=1n1(CW(2))2(⟨σ(u0)σ(u1)σ(u2)σ(u3)⟩G(1)−⟨σ(u0)σ(u1)⟩G(1)⟨σ(u2)σ(u3)⟩G(1))\int\Delta_{01}\Delta_{23}\,dP=\frac1{n_1}(C_W^{(2)})^2\big(\langle\sigma(u_0)\sigma(u_1)\sigma(u_2)\sigma(u_3)\rangle_{G^{(1)}}-\langle\sigma(u_0)\sigma(u_1)\rangle_{G^{(1)}}\langle\sigma(u_2)\sigma(u_3)\rangle_{G^{(1)}}\big)∫Δ01​Δ23​dP=n1​1​(CW(2)​)2(⟨σ(u0​)σ(u1​)σ(u2​)σ(u3​)⟩G(1)​−⟨σ(u0​)σ(u1​)⟩G(1)​⟨σ(u2​)σ(u3​)⟩G(1)​). Here ⟨F⟩G(1)\langle F\rangle_{G^{(1)}}⟨F⟩G(1)​ is the integral of FFF against Mathlib's centered multivariate Gaussian with covariance matrix G(1)G^{(1)}G(1) (the inputs may repeat, so G(1)G^{(1)}G(1) may be singular).

Human review
  • Endorsed by Shuze Chen · Sep 24, 2026

    Confirmed by the moderator at approval.

  • Endorsed by LG · Sep 24, 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