Sam Babichenko

Reading notes / Lazy training and feature learning

Mean-field limits of two-layer networks

Mei et al., 2018

Context. The population risk of a two-layer network is nonconvex in the weights. Mei et al. send the number of hidden units to infinity with the 1/N1/N output normalization and follow the empirical distribution of the neurons. The risk is a convex quadratic functional of that distribution, and SGD moves it by a Wasserstein gradient flow, in which neurons are particles transported by a common potential. Mass cannot jump, so the flow can stall at stationary points that are not minima; a spread-out initial distribution or a little noise prevents that, and the number of hidden units drops out of the dynamics. Neurons move by order one, unlike the lazy regime. The companion paper of Chizat and Bach proves that noiseless limits are global minimizers under homogeneity and a support condition.

Setting. Data (x,y)∼P(x,y)\sim\mathbb P, network y^(x;θ)=1N∑i≤Nσ∗(x;θi)\hat y(x;\theta)=\frac1N\sum_{i\le N}\sigma_*(x;\theta_i) with θi∈RD\theta_i\in\mathbb R^D, square loss, and one-pass SGD with step sk=εξ(kε)s_k=\varepsilon\xi(k\varepsilon). With V(θ)=−E y σ∗(x;θ)V(\theta)=-\mathbb E\,y\,\sigma_*(x;\theta) and the positive semidefinite kernel U(θ,θ′)=E σ∗(x;θ)σ∗(x;θ′)U(\theta,\theta')=\mathbb E\,\sigma_*(x;\theta)\sigma_*(x;\theta'), the risk depends on the neurons only through their empirical measure and extends to every ρ\rho: R(ρ)=R#+2 ⁣∫ ⁣V dρ+ ⁣∬ ⁣U dρ dρ,Ψ(θ;ρ)=V(θ)+ ⁣∫ ⁣U(θ,θ′)ρ(dθ′),R(\rho)=R_\#+2\!\int\!V\,d\rho+\!\iint\!U\,d\rho\,d\rho,\qquad \Psi(\theta;\rho)=V(\theta)+\!\int\!U(\theta,\theta')\rho(d\theta'), where 2Ψ2\Psi, the first variation of RR, is the potential each neuron feels. The limit transports mass down that potential, ∂tρt=2ξ(t)∇θ⋅(ρt∇θΨ(θ;ρt))\partial_t\rho_t=2\xi(t)\nabla_\theta\cdot(\rho_t\nabla_\theta\Psi(\theta;\rho_t)), formally the Wasserstein gradient flow of RR (a reading the paper notes without proving it). Noisy SGD (weight decay λ\lambda, Gaussian noise at inverse temperature β\beta) gives the Wasserstein gradient flow of the free energy Fβ,λ(ρ)=12R(ρ)+λ2∫∥θ∥2dρ−β−1Ent(ρ)F_{\beta,\lambda}(\rho)=\frac12R(\rho)+\frac\lambda2\int\|\theta\|^2d\rho-\beta^{-1}\mathrm{Ent}(\rho), with potential Ψλ=Ψ+λ2∥θ∥2\Psi_\lambda=\Psi+\frac\lambda2\|\theta\|^2.

Statics and Theorem 3 (SGD tracks the PDE). If a minimizer ρ∗\rho_* of RR has ∫U(θ,θ)ρ∗(dθ)≤K\int U(\theta,\theta)\rho_*(d\theta)\le K, then ∣inf⁡RN−inf⁡R∣≤K/N|\inf R_N-\inf R|\le K/N, and ρ∗\rho_* is a global minimizer when supp(ρ∗)⊆arg⁡min⁡θΨ(θ;ρ∗)\mathrm{supp}(\rho_*)\subseteq\arg\min_\theta\Psi(\theta;\rho_*). Under boundedness and Lipschitz conditions, with i.i.d. initialization from ρ0\rho_0, for every ff with ∥f∥∞,∥f∥Lip≤1\|f\|_\infty,\|f\|_{\mathrm{Lip}}\le1, with probability 1−e−z21-e^{-z^2}, sup⁡k≤T/ε∣1N∑if(θik)− ⁣∫ ⁣f dρkε∣+sup⁡k≤T/ε∣RN(θk)−R(ρkε)∣≤CeCT1N∨ε (D+log⁡(N/ε)+z).\sup_{k\le T/\varepsilon}\Big|\frac1N\sum_if(\theta_i^k)-\!\int\! f\,d\rho_{k\varepsilon}\Big|+\sup_{k\le T/\varepsilon}\big|R_N(\theta^k)-R(\rho_{k\varepsilon})\big|\le Ce^{CT}\sqrt{\tfrac1N\vee\varepsilon}\,\Big(\sqrt{D+\log(N/\varepsilon)}+z\Big). So N≫DN\gg D and ε≪1/D\varepsilon\ll1/D suffice, T/ε=O(D)T/\varepsilon=O(D) samples reach PDE time TT, and the same holds for noisy SGD (β≥1\beta\ge1, λ≤1\lambda\le1, sub-Gaussian ρ0\rho_0) with the diffusion PDE.

