Finite-width statistics at a single input: , , ,
DefinitionLesHouchesWidth_FiniteWidthFinite-width statistics of a Gaussian-initialized network at a single input (Lecture 4).
For the network with Gaussian initialization of Mission I, a single input , constants and nonlinearity :
- (
gaussAvg). for of variables is taken against i.i.d. coordinates (gaussAvgVec). - (
gaussVarSq). - (
chiParallel), so that . - is polynomially bounded if (
PolyBounded). - (
kappa4) and (dressedTwoPoint). - as a function of the layer- preactivation vector (
collectiveSigma).
Formalization Note Variances are treated as by gaussAvg. chiParallel uses Mathlib's deriv, which is where the map is not differentiable.
import Mathlib
import Definitions.Def_LesHouchesWidth_GaussianMLP
/-!
# Finite-width statistics at a single input (Les Houches lectures, Lecture 4)
Definitions used in Lecture 4 (Sections 4.2, 4.7–4.10) of arXiv:2309.01592v3, for the network
`mlpZ` with Gaussian initialization (eq. (119)) evaluated at a single input `x`.
-/
namespace LesHouchesWidth
open MeasureTheory ProbabilityTheory
/-- `⟨f⟩_K = ∫ f(z) exp(-z²/(2K)) dz / √(2πK)`, the average of `f` against the centered
Gaussian of variance `K` (Section 4.2). -/
noncomputable def gaussAvg (K : ℝ) (f : ℝ → ℝ) : ℝ :=
∫ t, f t ∂(gaussianReal 0 K.toNNReal)
/-- `⟨g⟩_K` for a function of `m` variables, averaged against `m` i.i.d. centered Gaussians of
variance `K` (the Gaussian with covariance `K · I_m`). -/
noncomputable def gaussAvgVec (m : ℕ) (K : ℝ) (g : (Fin m → ℝ) → ℝ) : ℝ :=
∫ y, g y ∂(Measure.pi fun _ : Fin m => gaussianReal 0 K.toNNReal)
/-- `Var_K[σ²] = ⟨σ⁴⟩_K - ⟨σ²⟩_K²`. -/
noncomputable def gaussVarSq (σ : ℝ → ℝ) (K : ℝ) : ℝ :=
gaussAvg K (fun t => σ t ^ 4) - gaussAvg K (fun t => σ t ^ 2) ^ 2
/-- The parallel susceptibility `χ_∥(K) = C_W ∂_K ⟨σ²⟩_K = ∂K^{(ℓ+1)}/∂K^{(ℓ)}` (Theorem 4.1). -/
noncomputable def chiParallel (CW : ℝ) (σ : ℝ → ℝ) (K : ℝ) : ℝ :=
CW * deriv (fun K' => gaussAvg K' (fun t => σ t ^ 2)) K
/-- `σ` is polynomially bounded: `|σ(t)| ≤ C (1 + |t|^k)` for some `C`, `k`. -/
def PolyBounded (σ : ℝ → ℝ) : Prop :=
∃ C : ℝ, ∃ k : ℕ, ∀ t, |σ t| ≤ C * (1 + |t| ^ k)
/-- The normalized connected four-point function of neuron `i` in layer `ℓ` at input `x`
(Section 4.8): `κ₄^{(ℓ)} = (1/3) (E[(z^{(ℓ)}_i)⁴] - 3 E[(z^{(ℓ)}_i)²]²)`. -/
noncomputable def kappa4 (Cb CW : ℝ) (σ : ℝ → ℝ) (n : ℕ → ℕ) (L : ℕ) (x : Fin (n 0) → ℝ)
(ℓ : ℕ) (i : Fin (n ℓ)) : ℝ :=
(1 / 3) * (∫ θ, (mlpZ Cb CW σ θ x ℓ i) ^ 4 ∂(stdGaussianParams n L) -
3 * (∫ θ, (mlpZ Cb CW σ θ x ℓ i) ^ 2 ∂(stdGaussianParams n L)) ^ 2)
/-- The dressed two-point function `G^{(ℓ)} = E[(z^{(ℓ)}_i)²]` (Theorem 4.2). -/
noncomputable def dressedTwoPoint (Cb CW : ℝ) (σ : ℝ → ℝ) (n : ℕ → ℕ) (L : ℕ)
(x : Fin (n 0) → ℝ) (ℓ : ℕ) (i : Fin (n ℓ)) : ℝ :=
∫ θ, (mlpZ Cb CW σ θ x ℓ i) ^ 2 ∂(stdGaussianParams n L)
/-- The collective observable `Σ^{(ℓ)} = C_b + (C_W / n_ℓ) ∑_j σ(z^{(ℓ)}_j)²` (Lemma 4.4). -/
noncomputable def collectiveSigma (Cb CW : ℝ) (σ : ℝ → ℝ) (n : ℕ → ℕ) (ℓ : ℕ)
(z : Fin (n ℓ) → ℝ) : ℝ :=
Cb + CW / (n ℓ : ℝ) * ∑ j, σ (z j) ^ 2
end LesHouchesWidth
Read-back
What the Lean code literally says, in plain math · Aristotle (Harmonic) - non-blind, same agent as drafter
Non-blind read-back. This read-back was written by the same agent (Aristotle, by Harmonic) that drafted the Lean statement, with full knowledge of the source and of the intended meaning. It is not independent testimony and should not be treated as a blind audit; an independent read-back is still recommended before launch.
The file imports the Gaussian-initialized network of Def_LesHouchesWidth_GaussianMLP and defines, in namespace LesHouchesWidth:
gaussAvg K f, the average of under the centered normal law with variance . It is the point mass at if , and the value is if is not integrable.gaussAvgVec m K gfor .gaussVarSq σ K.chiParallel CW σ K, using Mathlib'sderiv, which is if the map is not differentiable at . For the function is constant on .PolyBounded σ: there exist a real and a natural number with for all real .kappa4 Cb CW σ n L x ℓ i. HeremlpZ Cb CW σ θ x ℓand is i.i.d. standard normal. For this is computed from the deterministic input. Non-integrable integrands contribute .dressedTwoPoint Cb CW σ n L x ℓ i.collectiveSigma Cb CW σ n ℓ zfor a vector , with read as .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.