Share
Embed
Taiji Suzuki (University of Tokyo, Japan) Convergence of mean field Langevin dynamics and its application to neural network featureย learning
WORKSHOP ON OPTIMAL TRANSPORT
FROM THEORY TO APPLICATIONS
INTERFACING DYNAMICAL SYSTEMS, OPTIMIZATION, AND MACHINE LEARNING
Venue: Humboldt University of Berlin, Dorotheenstraรe 24
Berlin, Germany. March 11th - 15th, 2024
Jia-Jie Zhu
March 27, 2024
Transcript
44 slides
-
Convergence of mean field Langevin dynamics and its application to
neural network feature learning 1 Taiji Suzuki The University of Tokyo / AIP-RIKEN 15th/Mar/2024 Workshop on Optimal Transport, Berlin (Deep learning theory team) -
Outline of this talk 2 Convex โข ๐น is convex:
โข Entropy regularization: Application: Training 2-layer NN in mean field regime. [Convergence] โข We introduce mean field Langevin dynamics (MFLD) to minimize โ. โข We show its linear convergence under a log-Sobolev inequality condition. [Generalization error analysis] โข A generalization error analysis of 2-layer NN trained by MFLD is given. โข Separation from kernel methods is shown. -
Feature learning of NN 3 Benefit of feature learning with
optimization guarantee. โข [Computation] Suzuki, Wu, Nitanda: โConvergence of mean-field Langevin dynamics: Time and space discretization, stochastic gradient, and variance reduction.โ NeurIPS2023. โข [Generalization] โข Suzuki, Wu, Oko, Nitanda: โFeature learning via mean-field Langevin dynamics: Classifying sparse parities and beyond.โ NeurIPS2023. โข Nitanda, Oko, Suzuki, Wu: โAnisotropy helps: improved statistical and computational complexity of the mean-field Langevin dynamics under structured data.โ ICLR2024. Especially, we compare the generalization error between neural networks and kernel methods. Trade-off: Statistical complexity vs computational complexity Feature learning Optimization Neural network โ Non-convex Kernel method ร Convex -
Collaborators 4 Denny Wu (NYU/Flatiron Institute) Atsushi Nitanda (A*STAR) Kazusato
Oko (The University of Tokyo/ RIKEN-AIP) -
Noisy gradient descent 5 Noise Gradient descent Optimization of neural
network is basically non-convex. โข Noisy gradient descent (e.g., SGD) is effective for non- convex optimization. Noisy perturbation is helpful to escape a local minimum. โข Likely converges to a flat global minimum. -
Gradient Langevin Dynamics (GLD)6 (Gradient Langevin dynamics) (Non-convex) (Euler-Maruyama scheme)
Discretization [Gelfand and Mitter (1991); Borkar and Mitter (1999); Welling and Teh (2011)] Stationary distribution: Can stay around the global minimum of ๐น(๐ฅ). Regularized loss: -
GLD as a Wasserstein gradient flow7 : Distribution of ๐๐ก
(we can assume it has a density) PDE that describes ๐๐กโs dynamics [Fokker-Planck equation]: [linear w.r.t. ๐] = Stationary distribution This is the Wasserstein gradient flow to minimize the following objective: c.f., Donsker-Varadan duality formula โ -
2-layer NN in mean-field scaling 8 โข 2-layer neural network:
Non-linear with respect to parameters ๐ ๐ , ๐ค๐ ๐=1 ๐ . where ๐(๐) = ๐๐ , ๐ค๐ and Regularized empirical risk: Non-convex Loss L2 regularization -
Noisy gradient descent 9 Noisy gradient descent update (GLD): Does
it converge? Naรฏve application of existing theory in gradient Langevin dynamics yields iteration complexity to achieve ๐ error. โ Cannot be applied to wide neural network. [Raginsky, Rakhlin and Telgarsky, 2017; Xu, Chen, Zou, and Gu, 2018; Erdogdu, Mackey and Shamir, 2018; Vempala and Wibisono, 2019] โ -
Mean field limit 10 Loss function (empirical risk + regularization):
๐ โ โ โฆ โ Mean field limit: Non-linear with respect to the parameters ๐๐ , ๐ค๐ ๐=1 ๐ . Convex w.r.t. ๐ if the loss โ๐ is convex (e.g., squared / logistic loss). [Nitanda&Suzuki, 2017][Chizat&Bach, 2018][Mei, Montanari&Nguyen, 2018][Rotskoff&Vanden-Eijnden, 2018] Linear with respect to ๐. -
General form of mean field LD 11 โข SDE the
Fokker-Planck equation of which corresponds to the Wasserstein GF: ๐น Gradient convex strictly convex = strictly convex + Mean field Langevin dynamics: The first variation ๐ฟ๐น ๐ฟ๐ : ๐ซ ร โ๐ โ โ is defined as a continuous functional such as Definition (first variation) GLD: , โข โข -
MF-LD to optimize mean field NN 12 Loss function: (distribution
of ๐๐ ) Neuron โ๐ฅ (โ ) ๐ฅ Discrete time MFLD: -
Proximal Gibbs measure 13 ๐น Gradient Minimizer Proximal Gibbs measure
โขThe proximal Gibbs measure is a kind of โtentativeโ target. โขIt plays important role in the convergence analysis. Linearized objective at ๐: -
Convergence rate 14 Proximal Gibbs measure: Theorem (Linear convergence) [Nitanda,
Wu, Suzuki (AISTATS2022)][Chizat (2022)] Assumption (Log-Sobolev inequality) KL-div Fisher-div There exists ๐ผ > 0 such that for any probability measure ๐ (abs. cont. w.r.t. ๐๐), If ๐๐๐ก satisfies the LSI condition for any ๐ก โฅ 0, then This is a non-linear extension of well known GLD convergence analysis. c.f., Polyak-Lojasiewicz condition ๐ ๐ฅ โ ๐ ๐ฅโ โค ๐ถ ๐ป๐ ๐ฅ 2 The rate of convergence is characterized by LSI constant -
Log-Sobolev inequality 15 L2-regularized loss function for mean field 2-layer
NN: Proximal Gibbs: If sup ๐ง โ๐ โฒ ๐๐ (โ ) โ๐ฅ (โ ) โค ๐ต, the proximal Gibbs measure ๐๐ satisfies the LSI with a constant ๐ผ with โต Bakry-Emery criterion (1985) and Holley-Strook bounded perturbation lemma (1987) Bounded (โค ๐ต) Strongly convex where Gaussian Bounded perturbation -
We have obtained a convergence of infinite width and continuous
time dynamics. Question: Can we evaluate a finite particles & discrete time approximation errors? 17 (distribution of ๐๐ก) Neuron ๐ฅ (vector field) (Finite particle approximation) -
Difficulty โข SDE of interacting particles (McKean, Kac,โฆ, 60โ) 18
๐ก = 1 ๐ก = 2 ๐ก = 3 ๐ก = 4 Finite particle approximation error can be amplified through time. โ It is difficult to bound the perturbation uniformly over time. The particles behave as if they are independent as the number of particles increases to infinity. Propagation of chaos [Sznitman, 1991; Lacker, 2021]: โข A naรฏve evaluation gives exponential growth on time: โข Weak interaction/Strong regularization in existing work exp ๐ก /๐ [Mei et al. (2018, Theorem 3)] -
Practical algorithm 19 โข Time discretization: ๐ก โ ๐๐ (๐:
step size, ๐: # of steps) โข Space discretization: ๐๐ก is approximatd by ๐ particles โข Stochastic gradient: ๐ป ๐ฟ๐น ๐ ๐ฟ๐ โ ๐ฃ๐ ๐ ๐๐ก โ เท ๐๐ = 1 ๐ โ๐ฟ ๐ ๐ (๐) where and (stochastic gradient) (space discretization) (time discretization) โข Noisy gradient descent on 2-layer NN with finite width. ๐ particles ๐ ๐ ๐ ๐=1 ๐ -
Convergence analysis 20 Time discr. Space discr. Stochastic approx. Under
smoothness and boundedness of the loss function, it holds that Suppose that ๐๐ satisfies log-Sobolev inequality with a constant ๐ผ. Theorem (One-step update) [Suzuki, Wu, Nitanda (2023)] : proximal Gibbs measure 1. ๐น: ๐ซ โ โ is convex and has a form of ๐ญ ๐ = ๐ณ ๐ + ๐๐ ๐ผ๐ ๐ ๐ . 2. (smoothness) ๐ป๐ฟ๐ฟ ๐ ๐ฟ๐ ๐ฅ โ๐ป๐ฟ๐ฟ ๐ ๐ฟ๐ ๐ฆ โค ๐ถ(๐2 ๐, ๐ + ๐ฅ โ ๐ฆ ) and (boundedness) ๐ป๐ฟ๐ฟ ๐ ๐ฟ๐ ๐ฅ โค ๐ . Assumption: (+ second order differentiability) Naรฏve bound: [Suzuki, Wu, Nitanda: Convergence of mean-field Langevin dynamics: Time and space discretization, stochastic gradient, and variance reduction. arXiv:2306.07221] ๐(๐/๐ด) -
Uniform log-Sobolev inequality 21 ๐ ๐ (1) ๐ ๐ (2)
๐ ๐ (๐) ๐ณ๐ = ๐ ๐ ๐ ๐=1 ๐ โผ ๐ ๐ ๐ : Joint distribution of ๐ particles. Potential of the joint distribution ๐ ๐ (๐ด) on โ๐ ร๐ด : where (Fisher divergence) where โข The finite particle dynamics is the Wasserstein gradient flow that minimizes . (Approximate) Uniform log-Sobolev inequality [Chen et al. 2022] Recall [Chen, Ren, Wang. Uniform-in-time propagation of chaos for mean field Langevin dynamics. arXiv:2212.03050, 2022.] For any ๐ด, Reference -
Computational complexity 22 Time discr. Space discr. Stochastic approx. SG-MFLD
Iteration complexity: to achieve ๐ + ๐(1/(๐2 ๐ผ๐)) accuracy. By setting , the iteration complexity becomes โข ๐ต = 1/(๐2 ๐ผ๐) is the optimal mini-batch size. โ ๐ = ๐ ฮค log ๐โ1 ๐ . (finite sum), (stochastic gradient) (Mini-batch size = ๐ต) โขApproximation errors are uniform in time. โขNo exponential dependency on ๐ด (number of neurons). -
Numerical experiment 23 Test error v.s. Number of steps (regularization
term: ๐ ๐ฅ = ๐ฅ 2) ๐ โ โ -
Generalization error analysis So far, we have obtained convergence of
MFLD. โ How effective is the feature learning of MFLD in terms of generalization error? 25 โข Benefit of feature learning? Neural network vs Kernel method (NTK vs mean field) -
Classification task 26 Problem setting (classification): โขLogistic loss: โ ๐ฆ๐
= log(1 + exp(โ๐ฆ๐)) โขtanh activation: โ๐ฅ ๐ง = เดค ๐ โ [tanh ๐ฅ1 , ๐ง + ๐ฅ2 + 2 โ tanh ๐ฅ3 ]/3 Loss function and model: (+1) (-1) -
Assumptions There exists ๐โ such that 1. KL ๐, ๐โ
โค ๐ , 2. ๐๐๐โ ๐ โฅ ๐0 for some constants ๐ , ๐0 > 0. 27 Assumption where ๐ = ๐(0, ๐/(2๐1 )). Objective of MFLD: The Bayes classifier is attained by ๐โ with a bounded KL-div from ๐. (a. s. ), KL-regularization ๐0 ๐ = 1 ๐ = โ1 ๐๐โ(๐ง) ๐ง supp(๐๐ ) supp(๐๐ ) (+ classification calibration condition) -
Main theorem 28 Suppose that ๐ = ฮ( ฮค 1
๐ ), then it holds that with probability 1 โ exp โ๐ก . Class. error Theorem 1 O เดค ๐ 2๐ ๐ โข โ๐ฅ ๐ง = เดค ๐ โ [tanh ๐ฅ1 , ๐ง + ๐ฅ2 + 2 โ tanh ๐ฅ3 ]/3 โข ๐โ: KL ๐, ๐โ โค ๐ , ๐๐๐โ ๐ โฅ ๐0 Existing bound: Chen et al. (2020); Nitanda, Wu, Suzuki (2021) Class. Error โค O 1 ๐ . (Rademacher complexity bound) โข Our bound provides fast learning rate (faster than 1/ ๐). O ฮค ๐ ๐ โช O ฮค 1 ๐ -
Main theorem 2 29 Theorem 2 ๐ผ[Class. Error] โค O
๐ ๐ . then it holds that with probability Theorem 1: ๐ผ[Class. Error] โค O exp(โO(๐/๐ 2)) if ๐ โฅ ๐ 2. Theorem 2: Suppose that ๐ = ฮ(1/๐ ) and If we have sufficiently large training data, we have exponential convergence of test error. We only need to evaluate ๐ to obtain a test error bound. -
Example: k-sparse parity problem 30 โข ๐-sparse parity problem on
high dimensional data โข ๐ โผ Unif( โ1,1 ๐) (up to freedom of rotation) โข ๐ = ฯ๐=1 ๐ ๐๐ Table 1 of [Telgarsky: Feature selection and low test error in shallow low-rotation ReLu networks, ICLR2023]. Q: Can we learn sparse ๐-parity with GD? Is there any benefit of neural network? โป Suppose that we donโt know which coordinate ๐๐ is aligned to. ๐ = 2: XOR problem ๐ = 3, ๐ = 2 Complexity to learn XOR function (๐ = 2) Only the first ๐-coordinates are informative. -
Generalization bound 31 ๐ผ[Class. Error] โค O ๐ ๐ .
Theorem 1: ๐ผ[Class. Error] โค O exp(โO(๐/๐ 2)) Theorem 2: if ๐ โฅ ๐ 2. ๐โ: KL ๐, ๐โ โค ๐ , ๐๐๐โ ๐ โฅ ๐0 (perfect classifier with margin ๐0) Suppose that there exists ๐โ such that For the ๐-parity problem, we may take Then, Lemma We can evaluate ๐ required for the ๐-sparse parity problem: Reminder -
Generalization error bound โข Setting 2: ๐ > ๐2 32
โข Setting 1: ๐ > ๐ โข Test error (classification error) = ๐(exp(โ๐/๐ ๐)) โข Test error (classification error) = ๐( ฮค ๐ ๐) These are better than NTK (kernel method); Sample complexity of NTK ๐ = ๐ ๐ ๐ vs NN ๐ = ๐(๐ ) Trade-off between computational complexity and sample complexity. Our analysis provides โข better sample complexity โข discrete-time/finite-width analysis โข ๐ and ๐ are โdecoupled.โ Corollary (Test accuracy of MFLD) (Computational complexity is exp O ๐ (But, can be relaxed to O(1) if X is anisotropic)) -
Anisotropic data structure โข Isotropic data: โขTest error bound: O(
ฮค ๐ ๐). โขComputational complexity is O(exp ๐ ). 33 If data has anisotropic covariance, sample / computational complexities can be much improved. True signal True signal Isotropic data distribution Anisotropic data distribution # of iterations: (๐ = ๐ yields exp(๐)) The data structure affects the complexities. -
Anisotropic k-parity setting 34 Input Label (k-sparse parity) +1 +1
-1 -1 +1 +1 -1 -1 Example: coordinate wise scaling where ๐ ๐ is the scaling factor s.t. โ ๐=1 ๐ ๐ ๐ 2 = 1. โข Power low decay: ๐ ๐ 2 โ ๐โ๐ผ/๐1โ๐ผ โข Spiked covariance: ๐ ๐ 2 โ ๐๐ผโ1 ๐ โ ๐ ๐ ๐ 2 โ ๐โ1 ๐ โ ๐ + 1, ๐ (๐ผ โ [0,1]) (๐๐ = ยฑ๐ ๐ ) -
Generalization error bound 35 Anisotropic ๐-sparse parity with coordinate wise
scaling (we assume โ ๐=1 ๐ ๐ ๐ 2 = 1) Input: Label: โข Setting 2: ๐ > ๐๐ 2 โข Setting 1: ๐ > ๐๐ โข Test error (classification error) = โข Test error (classification error) = Corollary 1. ๐ผ[Class. Error] โค O ๐ ๐ . 2. ๐ผ[Class. Error] โค O exp(โO(๐/๐ 2)) if ๐ โฅ ๐ 2. Lemma -
Example 36 (with โ ๐=1 ๐ ๐ ๐ 2 = 1)
Input: โข Setting 2: ๐ > ๐๐ 2 โข Setting 1: ๐ > ๐๐ โข Test error (classification error) = โข Test error (classification error) = Test error = โข Isotropic setting (๐๐ ๐ = ๐/๐ ): Test error = 1. Power low decay (๐๐ ๐ โ ๐โ๐ถ): 2. Spiked covariance Test error = Test error โข Anisotropic setting: -
37 Anisotropic Isotropic k-signal components Noisy components k-signal components Noisy
components Large signal Small noise Small signal Large noise ๐โ๐ถ -
Computational complexity When ๐ = ๐( ฮค 1 ๐ ), the
number of iterations can be bounded by 38 By substituting, then the # of iterations can be summarized as โข Isotropic setting: โข Anisotropic setting: Anisotropic structure mitigate the computational complexity. Especially, there is no exponential dependency on ๐ when ๐ถ = ๐. (assuming ๐ = ๐(1)) -
Kernel lower bound 39 When ๐ = ๐โ, Mean field:
Kernel: Mean field NN can โdecoupleโ ๐ and ๐ , while kernel has exponential relation between them. Setting: Thm For arbitrary ๐ฟ > 0, the sample complexity of kernel methods is lower bounded as (kernel) -
Coordinate transform 40 โข When the input ๐ is isotropic,
we may estimate the โinformative directionโ by the gradients at the initialization. โข Then, ๐บ estimates the informative direction. By the following coordinate transformation, we may take ๐ independent of ๐ (exp ๐ โ exp(๐)): True signal True signal Isotropic input (avoiding curse of dim) -
Sample complexity to compute G 41 By using training data
with size Then, ๐ can be modified as we can compute ๐บ as Without ๐บ estimation: ๐ = ฮฉ(๐). Isotropic setting: -
Summary of the result 42 Upper bound for NN (our
result) Lower bound for kernel method (our result) Improve sample complexity -
Discussion โข The CSQ lower bound states that O ๐๐โ1
sample complexity is optimal for methods with polynomial order computational complexity. [Abbe et al. (2023); Refinetti et al. (2021); Ben Arous et al. (2022); Damian et al. (2022)] โข On the other hand, our analysis is about full-batch GD. 43 Minibatch size # of iterations Sample complexity Our analysis ๐ ๐๐ ๐ SGD (CSQ-lower bound) 1 ๐๐โ1 ๐๐โ1 We obtain a better sample complexity than O(๐๐โ1) with higher computational complexity. โ We can obtain a polynomial order method with MFLD for anisotropic input. -
Conclusion โข Mean field Langevin dynamics โข Mean field representation
of 2-layer NNs โข Optimizing convex functional โข Convergence guarantee (Wasserstein gradient flow, Uniform-in-time propagation of chaos) โข Generalization error of mean field 2-layer NN โข Fast learning rate โข Sparse ๐-parity problem โขBetter sample complexity than kernel methods โขStructure of data (anisotropic covariance) can improve the complexities. 44 Kernel Mean field Mean field Kernel lower bound Kernel lower bound