Unit 11 of 11 · about 5 hours · measure

Matched-parameter, matched-token and matched-compute comparisons and the decisive mechanism-risk experiment

Every unit in this section produces a variant that looks better or worse in one run. Whether that difference belongs to the mechanism depends on the contract you ran it under, and most published architecture gains are reported at one scale, one seed and one learning rate.

You'll be able to

  • Write a comparison contract for an architecture variant: what is matched (parameters, tokens, compute, data order), what is tuned per arm, what is fixed, and what the claim may and may not say.
  • Count parameters, active parameters and training FLOPs of both arms from the actual models, and say which budget each arm was matched on.
  • Run a paired, multi-seed comparison, report the difference against the seed spread, and attribute it to architecture, parameter count, token budget, sequence length or optimizer retuning.
  • Name the decisive mechanism-risk experiment for choosing among architectures under a stated context, data, compute and serving objective.

Covers

Matched-parameter, matched-token and matched-compute architecture comparisonsArchitecture selection from a decisive mechanism-risk experiment
1

Read

In this order, only the parts listed

0 of 6 done

  1. Deep Learning Tuning PlaybookDeep Learning Tuning Playbook

    Identifying scientific, nuisance and fixed hyperparameters, then Determining whether to adopt a training pipeline change or hyperparameter configuration (trial variance, study variance)

    Skip the batch-norm and quasi-random-search material.

  2. CS336 Assignment 1 handoutCS336 2026 - Architectures and Attention Alternatives

    Section 7.3, problems (layer_norm_ablation), (pre_norm_ablation), (no_pos_emb) and (swiglu_ablation) (pp. 42 to 44); note the parameter-matching rule in the SwiGLU ablation (feed-forward width 4 times the model width against about 8/3)

    The handout asks for one learning curve per variant and a few sentences. It does not ask for seeds or a retuned learning rate; the card adds both. Its budgets are B200 hours; use the substitute described in the practice item.

  3. GLU Variants Improve Transformer (arXiv:2002.05202v1)GLU Variants Improve Transformer (Shazeer, 2020)

    Section 3.1 and Table 1 as a worked comparison: parameters and operations matched by width, four runs at 65,536 steps for the variance, single runs at 524,288

  4. 2 OLMo 2 Furious (arXiv:2501.00656v3)OLMo 2 Open Model and Training Recipe

    Section 3.3.2 (reordered norm and QK-norm, 'in isolation neither of these changes yield good results'), Figure 7, and Table 1 as an example of a package of changes

  5. DeepSeek-V2 (arXiv:2405.04434)DeepSeek-V2, Section 2.1 (Multi-head Latent Attention)

    Appendix D.1 (MHA, GQA and MQA models aligned at about 7B parameters by changing the number of layers) and D.2 (MLA against MHA)

    Read it as a design review: list what differs between arms besides the attention head layout.

  6. Roadmap-Final project: Decoder-Only Transformer StackDecoder-Only Transformer Stack

    Measurement requirements ('No quality or speed target without baseline') and the design-defense questions

2

Focus on

  • Write the contract before the run. The scientific variable is the mechanism. Nuisance variables that change with it, above all the learning rate and sometimes warmup, are tuned per arm or you must say that they were not. Everything else is fixed and becomes a caveat on the conclusion (Tuning Playbook). Fix the token budget and the data order, and record parameters, active parameters and FLOPs per token for each arm.
  • Parameters, tokens and compute are three different matches. A gated feed-forward network or a head layout can be matched in parameters by changing a width, and GQA saves parameters that must go somewhere (deeper, wider, or left unmatched). A mixture of experts matches active parameters and FLOPs but not total parameters or memory. DeepSeek-V2's dense ablation aligned parameters by changing depth, so depth is a second difference between its arms.
  • Compare the difference with the spread. Use the same seeds for data order in both arms, take paired differences, and report them next to the standard deviation across seeds. GLU Variants' Table 1 shows what that looks like: four runs at 65,536 steps have a standard deviation of 0.004 to 0.010, and a 0.003 gap at the longest run is a single value. One run per arm cannot support a ranking.
  • Packages hide attributions, so test one mechanism with a negative control (the baseline with the knob at its null value) and the strongest simple alternative. OLMo 2 changed norm placement, QK-norm, initialization and z-loss together and says two of them 'in isolation' do not give good results. Then pick the decisive experiment from the risk: for a stated serving context, ask which single assumption would make the variant a bad choice (long-context recall for a mixer, drop rate and balance for MoE, quality lost to fewer KV heads at your scale) and design the smallest run that could falsify it.