Convergence theorems. Along the noiseless PDE R(ρt)R(\rho_t) is nonincreasing, and ρ\rho is a fixed point iff supp(ρ)⊆{∇θΨ(⋅;ρ)=0}\mathrm{supp}(\rho)\subseteq\{\nabla_\theta\Psi(\cdot;\rho)=0\}, a larger set than the minimizers. Theorem 4: with noise, under C4C^4 regularity and λ\lambda bounded above and below, Fβ,λF_{\beta,\lambda} has a unique minimizer, the Gibbs fixed point ρ∗∝exp⁡{−βΨλ(θ;ρ∗)}\rho_*\propto\exp\{-\beta\Psi_\lambda(\theta;\rho_*)\}; the flow converges to it from any ρ0\rho_0 of finite free energy, and R(ρ∗β,λ)≤inf⁡ρRλ(ρ)+K(1+λ)Dlog⁡(2+1/λ)/βR(\rho_*^{\beta,\lambda})\le\inf_\rho R_\lambda(\rho)+K(1+\lambda)D\log(2+1/\lambda)/\beta with Rλ=R+λ∫∥θ∥2dρR_\lambda=R+\lambda\int\|\theta\|^2d\rho. Theorem 5 combines this with Theorem 3: for β≥KD\beta\ge KD there is T<∞T\lt\infty, independent of NN, such that noisy SGD with N,1/ε≥C0eC0TDN,1/\varepsilon\ge C_0e^{C_0T}D has RN(θk)≤inf⁡ρRλ(ρ)+ηR_N(\theta^k)\le\inf_\rho R_\lambda(\rho)+\eta for k∈[T/ε,10T/ε]k\in[T/\varepsilon,10T/\varepsilon] with probability 1−δ1-\delta. Theorems 6 and 7 (noiseless stability): δθ∗\delta_{\theta_*} is a fixed point iff ∇V(θ∗)+∇1U(θ∗,θ∗)=0\nabla V(\theta_*)+\nabla_1U(\theta_*,\theta_*)=0; if H0=∇θ2Ψ(θ∗;δθ∗)≻0H_0=\nabla^2_\theta\Psi(\theta_*;\delta_{\theta_*})\succ0, any ρt0\rho_{t_0} supported in a small ball around θ∗\theta_* converges to it exponentially. Conversely, if ρ∗=p∗δθ∗+(1−p∗)ρ~∗\rho_*=p_*\delta_{\theta_*}+(1-p_*)\tilde\rho_* is a fixed point at which ∇2Ψ(θ∗;ρ∗)\nabla^2\Psi(\theta_*;\rho_*) is nonsingular with a negative eigenvalue and ρ~∗\tilde\rho_* sits strictly below the level Ψ(θ∗;ρ∗)\Psi(\theta_*;\rho_*) (plus a compactness condition on level sets), no ρ0\rho_0 with bounded density converges to ρ∗\rho_*.

Theorem 1 and the companion result. For two centered Gaussian classes, x∼N(0,(1±Δ)2Id)x\sim N(0,(1\pm\Delta)^2I_d) given y=±1y=\pm1, a bounded monotone piecewise-linear σ\sigma meeting explicit conditions, and any radial initialization with bounded density and d=∞d=\infty risk below 1, for all large enough dd, SGD with N≥C0dN\ge C_0d and ε∈[N−10,1/(C0d)]\varepsilon\in[N^{-10},1/(C_0d)] has RN(θk)≤inf⁡RN+ηR_N(\theta^k)\le\inf R_N+\eta for all k∈[T/ε,10T/ε]k\in[T/\varepsilon,10T/\varepsilon] with probability 1−δ1-\delta: O(d)O(d) samples, independent of NN. Theorem 2 is the same with the variances differing only on an unknown subspace of dimension γd\gamma d, so the network must find the subspace. Chizat and Bach minimize F(μ)=R(∫Φ dμ)+∫V dμF(\mu)=R(\int\Phi\,d\mu)+\int V\,d\mu over nonnegative measures, RR convex and smooth, with the lift Φ(w,θ)=w ϕ(θ)\Phi(w,\theta)=w\,\phi(\theta). If Φ,V\Phi,V are 2-homogeneous (ReLU-type) and supp(μ0)\mathrm{supp}(\mu_0) separates two spheres around the origin, or 1-homogeneous in ww (sigmoid-type) and it separates w=−r0w=-r_0 from w=r0w=r_0, then a flow that converges has a global minimizer as its limit, as do particle flows as m,t→∞m,t\to\infty in either order (Sard-type conditions omitted).

Step 1

The static problem is convex, and optimality is a condition on the potential. U⪰0U\succeq0 makes RR convex in ρ\rho, RNR_N is RR at the empirical measure, and sampling neurons i.i.d. from ρ∗\rho_* loses only the diagonal of the double sum, K/NK/N. For optimality expand R(ρ)−R(ρ∗)=2⟨Ψ(⋅;ρ∗),ρ−ρ∗⟩+⟨U,(ρ−ρ∗)⊗2⟩.R(\rho)-R(\rho_*)=2\langle\Psi(\cdot;\rho_*),\rho-\rho_*\rangle+\langle U,(\rho-\rho_*)^{\otimes2}\rangle. Moving mass tt from near a support point where Ψ\Psi is higher by Δ\Delta to arg⁡min⁡Ψ\arg\min\Psi changes the risk by −2Δt+O(t2)<0-2\Delta t+O(t^2)\lt0; conversely the support condition makes the linear term nonnegative, and the quadratic term is nonnegative by positive semidefiniteness. The gap between stationarity (∇Ψ=0\nabla\Psi=0 on the support) and optimality (Ψ\Psi minimal on the support) is the whole difficulty of the dynamics.

Step 2

SGD stays close to i.i.d. copies of a McKean-Vlasov process (propagation of chaos). Couple each neuron to the nonlinear dynamics started at the same point, θˉit=θi0−2∫0tξ(s)∇Ψ(θˉis;ρs) ds,ρs=Law(θˉis),\bar\theta_i^t=\theta_i^0-2\int_0^t\xi(s)\nabla\Psi(\bar\theta_i^s;\rho_s)\,ds,\qquad \rho_s=\mathrm{Law}(\bar\theta_i^s), which exists and is unique by Sznitman's theorem and makes the θˉi\bar\theta_i i.i.d. with law solving the PDE. The gap comes from time discretization (order ε\varepsilon), a martingale (order ε(D+log⁡N+z)\sqrt\varepsilon(\sqrt D+\sqrt{\log N}+z), by Azuma-Hoeffding) and the empirical measure in the drift, which costs the average coupling distance over the other neurons plus an i.i.d. fluctuation of order (D+log⁡N)/N\sqrt{(D+\log N)/N}, since ∇1U\nabla_1U is bounded. Grönwall on the maximal deviation closes the argument and is where eCTe^{CT} comes from.

Step 3

The PDE descends the risk, and its stationary points carry no current. By the weak form of the PDE, ddtR(ρt)=−4ξ(t)∫∥∇θΨ(θ;ρt)∥2ρt(dθ),\frac{d}{dt}R(\rho_t)=-4\xi(t)\int\|\nabla_\theta\Psi(\theta;\rho_t)\|^2\rho_t(d\theta), so the risk is monotone and a fixed point is a measure supported on critical points of its own potential. If Ψ(⋅;ρ)\Psi(\cdot;\rho) has a deeper valley where ρ\rho has no mass, transport cannot reach it, and ρ\rho is stationary without being optimal.

Step 4

