Sparse Attention at 10M Token Context: The Key to a 22x Speedup Is the Index
As context windows grow into the millions of tokens, the bottleneck in long-context inference is shifting from computing attention to finding what to attend to. This article breaks down where the quadratic cost of sparse attention actually hides, explains how Latent Sparse Attention moves indexing into a low-dimensional latent space to decouple retrieval cost from head dimension, and reviews reported single-layer prefill speedups of roughly 72x and 22.7x at 10M tokens. It also covers why low-dimensional indexing can preserve accuracy, and offers a practical migration checklist for moving from million-token to ten-million-token contexts.
Sparse Attention at 10M Token Context: The Key to a 22x Speedup
1. Long Context Is Shifting the Cost Center from Compute to Search
Over the past two years, long-context capability has moved quickly from an experimental feature to a default specification. Million-token context is becoming a standard configuration for some cloud and model services, and architectures that mix sparse attention with linear attention are entering mainstream model design. These approaches share the same premise: a query vector does not need to scan every historical token, only to select the few most relevant ones for computation.
That premise has been validated repeatedly at the million-token scale. But as context pushes toward ten million tokens, an overhead that used to be unremarkable starts to spiral. Take one global attention layer in a ten-million-token-class model: at 10M tokens, roughly 98% of prefill time is spent not on the attention computation itself, but on the indexing step that decides which tokens to look at.
The nature of the problem has therefore changed. Sparse attention has already shown that “looking at only a small fraction” is enough to preserve accuracy. What actually blocks ultra-long context is that the cost of “finding that small fraction” still grows quadratically with context length.
2. Cost Breakdown: Where the Quadratic Bill Is Hidden
The cost structure of standard full attention is straightforward: every query computes relevance against all previous keys. With context length T, prefill compute is roughly O(T²), and the incremental cost of decoding one token is roughly O(T). Going from 1M to 10M tokens increases attention compute by about 100x in theory.
Sparse attention divides the work like this: a lightweight indexer first selects the k most relevant keys for each query, then the real attention computes only over those k keys, reducing the attention body to O(Tk).
This works under one condition: the model really does need only a few keys. Relevant validation shows that at 128k tokens, letting each query attend to only the 512 keys most relevant to it (about 0.8% of all keys) still preserves roughly 98% of full-attention accuracy on long-context benchmarks.
But a paradox is hidden here: for the indexer to decide which 512 keys are most relevant, it must first score every key. Common mitigations in the industry include lowering scoring precision, compressing dimensions, and aggregating multiple keys into a single block representation. These reduce the constant factor, but they do not change the structural fact that the number of scoring operations grows with T and is repeated for every query — the overall cost remains quadratic.
Schematically, the problem can be abstracted as:
# Naive indexing: every query scans all keys, complexity O(T^2)scores = query @ keys.T # [T, T]topk_idx = scores.topk(k, dim=-1)out = sparse_attention(query, keys, values, topk_idx)
As long as the scores row is T×T in size, any constant-factor optimization only postpones the bill rather than canceling it.
3. Latent Sparse Attention: Moving the Search into a Low-Dimensional Space
A recent study jointly released by a startup team in London and a university in Zurich proposes Latent Sparse Attention, whose core idea is to migrate indexing from the original token space into a low-dimensional latent space.
The key observation is that indexing is expensive not because “we need to search,” but because “we search in a high-dimensional, long-sequence space.” If both keys and queries are projected into a shared low-dimensional latent space, scoring and retrieval happen only in that small dimension, and the cost is decoupled from the original head dimension. The selected indices are then mapped back to the original space to run the real sparse attention.
The reported results are: at 10M tokens, roughly 72x prefill speedup for a single attention layer of a 27B-class model, and roughly 22.7x single-layer speedup for a model that supports ten-million-token context, while maintaining accuracy close to the original model across a range of long-context tasks.
It is worth stressing that these numbers are single-layer prefill results under specific models, specific layer types, specific hardware, and specific implementations. They are not equivalent to end-to-end throughput gains. In-layer speedups are diluted by communication, normalization, feed-forward networks, sampling, and scheduling, so engineering evaluation should be based on end-to-end metrics.
4. Why Low-Dimensional Indexing Saves Time and Preserves Accuracy
The feasibility of a low-dimensional latent space rests on three properties that usually hold.
First, relevance judgment is low-rank. Deciding “whether to look” demands far less expressive power than “what to compute after looking,” so it can be carried by a representation much smaller than the original dimension.
Second, indexing is decoupled from computation. The indexer is only responsible for recall, and recall quality is measured by hit rate; the real attention is responsible for precise weighting. As long as the recalled set covers the truly high-relevance keys, the final output stays close to full attention.
Third, errors can be compensated. In practice, a small number of global or local anchor keys are introduced (for example, a fixed initial block and the current local window) to cover long-tail dependencies with a tiny fixed budget, avoiding missed recall from pure top-k under extreme distributions.
Engineering also requires consistency between training and inference: the latent projection needs to be trained jointly with the main model or lightly fine-tuned, otherwise the index distribution will drift. If index precision is too low (for example, low-bit quantization), the drop in recall translates directly into accuracy loss, so sensitivity analysis should be done per layer rather than with a single global setting.
5. Deployment Checklist: Migrating from Million to Ten Million Tokens
- Quantify the bottleneck first. Use layer-wise profiling to confirm whether time is spent on indexing, attention, or feed-forward and communication, so you do not optimize the wrong target.
- Configure layers differently. Not all layers need the same sparsity; recall budgets for shallow vs. deep layers and local vs. global layers should be calibrated separately.
- Treat recall rate as a first-class metric. Beyond task accuracy, directly monitor top-k hit rate and the missed-recall distribution to catch degradation earlier.
- Keep an anchor budget. Reserve a fixed key budget for the initial block and the local window; the cost is constant and the payoff is long-tail stability.
- Validate end to end. Evaluate with time-to-first-token, prefill throughput, decode throughput, and peak memory together, rather than looking only at single-layer speedup.
- Coordinate with the system side. Sparse indexing changes memory access patterns, so it needs to be tuned together with chunked prefill, cache management, and parallelism/sharding strategies.
6. Conclusion
For ten-million-token context, the core tension has shifted from “attention cannot be computed” to “the index cannot find it.” Moving retrieval into a low-dimensional latent space is currently a viable path to compress the quadratic bill into near-linear cost; whether it translates into real business value depends on the joint refinement of recall quality, layer-wise strategy, and system coordination.
