Comparing Architecture Families Fairly › Matched-Compute Experiments in Practice
Language AI HandbookAll chapters Now to the core machinery. If you only ever run one kind of architecture comparison, make it the matched-compute one, and make it honest.
Matched-compute is the workhorse comparison because it answers the question most teams actually have: given a fixed training budget, which family gives the best model? Answering it well requires two things that are easy to get wrong. The first is an accurate FLOPs model. The second is a per-family search, because the optimal allocation of a fixed budget differs across families. We take them in order.
Where 6ND comes from, and when it stops being true
The standard training-FLOPs estimate for a dense Transformer is
where:
- : the parameter count, i.e. the number of weights in the model
- : the number of training tokens seen during training
The factor 6 comes from three passes: a forward pass costing about FLOPs per token (each weight participates in one multiply and one add), a backward pass costing about per token (two matmuls with respect to activations and weights), and nothing else. Summed over tokens, that is .
The projection-only estimate is most useful when linear maps dominate. In a width- Transformer layer with full multi-head projections and a two-matrix feed-forward sublayer expanded to , the linear maps contain about weights and cost about FLOPs per forward position. The attention products add about FLOPs for a query that sees keys. At , those products add one sixth as much work as the linear maps. At about 128,000 keys and width 4,096, they add just over five times as much.
For a token that attends to keys, the ratio in this layer model is . At width 4,096, it reaches one at 24,576 keys. During dense causal prefill, positions attend to keys per position on average. Setting gives . At width 4,096 these are two distinct quantities: 24,576 keys for one query and 49,151 positions for the sequence-wide average.
Attention adds context-dependent work even below the crossover. At , attention work equals the linear-map work in this example, so total forward FLOPs are twice the linear-map estimate.
PythonIn [5]Expand
import numpy as np
crossover_context = np.logspace(3.0, 6.0, 240)
crossover_widths = np.array([2048, 4096, 8192])
attention_linear_ratio = crossover_context[None, :] / (
6.0 * crossover_widths[:, None]
)VisualizationOut [6]Expand

In this approximation the forward matmul cost per position of one dense layer is for a query with allowed keys. Sum over layers and query positions. A threefold multiplier approximates training matmul work under the forward and backward accounting used here.
Here counts keys available to query in attention layer . Under a window of width , this becomes . Use the SSM's own projection and scan costs for its layers. The toy comparison below uses a shared per-layer projection proxy and omits SSM-specific work. Its hybrid estimate adds attention work only in the selected layers.
If you compute the training budget as for every family, you will systematically underestimate the dense Transformer's cost at long context and therefore overestimate how much data it could have seen for the same money. Every downstream conclusion inherits the error.
Consider two ways a budget enters the comparison. At the same reported proxy budget, the dense run can get more actual compute because the proxy omits attention. At the same actual budget, the proxy can overstate the amount of dense training that fits. The loss ranking still depends on the realized allocations and on each model's loss curve.
Total versus active parameters
Jamba reports 52B total and 12B active parameters. Total count helps estimate resident weights at a given precision. The active count helps estimate projection work. Context, routing, and other operations also affect per-position FLOPs.
Report both counts and the model used to convert them to memory and work. Expert placement and routing can affect realized traffic and timing.
Chinchilla, and what it does and does not license
Hoffmann et al. fitted results from more than 400 dense language models at scales roughly spanning 70M to 16B parameters. Their estimates favor increasing parameters and training tokens at similar rates. The 70B Chinchilla run used 1.4T tokens, about 20 tokens per parameter. The 280B Gopher run used 300B tokens.
The result is scoped to the tested dense Transformer configurations, MassiveText mixture and horizon-matched learning-rate schedules. Estimate the feasible allocations separately for families with different costs or loss curves.
Treat the 20-to-one ratio as a reported design point. Test whether a different family has a similar allocation at the budget of interest.
The right way to use Chinchilla in a cross-family study is as a prior about the shape of the frontier: expect loss to fall as a power law in both and , and expect the optimal allocation to sit somewhere in the middle rather than at either extreme. Then re-fit the frontier for each family rather than importing the exponent.
For the frontier the optimal allocation is often written as
where:
- : the fixed training compute budget in FLOPs
- : the parameter count that minimizes loss subject to the compute constraint
- : the training-token count at that optimum
- : the fitted exponents, with when the FLOPs constraint is
The equal-proportion claim is the case . Whether that case holds, and what the exponents are for a particular family, is an empirical question that the per-family re-fit answers.
The two allocation exponents govern how each fit trades off model size and training data. Different exponent pairs can produce the same optimized loss slope. Compare the fitted cost-quality frontiers across the budgets you intend to use, since the rankings can cross.
The protocol, in order
This sequence describes an empirical comparison. The notebook illustrates its cost accounting, allocation search and uncertainty steps on synthetic inputs.
- Predeclare the question. Pick one of the five questions above. Write it down before you run anything.
- Predeclare the workload matrix. The axes you will sweep, and the values you will use. Fixing these in advance prevents the silent search over evaluation conditions that inflates apparent wins.
- Fix the data. Give every family the same deduplicated training pool, a shared document-level split, and byte-identical held-out text. Fix the consumed training bytes for iso-data. For iso-compute, vary the training allocation within the declared search space.
- Build a per-family cost model. Parameter count, forward FLOPs per token as a function of context, bytes per token, KV-cache size, recurrent state size. Check it against a known configuration.
- Search, do not guess. For iso-compute, find each family's optimal . For iso-quality, find each family's cheapest configuration meeting the target. Report the search space.
- Measure end-to-end. Wall-clock on the same hardware, same precision, same batch policy. Report both "best available kernel" and, if you must, "reference kernel" numbers separately and label them.
- Estimate uncertainty by resampling the right unit. Documents for quality, requests for latency.
- Report both an aggregate metric and at least one capability metric. Aggregate loss and long-range retrieval disagree, and the disagreement is the interesting part.
Declare the question and workload before model selection. If either changes, revisit the split, search, and interpretation wherever they depend on the revised design.
An Example Workload Matrix
Scale the design to the resources and workloads the study can support. Predeclaring the grid limits selective reporting within it. Rankings can still change outside the grid.
| Axis | Values | Why |
|---|---|---|
| Training pool | The same deduplicated training pool, document split, and held-out text | Controls the available data and evaluation text. Consumed training bytes vary only if the comparison permits it. |
| Split | 80/10/10 at the grouped document level, with a cross-split overlap audit | Reduces known leakage |
| Training compute | FLOPs | Samples the frontier at three prespecified budgets |
| Context at evaluation | 4, 32, 128 and 512 KiB of UTF-8 text | Convert to positions for each tokenizer |
| Aggregate metric | Held-out bits per UTF-8 byte | Shared denominator across tokenizers |
| Capability metric | Long-range retrieval accuracy at each context | Catches what the average hides |
| Inference target | TTFT 1 s; 50 concurrent sequences at 128 KiB | Deployment-relevant constraint |
| Precision | bf16 weights and activations, fp32 optimizer state | Same for all families |
| Decoding | Greedy for retrieval, prespecified sampler and seeds for generation | Makes the decoding procedure explicit |
| Repeats | Three training seeds per configuration, with a declared uncertainty procedure | Separates training replication from evaluation resampling |
Express context in bytes, not tokens. A 128 KiB document is 32,768 tokens for a 4-bytes-per-token tokenizer and 131,072 tokens for a byte-level model. If you sweep "context length" in tokens, you are sweeping different amounts of text for different families, and the axis label lies.
The grid covers three compute budgets, four context lengths, and two metrics. Use a wider grid when the decision depends on regimes beyond these points.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!