Infinite Width: NTK & Mean-Field Limits
When wide networks behave like kernels, and when they don’t.
Make a network wider and wider and two very different things can happen. With one scaling it becomes a Gaussian process at initialization and a kernel machine under gradient descent, its features frozen in place. With another, its neurons become interacting particles whose features travel far. This lesson derives both limits, shows that which one you get is a choice of parameterization, and explains the maximal-update parameterization that keeps feature learning alive at every width.
What you’ll learn
- Derive the Gaussian-process limit of a wide random network, the layer-by-layer kernel recursion, and its closed form for ReLU.
- Define the neural tangent kernel, solve the training dynamics for squared loss in the infinite-width limit, and explain why the weights barely move.
- Explain lazy training as a consequence of scaling, and the sample-size limits of kernel methods in high dimension.
- Derive the mean-field limit of a two-layer network as a gradient flow over probability measures, and describe the parameterization dichotomy and μP.
Wide random networks are Gaussian processes
Take one hidden layer of width with independent random parameters and an output scaled by :
For any finite set of inputs, is a sum of independent, identically distributed random vectors scaled by . By the multivariate central limit theorem it converges to a Gaussian, so converges to a Gaussian process with covariance . Neal (1996) made this observation for Bayesian neural networks: a prior over the weights of an infinitely wide network is a prior over functions, and a Gaussian one.
Let layer have pre-activations , with and . Conditionally on the layer below, the units are independent Gaussian processes with an empirical covariance:
As the average converges by the law of large numbers, and by induction the units below are Gaussian, so the covariance becomes a deterministic NNGP kernel, given by a recursion over layers (Lee et al., 2018; Matthews et al., 2018) that starts from :
For ReLU the expectation has a closed form, the first arc-cosine kernel (Cho & Saul, 2009). With variances and correlation :
So exact Bayesian prediction with an infinitely wide network is GP regression with this kernel: the posterior mean at is (Gaussian Processes). On MNIST and CIFAR-10, Lee et al. found these GPs typically more accurate than the finite fully connected networks they trained by gradient descent, with the trained networks closing the gap as they widened.
Two inputs give pre-activations with unit variances and zero correlation (). What is ? Use the formula, then check it another way.
Show the answer
0.16
The formula gives . Check: uncorrelated jointly Gaussian variables are independent, so the expectation factors as . At the formula gives : half the variance, the factor behind He initialization.
The neural tangent kernel
Now train. Under gradient flow on the squared loss , the chain rule moves the function like this:
is the neural tangent kernel: an inner product of the "tangent features" , hence a positive semidefinite kernel. For a finite network it is random at initialization and changes during training.
With constant, the training residual obeys a linear ODE. Diagonalize : the component of the residual along decays like , so the network fits the top kernel principal components first, one motivation for early stopping.
At a test point, ; integrate in time:
As this is kernel regression with the NTK, started from the random function , which is itself an NNGP sample: the trained network's predictions are Gaussian, with a mean and covariance computable from and (Lee et al., 2019).
Equivalently, training follows the first-order Taylor expansion of the network around its initialization; Lee et al. (2019) proved this for any depth in the infinite-width limit and found close agreement for finite, practically sized networks.
Why the kernel freezes. Take the two-layer network above. Fitting the data changes the function by , but every hidden unit's parameters enter with the factor , so each has a gradient of size and moves by only that much. The total displacement of the parameters stays while is of order , and every hidden unit's pre-activation moves by . The features , and with them , stay where they started. Infinitely wide networks in this regime do not learn features at all; they fit a linear model on fixed random tangent features.
Lazy training is a choice of scale
Chizat, Oyallon & Bach (2019) showed that nothing about this is specific to width. Take any differentiable model and train the scaled model on the rescaled loss . As , a tiny change in already changes the output a lot, so gradient flow fits the data before the parameters move far from , and the path stays close to that of the linearized model; they bound the distance between the two paths. The output scaling is an implicit large . Their experiments carry a warning: deep convolutional networks trained in the lazy regime performed worse than the same networks trained normally, which makes laziness an unlikely explanation for deep learning's successes.
Kernel methods also have provable sample-size limits in high dimension. For inputs uniform on the sphere in with samples, Ghorbani, Mei, Misiakiewicz & Montanari (2021) proved that rotationally invariant kernel methods, including the infinite-width NTK and random-features models, can fit at most a degree- polynomial of the input. A target as simple as then needs on the order of samples, while networks that adapt their first-layer weights toward can provably do with far fewer in stylized models, an active line of work.
The NTK is also not the whole story at finite size. Hanin & Nica (2020) showed that for ReLU networks whose depth and width grow together, the fluctuations of the NTK at initialization and its change during the first steps of training are exponential in the ratio depth/width: deep, finite-width networks are not lazy even when they are wide.
In the NTK limit, a network fits its training data perfectly. What has happened to its hidden-layer features ?
- They have been learned from scratch to suit the task
- They are essentially unchanged from initialization: training fit a linear model on the fixed tangent features
- They have collapsed to zero
- They have become the eigenvectors of the data covariance
Show the answer
B. They are essentially unchanged from initialization: training fit a linear model on the fixed tangent features
Each hidden unit's pre-activation moves by , so in the limit the representation is frozen; all the change in the function comes from a linear combination of the initial tangent features. That is exactly why this limit cannot explain pretraining and transfer, which depend on learned features.
The mean-field limit: features that move
Now scale the output by instead of , the scaling of the mean-field limit. A two-layer network becomes an average over its neurons, that is, an integral against their empirical distribution with :
The function is linear in , so the risk is a convex functional of the measure. The non-convexity of training lives entirely in the parameterization of by finitely many particle positions.
Each particle's gradient is times the gradient of the first variation of , . Speed time up by (step size ) and every particle follows the same vector field:
As with i.i.d. initial particles from , the empirical measure converges to the solution of a continuity equation, the Wasserstein gradient flow of : a law of large numbers for interacting particles (Mei, Montanari & Nguyen, 2018; Chizat & Bach, 2018; Rotskoff & Vanden-Eijnden, 2018; Sirignano & Spiliopoulos, 2020).
Because is convex in , stationary points of the flow that put mass everywhere they need to are global minimizers. Chizat & Bach (2018) turned this into a theorem: for suitably homogeneous models and initializations with sufficiently spread-out support, if the many-particle gradient flow converges, its limit is a global minimizer. Unlike in the NTK limit, each particle moves by : the first-layer weights, the features, change substantially, and the function evolves nonlinearly.
| Property | NTK (lazy) limit | Mean-field limit |
|---|---|---|
| Output scaling (two layers) | ||
| Movement of a neuron's weights | (after rescaling time) | |
| Limit object | a fixed kernel | a probability measure over neurons |
| Dynamics | linear ODE in function space | nonlinear PDE (Wasserstein gradient flow) |
| Features learned? | no | yes |
| Theory for deep networks | well developed, any depth | mostly two-layer; deep versions are harder and less complete |
Parameterizations and μP
Yang & Hu (2021) organized all of this into a family of abc-parameterizations: for each layer, a width power in the output multiplier, in the initialization variance and in the learning rate. Their dichotomy theorem says that every stable, nontrivial member of the family either admits feature learning or has infinite-width dynamics given by kernel gradient descent, but not both. The standard parameterization and the NTK parameterization both land on the kernel side (the standard one becomes unstable unless its learning rate shrinks with width). The Maximal Update Parameterization (μP) is the member in which every layer's features change by amounts during training at every width; its limits can be computed with their Tensor Programs technique, and on tasks that rely on feature learning (Word2Vec, few-shot learning with MAML) they outperformed NTK limits, with finite networks approaching them as width grew.
| Parameter | Initialization variance | Adam learning rate |
|---|---|---|
| Input weights and all biases | ||
| Hidden weights | ||
| Output weights |
The practical payoff is μTransfer. Under μP the best learning rate, and several other hyperparameters, barely move as the network widens, so a search run on a narrow proxy can be reused on the wide target without retuning. Yang et al. transferred settings tuned on a 40-million-parameter proxy to a 6.7-billion-parameter GPT-3 model, which then beat the published results for GPT-3 at that size.
Key takeaways
- At initialization, wide random networks are Gaussian processes (CLT); the NNGP kernel follows a layer-by-layer recursion, with an arc-cosine closed form for ReLU, and gives exact Bayesian inference for infinite width.
- The NTK becomes deterministic and constant in the NTK limit; squared-loss training then solves to , and the features never move.
- Laziness is produced by scaling (Chizat, Oyallon & Bach); lazy networks can underperform, and rotationally invariant kernels need about samples to fit degree- polynomials.
- With scaling, a two-layer network is a measure over neurons whose training is a Wasserstein gradient flow of a convex risk; neurons move by and features are learned.
- abc-parameterizations are either feature-learning or kernel-limited, not both; μP is the maximal-update member, and it makes hyperparameters transferable across width.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
Why does a randomly initialized one-hidden-layer network with output scaled by become a Gaussian process as ?
- Because each activation function outputs Gaussian values
- Because its outputs at any finite set of inputs are a scaled sum of i.i.d. random vectors, which the central limit theorem makes Gaussian
- Because training with squared loss makes the outputs Gaussian
- Because the weights are Gaussian, and any function of Gaussian weights is Gaussian
Show the answer
B. Because its outputs at any finite set of inputs are a scaled sum of i.i.d. random vectors, which the central limit theorem makes Gaussian
Each unit contributes an independent copy of evaluated at all the inputs, and the scaling is exactly the CLT normalization. The limit is Gaussian for any activation with enough moments, whatever the distribution of the individual terms.
In the NTK limit with squared loss, the training residual decomposes along the eigenvectors of . Which components are fitted first?
- Those along eigenvectors with the smallest eigenvalues
- All components at the same rate
- Those along eigenvectors with the largest eigenvalues, decaying like
- It depends on the random initialization only
Show the answer
C. Those along eigenvectors with the largest eigenvalues, decaying like
, so the component along shrinks at rate . Large-eigenvalue directions, usually smooth functions of the input, are learned first; small ones, often noise-like, last, which is why stopping early regularizes.
Two wide two-layer networks differ only in the output scaling: versus (with time rescaled appropriately). Which statement is right?
- Both learn features; the scaling only changes the speed
- With (mean field) each neuron's weights move by and features are learned; with (NTK) they move by and the kernel stays fixed
- With the network learns features; with it is a fixed kernel
- Neither network can fit its training data in the limit
Show the answer
B. With (mean field) each neuron's weights move by and features are learned; with (NTK) they move by and the kernel stays fixed
The scaling acts like a large output multiplier , which makes training lazy. With the network is an average over neurons, so fitting the data requires the neurons themselves to move, and the limit is a nonlinear gradient flow over the distribution of neurons.
According to the dichotomy theorem of Yang & Hu (2021), what happens to the standard parameterization, with a learning rate kept stable, as width goes to infinity?
- It learns features maximally, like μP
- It becomes a Gaussian process with no training dynamics at all
- It diverges for every learning rate
- Its infinite-width training dynamics are kernel gradient descent, so it does not learn features in the limit
Show the answer
D. Its infinite-width training dynamics are kernel gradient descent, so it does not learn features in the limit
Every stable, nontrivial abc-parameterization is either feature-learning or kernel-limited, not both. Standard and NTK parameterizations fall on the kernel side; μP is designed so that every layer's features move by a width-independent amount.
Further reading
- R. M. Neal, Bayesian Learning for Neural Networks, Lecture Notes in Statistics 118 (Springer, 1996), chapter 2.
- A. Jacot, F. Gabriel & C. Hongler, "Neural tangent kernel: convergence and generalization in neural networks," Advances in Neural Information Processing Systems 31 (2018).
- L. Chizat, E. Oyallon & F. Bach, "On lazy training in differentiable programming," Advances in Neural Information Processing Systems 32 (2019).
- S. Mei, A. Montanari & P.-M. Nguyen, "A mean field view of the landscape of two-layer neural networks," Proceedings of the National Academy of Sciences 115(33) (2018).
- G. Yang & E. J. Hu, "Tensor programs IV: Feature learning in infinite-width neural networks," Proceedings of the 38th International Conference on Machine Learning (2021).