Latent Sparse Attention: Breaking the Indexer Bottleneck for 10M-Token Contexts
As large language models push context windows from one million toward ten million tokens, sparse attention has hit an unexpected wall: the indexing process that decides which tokens to attend to now consumes up to 98% of prefill time. This article examines Latent Sparse Attention (LSA), a two-stage approach that projects keys into a low-dimensional latent space for fast candidate screening before running full attention on a small subset. In tests at 10M-token context lengths, LSA delivers 20x to 70x speedups on global attention layers while maintaining model accuracy across long-context benchmarks. The article also discusses broader engineering takeaways for teams building production systems with extreme context lengths.
The race toward longer context windows has been one of the defining trends in large language model development. As context lengths move from one million tokens toward ten million, the industry’s go-to solution—sparse attention—has exposed a problem that was easy to overlook at smaller scales. The attention computation itself can be aggressively pruned, but the process of deciding which tokens to look at grows quadratically with context length. At scale, that indexing step stops being a supporting actor and becomes the main bottleneck.
The Rise of Sparse Attention and Its Hidden Cost
Major language models now treat million-token contexts as a default capability, and most rely on a hybrid architecture that combines sparse attention with linear attention mechanisms. The shared intuition behind these approaches is straightforward: instead of having every query scan all historical tokens, only a small subset of the most relevant tokens participates in the actual attention computation. Extensive practice has shown that this “look at a small fraction” strategy preserves model quality.
But as context length scales to ten million tokens, a new cost begins to spiral out of control. In a typical global attention layer, prefill over ten million tokens spends most of its time not on attention computation itself, but on the indexer that determines which tokens deserve attention. That proportion can reach 98%.
This marks a fundamental shift in the nature of the problem. Sparse attention long ago settled the question of whether “attending to a small subset” is sufficient for accuracy. The real constraint on ultra-long contexts is that the cost of finding that subset still grows quadratically with sequence length.
The Core Idea Behind Latent Sparse Attention
A recent paper, jointly produced by a startup research lab and a prominent European university, introduces a method called Latent Sparse Attention (LSA) that targets the indexer bottleneck directly.
The key insight is that traditional indexers perform similarity search over the full key space. The number of keys grows linearly with context length, and comparing every query against every key produces quadratic overhead. LSA instead projects tokens into a low-dimensional latent space and performs a “coarse screening” in this compressed space:
Offline construction of latent representations: Each token’s key vector is compressed into an extremely low-dimensional latent vector that retains the most salient information needed for relevance judgment.
Fast screening in latent space: Queries are similarly projected into the latent space, where similarity is computed among low-dimensional vectors. Because the dimensionality is drastically reduced, the cost of each individual comparison drops significantly.
Full attention only on shortlisted candidates: Only the small set of tokens that pass the latent-space screening enters the high-dimensional full attention computation.
This two-stage design—“low-dimensional coarse screening followed by high-dimensional precise computation”—reframes the index cost as comparisons against low-dimensional latent vectors rather than full key vectors. It fundamentally changes the growth curve of indexing overhead.
Results: Order-of-Magnitude Gains at 10M Tokens
The experimental results reported in the paper are notable:
- At a 10M-token context, prefill on a single global attention layer of a hybrid-architecture model achieves more than a 20x speedup.
- On another widely used open-source model, the speedup exceeds 70x.
- On a range of long-context understanding tasks, model accuracy remains on par with the original dense-indexing baseline.
The speedup comes from two compounding factors. First, the latent space dimensionality is far lower than the original key dimensionality, so each similarity computation costs much less. Second, latent vectors can be stored and accessed more compactly, reducing memory bandwidth pressure. Together, these effects shrink the indexing phase—previously responsible for 98% of the time—to a negligible portion of the pipeline.
Engineering Takeaways
For teams that need to support extreme context lengths in production, this work offers several generally applicable lessons:
Bottlenecks shift—keep profiling. After sparse attention reduces the cost of attention computation itself, other stages can become the new constraint: indexing, KV cache management, data movement. At the ten-million-token scale, any component that grows quadratically with length will be brutally amplified.
Two-stage screening is a general pattern. “Low-dimensional coarse screening followed by precise computation” applies beyond attention indexing. It is equally relevant to retrieval-augmented generation and long-document processing: use a cheap signal to narrow the candidate set, then run exact computation on the survivors.
Accuracy and efficiency can coexist, but must be verified. Compression inherently loses information. The question is whether the loss affects downstream task performance. Teams should evaluate on their own long-context workloads before deployment, rather than relying on generic benchmarks alone.
As the context-length competition continues, innovation around “how to efficiently find the tokens worth attending to” is likely to become the next technical battleground. Latent Sparse Attention demonstrates that this direction still has substantial room for optimization.
