9.9 Scaling Up

Neural networks are developed at small scale and deployed at large scale. Because a multi-billion-parameter pretraining run cannot afford a grid search over learning rates, practitioners tune hyperparameters on a small proxy model of the same architectural family and transfer them to the target scale.

Under the standard parametrization (SP) used by default in deep learning frameworks, where layer weights are initialized with variance 1/fan-in1/\text{fan-in} and all layers share a single global learning rate η\eta, the optimal learning rate does not transfer across model width. As layer width nn increases, a single Adam step changes hidden-layer pre-activations by O(ηn)O(\eta n) because the nn terms in the matrix-vector product ΔW h\Delta\mathbf{W}\,\mathbf{h} align in sign with the incoming activations h\mathbf{h}. Consequently, the optimal learning rate drifts downward as the model widens.

The Maximal Update Parametrization (μP\mu\text{P}, Yang and Hu (2021), Yang et al. (2022)) eliminates this drift by scaling the learning rate and output multiplier of each layer according to its fan-in and fan-out growth, ensuring that every hidden layer experiences Θ(1)\Theta(1) feature updates as width n→∞n \to \infty. In this section, we measure the learning-rate drift under SP across a 64×64\times range of MLP widths (n=128n = 128 to 8,1928{,}192), derive the first-step scaling rule, implement μP\mu\text{P} and verify it with the one-step coordinate check (Yang et al., 2022; Dey et al., 2024), demonstrate zero-shot learning-rate transfer across widths, and extend the rules to Transformers, spectral-norm optimizers, and depth.

import random

9.9.1 Learning Rate and Width Under Standard Parametrization#

9.9.1.1 A Family of Widths and Learning-Rate Drift#

Consider a three-hidden-layer ReLU MLP on Fashion-MNIST whose hidden width nn varies across {128,512,2048,8192}\{128, 512, 2048, 8192\} (from 1.35×1051.35 \times 10^5 to 1.41×1081.41 \times 10^8 parameters). Note how each weight matrix scales with nn:

  • Input layer (fc_in, 784→n784 \to n): fan-in is fixed (784784), fan-out grows with nn.
  • Hidden layers (fc_h1, fc_h2, n→nn \to n): both fan-in and fan-out grow with nn.
  • Output readout (fc_out, n→10n \to 10): fan-in grows with nn, fan-out is fixed (1010).

Under standard parametrization (SP), every weight matrix is initialized from N(0,1/fan-in)\mathcal{N}(0, 1/\text{fan-in}), biases are initialized to zero, and all parameters share a single Adam learning rate η\eta. We first flatten and normalize the 60,00060{,}000 Fashion-MNIST training images onto the accelerator:

fashion = d2l.FashionMNIST()
device = d2l.try_gpu()
X = (fashion.train.data.float().reshape(-1, 784) / 255).to(device)
Y = fashion.train.targets.to(device)

Next we define MLP(width) with layers 784→n→n→n→10784 \to n \to n \to n \to 10 initialized with standard deviation fan-in−1/2\text{fan-in}^{-1/2} and a single Adam learning rate across all parameters:

class MLP(nn.Module):
    """A three-hidden-layer ReLU network under standard parametrization."""
    def __init__(self, width):
        super().__init__()
        self.fc_in = nn.Linear(784, width)
        self.fc_h1 = nn.Linear(width, width)
        self.fc_h2 = nn.Linear(width, width)
        self.fc_out = nn.Linear(width, 10)
        for lin in (self.fc_in, self.fc_h1, self.fc_h2, self.fc_out):
            nn.init.normal_(lin.weight, std=lin.in_features ** -0.5)
            nn.init.zeros_(lin.bias)

    def features(self, X):
        h = F.relu(self.fc_h1(F.relu(self.fc_in(X))))
        return F.relu(self.fc_h2(h))

    def forward(self, X):
        return self.fc_out(self.features(X))

    def configure_adam(self, lr):
        return torch.optim.Adam(self.parameters(), lr)

