Simple Algorithm
Deep Learning · Emergence · 30 min

μP & Hyperparameter Transfer

Parameterizing width so the best learning rate stays put as models grow.

Tune a model with 13 million parameters, copy its learning rate and initialization to one with 350 million, and beat the published results for the big model: Yang and colleagues reported exactly that for BERT-large. Under the default parameterization this fails, because the best learning rate drifts as the network widens. This lesson derives why, from how gradient updates add up, and derives the per-layer scalings that stop the drift.

What you’ll learn

  • Explain why the optimal learning rate drifts with width under the standard parameterization, by comparing how random weights and gradient updates act on a vector (central limit versus law of large numbers).
  • Define abc-parameterizations and state the stability conditions and the dynamical dichotomy: a nontrivial stable infinite-width limit either learns features or is kernel gradient descent.
  • Derive the maximal update parameterization (μP) for SGD and Adam layer by layer, and state the equivalent spectral scaling condition.
  • Describe μTransfer and the evidence on it: what transfers, what does not, and the alternatives that also transfer.

Why the best learning rate drifts

Scaling studies compare well-tuned runs (Neural Scaling Laws), but nobody can afford a learning-rate sweep on the largest model. The obvious shortcut is to tune a narrow copy and reuse its settings. Under the standard parameterization (SP), the default in deep learning frameworks with variance 1/fan-in1/\text{fan-in} initialization and one global learning rate, it fails: in Yang et al.'s (2021) experiments the best learning rate of an MLP on CIFAR-10 moved by roughly an order of magnitude as the width went from 256 to 8,192, and the optimum of transformers trained with Adam drifted too. The cause shows up after a single step of training.

DerivationOne SGD step on a two-layer linear network
  1. f1(x)x=v⊤u+ηvθ u⊤u+ηuθ v⊤v+ηuηvθ2 u⊤v\frac{f_1(x)}{x}=\mathbf v^\top\mathbf u+\eta_v\theta\,\mathbf u^\top\mathbf u+\eta_u\theta\,\mathbf v^\top\mathbf v+\eta_u\eta_v\theta^2\,\mathbf u^\top\mathbf v

    Take f(x)=v⊤u xf(x)=\mathbf v^\top\mathbf u\,x with u,v∈Rn\mathbf u,\mathbf v\in\R^n, scalar input and output, and loss ℓ(f,y)\ell(f,y). The gradients are ℓ′x u\ell'x\,\mathbf u for v\mathbf v and ℓ′x v\ell'x\,\mathbf v for u\mathbf u. With learning rates ηv,ηu\eta_v,\eta_u and θ=−ℓ′x\theta=-\ell'x, one step gives v1=v+ηvθu\mathbf v_1=\mathbf v+\eta_v\theta\mathbf u, u1=u+ηuθv\mathbf u_1=\mathbf u+\eta_u\theta\mathbf v and

  2. f1(x)x=Θ(1)+ηθ⋅Θ(n)+ηθ⋅Θ(1)+η2θ2⋅Θ(1)\frac{f_1(x)}{x}=\Theta(1)+\eta\theta\cdot\Theta(n)+\eta\theta\cdot\Theta(1)+\eta^2\theta^2\cdot\Theta(1)

    SP: ui∼N(0,1)u_i\sim\mathcal N(0,1), vi∼N(0,1/n)v_i\sim\mathcal N(0,1/n), one rate η\eta. The sum v⊤u\mathbf v^\top\mathbf u adds nn random-sign terms of size n−1/2n^{-1/2} and is Θ(1)\Theta(1), but u⊤u\mathbf u^\top\mathbf u adds nn positive terms and is Θ(n)\Theta(n):

  3. A fixed η\eta makes the output blow up with width, so stability forces η=Θ(1/n)\eta=\Theta(1/n). Then the hidden feature uxux moves by ηθ vx\eta\theta\,\mathbf v x, whose coordinates are Θ(n−3/2)\Theta(n^{-3/2}): at large width the features freeze, and training becomes regression with a kernel fixed at initialization (in this toy, fitting the last layer on fixed random features).

  4. f1(x)x=Θ(n−1/2)+ηθ u⊤un+ηθ n v⊤v+η2θ2 u⊤v=Θ(1)\frac{f_1(x)}{x}=\Theta(n^{-1/2})+\eta\theta\,\frac{\mathbf u^\top\mathbf u}{n}+\eta\theta\,n\,\mathbf v^\top\mathbf v+\eta^2\theta^2\,\mathbf u^\top\mathbf v=\Theta(1)

    μP (Yang & Hu, 2021): vi∼N(0,1/n2)v_i\sim\mathcal N(0,1/n^2), ηv=η/n\eta_v=\eta/n, ηu=ηn\eta_u=\eta n. Now v⊤u=Θ(n−1/2)\mathbf v^\top\mathbf u=\Theta(n^{-1/2}) and both middle terms are Θ(η)\Theta(\eta) for any width:

  5. A width-independent η\eta is now stable, and the feature moves by ηnθ vx\eta n\theta\,\mathbf v x, which has Θ(1)\Theta(1) coordinates: it learns at every width. The output starts at zero in the limit.

