TL;DR
Production LLMs use token-level sparse attention to handle long contexts, but this shifts the computational bottleneck to the "indexer" that scans the entire history for every query. PIVOT eliminates this $O(L^2)$ bottleneck by grouping nearby queries and sharing a single full-prefix scan via a "proxy query," accelerating the indexer by up to 4×. It maintains dense-level accuracy while slashing end-to-end inference latency by up to 1.6× at long contexts without requiring any model retraining.
What Problem Does This Paper Address?
As Large Language Models (LLMs) scale to context windows of hundreds of thousands of tokens, standard attention mechanisms become prohibitively expensive due to their quadratic ($O(L^2)$) computational and memory scaling. To mitigate this, state-of-the-art production models like DeepSeek-V3.2 and GLM-5.1 employ DeepSeek Sparse Attention (DSA). DSA uses a lightweight "indexer" to score and select only the top-$k$ most relevant historical tokens for each query to attend to, dropping the downstream attention cost to $O(Lk)$.
However, this design introduces a new bottleneck: to determine which tokens are relevant, the indexer must still score every preceding token for every individual query. This per-query full-prefix scan scales quadratically ($O(L^2)$). At a 200K token context length, this dense indexing step balloons to consume roughly 81% of prefill latency and 41% of decode latency. PIVOT addresses this problem by targeting the unoptimized query axis, eliminating redundant scans across neighboring tokens.
Methods
PIVOT (Proxy Indexing Via One full-prefix Traversal) is a training-free, drop-in replacement for the DSA indexer. Instead of executing independent full-prefix scans for every query, PIVOT processes queries in small groups (typically $g=4$) using a two-stage approach:
- The Shared Proxy Scan (Coarse Step): PIVOT aggregates a group of queries into a single proxy query by taking the per-head average of their indexing queries and gating weights. This proxy query performs a single full-prefix scan over the key history to generate a shared set of candidate scores.
- Per-Query Selection (Fine Step): To accommodate different speed and accuracy needs, the authors introduce two variants to derive individual top-$k$ tokens from the shared scan:
- PIVOT-Reuse: Directly assigns the top-$k$ tokens from the proxy scan to all queries in the group. This completely skips per-query scoring, reducing indexing complexity to $O(L)$.
- PIVOT-Refine: Selects a slightly larger candidate pool ($c = 2k$) from the proxy scan, and then re-scores only these candidates using each query's exact indexer. This restores query-specific nuance at a fraction of the original cost ($O(L + gc)$ complexity).
Additionally, PIVOT augments the candidate pool with a small local window of the most recent tokens to guarantee that immediate context is never lost.
Crucially, PIVOT forms these query groups naturally depending on the inference phase. In the prefill phase, it partitions simultaneously available query positions into fixed-size contiguous blocks. In the decode phase, it seamlessly piggybacks on Multi-Token Prediction (MTP) speculative decoding, grouping the target query with its proposed draft queries at zero additional cost.
Datasets
The authors evaluated PIVOT on two prominent long-context benchmark suites using DeepSeek-V3.2 and GLM-5.1:
- RULER: A benchmark designed to probe effective context size through synthetic retrieval and reasoning tasks (e.g., multi-needle retrieval) across lengths from 4K to 128K tokens.
- LongBench: A suite covering realistic, long-document tasks across multiple domains, including single/multi-document QA, summarization, few-shot learning, and code completion.
Key Insights and Ideas
The success of PIVOT relies on three core observations of how indexers behave in production LLMs:
- High Query Locality: Neighboring queries select highly overlapping top-$k$ token sets (sharing 65% to 78% of their top-$k$ tokens). Because adjacent queries share almost the same prefix and carry similar hidden states, their token preferences drift gradually rather than jumping abruptly.
- Sub-linear Union Growth: The union of top-$k$ tokens for a group of queries grows very slowly. For a group of 4 or 8 queries, the total number of unique important tokens barely exceeds $k$, meaning a small candidate budget ($c=2k$) is more than enough to cover the needs of the entire group.
- Long-tailed Indexer Scores: Due to the use of ReLU activations in the indexer, a tiny fraction of keys captures almost all the score mass, while the rest collapse to zero. This makes the "Refine" step highly reliable because the true top-$k$ tokens are almost guaranteed to be caught in the proxy's top-$c$ net.
Key Results
- Indexer & End-to-End Speedups: PIVOT accelerates the indexer kernel by up to 4× at long context lengths (256K). This translates to an end-to-end latency reduction of up to 1.6× at 128K context length.
- Maintained Accuracy: On LongBench, PIVOT-Refine matches or slightly exceeds the dense DSA baseline (e.g., 56.18% vs 55.95% macro-average on DeepSeek-V3.2). On RULER, PIVOT-Refine tracks the dense baseline across all context lengths up to 128K, avoiding the severe accuracy degradation seen in alternative acceleration methods like HISA or MISA.
Limitations and Future Work
While PIVOT-Refine maintains near-lossless accuracy, the faster PIVOT-Reuse variant experiences a noticeable drop in accuracy at extreme context lengths (64K–128K) on the RULER benchmark. This occurs because a single shared token selection struggles to capture increasingly diverse query needs over very long spans.
Additionally, PIVOT's optimization along the query axis is entirely orthogonal to existing methods that optimize along the token, head, or layer axes. The authors suggest that combining PIVOT with these complementary techniques and extending the query-grouping framework to broader model architectures represent promising directions for future work.
Summary updated