To measure how the optimal learning rate varies with width nn, train_mlp trains arch(width) for 400400 steps of Adam (b=512b = 512) and returns the mean loss over the final 5050 steps (capped at 2.52.5 for diverged runs):

def train_step(model, optimizer, Xb, Yb):
    loss = F.cross_entropy(model(Xb), Yb)
    optimizer.zero_grad()
    loss.backward()
    optimizer.step()
    return loss.detach()

def train_mlp(arch, width, lr, seed, num_steps=400, batch_size=512):
    torch.manual_seed(seed)
    model = arch(width).to(device)
    optimizer = model.configure_adam(lr)
    idx = torch.as_tensor(np.random.default_rng(seed).integers(
        0, X.shape[0], (num_steps, batch_size)), device=device)
    losses = torch.stack([train_step(model, optimizer, X[i], Y[i])
                          for i in idx])
    v = float(losses[-50:].mean())  # Mean minibatch loss of the last 50 steps
    return min(v, 2.5) if math.isfinite(v) else 2.5

The helpers sweep, print_optimum, and plot_sweep evaluate train_mlp across a grid of widths, learning rates, and seeds, fit the log–log slope of the optimal learning rate η⋆(n)\eta^\star(n) versus nn, and plot the seed-averaged loss curves:

def sweep(arch, widths, lrs, seeds):
    """Score of every width and learning rate, one column per seed."""
    return {w: np.array([[train_mlp(arch, w, lr, s) for s in seeds]
                         for lr in lrs]) for w in widths}

def print_optimum(loss, lrs):
    """Best rate of the seed-averaged loss per width; slope in log-log."""
    widths = list(loss)
    best = [lrs[loss[w].mean(1).argmin()] for w in widths]
    slope = np.polyfit(np.log(widths), np.log(best), 1)[0]
    print('best lr:', '  '.join(f'{lr:.1e}' for lr in best),
          f'   slope {slope:+.2f}')

def plot_sweep(loss, lrs):
    d2l.plot(lrs, [l.mean(1) for l in loss.values()], 'learning rate',
             'training loss', xscale='log', ylim=[0.2, 0.8],
             legend=[f'width {w}' for w in loss])

We now execute sweep on MLP across widths n∈{128,512,2048,8192}n \in \{128, 512, 2048, 8192\} and 1010 log-spaced learning rates η∈{2−14,…,2−5}\eta \in \{2^{-14}, \ldots, 2^{-5}\} over two shared seeds:

widths = [128, 512, 2048, 8192]
lrs = [2.0 ** k for k in range(-14, -4)]
seeds = [random.getrandbits(32) for _ in range(2)]  # Shared by every sweep
sp_loss = sweep(MLP, widths, lrs, seeds)
print_optimum(sp_loss, lrs)
plot_sweep(sp_loss, lrs)
best lr: 3.9e-03  2.0e-03  4.9e-04  2.4e-04    slope -0.70

Under standard parametrization, the U-shaped loss curves shift steadily to the left as width grows: the optimal learning rate drops 1616–32×32\times (from ∼3.9×10−3\sim 3.9 \times 10^{-3} at width 128128 to ∼1\sim 1–2×10−42 \times 10^{-4} at width 8,1928{,}192, a log–log slope of −0.7-0.7 to −0.8-0.8). Applying the width-128128 optimal learning rate directly to the width-8,1928{,}192 model pushes it far up the unstable right arm of its curve, wiping out the benefit of the 1,000×1{,}000\times larger parameter count.

9.9.1.2 Optimal Learning Rate Drift on the First Adam Step#

To see why η⋆\eta^\star must fall with width nn, consider a square hidden weight matrix W∈Rn×n\mathbf{W} \in \mathbb{R}^{n \times n} mapping activation vector h∈Rn\mathbf{h} \in \mathbb{R}^n to z=Wh\mathbf{z} = \mathbf{W}\mathbf{h}. Because Wij∼N(0,1/n)W_{ij} \sim \mathcal{N}(0, 1/n) is independent of h\mathbf{h} at initialization, each coordinate ziz_i has variance Θ(1)\Theta(1) independent of nn.

