Comparing Architecture Families Fairly › Matched-Compute Experiments in Practice

Michael BrenndoerferNovember 17, 20269 min read
Language AI HandbookAll chapters
Part 19 of 67Alternative Sequence and Generative Architectures
Chapter 138Comparing Architecture Families Fairly › Matched-Compute Experiments in Practice
Reading section 5 of 16 · Matched-Compute Experiments in Practice · 9 minSection 5 of 16 · 9 min

Section 5 of 16 · 9 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

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

C≈6 N DC \approx 6\,N\,D

where:

  • NN: the parameter count, i.e. the number of weights in the model
  • DD: the number of training tokens seen during training

The factor 6 comes from three passes: a forward pass costing about 2N2N FLOPs per token (each weight participates in one multiply and one add), a backward pass costing about 4N4N per token (two matmuls with respect to activations and weights), and nothing else. Summed over DD tokens, that is 6ND6ND.

The projection-only estimate is most useful when linear maps dominate. In a width-dd Transformer layer with full multi-head projections and a two-matrix feed-forward sublayer expanded to 4d4d, the linear maps contain about 12d212d^2 weights and cost about 24d224d^2 FLOPs per forward position. The attention products add about 4Ld4Ld FLOPs for a query that sees LL keys. At L=dL=d, 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 LL keys, the ratio in this layer model is L/(6d)L/(6d). At width 4,096, it reaches one at 24,576 keys. During dense causal prefill, nn positions attend to (n+1)/2(n+1)/2 keys per position on average. Setting (n+1)/2=6d(n+1)/2=6d gives n=12d−1n=12d-1. 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 L=6dL = 6d, attention work equals the linear-map work in this example, so total forward FLOPs are twice the linear-map estimate.

PythonIn [5]
CollapseExpand
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]
CollapseExpand
Narrower layers reach equal attention and linear-map work with fewer keys per query.
Attention FLOPs divided by linear-map FLOPs for one query in a dense Transformer layer. The x-axis counts keys available to that query. At width 4,096, the ratio reaches one at 24,576 keys. The mean ratio across a causal prefill reaches one at 49,151 sequence positions.

In this approximation the forward matmul cost per position of one dense layer is 24d2+4Ld24d^2+4Ld for a query with LL allowed keys. Sum over layers and query positions. A threefold multiplier approximates training matmul work under the forward and backward accounting used here.

C≈3∑ℓ,q(24d2+4dLℓ,q)C \approx 3 \sum_{\ell,q} (24d^2 + 4dL_{\ell,q})

Here Lℓ,qL_{\ell,q} counts keys available to query qq in attention layer ℓ\ell. Under a window of width ww, this becomes min⁡(Lℓ,q,w)\min(L_{\ell,q},w). Use the SSM's own projection and scan costs for its layers. The toy comparison below uses a shared 24d224d^2 per-layer projection proxy and omits SSM-specific work. Its hybrid estimate adds attention work only in the selected layers.

Why this matters for the comparison

If you compute the training budget as 6ND6ND 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 NN and DD, 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

Nopt(C)∝Ca,Dopt(C)∝CbN_{\text{opt}}(C) \propto C^{a}, \qquad D_{\text{opt}}(C) \propto C^{b}

where:

  • CC: the fixed training compute budget in FLOPs
  • Nopt(C)N_{\text{opt}}(C): the parameter count that minimizes loss subject to the compute constraint
  • Dopt(C)D_{\text{opt}}(C): the training-token count at that optimum
  • a,ba, b: the fitted exponents, with a+b=1a + b = 1 when the FLOPs constraint is C≈6NDC \approx 6ND

The equal-proportion claim is the case a≈b≈0.5a \approx b \approx 0.5. 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.

  1. Predeclare the question. Pick one of the five questions above. Write it down before you run anything.
  2. 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.
  3. 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.
  4. 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.
  5. Search, do not guess. For iso-compute, find each family's optimal (N,D)(N, D). For iso-quality, find each family's cheapest configuration meeting the target. Report the search space.
  6. 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.
  7. Estimate uncertainty by resampling the right unit. Documents for quality, requests for latency.
  8. 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.

AxisValuesWhy
Training poolThe same deduplicated training pool, document split, and held-out textControls the available data and evaluation text. Consumed training bytes vary only if the comparison permits it.
Split80/10/10 at the grouped document level, with a cross-split overlap auditReduces known leakage
Training compute{1020,1021,1022}\{10^{20}, 10^{21}, 10^{22}\} FLOPsSamples the frontier at three prespecified budgets
Context at evaluation4, 32, 128 and 512 KiB of UTF-8 textConvert to positions for each tokenizer
Aggregate metricHeld-out bits per UTF-8 byteShared denominator across tokenizers
Capability metricLong-range retrieval accuracy at each contextCatches what the average hides
Inference targetTTFT ≤\le 1 s; ≥\ge 50 concurrent sequences at 128 KiBDeployment-relevant constraint
Precisionbf16 weights and activations, fp32 optimizer stateSame for all families
DecodingGreedy for retrieval, prespecified sampler and seeds for generationMakes the decoding procedure explicit
RepeatsThree training seeds per configuration, with a declared uncertainty procedureSeparates 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!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy