TL;DR
DoSA speeds up sparse-attention token selection by proving a candidate key cannot win Top-K without computing its full score, using cheap upper bounds from a few evaluated heads. It cuts time-to-first-token on million-token prompts by roughly 2x without changing which tokens get picked.
Why It Matters
Modern long-context LLMs like GLM-5.2 and DeepSeek-V3.2 do not attend to every past token. Instead, they run a small scorer (an “indexer”) that picks the top K keys for each query, then runs full attention only on those. The problem: the indexer itself has become the bottleneck. At roughly 1M tokens of context, the paper reports the indexer eats 73% of prefill GPU time on GLM-5.2 and 90.8% on DeepSeek-V3.2.
Why so expensive? The indexer in Dual-Source Anchoring computes a signed, multi-head dot-product score for every key, then takes Top-K. Prior accelerators like LiteTopK fuse scoring with selection to cut memory traffic, but they still evaluate every head for every key. The authors ask whether you can skip most of that scoring entirely, while still returning the exact same Top-K the original scorer would have chosen.
How It Works
The core idea comes from classical document retrieval (WAND, MaxScore): if you already have K candidates with known scores, any new key whose score cannot exceed the K-th best can be rejected without computing its full score. You just need a cheap upper bound.
DoSA builds that upper bound for the signed, multi-head ReLU score used by DSA. For each query:
1.
Seed threshold. Fully score a small set of visible keys. The K-th highest among them is a safe lower bound on the real Top-K cutoff.
2.
Retain a few heads, bound the rest. Pick a subset of heads to evaluate exactly. Positive-weight heads that are dropped get upper-bounded by projecting them onto a retained head plus a norm-based slack term (Cauchy-Schwarz inequality on the leftover residual). Negative-weight heads get a lower bound on how much they subtract, using an activation-pattern-aware aggregate (only count heads that fire on seed keys at least half the time).
3.
Reject or refine. Any key whose upper bound falls below the seed threshold is dropped. Survivors get the full original score. Only scores at or above the threshold are written to memory for final selection.
The bound is proven to never exclude a true winner, so Top-K is exact, not approximate. Pseudocode for one query:
tau = kth_largest(full_score(seed_keys)) # lower bound on true Top-K cutoff
R = pick_retained_heads(budget=r) # evaluate exactly
for key_tile in all_keys:
partial = retained_head_scores(R, key_tile)
U = partial + positive_residual_bound(key_tile) \
- negative_aggregate(key_tile) # upper bound on true score
survivors = [k for k in key_tile if U[k] >= tau]
full_scores = original_scorer(survivors) # all H heads
candidates = [k for k in survivors if full_scores[k] >= tau]
return topk(seed_keys + candidates)
The GPU kernel groups queries so screening uses dense Tensor Core matmuls, shares key loads across queries during refinement, and writes back only scores above threshold.
What They Found
On microbenchmarks across English, Chinese, and code inputs, DoSA beat both baselines in all 60 configurations of context length and prefill chunk size. Speedups on the complete indexer reach 2.74x over SGLang and 1.69x over LiteTopK at 1M tokens. End-to-end TTFT on 1M-token prompts improves by 1.86x on GLM-5.2 and 1.94x on DeepSeek-V3.2 versus SGLang.
The pruning rate (fraction of query-key pairs rejected by the certificate before full scoring) averages 97.2% to 97.5% across layers and domains. Most keys are far enough below the Top-K cutoff that even a loose bound rejects them.
An ablation isolates the mechanisms. Screening alone cuts latency by 37.4%; sparse writeback alone by 23.4%; together, 47.3%. More telling: removing the negative-aggregate bound raises candidate survival from 2.65% to 95.06%, nearly destroying pruning. The signed structure of the score (positive and negative heads canceling) is what makes the bound tight, and handling negative heads well is what makes DoSA work.
The gain grows with context length because the indexer’s share of total time grows. Short contexts can even lose a little, since every key still gets scanned and screening adds some overhead.
What’s Useful
•
If you serve long-context inference on models that use a learned sparse-attention indexer (DSA-family: DeepSeek-V3.2, GLM-5.2, and similar), the indexer is likely your prefill bottleneck past ~256K tokens. Profile it before optimizing attention or feed-forward layers.
•
The DoSA technique applies specifically to signed multi-head ReLU scorers like DSA’s. If your sparse attention uses a different selection rule (block routing in MoBA, token compression in Native Sparse Attention (NSA), hierarchical indexing), the certificate construction does not transfer directly, though the general “bound-then-skip” pattern from WAND/MaxScore might.
•
The method preserves exact Top-K, so it is a drop-in replacement for the indexer kernel with no model retraining and no accuracy risk from approximation. The paper does not release code in the supplied text; implementation is nontrivial because it needs careful FP8 numerical guards and custom CUDA kernels using Tensor Memory.
•
Worth testing: whether training the indexer with a slack-regularization objective (the authors suggest this as future work) would let you keep fewer retained heads and prune even more aggressively.
Caveats
•
Gains require long contexts. At 128K tokens on GLM-5.2 speedup is only 1.19x; the certificate’s overhead can exceed its savings on short inputs.
•
Exact Top-K means the same set of selected keys, but with ties the specific IDs returned can differ unless a common tie-break order is enforced. The paper notes this does not guarantee bit-identical generated text.
•
All measurements are latency and pruning rates. The paper explicitly disclaims any claim about improved task accuracy; this is a systems contribution, not a modeling one.
•
Evaluation covers two models and three input domains on NVIDIA GPUs with eight-way tensor parallelism. Behavior on other hardware, smaller TP configs, or indexers with very different head counts is not characterized.
•
DeepSeek-V3.2 measurements beyond its declared context length are used only to study compute scaling, not quality.