For a single example with backpropagated output gradient δ=∂ℓ/∂z\boldsymbol{\delta} = \partial \ell / \partial \mathbf{z}, the weight gradient is the outer product G=δh⊤\mathbf{G} = \boldsymbol{\delta}\mathbf{h}^\top. On step 11, Adam's bias-corrected update is ΔW=−η sign⁡(G)=−η sign⁡(δ)sign⁡(h)⊤\Delta\mathbf{W} = -\eta\,\operatorname{sign}(\mathbf{G}) = -\eta\,\operatorname{sign}(\boldsymbol{\delta})\operatorname{sign}(\mathbf{h})^\top. Evaluated on the same activation vector h\mathbf{h}, the resulting shift in pre-activation ziz_i is

(ΔW h)i=−η∑j=1nsign⁡(δihj) hj=−η sign⁡(δi)∑j=1n∣hj∣=−η sign⁡(δi) n ∣h∣‾,(9.9.1)\begin{aligned} (\Delta\mathbf{W}\, \mathbf{h})_i &= -\eta \sum_{j=1}^{n} \operatorname{sign}(\delta_i h_j)\, h_j = -\eta\, \operatorname{sign}(\delta_i) \sum_{j=1}^{n} |h_j| \\ &= -\eta\, \operatorname{sign}(\delta_i)\, n\, \overline{|h|}, \end{aligned} \tag{9.9.1}

where ∣h∣‾=1n∑j=1n∣hj∣=Θ(1)\overline{|h|} = \frac{1}{n}\sum_{j=1}^n |h_j| = \Theta(1). Because ΔWij\Delta W_{ij} is correlated with hjh_j, all nn terms in the sum share the same sign and add coherently (O(n)O(n)) rather than cancelling like random-sign initialization terms (O(n)O(\sqrt{n})). To keep the feature update (ΔW h)i=Θ(1)(\Delta\mathbf{W}\,\mathbf{h})_i = \Theta(1) invariant to width nn, the learning rate of a hidden matrix with fan-in nn must scale as η∝1/n\eta \propto 1/n (log–log slope −1-1; the empirical slope of −0.7-0.7 to −0.8-0.8 on the full MLP reflects a compromise between the n×nn \times n hidden matrices and the fixed-fan-in input layer and biases).

9.9.2 Maximal Update Parametrization (μP\mu\text{P})#

9.9.2.1 The μP\mu\text{P} Scaling Rules#

Rather than forcing a single global learning rate across layers with different fan-in scaling, Maximal Update Parametrization (μP\mu\text{P}, Yang and Hu (2021), Yang et al. (2022)) scales each layer relative to a reference base width nbasen_{\text{base}} via the width multiplier m=n/nbasem = n / n_{\text{base}} (Table 9.9.1):

  1. Input weights and 1D biases/norms (fixed fan-in): Keep initial variance 1/fan-in1/\text{fan-in} and learning rate η\eta unchanged.
  2. Hidden matrices (fan-in and fan-out ∝n\propto n): Keep initial variance 1/fan-in=1/n1/\text{fan-in} = 1/n and scale the Adam learning rate as η/m\eta / m, so that (η/m) n ∣h∣‾=η nbase ∣h∣‾=Θ(1)(\eta / m)\,n\,\overline{|h|} = \eta\,n_{\text{base}}\,\overline{|h|} = \Theta(1) at every width.
  3. Output readout matrix (fan-in ∝n\propto n, fixed fan-out): Because both ΔWout h\Delta\mathbf{W}_{\text{out}}\,\mathbf{h} and Wout Δh\mathbf{W}_{\text{out}}\,\Delta\mathbf{h} sum nn correlated terms into the output logits, Wout\mathbf{W}_{\text{out}} must have entry magnitude O(1/n)O(1/n) rather than O(1/n)O(1/\sqrt{n}). Fixing the unscaled weight initialization variance at 1/nbase1/n_{\text{base}}, multiplying the output logits by 1/m1/m in the forward pass, and keeping the Adam learning rate at η\eta ensures that both the effective output weights and their updates scale as O(1/n)O(1/n), producing Θ(1)\Theta(1) logit updates at every width.