With noise the free energy is strictly convex, so the flow has a unique limit. Entropy makes Fβ,λF_{\beta,\lambda} strictly convex, with the Gibbs equation as first-order condition, and the diffusion PDE dissipates it, ddtFβ,λ(ρt)=−2ξ(t)∫∥∇θ(Ψλ(θ;ρt)+β−1log⁡ρt(θ))∥2ρt(dθ),\frac{d}{dt}F_{\beta,\lambda}(\rho_t)=-2\xi(t)\int\big\|\nabla_\theta\big(\Psi_\lambda(\theta;\rho_t)+\beta^{-1}\log\rho_t(\theta)\big)\big\|^2\rho_t(d\theta), so the dissipation vanishes along a sequence, tightness gives a limit point with a density, and there βΨλ+log⁡ρ\beta\Psi_\lambda+\log\rho is constant, which makes it the unique Gibbs measure. The temperature cost comes from smoothing: convolving a near-optimal ρ\rho with N(0,τ2I)N(0,\tau^2I) raises RR by O(τ2D)O(\tau^2D) while its entropy is at least D2log⁡(2πeτ2)\frac D2\log(2\pi e\tau^2), and at τ=1/β\tau=1/\beta the log⁡β\log\beta terms cancel against the entropy upper bound, leaving O(Dlog⁡(1/λ)/β)O(D\log(1/\lambda)/\beta). No rate in tt comes out; the relevant log-Sobolev constant can be exponentially small in DD, suggesting T=eO(D)log⁡(1/η)T=e^{O(D)}\log(1/\eta).

Step 5 (Theorems 6 and 7)

Without noise, a stable atom attracts, and a saddle cannot be reached from a bounded density. For stability, test against φ2=12∥θ−θ∗∥2\varphi_2=\frac12\|\theta-\theta_*\|^2: for ρ\rho supported in a small ball the positive Hessian gives ∫⟨θ−θ∗,∇Ψ(θ;ρ)⟩dρ≥λ2∫∥θ−θ∗∥2dρ\int\langle\theta-\theta_*,\nabla\Psi(\theta;\rho)\rangle d\rho\ge\frac\lambda2\int\|\theta-\theta_*\|^2d\rho, so ⟨φ2,ρt⟩\langle\varphi_2,\rho_t\rangle decays exponentially, and a second test function keeps the support inside the ball. At a nondegenerate saddle the characteristics expand along the negative eigendirection, so mass converging to θ∗\theta_* must start near a codimension-one stable set, and a bounded density puts too little mass in a thin slab around it to deliver the atom p∗p_*. This is why the examples assume bounded densities: they exclude initializations sitting exactly on saddles.

Step 6

In the Gaussian example symmetry reduces the PDE to one dimension, and at d=∞d=\infty the risk depends on two numbers. The PDE preserves rotation invariance (which no finite set of neurons has), so ρt\rho_t is determined by the law of r=∥w∥r=\|w\|. As d→∞d\to\infty independent uniform directions are orthogonal, so each class output concentrates at ⟨q±,ρ⟩\langle q_\pm,\rho\rangle, q±(r)=Eσ((1±Δ)rG)q_\pm(r)=\mathbb E\sigma((1\pm\Delta)rG), and the risk is a sum of squares of the class residuals λ±\lambda_\pm. The radial force factors, ∂rψ∞(r;ρ)=λ+q+′(r)+λ−q−′(r)=λ−q+′(r)[λ+λ−+Z(r)],Z=q−′/q+′ increasing,\partial_r\psi_\infty(r;\rho)=\lambda_+q_+'(r)+\lambda_-q_-'(r)=\lambda_-q_+'(r)\Big[\frac{\lambda_+}{\lambda_-}+Z(r)\Big],\qquad Z=q_-'/q_+'\ \text{increasing}, so it changes sign at most once, and the signs of (λ+,λ−)(\lambda_+,\lambda_-) determine the outcome: equal signs leave only stationary points with risk at least 1, never reached from below 1; one mixed sign traps mass at δr∗\delta_{r_*}, the global minimizer when Δ<Δ∞\Delta\lt\Delta_\infty; the other puts δr∗\delta_{r_*} at a maximum of the potential, which Step 5 rules out. For Δ≥Δ∞\Delta\ge\Delta_\infty the limit has zero risk, and finite dd follows by continuity of the PDE in (V,U)(V,U) and Theorem 3.

Step 7 (Chizat and Bach)