abc-parameterizations and the dichotomy

Parameterizationaℓa_\ellbℓb_\ellccrrWide limit
SP, learning rate η/n\eta/n0000 for ℓ=1\ell=1; 12\tfrac12 after1112\tfrac12kernel
NTK (NTP)00 for ℓ=1\ell=1; 12\tfrac12 after000012\tfrac12kernel (the NTK)
Mean field (L=1L=1)00, then 1100−1-100feature learning
μP−12-\tfrac12 for ℓ=1\ell=1; 00 hidden; 12\tfrac12 output12\tfrac120000feature learning
After Table 1 of Yang & Hu (2021). SP with a width-independent rate (c=0c=0) is unstable, as the toy network showed.

Read the table through rr. SP with a 1/n1/n rate and NTP both have r=12r=\tfrac12: the last hidden features move like n−1/2n^{-1/2}, vanishing at infinite width, which is the lazy regime where a wide network is a kernel machine. The stable parameterizations form an unbounded polyhedron in the space of exponents; μP is a vertex of its feature-learning part, where every layer is updated as much as stability allows, hence maximal update. Two consequences are worth knowing:

  • In any feature-learning limit the output at initialization is identically zero, which is why μP's readout starts tiny.
  • The description is redundant: shifting aℓ→aℓ+θa_\ell\to a_\ell+\theta, bℓ→bℓ−θb_\ell\to b_\ell-\theta and multiplying that layer's learning rate by n2θn^{2\theta} leaves SGD training unchanged. μP therefore has several equivalent tables, trading output multipliers against initialization and learning rates.

Deriving μP layer by layer