Table 9.9.1. Maximal Update Parametrization (μP\mu\text{P}) rules for Adam relative to base width nbasen_{\textrm{base}} with width multiplier m=n/nbasem = n/n_{\textrm{base}}.
Parameter groupInitial varianceAdam learning rateForward multiplier
Input weights & all biases1/fan-in1/\textrm{fan-in} (biases 00)η\eta11
Hidden matrices (n×nn \times n)1/fan-in=1/n1/\textrm{fan-in} = 1/nη/m\eta / m11
Output readout (n×doutn \times d_{\text{out}})1/nbase1/n_{\textrm{base}}η\eta1/m1/m
class MuMLP(MLP):
    """The same network under muP, relative to a width-8,192 base."""
    def __init__(self, width, base_width=8192):
        super().__init__(width)
        self.m = width / base_width
        # Rule 3: output init variance 1/base_width at every width
        with torch.no_grad():
            self.fc_out.weight.mul_(self.m ** 0.5)

    def forward(self, X):
        # Rule 3: scale the output matrix's logits; the bias is untouched
        return self.fc_out(self.features(X) / self.m)

    def configure_adam(self, lr):
        hidden = [self.fc_h1.weight, self.fc_h2.weight]
        rest = [p for p in self.parameters()
                if not any(p is q for q in hidden)]
        return torch.optim.Adam([
            {'params': rest, 'lr': lr},
            {'params': hidden, 'lr': lr / self.m}])  # Rule 2: hidden LR / m

(Setting base_width=8192 makes MuMLP identical to MLP at the largest width n=8,192n = 8{,}192, allowing direct comparison with the SP sweep above; in production, base_width is set to the small proxy width and m>1m > 1 scales up to the target model.)

9.9.2.2 The Coordinate Check and Learning-Rate Transfer#

To verify a μP\mu\text{P} implementation before launching a sweep, the coordinate check (Yang et al., 2022; Dey et al., 2024) takes a single Adam step across widths n∈{128,256,…,8192}n \in \{128, 256, \ldots, 8192\} and measures the mean absolute activation ∣hℓ∣‾\overline{|h_\ell|} of each layer via activations and coord_check:

def activations(model, Xb):
    with torch.inference_mode():
        h1 = F.relu(model.fc_in(Xb))
        h2 = F.relu(model.fc_h1(h1))
        h3 = F.relu(model.fc_h2(h2))
        return [float(h.abs().mean()) for h in (h1, h2, h3, model(Xb))]

def coord_check(arch, widths, lr, seed, num_steps=1):
    Xb, Yb = X[:256], Y[:256]
    sizes = []
    for width in widths:
        torch.manual_seed(seed)
        model = arch(width).to(device)
        optimizer = model.configure_adam(lr)
        for _ in range(num_steps):
            train_step(model, optimizer, Xb, Yb)
        sizes.append(activations(model, Xb))
    return list(zip(*sizes))

Running coord_check on the standard-parametrization MLP across seven widths n∈{128,256,…,8192}n \in \{128, 256, \ldots, 8192\} at width 128128's optimal learning rate lr_128 reveals severe activation blow-up with width:

check_widths = [128 * 2 ** k for k in range(7)]  # 128 to 8,192
lr_128 = lrs[sp_loss[128].mean(1).argmin()]  # SP's best rate at width 128
sp_acts = coord_check(MLP, check_widths, lr_128, seeds[0])
d2l.plot(check_widths, list(sp_acts), 'width', 'mean |activation|',
         xscale='log', yscale='log', ylim=[0.05, 1000],
         legend=['layer 1', 'layer 2', 'layer 3', 'logits'])

Running the exact same one-step coord_check on MuMLP at the base-width learning rate lr_base confirms that μP\mu\text{P} keeps all three hidden layers and the output logits invariant across widths:

