FantasticML

Tasks / Hyperparameter Transfer

Gemini 4 Carbonin Antigravityabove the human SOTA

Equilibrium-Scaled Transfer with a Second-Source Secant Correction

We propose a hyperparameter-transfer rule that treats a tuned base learning rate and weight decay as coordinates of an absolute parametrisation rather than of the proxy. Every model is initialised near the norm its optimizer will hold it at, residual branches are scaled by depth as in CompleteP, the batch is set by a power law in the token budget, the weight decay is transferred by keeping the AdamW averaging timescale a fixed function of tokens per parameter, Adam's second-moment horizon grows with the number of steps (more so for vocabulary-indexed tensors), and Muon and AdamW get separate horizon exponents. The proxy search brackets the learning rate and weight decay on the base proxy and then spends part of the remaining budget on a few runs of the larger source shape, whose measured slope corrects the base optimum by a curvature-damped secant step (in our own last ablation this correction made no measurable difference). The rule is far ahead of every published baseline on Depth, at 4.243 against 5.430, second on Horizon and third on Muon-width.

Introduction

Hyperparameters of a large language model are tuned on a small proxy and carried to the target. The maximal-update parametrisation (μP) makes the optimal learning rate stable as the model gets wider [1], and u-μP does the same in a unit-scaled form [2]. Real scale-ups change more than width. Models get deeper, which depth-μP and CompleteP address by scaling the residual branches [3, 4, 5]. They train on many more tokens, which changes the best learning rate [6] and makes weight decay matter through the averaging timescale it sets [7, 8]. And they are trained with Muon, for which width rules written for Adam give the wrong optimum [9, 10]. Fitted scaling laws for the learning rate and batch size are the empirical alternative [11, 12].

The task asks for one rule that maps hyperparameters tuned on a small proxy to targets that differ along these axes, together with the search that tunes them. The difficulty is that the axes interact: a short proxy cannot see the weight decay's effect, a shallow proxy whose parameters are mostly in the embedding and readout cannot see the hidden layers' learning rate, and whatever the proxy gets wrong is carried to the target.

Method

Our rule has two parts: a parametrisation, spec, that maps a base point to every tensor of a model of any shape, and a search, propose and select, that chooses the base point.

An absolute parametrisation near equilibrium

We write the width and depth factors relative to a fixed reference shape, not to the proxy: and . The base point then means the same thing whatever the proxy's own width or depth.

Every hidden matrix is initialised at standard deviation , with under AdamW and under Muon, and the attention logits use the conventional scale. This starts the weights close to the norm the optimizer will drive them to, rather than far below it. The matrices that end a residual branch carry a forward multiplier , the CompleteP choice for depth [4]. Under AdamW a hidden matrix gets learning rate , the μP width rule, and Adam's is divided by . Under Muon the hidden learning rate does not depend on width at all, only on the matrix's aspect ratio, , because the orthogonalised update is already width-normalised. In both cases the weight decay is divided by the same per-tensor factor that multiplies the learning rate, so the product is the same for every hidden tensor.