DerivationPer-layer scalings for SGD and Adam
  1. ΔWh′=−η δ (h⊤h′)=Θ(η)⟹ηhiddenSGD=Θ(1)\Delta W\mathbf h'=-\eta\,\boldsymbol\delta\,(\mathbf h^\top\mathbf h')=\Theta(\eta)\quad\Longrightarrow\quad\eta^{\text{SGD}}_{\text{hidden}}=\Theta(1)

    A hidden matrix W∈Rn×nW\in\R^{n\times n} acts on h\mathbf h with Θ(1)\Theta(1) coordinates, and δ=∂ℓ/∂z\boldsymbol\delta=\partial\ell/\partial\mathbf z arrives at its output. In μP the readout has entries Θ(1/n)\Theta(1/n), so δ\boldsymbol\delta has Θ(1/n)\Theta(1/n) coordinates. An SGD step ΔW=−η δh⊤\Delta W=-\eta\,\boldsymbol\delta\mathbf h^\top acting on a correlated input h′\mathbf h' gives coordinates η⋅Θ(1/n)⋅Θ(n)\eta\cdot\Theta(1/n)\cdot\Theta(n):

  2. (ΔWh)i=−ηsign⁡(δi)∑j=1n∣hj∣=Θ(η n)⟹ηhiddenAdam=Θ(1/n)(\Delta W\mathbf h)_i=-\eta\operatorname{sign}(\delta_i)\sum_{j=1}^n\abs{h_j}=\Theta(\eta\,n)\quad\Longrightarrow\quad\eta^{\text{Adam}}_{\text{hidden}}=\Theta(1/n)

    Adam normalizes each entry; its first step is exactly −ηsign⁡(δihj)-\eta\operatorname{sign}(\delta_ih_j) up to ϵ\epsilon, and later steps keep entries of size about η\eta whatever the gradient's scale. The nn terms of a coordinate then share one sign:

  3. Δv⊤h=Θ(η n)⟹ηout=Θ(1/n)  for SGD and for Adam\Delta\mathbf v^\top\mathbf h=\Theta(\eta\,n)\quad\Longrightarrow\quad\eta_{\text{out}}=\Theta(1/n)\ \text{ for SGD and for Adam}

    The readout f=v⊤hf=\mathbf v^\top\mathbf h maps width to a fixed size. Its update is −ηℓ′h-\eta\ell'\mathbf h (SGD) or −ηsign⁡(ℓ′h)-\eta\operatorname{sign}(\ell'\mathbf h) (Adam), and either way Δv⊤h\Delta\mathbf v^\top\mathbf h sums nn aligned terms:

  4. ηinSGD=Θ(n),ηinAdam=Θ(1)\eta^{\text{SGD}}_{\text{in}}=\Theta(n),\qquad\eta^{\text{Adam}}_{\text{in}}=\Theta(1)

    The input layer U∈Rn×dU\in\R^{n\times d} maps a fixed dimension up to width nn. SGD gives ΔUx=−η δ∥x∥2\Delta U\mathbf x=-\eta\,\boldsymbol\delta\norm{\mathbf x}^2, of size η/n\eta/n; Adam's entries of size η\eta give Θ(ηd)=Θ(η)\Theta(\eta d)=\Theta(\eta):

  5. Var⁡(Wij(1))=1d,Var⁡(Wij(ℓ))=1n,Var⁡(vj)=1n2\Var\big(W^{(1)}_{ij}\big)=\frac1d,\qquad\Var\big(W^{(\ell)}_{ij}\big)=\frac1n,\qquad\Var(v_j)=\frac1{n^2}

    Initialization keeps variance 1/fan-in1/\text{fan-in} for input and hidden weights, so pre-activations are Θ(1)\Theta(1) by the central limit theorem. The readout gets 1/fan-in21/\text{fan-in}^2: its random part contributes only Θ(n−1/2)\Theta(n^{-1/2}) to ff, and it sends back the Θ(1/n)\Theta(1/n) gradients assumed in the first step.

Scaling with widthInput weights and all biasesOutput weightsHidden weights
Init. variance1/fan-in1/\text{fan-in}1/fan-in21/\text{fan-in}^2 (SP: 1/fan-in1/\text{fan-in})1/fan-in1/\text{fan-in}
SGD learning ratefan-out\text{fan-out} (SP: 11)1/fan-in1/\text{fan-in} (SP: 11)11
Adam learning rate111/fan-in1/\text{fan-in} (SP: 11)1/fan-in1/\text{fan-in} (SP: 11)
μP as in Table 3 of Yang et al. (2021, Tensor Programs V), with SP in parentheses where it differs. Entries are width scalings: in code each is a ratio to a base width n0n_0 times a tuned constant, so μP coincides with SP at n0n_0. A bias's fan-out is its length and its fan-in is 1. For transformers, attention logits become q⊤k/dk\mathbf q^\top\mathbf k/d_k instead of q⊤k/dk\mathbf q^\top\mathbf k/\sqrt{d_k}: after training, queries and keys are correlated, and their dot product grows like dkd_k.
Predict before you look

Under μP with Adam, a proxy of width 512 has a tuned hidden-layer learning rate of 4×10−34\times10^{-3}. The target model has width 4,0964{,}096. What learning rate do its hidden matrices get, in units of 10−410^{-4}?

Show the answer

5 × 10⁻⁴