lr_base = lrs[sp_loss[8192].mean(1).argmin()]  # Best at the base width
mup_acts = coord_check(MuMLP, check_widths, lr_base, seeds[0])
d2l.plot(check_widths, list(mup_acts), 'width', 'mean |activation|',
         xscale='log', yscale='log', ylim=[0.05, 1000],
         legend=['layer 1', 'layer 2', 'layer 3', 'logits'])

Under SP (MLP), layer 22, layer 33 and the output logits approach O(n)O(n), O(n2)O(n^2) and O(n3)O(n^3) growth at the widest widths (the logits rise about 1,000×1{,}000\times from width 128128 to width 8,1928{,}192 after a single step). Under μP\mu\text{P} (MuMLP), every layer's activation and logit scale remains flat across all seven widths.

Repeating the 400400-step learning-rate sweep under μP\mu\text{P} confirms that the optimal learning rate aligns across the entire 64×64\times width range:

mup_loss = sweep(MuMLP, widths[:-1], lrs, seeds)
mup_loss[widths[-1]] = sp_loss[widths[-1]]  # At the base width muP is SP
print_optimum(mup_loss, lrs)
plot_sweep(mup_loss, lrs)
best lr: 2.4e-04  2.4e-04  2.4e-04  2.4e-04    slope +0.00

Finally, we compare the training loss achieved at width 8,1928{,}192 when transferring the learning rate tuned on the narrow width-128128 proxy versus tuning directly at width 8,1928{,}192 under both SP and μP\mu\text{P}:

for name, loss in (('SP', sp_loss), ('muP', mup_loss)):
    mean = {w: l.mean(1) for w, l in loss.items()}
    print(f'{name:3s} best loss per width:',
          '  '.join(f'{m.min():.3f}' for m in mean.values()))
    small, wide = widths[0], widths[-1]
    tuned, own = mean[small].argmin(), mean[wide].argmin()
    for label, i in ((f'the width-{small} lr', tuned), ('its own lr', own)):
        runs = '  '.join(f'{v:.3f}' for v in loss[wide][i])
        print(f'    width {wide} at {label:16s} {mean[wide][i]:.3f}'
              f'  (seeds {runs})')
SP  best loss per width: 0.323  0.298  0.262  0.230
    width 8192 at the width-128 lr 0.355  (seeds 0.382  0.329)
    width 8192 at its own lr       0.230  (seeds 0.232  0.228)
muP best loss per width: 0.335  0.265  0.241  0.230
    width 8192 at the width-128 lr 0.230  (seeds 0.232  0.228)
    width 8192 at its own lr       0.230  (seeds 0.232  0.228)

Under μP\mu\text{P}, the log–log slope of η⋆(n)\eta^\star(n) collapses from −0.7-0.7 or steeper under SP to near zero (the optimum moves by at most one grid step across the 64×64\times width range): transferring the learning rate tuned at width 128128 directly to width 8,1928{,}192 incurs ≤0.003\le 0.003 nats of suboptimality (well below seed noise), compared to a 0.10–0.150.10\text{--}0.15-nat penalty under SP.

9.9.3 Extensions to Transformers and Spectral Optimizers#

9.9.3.1 μP\mu\text{P} Rules for a Transformer#

Applying μP\mu\text{P} to a Transformer such as TinyLM (Section 9.3.1) with model dimension dd and width multiplier m=d/dbasem = d / d_{\text{base}} follows the exact same fan-in/fan-out classification, with one additional rule for attention logits (Table 9.9.2): because learned query and key vectors align during training, their dot product q⊤k\mathbf{q}^\top\mathbf{k} over head dimension dk∝dd_k \propto d grows as O(dk)O(d_k), requiring attention scaling by 1/dk1/d_k (an extra factor of 1/m1/\sqrt{m} relative to standard 1/dk1/\sqrt{d_k} scaling (Yang et al., 2022)).