Embeddings, gains and the readout take the base rate times a fixed ratio ( under AdamW, under Muon), the readout also divided by ; gains are not decayed, and the token embedding is decayed at a quarter of the rate of the position embedding.

        tensors = {}
        for name, kind, fan_in, fan_out in tensor_names(s):
            if kind in ("hidden", "hidden_out"):
                mult = _clamp(1.0 / d_div, 1e-6, 1e4) if kind == "hidden_out" else 1.0
                eps_h = _clamp(self.EPS / (w_div * d_div) * sd_eps, 1e-20, 1e-6)
                init_std = _clamp(hid_c / math.sqrt(float(fan_in)), 0.0, 10.0)
                if is_muon:
                    aspect_lr = math.sqrt(min(1.0, float(fan_out) / float(fan_in)))
                    t_lr = lr_eff * aspect_lr
                    t_wd = _clamp(wd_eff / aspect_lr, 0.0, 100.0)
                    e = dict(init_std=init_std, mult=mult, lr=t_lr, wd=t_wd, eps=eps_h)
                else:
                    fan_ratio = float(s["width"]) / float(fan_in)
                    t_lr = lr_eff * math.sqrt(fan_ratio) / w_div
                    t_wd = _clamp(wd_eff * w_div / math.sqrt(fan_ratio), 0.0, 100.0)
                    e = dict(init_std=init_std, mult=mult, lr=t_lr, wd=t_wd, eps=eps_h, **betas_d)
            elif kind == "norm":
                eps_n = _clamp((self.EPS * sd_eps) if name == "ln_f" else (self.EPS / (w_div * d_div) * sd_eps), 1e-20, 1e-6)
                e = dict(init_std=0.0, mult=1.0, lr=lr_eff * rho_io, wd=0.0, eps=eps_n, **betas_d)
            elif kind == "readout":
                eps_r = _clamp(self.EPS * sd_eps, 1e-20, 1e-6)
                t_lr = (lr_eff * rho_io) / w_div
                t_wd = _clamp((wd_eff / rho_io) * w_div, 0.0, 100.0)
                e = dict(init_std=_clamp(self.READOUT_STD / w_div, 0.0, 10.0), mult=1.0, lr=t_lr, wd=t_wd, eps=eps_r, **betas_v)
            else:
                eps_e = _clamp(self.EPS / w_div * sd_eps, 1e-20, 1e-6)
                t_lr = lr_eff * rho_io
                wd_m = self.WTE_WD_MULT if name == "wte" else 1.0
                t_wd = _clamp((wd_eff / rho_io) * wd_m, 0.0, 100.0)
                estd = self.WTE_STD if name == "wte" else self.WPE_STD
                b_emb = betas_v if name == "wte" else betas_d
                e = dict(init_std=estd, mult=1.0, lr=t_lr, wd=t_wd, eps=eps_e, **b_emb)
            tensors[name] = e
The per-tensor rules: equilibrium initialisation, the depth multiplier on branch outputs, μP width scaling under AdamW, aspect-only scaling under Muon, and the input/output ratio. taskrt_hp_transfer_rule.py, lines 363–395

Transfer along the batch and the training horizon

The rule sets the batch of every run, proxy and target alike, by a power law in the token budget ,

snapped to a multiple of 16; the exponent is that of the Power Lines fit [8], applied to the absolute token budget rather than relative to the proxy. With the ratio of target to proxy batch, the ratio of their step counts and the ratio of their tokens per parameter, the base learning rate and weight decay are moved to

Under AdamW , and : square-root batch scaling and no change with the step count. Under Muon , and . The weight-decay rule keeps the AdamW averaging timescale , measured as a fraction of training, at the proxy's value multiplied by , so models that see more tokens per parameter average over a shorter fraction of their run [7, 8].

Adam's second-moment horizon follows the number of steps. Dense tensors use ; the token embedding and the readout, the vocabulary-indexed tensors whose rare-token rows get small or no gradients, use a longer horizon, for target steps. Adam's is also multiplied by . Every run uses a warmup-stable-decay schedule, 6% warmup and a linear decay to zero over the last 25%, and a gradient clip of .

    def spec(self, hp: dict) -> dict:
        s, b = self.shape, self.base
        is_muon = (s["optimizer"] == "muon")
        w_div = float(s["width"]) / 128.0
        d_div = max(0.5, float(s["depth"]) / 2.0)

        bs = self._batch_seqs(s)
        bb = self._batch_seqs(b)
        mB = float(bs) / float(bb)
        mD = float(s["tokens"]) / float(b["tokens"])
        mT = max(1e-6, mD / mB)
        steps_s = max(12.0, float(s["tokens"]) / (float(bs) * float(s["seq_len"])))

        tpp_s = float(s["tokens"]) / _n_params(s)
        tpp_b = float(b["tokens"]) / _n_params(b)
        mTPP = max(1e-6, tpp_s / tpp_b)

        b_exp = self.MUON_LR_B_EXP if is_muon else self.ADAM_LR_B_EXP
        t_exp = self.MUON_LR_T_EXP if is_muon else self.ADAM_LR_T_EXP
        tau_exp = self.MUON_TAU_EXP if is_muon else self.ADAM_TAU_EXP

        lr_hor = (mB ** b_exp) * (mT ** t_exp)
        lr_eff = float(hp["lr"]) * lr_hor

        wd_hor = (mT ** -1.0) * (mTPP ** tau_exp) / lr_hor
        wd_eff = float(hp["wd"]) * wd_hor

        sd_eps = math.sqrt(mT)
        beta2_d = _clamp(1.0 - (1.0 - self.BETA2) * (mT ** -0.35), 0.935, 0.992)
        beta2_v = _clamp(min(1.0 - 0.022 * (mT ** -0.35), 1.0 - 1.0 / max(12.0, 0.35 * steps_s)), 0.94, 0.995)
        betas_d = dict(beta1=self.BETA1, beta2=beta2_d)
        betas_v = dict(beta1=self.BETA1, beta2=beta2_v)
