Skip to content

Who Pays for the Index in Million-Token Context?

THE ARGUMENT

Subquadratic holds only when the index, the routing, and the final attention are added on one ledger. ZHA's contribution is pushing the index from quadratic to logarithmic; its evidence, though, is a performance model and short distillation runs, not a production bill.

On this page

Stretch the context from 8K to 1M and the length grows 125 times, but the key pairs full attention must compare grow 15,625 times. Most people read “subquadratic” as a claim about attention alone, and treat the index as a constant cost that comes along for free. One line in the abstract breaks that reading: sparse attention earns only constant-factor speedups because its indexer is itself quadratic. So the question is not whether a system is subquadratic, but which columns were added together. This paper puts index, routing, and final attention on one ledger. Below, I turn it into a table you can fill with your own numbers.

The index is not free

“Subquadratic” is a convenient word. It describes the shape of a curve and says nothing about where the curve starts bending down. At 8K tokens the quadratic term is noise; at 1M it is the entire cost.

The abstract sorts existing routes into two groups, and both are stuck. Sliding-window and linear attention trade a fixed-size state for speed, and pay with expressiveness that does not match full attention. Sparse attention keeps the expressiveness, but its indexer grows quadratically, so the pipeline earns only a constant-factor speedup. One route is short on capability; the other on bookkeeping.

Split one long-context pass into three: the indexer produces candidate keys for every query, the routing walks the tree to reach them, and the final attention does dot products only on the selected subset. Drop a column and subquadratic becomes a local fact. A quote that reports only “attention complexity” has folded two columns into “other”.

The bill is real.

How a tree pushes the index down

ZHA builds the index as a tree: recursively compressed key summaries stacked over the KV cache, abstract at the top, specific at the leaves. A query walks down from the root, follows the top-scoring branches at each level, and lands on a sparse set of keys.[1]

Depth is the knob. Each extra level multiplies the keys a fixed branching factor can cover, while a query pays one more level of node visits. The abstract's phrasing: total cost, routing and final attention included, grows sublinearly in sequence length, so attention ends up subquadratic but still superlinear.

Read “sublinear” carefully. Taken as “the total stops growing”, it collides with the same abstract's “superlinear overall”. Read it as cost per unit of sequence, multiplied by the token count, and both statements hold. That distinction kills the inference that a longer window is free.

The retrofit is cheap: no retraining, just a short KL distillation stage over a few billion tokens, and performance holds on long-context retrieval, reasoning, math, and agentic coding. The abstract also reports tolerance for tree geometry, including trees 6 levels deep.

Six levels is a cheap depth.

Turn the ledger into numbers you can plug in

Branching 8, depth 6: the tree covers 8 to the sixth, or 262,144 keys, and a query visits 6 times 8, that is 48 nodes. Take 2,048 keys for the final attention, and cost per token is 48 plus 2,048, about 2,096 operations.

Compare that with full attention. For N tokens, full attention compares N squared over 2 key pairs; the indexed route does 2,096 times N operations. The two are equal when N equals 4,192.

Not at 8K.

Context lengthFull attention: key pairsTree index + sparse attention: operationsCheaper side
8,19233.55 million17.17 millionIndex, by half
1 million500 billion2.1 billionIndex, 238 times
4 million8 trillion8.4 billionIndex, 952 times
10 million50 trillion21 billionIndex, 2,381 times

The first row matters most. At 8,192 tokens, full attention compares 33.55 million key pairs, the tree route 17.17 million: a saving of half. Half does not pay for the engineering.

Watch k as well. The 2,096 above assumes 2,048 keys per query. Ask for 8,192 keys and cost per token becomes 8,240, moving the crossover to 16,480. k is set by the task, not by the paper.

  • What is the order of the indexer itself? A quadratic indexer hands the savings back.
  • Is routing inside the reported number? If not, one column is missing.
  • What is the per-token index cost C? The crossover is 2C, one division away.
  • How many distillation tokens? Against your pretraining volume, that sets the share.

Five things to ask for

  1. Fill three columns first. Take your longest context as N, and get index, routing, and final attention written as operation counts; refuse a single merged percentage.
  2. Compute 2C and compare it with N. When N is below 2C, the index loses money in your setting, so do not pay a premium for it.
  3. Ask for k. Request cost at 2,048 and at 8,192 selected keys, not one point estimate; the 16,480 crossover comes straight from the larger k.
  4. Cover four task families in the stress test: long-context retrieval, reasoning, math, and agentic coding. Those are the four the abstract reports, and skipping one leaves a hole in the conclusion.
  5. Ask for a depth sweep. Run 4, 5, and 6 levels and check whether the curve is flat or sagging; a single number at 6 levels hides any degradation.

The last item is the one people skip. “Stable down to 6 levels” gets read as “6 is the ceiling”; it means 6 was tested. Seven and eight are untested, not ruled out. At acceptance, that difference decides whether you hold a spec or a curve.

Where this ledger stops holding

Boundary one: the evidence. Beating competing methods beyond 1 million context is a result from a performance model, not from a production bill. A model counts operations; bandwidth, cache hits, and scheduling are the big lines on a real invoice, and the abstract numbers none of them.

Boundary two: the object. This method attaches to existing pretrained models through a short KL distillation stage. Train from scratch, or run a different kind of KV cache, and the premise does not apply.

Boundary three: geometric ceiling. Depth 6 with branching 8 covers 262,144 keys; reaching 1 million at the same branching takes 7 levels, since 8 to the seventh is 2,097,152. One more level adds 16.7% node visits, 48 to 56, but every compression layer loses information, and the abstract does not say how much.

Boundary four: the worked example itself. The 2,096 is mine, set so the table would compute; it is not a number from the paper. In a real system k varies by layer, by head, by task. The table is a template, not a result you can cite.

One sentence to keep: subquadratic is not a capability, it is an accounting choice. A ledger that is not broken out is not a ledger.

References

  1. Subquadratic Attention with a Hierarchical Tree-Structured Indexer

Sign in to Padda

A code in your inbox. No password to remember.

Connecting to sign-in…