Why Indexers Are the Real Bottleneck in Multi-Million-Token Contexts
For long-context LLMs, the challenge has shifted from fitting millions of tokens into memory to computing over them affordably. This article explains why the indexer—not attention itself—becomes the dominant cost in sparse attention pipelines, compares full attention, traditional sparse attention, and latent-space approaches, and provides a practical checklist for evaluating speedups and deploying 10M-token inference reliably.
When context windows grew from 1M tokens to 10M tokens, the real question changed. It is no longer “can the model fit the sequence?” but “can the computation finish in reasonable time and cost?” Most mainstream models now treat 1M tokens as a standard service specification, and as windows push toward 10M tokens, computational overheads that once seemed negligible scale up dramatically.
Why Long Context Gets Stuck on the Indexer
In standard full attention, every query must be compared against all previous keys. With a sequence length of T, attention computation in the prefill stage is O(T²), and decoding costs roughly O(T) per generated token. Scaling from 1M to 10M tokens increases sequence length by 10x, and the number of pairwise comparisons grows by roughly 100x.
Sparse attention addresses this in two steps. A lightweight indexer first selects the k most relevant keys for each query, and full attention is then computed only over those k keys, reducing attention itself to O(Tk). The problem is the first step. To decide which k keys are most relevant, an indexer that scores every key still performs O(T²) comparisons. At large T, this stage dominates total runtime.
The original article claims that “98% of time is spent in the indexer.” Since no measurement conditions were provided, this article does not treat that figure as definitive. What is certain is that indexing cost grows with T and can become the primary bottleneck in ultra-long contexts.
Comparing Full Attention, Traditional Sparse Attention, and Latent-Space Approaches
The table below compares the main costs of three approaches. Complexity figures are asymptotic estimates; real-world performance depends on implementation and hardware.
| Approach | Prefill attention compute | Index scoring comparisons | KV cache memory | Main risk |
|---|---|---|---|---|
| Full attention | O(T²) | No indexer | Grows linearly with T | Compute and latency become impractical at long lengths |
| Traditional sparse attention | O(Tk) | Full scoring, roughly O(T²) | Grows linearly with T | Indexer dominates runtime |
| Latent-space sparse attention | O(Tk) | Low-dimensional scoring, constant-factor reduction; pruning required to change the order | Grows linearly with T | Low-dimensional representations may miss critical tokens; accuracy needs continuous monitoring |
What Low-Dimensional Projection Saves—and What It Doesn’t
A common idea is to project queries and keys into a lower-dimensional latent space and score them there. Reducing the dimension from 128 to 32 cuts the multiply-accumulate operations per dot product by roughly 75%. This lowers the constant overhead of the indexer, but the number of comparisons is still T times T.
To change the complexity order, the indexer must reduce the number of comparisons. Common techniques include:
- Blocking: aggregate keys into blocks, filter candidate blocks using block-level summaries, then examine keys within candidates.
- Clustering: group similar keys into clusters; queries only visit relevant clusters.
- Approximate nearest neighbor (ANN): use hashing or graph indexes to find neighbors quickly, at the cost of approximate results and some recall loss.
- Hierarchical indexing: coarse filtering across multiple levels with progressive refinement, approaching O(T log T) under ideal structures.
- Learnable routing: train a small module to decide which blocks to access, requiring additional training data and validation.
The Idea and Limits of Latent-Space Sparse Attention
The method described in the original article maps queries and keys into a latent space with higher information density and performs indexing there. Scoring happens in the low-dimensional space, so it is cheaper. The article also states that this dimensionality reduction can be fused with feed-forward network (FFN) or attention projection layers with minimal extra memory. Whether such fusion holds depends on the specific architecture and requires empirical verification.
This class of methods has three boundaries. First, low-dimensional representations lose information—if a critical token’s rank drops after projection, it gets missed. Second, if the indexer still scores every key, the complexity order is unchanged and speedups come only from constant factors. Third, these approaches usually require training or adaptation; applying them directly to existing models may degrade accuracy.
The original article reports speedups of “tens of times, up to over 72x,” but does not specify hardware, sequence length, baseline implementation, or measurement methodology. Unless the original paper or a reproducible test report can be found, this figure should not be treated as a general conclusion. The same applies to the reported result of “about 0.8% of keys retaining roughly 98% accuracy” at 128K context—verify the benchmark name, model scale, and error margins before citing it.
How to Evaluate Speedup Claims
An evaluation should include at least four items:
- Measure indexing and attention stages separately to confirm where the bottleneck actually is.
- With fixed hardware, plot latency curves as sequence length scales from 128K to 10M and check whether the slope decreases.
- Compare full attention against the sparse approach on long-context benchmarks, recording score differences and confidence intervals.
- Record peak memory usage and time-to-first-token. At long sequence lengths, bottlenecks often appear in memory reads and writes—looking only at compute time misses this.
During testing, fix the hardware, batch size, numerical precision (e.g., BF16), and operator versions, and run each experiment multiple times, taking the median. Otherwise, run-to-run variance may exceed the difference between the two approaches.
A Deployment Checklist for Multi-Million-Token Inference
- Confirm whether the model was trained or adapted for sparse attention. Unadapted substitutions require separate accuracy validation.
- Sweep the k value and record its relationship to recall and task scores; choose the smallest k with acceptable accuracy.
- Monitor tail latency (P95, P99). Certain inputs can cause sudden spikes in sparse-selection compute.
- Plan KV cache paging and offloading strategies to avoid running out of memory during long sessions.
- Set up an accuracy fallback switch. If online metrics drop beyond a threshold, revert to full attention or a larger k.
- Run offline evaluations per scenario—long-document QA, codebase analysis, and so on—rather than relying on a single benchmark.
- For cloud deployment, select instances based on compute, memory, and network bandwidth, account for peak costs, and track average throughput.
Common Pitfalls
Pitfall 1: Assuming lower dimensions make complexity linear. Dimensionality reduction usually only changes the constant factor; changing the order requires pruning-style structures.
Pitfall 2: Looking only at single-layer attention speedups. End-to-end inference also includes FFNs, communication, sampling, and scheduling. Single-layer numbers cannot be directly translated into end-to-end latency.
Pitfall 3: Treating one benchmark’s accuracy as representative of all tasks. Retrieval tasks and reasoning tasks differ in how sensitive they are to missing critical tokens.
Pitfall 4: Ignoring memory. Sparse attention reduces compute, but historical KV still needs to be stored. For long sessions, memory pressure often becomes the bottleneck before compute does.