Common mistakes · 3
  • Comparing at one learning rate and calling it architecture. The best learning rate depends on the architecture, so a fixed value favors the arm it happens to suit. A fair statement is 'at this learning rate' or a per-arm sweep with the same budget for each arm.
  • Letting parameters, depth and tokens drift together. A variant that saves parameters (GQA, MoE active parameters) looks worse unless you decide what happens to the saved budget, and one that adds layers looks better for reasons that are not the mechanism. State which budget was matched and show the arm that matches the other budgets.
  • Reading a package result as a component result, or a scale-specific result as general. A change evaluated at a few million parameters on one corpus says little about a billion parameters. Say what scale, data and sequence length the claim covers and what experiment would extend it.
3

Try it yourself

Closed-book, before checking anything

Write the contract for four arms on your own decoder, then run it at fixed tokens, with 3 seeds, paired data order, and a stated learning rate policy. Labeled example, not a target: decoder with 4 layers, width 128, 4 heads, byte-level text (2 MB of JSON files, 90/10 split), 600 steps of 16 sequences of 128 tokens (1,228,800 tokens), AdamW with betas 0.9 and 0.95 and no weight decay, peak learning rate 3e-3 for every arm (not retuned), 30 warmup steps and a cosine schedule to 10%, PyTorch 2.14.1 on CPU. Arms: A multi-head attention with SwiGLU feed-forward width 344; B the same with a GELU feed-forward network of width 516 (equal parameters to A); C grouped-query attention with 2 KV heads and SwiGLU width 344 (fewer parameters); D grouped-query attention with SwiGLU width 387 (parameters about equal to A). Parameter counts: A 857,216; B 857,216; C 791,680; D 857,728. Validation cross-entropy in nats per byte on 64 held-out sequences of 128 bytes, seeds 0, 1 and 2: A 1.4821, 1.3742, 1.4224 (mean 1.426, standard deviation 0.054); B 1.4917, 1.3940, 1.3881 (1.425, 0.058); C 1.4889, 1.4820, 1.4546 (1.475, 0.018); D 1.4329, 1.3781, 1.3800 (1.397, 0.031). Paired differences against A for seeds 0, 1, 2: B +0.0095, +0.0198, -0.0344; C +0.0068, +0.1078, +0.0321; D -0.0492, +0.0039, -0.0424. The B and D differences change sign across seeds and are smaller than the seed spread, so three seeds do not rank A, B and D. Only C, which has fewer parameters, is worse in all three seeds, and its gap ranges from 0.007 to 0.108. One run per arm could have shown D as a clear win or B as a clear loss. Your numbers will differ; the target is the table with the paired differences next to the spread.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Two arms differ by a gated feed-forward network and are matched in parameters. What have you not matched, and which of those can change the outcome?Answer

    Activation memory and elementwise work (the gated one stores more activations per token for the backward pass), possibly throughput, and the optimal learning rate. Any of them can change the result or the cost of achieving it, so state the matched budget and the unmatched ones.

  2. 2.Variant B beats baseline A by 0.02 in validation loss in one run each. List what you need before claiming B is better.Answer

    Several seeds with paired data order and the spread of the difference, the same token budget, matched parameters or a stated reason for unequal ones, learning rate tuned (or a sweep) for both arms, and the same evaluation data, tokenizer and context length. Then compare the difference with the trial-to-trial standard deviation.

  3. 3.You save parameters with GQA and spend them on a wider feed-forward network. Why is the comparison with MHA still not a pure test of the head layout?Answer

    The FFN width also changed, so a difference could come from the wider FFN. A fuller design adds the arm with GQA and the original FFN (fewer parameters) and the arm with MHA and the wider FFN, so each change is isolated.

  4. 4.An MoE with the same active parameters as a dense model trains at lower loss for the same tokens. What claims does that support and what claims does it not?Answer

    It supports a quality gain per active parameter and per training token at that scale. It does not support equal memory or serving cost, since total parameters are larger, nor equal training throughput or wall-clock time, since routing and communication cost time, nor a claim at larger scale.

  5. 5.A source claims QK-norm lets a model train at a learning rate ten times higher. What runs does the claim need?Answer

    The claim is about the range of learning rates that train stably, so both arms need the same learning-rate grid and the same seeds, and you compare where each diverges or degrades. A single high-rate run of each arm cannot separate the mechanism from one unlucky baseline run, and a single learning rate cannot show a range.