Table 9.9.2. Maximal Update Parametrization (μP\mu\text{P}) rules for a Transformer under Adam (m=d/dbasem = d/d_{\textrm{base}}).
ComponentScaling reasonμP\mu\text{P} rule
Embeddings, 1D biases, LayerNorm scales/shiftsFixed fan-in (lookup or elementwise)Learning rate η\eta
Internal block matrices (qkv, proj, mlp1, mlp2)Both fan-in and fan-out ∝d\propto dLearning rate η/m\eta/m, init variance 1/fan-in1/\text{fan-in}
Output readout headFan-in ∝d\propto d, fixed vocabulary size VVInit variance 1/dbase1/d_{\text{base}}, logits ×1/m\times 1/m, learning rate η\eta
Attention dot-product scoresInner product of aligned dkd_k-vectorsScale scores by 1/dk1/d_k (extra factor 1/m1/\sqrt{m})
Residual branches, when the depth LL also growsLL branch outputs add in the residual streamMultiply each branch by Lbase/LL_{\text{base}}/L (Section 9.9.3.3)

9.9.3.2 The Spectral Scaling Condition and Muon#

As Yang et al. (2023) show, all μP\mu\text{P} rules can be unified under a single operator-norm principle: for a layer mapping h∈Rdin\mathbf{h} \in \mathbb{R}^{d_{\text{in}}} with ∥h∥2=Θ(din)\|\mathbf{h}\|_2 = \Theta(\sqrt{d_{\text{in}}}) to z∈Rdout\mathbf{z} \in \mathbb{R}^{d_{\text{out}}} with ∥z∥2=Θ(dout)\|\mathbf{z}\|_2 = \Theta(\sqrt{d_{\text{out}}}), preserving Θ(1)\Theta(1) entrywise activations and updates requires both the weight matrix W\mathbf{W} and its update ΔW\Delta\mathbf{W} to have spectral norm

∥ΔW∥2=Θ ⁣(doutdin).(9.9.2)\|\Delta\mathbf{W}\|_2 = \Theta\!\left(\sqrt{\frac{d_{\textrm{out}}}{d_{\textrm{in}}}}\right). \tag{9.9.2}

For a square n×nn \times n hidden matrix, (9.9.2) requires ∥ΔW∥2=Θ(1)\|\Delta\mathbf{W}\|_2 = \Theta(1). Under Adam, a rank-11 sign update has ∥ΔW∥2=Θ(ηn)\|\Delta\mathbf{W}\|_2 = \Theta(\eta n), requiring η∝1/n\eta \propto 1/n. Under Muon (Section 9.6), the orthogonalized update NS5(⋅)\mathrm{NS}_5(\cdot) has unit spectral norm by construction; if scaled by dout/din\sqrt{d_{\text{out}}/d_{\text{in}}} (Bernstein, 2025), its learning rate transfers across widths directly with no 1/m1/m correction (whereas the AdamW-matched factor 0.2max⁡(dout,din)0.2\sqrt{\max(d_{\text{out}}, d_{\text{in}})} of Section 9.6 has spectral norm Θ(ηn)\Theta(\eta\sqrt{n}) and therefore scales as η∝1/n\eta \propto 1/\sqrt{n}; Exercise 3).

9.9.3.3 Depth, Weight Decay, and Finite Size#

So far we have varied the width alone. A real scale-up also adds layers, and under AdamW the weight decay has to follow whatever is done to the learning rate. Both need a rule of their own.

Consider depth first. In a network of LL residual blocks, the residual stream is the sum of LL branch outputs. If every branch contributes Θ(1)\Theta(1), the sum grows with LL, and so does the effect of one optimizer step, since every block moves the output. The remedy has the same form as the logit multiplier: multiply each residual branch by (Lbase/L)α(L_{\text{base}}/L)^{\alpha}. Two exponents have been proposed. With α=1/2\alpha = 1/2 the branch outputs add like independent random terms, which they are at initialization (Bordelon et al., 2024; Yang et al., 2024). With α=1\alpha = 1 they add like aligned terms, which they become once training has correlated them. This is the argument that gave the readout 1/n1/n and not 1/n1/\sqrt{n}. Dey et al. (2025) find that in Transformers only α=1\alpha = 1 keeps every block learning features as LL grows, and that the learning rate then transfers across depth as it does across width.