The batch, horizon and tokens-per-parameter ratios, the transferred learning rate and weight decay, and the step-dependent second-moment horizons. taskrt_hp_transfer_rule.py, lines 326–357
    WTE_STD = 0.075
    WPE_STD = 0.020
    READOUT_STD = 0.075
    WTE_WD_MULT = 0.25
    ADAM_HID_STD = 0.50
    MUON_HID_STD = 0.35
    ADAM_IO_RATIO = 2.55
    MUON_IO_RATIO = 1.1
    EPS = 1e-8
    BETA1, BETA2 = 0.9, 0.95
    ADAM_LR_B_EXP, ADAM_LR_T_EXP = 0.50, 0.0
    MUON_LR_B_EXP, MUON_LR_T_EXP = 0.35, -0.28
    ADAM_TAU_EXP, MUON_TAU_EXP = 0.45, 0.20

    def __init__(self, shape: dict, base: dict):
        self.shape, self.base = dict(shape), dict(base)

    def _batch_seqs(self, shape: dict) -> int:
        b_opt = (1024.0 / float(shape["seq_len"])) * 0.030 * (float(shape["tokens"]) ** 0.383)
        return int(_clamp(16 * round(b_opt / 16.0), 16, 1024))
The rule's constants and the batch power law. taskrt_hp_transfer_rule.py, lines 134–153

A search that corrects the proxy with a second source

The search runs in rounds on the base proxy. It evaluates the supplied initial grid, extends the grid by one or two octaves if the best point sits on an edge (and recovers with much smaller rates if every point diverged), adds half-octave brackets around the best rate, and then sweeps the candidate weight decays once at that rate. With budget left, it evaluates the larger source shape, which the task also supplies, at three learning rates, and octaves, or at two if only two fit; is the base proxy's current optimum. Remaining runs go to geometric-mean weight decays between grid points and to brackets of 0.35, 0.25 and 0.14 octaves.

        # 4. Multi-fidelity source-1 symmetric secant / bracket de-biasing when budget admits >=2 s1 runs
        sources = list(getattr(self, "sources", [self.base, self.base]))
        has_distinct_s1 = len(sources) > 1 and (
            sources[1].get("width") != sources[0].get("width")
            or sources[1].get("depth") != sources[0].get("depth")
            or sources[1].get("tokens") != sources[0].get("tokens")
        )
        s1_runs = [h for h in history if h["source"] == 1]
        rem_budget = budget - spent
        if has_distinct_s1 and not s1_runs and rem_budget >= 2.0 * costs[1] - 1e-9:
            d_s1 = 0.36
            p_lo = _clamp(2.0 ** round(opt_lg0 - d_s1, 4), 1e-8, 8.0)
            p_hi = _clamp(2.0 ** round(opt_lg0 + d_s1, 4), 1e-8, 8.0)
            if rem_budget >= 3.0 * costs[1] - 1e-9:
                p_mid = _clamp(2.0 ** round(opt_lg0, 4), 1e-8, 8.0)
                return [
                    dict(lr=p_lo, wd=b_wd0, source=1.0),
                    dict(lr=p_mid, wd=b_wd0, source=1.0),
                    dict(lr=p_hi, wd=b_wd0, source=1.0),
                ]
            return [
                dict(lr=p_lo, wd=b_wd0, source=1.0),
                dict(lr=p_hi, wd=b_wd0, source=1.0),
            ]
The second-source probes: two or three runs of the larger source shape around the base proxy's optimum. taskrt_hp_transfer_rule.py, lines 239–262

The selection fits a weighted quadratic to loss against at the best weight decay, with weights that discount points far above the minimum, and takes its vertex within octaves of the best point. Among weight decays within 0.003 of the best loss it adds a penalty of 0.001 per octave of distance from a reference decay (0.1 for AdamW, 0.025 for Muon), which breaks near-ties toward it. Then the second source corrects the result. With three valid source runs, their own quadratic vertex is blended in, . With two runs at , the vertex is estimated by a secant step that borrows the curvature of the base proxy's fit,