Hidden Adam rates scale like 1/fan-in1/\text{fan-in}, and the width grew 8-fold: 4×10−3/8=5×10−44\times10^{-3}/8=5\times10^{-4}. The readout's rate also shrinks 8-fold, while the embedding and biases keep their proxy rates. Under SP every layer would have kept its proxy rate, and the hidden layers would take updates 8 times too large in effect.

μTransfer, and what the evidence says

μTransfer (Yang et al., 2021) has three steps: parameterize the target model in μP, tune a smaller version of it, copy the tuned hyperparameters. Learning rate, schedule, momentum and Adam's betas, per-layer initialization scales and output multipliers transferred across width, and empirically, on transformers, across depth, batch size, training time and sequence length; regularization such as dropout and weight decay was classed as not transferable. As reported, settings tuned on a 13-million-parameter proxy beat the published BERT-large results at a total tuning cost of about one BERT-large pretraining, and settings tuned at 40 million parameters beat the published 6.7-billion-parameter GPT-3 results with tuning cost 7% of the pretraining cost. Under μP, wider was also better throughout training, which is not guaranteed under SP.

Independent tests have qualified the picture:

  • Mostly confirmed, with exceptions. In ablations up to 1.2 billion parameters and a run up to 10 billion parameters and 190 billion tokens, the optimal learning rate transferred in most settings. It failed to transfer from the smallest proxies with trainable normalization gains, with weight decay implemented as in PyTorch's AdamW, with the Lion optimizer, and with the usual 1/dk1/\sqrt{d_k} attention scale in low precision (Lingle, 2024).
  • μP is not the only route. Across tens of thousands of runs up to 26.8 billion parameters, every parameterization tested (SP, NTK, mean field and μP) transferred once per-layer learning-rate exponents and constants were set, and SP with per-layer rates (embedding Θ(1)\Theta(1), hidden and readout Θ(1/n)\Theta(1/n)) beat μP for Adam. The derivations assume updates stay aligned with activations, and the best exponents were often ones that this assumption had ruled out. Adam's ϵ\epsilon must shrink with width, or the shrinking gradients fall below it and Adam degrades toward SGD; an ϵ\epsilon-free variant, Adam-atan2, avoids this (Everett et al., 2024).
  • Unit scaling. u-μP combines μP with unit scaling, which starts activations, weights and gradients at scale one, giving near-optimal default hyperparameters and models that train in FP8 out of the box (Blake et al., 2024).
  • Depth needs its own scaling of the residual branches, for example 1/L1/\sqrt L in Depth-μP (Yang, Yu, Zhu & Hayou, 2024); which scaling is right is debated (Scaling Residual Branches with Depth).
Check your understanding

A colleague says hyperparameters transfer across width only under μP. What did Everett et al. (2024) find?

  1. Correct: SP, NTK and mean-field parameterizations all lose transfer at scale
  2. No parameterization transfers above about one billion parameters
  3. All four parameterizations transferred with suitable per-layer learning rates, and SP with per-layer rates outperformed μP for Adam
  4. Transfer works only with SGD, never with Adam
Show the answer

C. All four parameterizations transferred with suitable per-layer learning rates, and SP with per-layer rates outperformed μP for Adam

They varied parameterization, optimizer and alignment assumptions over 14 model sizes up to 26.8 billion parameters. With per-layer learning-rate exponents and constants tuned at small scale, all four parameterizations transferred, and Adam's ϵ\epsilon also had to shrink with width, or the shrinking gradients fell below it.

Key takeaways

  • Random weights act on a vector through incoherent sums (n\sqrt n); gradient updates act through coherent ones (nn), because they are aligned with the activations. Ignoring the difference makes SP's best learning rate drift with width and pushes wide SP networks toward the kernel regime.
  • abc-parameterizations scale multipliers, initialization and learning rate with width. Nontrivial stable ones either learn features (r=0r=0) or train as kernel machines (r>0r>0), never both; μP updates every layer maximally.
  • μP for Adam: input weights and biases with rate Θ(1)\Theta(1), hidden and output weights with rate Θ(1/fan-in)\Theta(1/\text{fan-in}), readout initialized with variance 1/fan-in21/\text{fan-in}^2, and 1/dk1/d_k attention. Equivalently, weights and updates have spectral norm Θ(fan-out/fan-in)\Theta(\sqrt{\text{fan-out}/\text{fan-in}}).
  • μTransfer tunes a small proxy and copies its settings, and largely works in independent tests; but other parameterizations transfer too with per-layer rates, and ϵ\epsilon, normalization gains, weight decay and depth need care.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

