Hyperparameter transfer and muP
Look at the learning rates in the GPT-3 paper. The 125-million-parameter model was trained with a peak learning rate of , the 1.3-billion model with , and the 175-billion model with , ten times smaller than the first. Every size needed its own value, and nobody could tune the largest one properly, because a single trial run of a 175-billion-parameter model costs millions of dollars. The values for the big models were extrapolated by hand from the small ones. Over that range the width grew sixteenfold, from 768 to 12,288, while the learning rate fell tenfold, close to , so the drift is not a small correction. By the end of this section you will see why is the natural rate for most of a network's weights and why no single global value can be right for all of them.
Every scaling law in this chapter rests on that step. A scaling study compares models of many sizes, and if the large ones are tuned worse than the small ones, the curve bends for reasons that have nothing to do with scale (§9.1). And every frontier run needs hyperparameters that are right the first time.
This section explains why the best learning rate drifts as a network gets wider, and how to stop it. The fix is a different parameterization, a rule for how initialization, layer multipliers, and per-layer learning rates should change with width, so that one set of hyperparameters means the same thing at every size. It is called the Maximal Update Parametrization, P (Yang and Hu 2021), and the practice of tuning a small model and copying its hyperparameters to a large one is Transfer (Yang et al. 2022). We derive the rules from a single argument, build the coordinate check that verifies an implementation, and then look at how well transfer works in practice, including across depth.
Two ways a sum can grow
Everything in P follows from one fact about sums, so let's be careful with it. In this section is the width of a layer (its fan-in), and a vector "has coordinates of size " if its typical entry neither grows nor shrinks as grows. Take a linear layer with input whose coordinates are , and look at one output, , a sum of terms.
At initialization the terms are independent. With independent of , the terms have random signs, so their sum grows like , by the central limit theorem. To keep we need . This is the familiar fan-in initialization of §0.7.
After an update the terms are aligned. A gradient step changes by something built from itself. For one example, , where , so an SGD step with learning rate changes the output by
The terms of are all positive, so they add coherently, and grows like , by the law of large numbers.
In plain words, random weights produce outputs that grow like , but learned weight changes produce outputs that grow like , because the update is correlated with the very input it multiplies. Any rule that sets the initialization right but scales the learning rate wrong will see updates that grow or shrink with width.
Adam makes this even plainer. On its first step, with bias correction and a negligible , Adam's update is , the same size for every entry (§0.6). Then
The change in every output coordinate is proportional to . Double the width at a fixed learning rate and every hidden layer's activations move twice as far per step. To keep them moving by the same amount, a hidden layer's Adam learning rate must scale as .
Why updates grow with width
For a layer and an upstream gradient , the weight gradient is . Implement sgd_delta_h(x, g, eta) returning the change in after one SGD step, and adam_delta_h(x, g, eta) returning the change after Adam's first step, whose update is of the gradient elementwise. Then implement growth_exponent(widths, sizes) returning the slope of against .
Why one learning rate cannot fit every layer
Now apply the same reasoning to every layer of a network whose hidden width is .
- Input layer. Its fan-in is the input dimension, which does not grow with (for a Transformer's embedding, the input is a one-hot vector). The update does not depend on , so its Adam learning rate should stay constant.
- Hidden layers. Fan-in , so the Adam learning rate must shrink like .
- Output layer. Fan-in as well, so the same applies. Its initialization needs a separate argument, below.
The standard parameterization uses one global learning rate. As width grows, either the hidden layers' updates blow up (if the rate is held fixed) or, if it is lowered like to stop the blow-up, the input layer's updates shrink toward zero and the embeddings barely learn. The best global compromise moves with width, which is exactly the drift in the GPT-3 table. This is a structural problem, not a tuning problem.
The abc-parameterization
To reason about all possible rules at once, Yang and Hu (2021) describe each layer by three exponents. Its weights are written as a fixed multiplier times trainable parameters, those parameters are initialized at a width-dependent scale, and the learning rate also scales with width,
Here is what the optimizer sees, is a constant multiplier applied in the forward pass, sets the initial scale of , and is a width-independent base learning rate. In plain words, every parameterization is a choice of how a layer's multiplier, its initial scale, and its learning rate change as the network widens. The standard parameterization (SP) is everywhere, for the input layer, for the rest, and one learning rate.
These three knobs are not independent, and seeing why is a good exercise in the chain rule.
∂ The symmetry of the abc-parameterization
The network only ever uses . At initialization the entries of have variance , which depends only on .
During SGD, the gradient with respect to the trainable is , so a step changes by , and by times that,
which depends only on . So shifting , , keeps both and fixed, and the network computes exactly the same function at every step of training. This is the symmetry Yang and Hu state for SGD.
For Adam, the update to has size whatever the gradient's scale, so has size and the symmetry becomes , , . The practical meaning is that a multiplier on a layer can always be traded for a change in its initialization and its learning rate. That is why P can be written in several equivalent tables, with multipliers or without.
Within this family, Yang and Hu asked which parameterizations stay stable as (activations and outputs neither blow up nor vanish) and which let every layer's features change by during training. They proved a dynamical dichotomy. Every stable, nontrivial abc-parameterization either learns features or is in the kernel regime, where hidden representations stop moving in the infinite-width limit and the network behaves like a fixed kernel machine, never both. The standard parameterization can only stay stable with a learning rate that shrinks like , and then it ends up in the kernel regime, as does the neural tangent parameterization. The one that updates every layer as much as possible without blowing up is P, with for the input layer, for hidden layers, for the output layer, for every layer, and for SGD.
The output layer and its initialization
The last piece is why P initializes the output layer smaller than the standard . Write the logits as , with initialized to entries of variance . When the hidden features change by , the logits change by (plus the output layer's own update). Is that sum of terms random, growing like , or aligned, growing like ?
It is aligned, and a short calculation shows how much. The gradient that reaches is , where has a fixed, width-independent number of entries. So the features move along , say for some scalar . The entries of have size , so for the feature changes to have coordinates of size , as P demands, must be about . Then
because each diagonal entry of is a sum of squares, , while the off-diagonal entries are random sums and much smaller. For the logits to change by we need , that is, , not . A side effect is that the logits start near zero, of size . Yang et al. (2022) go further and recommend initializing the output layer, and the query projection of attention, exactly at zero.
The muP table
Putting it together, Table 3 of Yang et al. (2022) gives P in a form you can implement directly, with no multipliers. Each entry is how the quantity scales with the layer's fan-in or fan-out, up to a constant you tune once. Standard-parameterization values are in parentheses where they differ.
| input weights and all biases | hidden weights | output weights | |
|---|---|---|---|
| initialization variance | (SP ) | ||
| SGD learning rate | (SP ) | (SP ) | |
| Adam learning rate | (SP ) | (SP ) |
A bias is treated as an input weight with fan-in 1 and fan-out equal to its length. For Transformers there is one more rule. Attention logits use instead of . The reason is the same law of large numbers. The of §4.3 assumes queries and keys are independent, which holds at initialization, but training makes them correlated, so their dot product grows like . The general rule, in Yang et al.'s words, is that "a multiplier of order 1/fan_in should accompany any weight that maps an infinite dimension to a finite one", which covers both the output logits and the attention logits.
In plain words, with Adam, keep the embedding learning rate fixed, divide every matrix's learning rate by its fan-in, shrink the output layer's initialization by an extra factor of the width, and divide attention scores by .
In practice nobody writes "" with a raw width. You pick a small base model, say width , tune it, and express everything through the width multiplier , so that P and SP coincide at the base width and the tuned values carry over exactly. A hidden layer of the big model then gets learning rate and initial standard deviation , the output layer and , and the embedding keeps .
muP learning rates and initialization for a wider model
Implement mup_scale(layer, optimizer, fan_in, fan_out, base_fan_in, base_fan_out, base_lr, base_std) returning (lr, std) for one weight matrix of a wider model, following the table, normalized so that the result equals (base_lr, base_std) when the fans equal the base fans. layer is "input" (input weights or a bias), "hidden", or "output", and optimizer is "adam" or "sgd". Remember that a standard deviation is the square root of a variance.
The same table from one condition on norms
The table looks like a list of special cases, but one requirement produces all of it. Yang, Simon, and Bernstein (2023) stated it in terms of the spectral norm , the largest singular value, which is the most a matrix can stretch any vector (§0.10). Think in vector lengths. A vector in whose coordinates are has length about . A layer receives inputs of length about and should produce outputs, and output changes, of length about . The spectral condition asks that
In plain words, both a weight matrix and each update to it should stretch vectors by the ratio of the output and input lengths, no more and no less.
Why the largest singular value, rather than the size of the entries? Because updates are aligned with their inputs. The first section showed that a gradient step is built from itself, so is low rank and points along , and then is close to its upper bound . A random matrix is not aligned with , which is the CLT side of the same story. Each half of the table now follows in two lines.
Learning rates. Adam's first step on the rank-one gradient is , an outer product of two sign vectors, so . Setting it equal to gives , which is the Adam row of the table. Hidden and output matrices have fan-in , so their learning rate falls like , and the input layer's fan-in is fixed, so its learning rate is constant.
Initialization. A matrix with independent entries of standard deviation has , a standard result of random matrix theory. The condition then asks for
within a factor of 2. A square hidden layer gets . The output layer, with fan-in growing and fan-out fixed, gets , so , the P output rule. An input layer whose width grows past its fixed fan-in gets , a constant. (A token embedding is a special case, because a one-hot input has length 1, not . Practitioners keep the table's constant initialization there.)
The cell checks both claims on matrices of several shapes. It reports the spectral norm of a random matrix at that and of Adam's first update at , and how aligned each is with a random input, .
Both norms land on the target for every shape. The alignment column is the point. The update is aligned with its input at about 0.8 whatever the shape (for sign vectors it is ), so its spectral norm is what the output actually feels. The random initialization's alignment is 0.5 for square layers and shrinks as the fan-in of the output layer grows, which is why P logits start near zero.
The condition is also a bridge to the optimizers of §8.6. Muon replaces each matrix's update by an orthogonal factor whose singular values are all 1, so its spectral norm is exactly 1, and the condition says to multiply it by . That is the shape scale of Jordan's Muon for an matrix (fan-out , fan-in ), up to the floor at 1. Muon with that scale is, in this sense, P-shaped by construction. The Moonshot scale of §8.6, , matches AdamW's update size per entry instead, which gives a square matrix a spectral norm of , so by this argument its learning rate still has to shrink with width.
Initialization and learning rates from the spectral condition
Implement spectral_std(fan_in, fan_out), the standard deviation that gives a random matrix the target spectral norm, and spectral_adam_lr(fan_in, fan_out), the learning rate at which Adam's first step on a rank-one gradient has spectral norm exactly . Then check that the two reproduce the P table as width grows.
Coordinate checks
P is easy to get wrong. One layer with the wrong multiplier, one learning rate forgotten in an optimizer group, a tied embedding handled as an output layer, or attention left at , and transfer quietly fails. The standard test is the coordinate check of Yang et al. (2022). In their words, "one calculates the average coordinate size of every (pre)activation vector in the network over a few steps of training, as width is varied over a large range. An incorrect implementation will see some activation vector blow up or shrink to zero with width."
The cell implements one. A three-layer ReLU network (input of dimension 16, two hidden layers of width , one output) is trained with Adam for one step at five widths, and we measure how far each layer's activations moved, . Under P the movement should be the same at every width. We report the growth factor per doubling of width, which should be about 1.
Under the standard parameterization the first layer is fine, because its fan-in is fixed at 16, but the second layer's activations double with every doubling of width, exactly the growth derived above, and the output grows even faster, because it compounds the larger feature changes with the larger output-layer update. Under P all three stay flat. The widget runs the same check in your browser, with SGD as well as Adam, and over the first four steps.
A coordinate check should be the first thing you run after implementing P, and a failing one tells you which layer is wrong. Here is the interview version of the task.
A coordinate check that catches a bad parameterization
The setup provides make_measure(kind), which returns a function measure(width) that trains the network above for one Adam step at that width and returns a dictionary of mean absolute activation changes, with keys "h1", "h2", and "out". The kind is one of "mup", "sp", or two buggy P implementations you should not need to know about. Implement growth_slopes(measure, widths) returning a dictionary mapping each key to the slope of against , and non_mup_layers(measure, widths, tol=0.25) returning the sorted list of keys whose slope has absolute value above tol. A correct P implementation must produce an empty list.
The two bugs are the classic ones. The first initializes the output layer with the standard variance, so the logits respond to feature changes like . The second forgets to divide the hidden layer's Adam learning rate by the width multiplier, so its features move like .
muTransfer in practice
With a correct P implementation, hyperparameter tuning becomes three steps.
- Parameterize the target model in P, relative to a chosen base shape, so that every layer's initialization and learning rate follows the table. Microsoft's
muppackage does this for PyTorch models, replacing the output layer with a "readout" that applies the multiplier and providing P versions of SGD and Adam. - Tune a small proxy, the same architecture at a narrow width, with an ordinary hyperparameter search.
- Copy the tuned values to the full model and train it once.
The torch cell at the end of this section runs a miniature version. Swept over learning rates at widths 64, 256, and 1,024, the best standard-parameterization learning rate drifts down as the model widens, while under P it stays put and wider models are better at every learning rate.
Yang et al. (2022) report two headline results. "By transferring pretraining HPs from a model of 13M parameters, we outperform published numbers of BERT-large (350M parameters), with a total tuning cost equivalent to pretraining BERT-large once." And "by transferring from 40M parameters, we outperform published numbers of the 6.7B GPT-3 model, with tuning cost only 7% of total pretraining cost." The 40-million-parameter proxy was the 6.7B architecture shrunk to width 256, 168 times smaller, and the transferred model was comparable to the published 13-billion-parameter GPT-3. (Two caveats from the paper itself. Their own re-run of the baseline "mistakenly used absolute attention", so it is not an exact copy of GPT-3, and the P model was trained in float32 after "frequent divergences", while the original and the re-run used float16.)
What transfers, and across what? Yang et al. list it carefully.
| examples | transfers? | |
|---|---|---|
| optimization | learning rate, its schedule, momentum, Adam's betas | yes |
| initialization and multipliers | per-layer init scale, constants after weights and biases | yes |
| regularization | dropout, weight decay | no |
| across width | yes, which is what the theory guarantees | |
| across depth, batch size, sequence length, training time | empirically, for Transformers, with caveats |
The caveats matter. Transfer across the other dimensions held in their experiments only above minimum sizes (for example width 256, depth 4, batch size 32, sequence length 128, and 5,000 training steps), depth transfer worked only for pre-LayerNorm Transformers, and the best initialization scale did not transfer well across depth. A further consequence is attractive. In their experiments, "wider is always better in P but not in SP". At any fixed hyperparameters a wider P model reached a lower training loss, so a wider model never needed retuning to beat a narrower one.
Weight decay needs a rule of its own. Wang and Aitchison (2024) read AdamW's decoupled decay as making the weights an exponential moving average of recent updates, with a timescale of about steps for decay , and found that the best timescale, counted in epochs, stays roughly constant as model and dataset sizes change. Two rules follow. Under P a hidden layer's falls like , so to keep fixed its must grow with width. And on more data, with more steps per epoch, must shrink. Coupled decay (the default in many codebases, where the decay is multiplied by the learning rate) silently changes the timescale with width, and one of the independent tests below found that it breaks transfer.
Independent tests since then have been mostly positive, with instructive failures.
- Cerebras-GPT (Dey et al. 2023) trained models from 111 million to 2.7 billion parameters with P, tuned on a 40-million-parameter proxy, and reported Pile test losses 0.43 percent better and downstream accuracy 1.7 percent higher than their standard-parameterization models, with far smaller deviations from a fitted scaling law.
- MiniCPM (Hu et al. 2024) used P-style width and depth scaling and found the best learning rate stayed near 0.01 from 40 million to 500 million parameters, confirmed at 2.1 billion.
- Lingle (2024) tested learning-rate transfer up to 10 billion parameters and found it "worked as promised in most cases", with a slight drift at the largest scale, but not with trainable RMSNorm gains, not with the standard attention scale, and not with the standard form of weight decay. Decoupling weight decay from the learning rate, or leaving it out of the proxy, helped.
- Everett et al. (2024) trained models up to 26.8 billion parameters and found that with the right per-layer learning rates, "all parameterizations, not just muP, can achieve hyperparameter transfer", and that a per-layer prescription for the standard parameterization did even better. They also found that Adam's has to be scaled with width, because the gradients of wide layers shrink until a fixed dominates the denominator and quietly changes the update, and proposed Adam-atan2, which removes altogether.
The lesson from these studies is that the essential content of P is the per-layer learning-rate scaling, which is what the coordinate check verifies.
Transfer across depth
P fixes width. Depth needs its own rule, because adding blocks adds terms to the residual stream (§5.1), and a stream that is the sum of branches grows with unless each branch is scaled down. You saw one version of this in §5.7, GPT-2's initialization of the output projections. That fixes the scale at initialization, but, as with width, not the scale of the updates.
Depth-P (Yang et al. 2023, and independently Bordelon et al. 2023) multiplies every residual branch by in the forward pass,
where is the block and a tunable constant, and adjusts the learning rate. For SGD it stays , because the multiplier already shrinks each block's gradient by , and for Adam, which ignores the gradient's scale, it becomes . Bordelon et al. showed that this, combined with P, transfers optimal hyperparameters across both width and depth in residual networks and vision Transformers. Yang et al. found a limitation, though. With one layer per residual block the parameterization is optimal, but blocks with two or more layers, like a Transformer's attention and MLP, show fundamental limitations in every infinite-depth limit, and their optimal hyperparameters still shifted with depth.
CompleteP (Dey et al. 2025) revisits the choice and scales branches by instead, , with matching adjustments to learning rates, LayerNorm parameters, weight decay, and Adam's . They report that only this choice gave reliable depth-wise transfer, from 2 to 128 layers, and that it enabled 12 to 34 percent compute savings over the previous best parameterization by making deeper, narrower models trainable at their best settings.
A different strategy is to skip transfer and fit hyperparameters directly as functions of scale. DeepSeek's scaling study (DeepSeek-AI 2024) fit the best learning rate and batch size against compute, finding and , and extrapolated them to its large runs. It is the scaling-law approach of this chapter applied to the hyperparameters themselves, and it works with the standard parameterization, at the cost of many small sweeps. Learning-rate and batch-size scaling are taken up again in §8.7.
In PyTorch
A miniature Transfer experiment. A student MLP learns a fixed random teacher network, at widths 64, 256, and 1,024, under the standard parameterization and under P with Adam. P uses per-layer parameter groups, the hidden and output learning rates divided by the width multiplier, and a zero-initialized output layer.
The standard parameterization's best learning rate falls by a factor of about three as the width grows sixteenfold, and its widest model is worse than its narrowest at the largest learning rate. Under P the best learning rate is the same at every width, and at every learning rate the wider model wins, the "wider is better" property in miniature.
Read more
- Yang & Hu (2021). Feature Learning in Infinite-Width Neural Networks. Tensor Programs IV, the abc-parameterization, the dichotomy theorem, and the derivation of P.
- Yang et al. (2022). Tensor Programs V: Tuning Large Neural Networks via Zero-Shot Hyperparameter Transfer. The P tables, coordinate checks, and the GPT-3 and BERT transfer results.
- Yang et al. (2023). Tensor Programs VI: Feature Learning in Infinite-Depth Neural Networks. Depth-P and the limits for multi-layer blocks.
- Bordelon et al. (2023). Depthwise Hyperparameter Transfer in Residual Networks. branch scaling combined with P.
- Everett et al. (2024). Scaling Exponents Across Parameterizations and Optimizers. Per-layer learning rates for every parameterization, the problem, and Adam-atan2.
- Lingle (2024). An Empirical Study of μP Learning Rate Transfer. What breaks transfer in practice, up to 10B parameters.
- Dey et al. (2025). Don't be lazy: CompleteP enables compute-efficient deep transformers. Depth transfer with branch scaling.
- Yang, Simon & Bernstein (2023). A Spectral Condition for Feature Learning. The whole P table from one condition on spectral norms.
- Wang & Aitchison (2024). How to set AdamW's weight decay as you scale model and dataset size. Weight decay as an averaging timescale, and how it should scale.
- Microsoft. The mup package. A reference PyTorch implementation, including coordinate-check tools.