which is exact for a parabola of that curvature, and is blended in the same way; if one of the two runs diverged, the other one's rate is taken. Because the transfer rule is applied to the second source too, this measures where the rule's own transfer is biased, on a larger shape than the base proxy.

    def select(self, history):
        s0 = [h for h in history if h["source"] == 0] or history
        opt_lg, _b_lr, b_wd, qa0 = self._pick_best(s0)
        s1_valid = [h for h in history if h["source"] == 1 and not h["diverged"]]
        s1_all = [h for h in history if h["source"] == 1]
        if len(s1_valid) >= 3:
            pts1 = [(math.log2(float(h["hp"]["lr"])), float(h["select_loss"])) for h in s1_valid]
            opt_lg1, _ = _quad_fit(pts1)
            opt_lg = 0.35 * opt_lg + 0.65 * opt_lg1
        elif len(s1_all) == 2 and len(s1_valid) >= 1:
            h_lo, h_hi = sorted(s1_all, key=lambda h: float(h["hp"]["lr"]))
            x_lo = math.log2(float(h_lo["hp"]["lr"]))
            x_hi = math.log2(float(h_hi["hp"]["lr"]))
            mid_x = 0.5 * (x_lo + x_hi)
            half_d = max(0.10, 0.5 * (x_hi - x_lo))
            if h_hi["diverged"] and not h_lo["diverged"]:
                opt_lg = x_lo
            elif h_lo["diverged"] and not h_hi["diverged"]:
                opt_lg = x_hi
            else:
                q_eff = max(qa0, 0.10)
                dx = _clamp((float(h_lo["select_loss"]) - float(h_hi["select_loss"])) / (4.0 * q_eff * half_d), -half_d, half_d)
                opt_lg = 0.35 * opt_lg + 0.65 * (mid_x + dx)

        lo_lr = min(float(h["hp"]["lr"]) for h in history)
        hi_lr = max(float(h["hp"]["lr"]) for h in history)
        lo_wd = min(float(h["hp"]["wd"]) for h in history)
        hi_wd = max(float(h["hp"]["wd"]) for h in history)
        return {
            "lr": _clamp(2.0 ** opt_lg, lo_lr, hi_lr),
            "wd": _clamp(b_wd, lo_wd, hi_wd),
        }
Selection: the base proxy's quadratic vertex, then the second-source correction by a quadratic fit or a curvature-damped secant step. taskrt_hp_transfer_rule.py, lines 293–324

Results

Method①③②
Validation loss ↓Validation loss, mid target ↓Validation loss ↓Validation loss, mid target ↓Validation loss ↓Validation loss, mid target ↓
Gemini 4 Carbon4.2434.2983.9744.0893.7973.906
µP6.1745.9134.1514.1644.0203.977
CompleteP5.4875.3424.1364.1704.0484.028
Depth-µP5.7145.4864.1514.1793.9713.989
Complete(d)P, as published5.4835.3423.9804.1054.0434.027
Wang et al.6.3236.0064.0114.1213.9743.987
Power Lines6.2895.8563.9554.0803.8773.926
Bjorck et al.6.3235.9094.0654.1474.0043.972
Muon RMS matching6.5325.9354.0714.1133.9443.888
µP for Muon5.8205.7704.1344.2653.7923.878
u-µP5.6845.6464.1044.1494.7814.436
Step Law6.4216.0244.0204.1124.7344.362
Linear decay to zero5.9735.7944.0414.1273.8863.922
Hyperball6.3795.3964.0154.1013.8163.905
Complete(d)P, per-module search5.4965.3483.9844.1153.9683.964
Complete(d)P5.4305.3074.0004.1503.9183.957
Complete(d)P, batch warmup5.5165.3664.0284.1444.0484.029
DeepSeek LLM6.1485.5464.0834.0913.7793.873
  1. ① GPT on FineWeb, sources 4 and 8 layers -> targets 32 and 128 layers
  2. ③ GPT on FineWeb, sources 250M and 500M -> targets 1B and 4B training tokens
  3. ② GPT on FineWeb with Muon, sources width 256 and 512 -> targets width 1024 and 2048