Homogeneity plus spread initialization turns stationary limits into global minima. A limit ν\nu has F′(ν)=0F'(\nu)=0 on its support; optimality needs F′(ν)≥0F'(\nu)\ge0 everywhere. If F′(ν)F'(\nu) is negative somewhere, take a negative regular value −η-\eta of its restriction to the sphere: near ν\nu the cone over that sublevel set is invariant and, by 2-homogeneity, the radial velocity there is at least ηr\eta r, so ∣ut∣≥∣u0∣eηt|u_t|\ge|u_0|e^{\eta t} and any mass in the cone grows exponentially and pushes the flow out of every neighborhood of ν\nu. The support condition keeps mass in every cone: by a topological degree argument, if supp(μ0)\mathrm{supp}(\mu_0) separates two spheres then so does supp(μt)\mathrm{supp}(\mu_t) (in the 1-homogeneous case the sets separated are w=±r0w=\pm r_0, and the mass in the cone grows at least linearly instead of exponentially). So a convergent flow cannot converge to a non-optimal point; the result gives no rate but needs no noise. In the experiments particle gradient descent needs only slightly more particles than the sparsest minimizer (for a 4-neuron ReLU teacher in d=2d=2, 5 fail and 10 succeed).

Consequences and limits. With 1/N1/N normalization the number of hidden units is not a parameter of the dynamics: once N≫DN\gg D, SGD follows a PDE with a convex risk landscape, independent of NN, and O(D)O(D) samples reach any fixed PDE time. Global convergence needs entropy (at a temperature cost of order D/βD/\beta against the penalized risk inf⁡Rλ\inf R_\lambda), symmetry, or homogeneity with a support condition. The main limit is time: the error bound grows like eCTe^{CT}, so the approximation helps only when the PDE converges in bounded time, and that time is uncontrolled (heuristically eO(D)e^{O(D)}). The noiseless global results assume convergence or use symmetric models with tailored activations, and everything is for one hidden layer with 1/N1/N scaling, which Yang and Hu (next) place in a larger space of abc-parametrizations.

Terms

R(ρ)R(\rho)
R#+2∫V dρ+∬U dρ dρR_\#+2\int V\,d\rho+\iint U\,d\rho\,d\rho; convex in ρ\rho since U⪰0U\succeq0
Ψ(θ;ρ)\Psi(\theta;\rho)
V(θ)+∫U(θ,θ′)ρ(dθ′)V(\theta)+\int U(\theta,\theta')\rho(d\theta'): half the first variation of RR, the potential each neuron feels
Distributional dynamics
∂tρt=2ξ(t)∇⋅(ρt∇Ψ(θ;ρt))\partial_t\rho_t=2\xi(t)\nabla\cdot(\rho_t\nabla\Psi(\theta;\rho_t)), the W2W_2 gradient flow of RR
Fixed point vs minimizer
supp ⊆{∇Ψ=0}\subseteq\{\nabla\Psi=0\} versus supp ⊆arg⁡min⁡Ψ\subseteq\arg\min\Psi
Propagation of chaos
each neuron stays close to an i.i.d. McKean-Vlasov copy with the same start
Fβ,λF_{\beta,\lambda}
12R+λ2∫∥θ∥2dρ−β−1Ent\frac12R+\frac\lambda2\int\|\theta\|^2d\rho-\beta^{-1}\mathrm{Ent}; strictly convex, unique Gibbs minimizer
Temperature cost
R(ρ∗β,λ)≤inf⁡Rλ+K(1+λ)Dlog⁡(2+1/λ)/βR(\rho_*^{\beta,\lambda})\le\inf R_\lambda+K(1+\lambda)D\log(2+1/\lambda)/\beta
λ±\lambda_\pm
class residuals at d=∞d=\infty in the Gaussian example; their signs classify fixed points
Separation condition
supp(μ0)\mathrm{supp}(\mu_0) separates two spheres (2-homog.) or w=±r0w=\pm r_0 (1-homog.)
Optimality in M+\mathcal M_+
F′(μ)≥0F'(\mu)\ge0 everywhere and =0=0 on the support

Quiz

  1. In the proof of Theorem 3, what controls the error from replacing the empirical measure of the neurons by ρkε\rho_{k\varepsilon} in each neuron's drift?
  2. What does the temperature cost in Theorem 4, and where does the D/βD/\beta come from?
  3. Why do Theorems 1 and 7 assume the initialization has a bounded density?
  4. Theorem 3's error bound carries a factor CeCTCe^{CT}. What does that imply about using the PDE to analyze SGD?

Sources