Why does the largest stable learning rate of the standard parameterization shrink like 1/n1/n as the width nn grows?

  1. Wider networks have more parameters, so the loss surface is steeper everywhere
  2. Floating-point rounding grows with width
  3. Initial weights grow with width
  4. Gradient updates are aligned with the activations they act on, so their effect sums nn same-sign terms and grows like nn
Show the answer

D. Gradient updates are aligned with the activations they act on, so their effect sums nn same-sign terms and grows like nn

An update ΔW=−ηδh⊤\Delta W=-\eta\boldsymbol\delta\mathbf h^\top acts on h\mathbf h through ∥h∥2=Θ(n)\norm{\mathbf h}^2=\Theta(n) (law of large numbers), while random weights act through a Θ(n)\Theta(\sqrt n) sum. With SP's sizes the readout's update moves the output by Θ(ηn)\Theta(\eta n), so stability needs η=Θ(1/n)\eta=\Theta(1/n), and at that rate the hidden features barely move.

Question 2

Under μP with Adam, you double the width of every hidden layer. What happens to the hidden matrices' learning rate?

  1. It stays the same
  2. It halves
  3. It shrinks by 2\sqrt2
  4. It doubles
Show the answer

B. It halves

Adam makes every entry of an update about η\eta in size, and a coordinate of ΔWh\Delta W\mathbf h sums nn such aligned terms, so the rate must scale like 1/n1/n. Under SGD the hidden rate would stay constant, because the gradient's own Θ(1/n)\Theta(1/n) size does the scaling.

Question 3

What does Yang & Hu's dynamical dichotomy say about nontrivial, stable abc-parameterizations?

  1. All of them reach the neural tangent kernel limit
  2. All of them learn features at infinite width
  3. Their infinite-width limit either learns features (r=0r=0) or is kernel gradient descent (r>0r>0), never both
  4. Their limits depend on the random seed
Show the answer

C. Their infinite-width limit either learns features (r=0r=0) or is kernel gradient descent (r>0r>0), never both

The exponent rr governs how much the last hidden features move, Θ(n−r)\Theta(n^{-r}). If r>0r>0 they freeze and training is kernel gradient descent; if r=0r=0 the feature kernel evolves. SP (with a stable rate) and NTP are kernel limits; μP and mean field learn features.

Question 4

In Yang et al.'s μTransfer experiments, which kind of hyperparameter was not expected to transfer from a small proxy?

  1. Regularization strength, such as dropout or weight decay
  2. The learning rate
  3. The learning-rate schedule
  4. Per-layer initialization scales and output multipliers
Show the answer

A. Regularization strength, such as dropout or weight decay

How much regularization helps depends on the model's size relative to its data, which changes when the model grows, so its optimum need not stay put. Optimization and initialization hyperparameters are what μP stabilizes.

Further reading

  • G. Yang & E. J. Hu, "Tensor Programs IV: Feature learning in infinite-width neural networks," ICML (2021).
  • G. Yang, E. J. Hu, I. Babuschkin, S. Sidor, X. Liu, D. Farhi, N. Ryder, J. Pachocki, W. Chen & J. Gao, "Tensor Programs V: Tuning large neural networks via zero-shot hyperparameter transfer," NeurIPS (2021); arXiv:2203.03466.
  • G. Yang, J. B. Simon & J. Bernstein, "A spectral condition for feature learning," arXiv:2310.17813 (2023).
  • K. Everett et al., "Scaling exponents across parameterizations and optimizers," ICML (2024).
  • L. Lingle, "An empirical study of μP learning rate transfer," arXiv:2404.05728 (2024).