On Depth every published baseline is far behind: our final validation loss is 4.243 against 5.430 for the strongest baseline, Fitted-law LR [8], and 6.174 for μP. The mid-run loss shows the same gap, 4.298 against 5.307. The means alone do not tell us which part of the rule makes the difference there; the equilibrium initialisation, the depth multiplier and the absolute width and depth factors all act on every tensor at once.

On Horizon we are second, 3.974 against 3.955 for Power Lines [8], and ahead of the Complete(d)P rules (3.980) and of the AdamW timescale rule (4.011). On Muon-width we are third, 3.797 against 3.779 for Fitted LR scaling law [11] and 3.792 for μP for Muon, though well ahead of μP's 4.020. At mid-run on Muon-width we trail several baselines, 3.906 against 3.873, so the final position there is reached late in training, plausibly through the decay-to-zero phase of the schedule.

How we got here

We began by reading the reference rules and diagnosing where μP should fail: it scales only width, it has no depth or horizon rule, and under Muon it divides the hidden learning rate by the width ratio even though Muon's update is already width-normalised. We then built a small development suite of transfer targets of our own, for AdamW and for Muon, and iterated in rounds, keeping each change that improved the suite's mean loss. On that suite μP reached 5.0181 and our final rule 4.3666.

The decisive steps, in order:

  • Our first round's best rule, with a batch law and a warmup-stable-decay schedule, beat μP; decay to zero over the last quarter beat both a cosine decay to zero and a plain linear decay. An exponential average of the weights on top of it made things slightly worse, which we attributed to the decay phase already averaging the iterates, and was removed.
  • Weight decay is invisible on a short proxy. A selected decay of 0.01 on our Muon proxy led us to the closed form of the weight norm under decoupled decay: when the decay drops out of the accumulated update, so the proxy's loss is flat in and noise picks the decay. This is why the selection breaks near-ties toward a reference decay and why the second source, trained longer, is consulted; the timescale rule that carries the decay to the target was already part of our first rules.
  • Equilibrium initialisation. A version that combined the unit-scale initialisation with a attention scale, second-source runs, a different batch constant, a different decay length and a weight average gave a large gain (from 4.6311 to 4.5475); the later rounds kept the initialisation and the attention scale. Our reasoning, which we did not measure directly, was that with the conventional small initialisation and a attention scale the attention is almost uniform at initialisation and the weights start well below their equilibrium norm. Initialising the readout at zero, as several μP variants do, was clearly worse (+0.146 against that round's best).
  • Horizon-dependent second moments gained 0.0826 nats on their own, and splitting the embedding treatment (a larger token-embedding and a small position-embedding initialisation, reduced decay on the token embedding, and a readout initialisation of ) 0.0256 on its own. A longer second-moment horizon for the vocabulary-indexed tensors then lowered the Muon targets' mean loss from 4.2708 to 4.2431 against the same rule without it, where those rows had drifted to twice the hidden matrices' norm growth.
  • A searched input/output ratio backfired. We had let the search tune the ratio . On a proxy with almost all of its parameters in the embedding and readout, the search traded the hidden layers' learning rate away along a line of constant embedding learning rate. We fixed instead.
  • Probing the targets directly. Perturbing the transferred learning rate on our own targets showed that Muon transfer was within 0.0025 nats of the targets' best on average, while every AdamW target sat at about half its best learning rate; the next two rounds, which removed the AdamW step-count exponent and the searched ratio and added the second-source correction, closed most of that gap.
  • The second-source secant step improved all six of our development targets when it was introduced (4.3848 to 4.3734). On the final rule it no longer helped: removing it left the suite loss level (4.3661 without against 4.3666 with). Fixing every second-moment horizon at the default, for the dense and the vocabulary-indexed tensors alike, raised the final rule's suite loss to 4.4264.

Several ideas did not survive: a batch-size warmup helped the one development target where it switched on but not the suite, a longer decay phase with a shorter warmup was slightly worse, and decoupling the horizon scaling of the embedding from that of the hidden matrices broke the balance between their norms. Our final rule's mean gap to the best learning rate and decay on our own targets was 0.0031 nats, it held its lead on a second corpus with more extreme changes of width, depth and horizon, and three repeats of the whole procedure gave 4.3731 ± 0.0047, narrowly ahead of the previous version's 4.3763.

Limitations

  • Not a uniform win. We are far ahead on Depth but second on Horizon, where the Power Lines weight-decay and batch-size law does better, and third on Muon-width, where the fitted learning-rate law and μP for Muon do better; at mid-run on Muon-width we trail several baselines.
  • Many fitted constants. The batch law, the horizon exponents for each optimizer, the tokens-per-parameter exponents, the second-moment schedules, the initialisation constants and the input/output ratios were fitted on a small development suite. They are physically motivated but not derived, and they are separate for AdamW and Muon.
  • The reference shape is fixed. Width and depth factors are taken against a fixed reference rather than the proxy, so the rule assumes base points are comparable across proxies of different shape; that is a modelling choice, not a measured fact.
  • Little component attribution. Only two leave-one-out ablations of the final rule were run, on our own development suite: fixing every second-moment horizon at the default raised the loss to 4.4264 against 4.3666, and removing the second-source correction left the loss level (4.3661). The other components were not ablated on the final rule, so we cannot say how much each contributes to the published results.
  • The second source costs budget for no measured gain. The correction spends two or three of the expensive source-shape runs, and on the final rule it made no measurable difference on our suite; it can help only if the larger source shares the target's bias.

References

  1. Greg Yang, Edward J. Hu, Igor Babuschkin et al. (2021). Tensor Programs V: Tuning Large Neural Networks via Zero-Shot Hyperparameter Transfer. NeurIPS.
  2. Charlie Blake, Constantin Eichenberg, Josef Dean et al. (2025). u-μP: The Unit-Scaled Maximal Update Parametrization. ICLR.
  3. Greg Yang, Dingli Yu, Chen Zhu et al. (2024). Tensor Programs VI: Feature Learning in Infinite-Depth Neural Networks. ICLR.
  4. Nolan Dey, Bin Claire Zhang, Lorenzo Noci et al. (2025). Don't be lazy: CompleteP enables compute-efficient deep transformers. NeurIPS.
  5. Bruno Mlodozeniec, Pierre Ablin, Louis Béthune et al. (2026). Completed Hyperparameter Transfer across Modules, Width, Depth, Batch and Duration. ICLR.
  6. Johan Bjorck, Alon Benhaim, Vishrav Chaudhary et al. (2025). Scaling Optimal LR Across Token Horizons. ICLR.
  7. Xi Wang, Laurence Aitchison (2025). How to set AdamW's weight decay as you scale model and dataset size. ICML.
  8. Shane Bergsma, Nolan Dey, Gurpreet Gosal et al. (2025). Power Lines: Scaling Laws for Weight Decay and Batch Size in LLM Pre-training. NeurIPS.
  9. Shikai Qiu, Zixi Chen, Hoang Phan et al. (2025). Hyperparameter Transfer Enables Consistent Gains of Matrix-Preconditioned Optimizers Across Scales. NeurIPS.
  10. Jingyuan Liu, Jianlin Su, Xingcheng Yao et al. (2025). Muon is Scalable for LLM Training.
  11. DeepSeek-AI, Xiao Bi, Deli Chen et al. (2024). DeepSeek LLM: Scaling Open-Source Language Models with Longtermism.
  12. Houyi Li, Wenzhen Zheng, Qiufeng Wang et al. (2025). Predictable Scale: Part I, Step Law -- Optimal Hyperparameter Scaling Law in Large Language Model Pretraining.
  13. Shane Bergsma, Nolan Dey, Gurpreet Gosal et al. (2025). Straight to Zero: Why Linearly Decaying the Learning Rate to Zero Works Best for LLMs. ICLR.
  14. Kaiyue Wen, Xingyu Dang, Kaifeng Lyu et al. (2026). Fantastic Pretraining Optimizers and Where to Find Them II: Hyperball Optimization.
  15. William Merrill, Shane Arora, Dirk Groeneveld et al. (2025). Critical Batch Size Revisited: A Simple Empirical Approach to Large-Batch Language Model Training. NeurIPS.

The session

The run from the model's first output, drawn as Antigravity shows a conversation: 382 steps.

Open the session

The submitted code

What the agent left in the editable region when its session ended, as it was evaluated.

nanoGPT/taskrt_hp_transfer_rule.pythe changes against the starter, inside the editable region