5

Practice

  • CS336 Assignment 1: ablations with seeds and a retuned learning rate

    Section 7.3: problems (layer_norm_ablation), (pre_norm_ablation), (no_pos_emb) and (swiglu_ablation); Section 7.2.1 for the base configuration

    The handout budgets 0.5 B200 hours per ablation and has no tests. Substitute its TinyStories setup at the 40,000,000-token low-resource budget, or your own smaller decoder, and run the one variant you chose for this section against your baseline: same tokens and data order, 3 seeds, a stated or swept learning rate for each arm, parameter and FLOP counts from the models. The section mini-project is this comparison.

You're done when

You have a written contract, parameter and FLOP counts for both arms, a paired multi-seed table with the difference next to the seed spread, and a one-paragraph claim that names what was matched, tuned and fixed, plus the experiment that would extend it.

Only when you can do this without notes.

Leads to

Notes

Resources · 6 for this unit, 12 more in the section
  • CS336 2026 - Architectures and Attention AlternativesStanford University · primary

    Study the Lecture 3 slides (lecture_03.pdf, architectures and hyperparameters) and Lecture 4 slides (lecture_04.pdf, attention alternatives and mixture of experts) in stanford-cs336/lectures, then implement the Assignment 1 Section 3.3 to 3.5 pieces (RMSNorm, SwiGLU, RoPE, causal attention, the pre-norm block) against its tests. Reconstruct every parameter and state equation before you change one mechanism. Keep GPUs, kernels and parallelism (Lectures 5 to 8) for their own tracks.

  • OLMo 2 Open Model and Training RecipeAllen Institute for AI · required

    Read Section 2.1 (architecture), Section 3.2 (initialization) and Sections 3.3.1 to 3.3.3 (non-parametric norm to RMSNorm, reordered norm with QK-norm, z-loss) and Table 1, then find the same settings in a released configuration. The changes were adopted as a package, so the report cannot attribute stability to any single one.

  • GLU Variants Improve Transformer (Shazeer, 2020)Google · support

    Read Section 2 (the GLU family and SwiGLU) and Section 3.1 (hidden width cut from 3072 to 2048 so parameters match), then Table 1, where GEGLU edges out SwiGLU on the longest run. Check the matching arithmetic yourself.

  • Decoder-Only Transformer StackRoadmap-Final · support

    Extend the already-tested decoder with the chosen mechanism. Preserve its slow oracle, causal and position tests, generation behavior and model arithmetic.

  • DeepSeek-V2, Section 2.1 (Multi-head Latent Attention)DeepSeek-AI · optional

    Read Sections 2.1.1 to 2.1.4: low-rank joint key-value compression, decoupled RoPE and the cache comparison. The 93.3% cache reduction is against their own 67B model, not a portable ratio.

  • Deep Learning Tuning PlaybookGoogle Research · support

    Read 'Identifying scientific, nuisance, and fixed hyperparameters' and 'Determining whether to adopt a training pipeline change or hyperparameter configuration' as the protocol for comparing architecture variants (per-arm learning rate, trial variance). Skip the batch-norm material. Last commit 2024; pin commit 7554a51.

Also in this section