Weight decay comes next. Under AdamW, the decay timescale τ=1/(ηλ)\tau = 1/(\eta\lambda) sets how fast the weights approach their equilibrium norm (Section 9.5). A rule that divides a layer's learning rate by mm and leaves λ\lambda alone makes that layer's τ\tau grow mm-fold, so the wide model is regularized differently from the small one it was tuned on. One consistent choice is to hold τ\tau fixed: multiply λ\lambda by mm wherever η\eta is divided by mm (Wang and Aitchison, 2025).

Finally, all of these rules are exact only in the limit of infinite size. At practical widths the optimum still drifts a little; in our own sweep it moved by one grid step. A transferred learning rate is therefore best used as the center of a narrow sweep at the target size, not as a substitute for one.

9.9.4 Summary#

Under standard parametrization (SP), a single Adam step changes the output of a hidden layer with fan-in nn by Θ(ηn)\Theta(\eta n), causing the optimal learning rate η⋆(n)\eta^\star(n) to drift downward as the network widens. Maximal Update Parametrization (μP\mu\text{P}) scales hidden-matrix learning rates by 1/m1/m (where m=n/nbasem = n/n_{\text{base}}), fixes output-layer initialization variance at 1/nbase1/n_{\text{base}} while scaling logits by 1/m1/m, and scales Transformer attention scores by 1/dk1/d_k, achieving Θ(1)\Theta(1) feature updates and zero-shot learning-rate transfer across widths. A one-step coordinate check verifies across a geometric progression of widths that layer activation magnitudes remain flat after an optimizer step. Extending hyperparameter transfer to full scale-ups additionally scales residual branches by Lbase/LL_{\text{base}}/L with depth and holds the AdamW decay timescale τ=1/(ηλ)\tau = 1/(\eta\lambda) constant as layer learning rates vary, providing an asymptotic anchor around which narrow target-scale sweeps can be centered.

9.9.5 Exercises#

  1. [code] Diagnosing broken μP\mu\text{P} rules with the coordinate check. Set base_width=128 in MuMLP and use coord_check at lr_128 to test three deliberate bugs one at a time: (a) omitting the 1/m1/m logit multiplier, (b) omitting the η/m\eta/m hidden learning-rate scaling, and (c) scaling the hidden learning rate by η/m2\eta/m^2. Identify which errors coord_check catches immediately and why over-shrinking updates (η/m2\eta/m^2) requires a multi-step loss sweep to detect.

  2. [code] Effect of the reference base width. Rerun the μP\mu\text{P} sweep with base_width=128 across widths {128,512,2048,8192}\{128, 512, 2048, 8192\}, verify that the log–log slope of η⋆(n)\eta^\star(n) remains near zero, and identify which constant ratio (input-to-hidden learning-rate ratio vs. initial logit scale) accounts for the loss difference at width 8,1928{,}192.

  3. Spectral norm condition across layers and optimizers. ● Using (9.9.2), verify that the μP\mu\text{P} rules of Table 9.9.1 give input, hidden, and output layers updates of spectral norm Θ(dout/din)\Theta(\sqrt{d_{\text{out}}/d_{\text{in}}}) under a rank-11 Adam step, and derive the width scaling of η\eta required for Muon (Section 9.6) on the four block matrices of TinyLM.

  4. [code] Implementing μP\mu\text{P} and the coordinate check on TinyLM. ● Apply Table 9.9.2 to d2l.TinyLM across d_model ∈{64,128,256,512,1024}\in \{64, 128, 256, 512, 1024\} (num_heads=2, base_width=64) and verify with a one-step coordinate check at η=3×10−3\eta = 3 \times 10^{-3} that all sublayer output and logit magnitudes remain flat with width.

Discussions