Technology updates
NVIDIA Publishes Design Guidelines for Sparse Attention Indexers in Long-Context Inference
An NVIDIA developer blog uses an FP8 kernel to derive eight guidelines for sparse attention indexers, covering group size, key heads, head dimension, compression and Top-k fusion.
NVIDIA published a developer blog post on November 17 aimed at model developers who design sparse attention for long-context inference on its GPUs. The authors are Timmy Liu, Nidhi Bhatia, Samkit Jain, Makesh Tarun Chandran and Bita Darvish Rouhani. Their starting point is that agentic workloads, long documents and large codebases are pushing context lengths from tens of thousands of tokens toward hundreds of thousands, where attention becomes the most expensive part of a transformer layer; at 128K tokens, dense attention can consume most of a layer's prefill time.
The article focuses on model-level sparse attention, where sparsity is trained into the model rather than applied afterward by methods such as MInference or Quest. Its central observation is that sparsity moves cost rather than removing it. Each query attends to only a few selected keys, but the indexer that finds them must still score all N keys, followed by a Top-k selection stage and core attention. According to NVIDIA's figures, the indexer and Top-k together account for 47% of the prefill time in a DeepSeek V3.2 layer.
Against that backdrop, the post sweeps the indexer's design knobs with a production FP8 kernel: query heads, key heads, head dimension, compression ratio and speculative draft length. Arithmetic intensity scales with group size G, the number of query heads divided by key heads. Because prefill is compute-bound and decode is memory-bound, growing G by 16x moves decode runtime by only about 2%; prefill also grows sublinearly at small G, where the FP32 logit write still dominates cost.
Speculative decoding is the second theme. Each decode step must score D+1 query tokens, and those extra tokens add FLOPs without adding bytes, so they are nearly free as long as they fit in one Tensor Core tile. The authors measure a practical tile of about 200 rows, extended to 256 rows with an FP16 epilogue, which yields speedups of 1.31x to 1.45x. Hence the first two guidelines: keep G multipled by (D+1) within one tile, and run the indexer epilogue in FP16, with FP16 accumulation if scaling keeps outputs in range.
On key heads, raising KH from 1 to 8 makes decode runtime grow 7.6x, because each additional key head reads the whole key cache again; prefill is less sensitive at 1.3x to 1.6x. The authors therefore recommend KH=1 with a cross-head reduction that writes one logit per key. A head dimension of 128 or 256 balances Tensor Core work against decode traffic; 64 leaves the tensor cores waiting on the epilogue. Compression ratio does not change arithmetic intensity, but it cuts total work linearly with 1/CR, so halving it roughly doubles both prefill and decode time.
Top-k cost follows the number of keys scored, not the number kept: each doubling of keys adds about 1.7x in prefill and 1.5x in decode, while a 64x larger k raises time by less than 2x. The post cites TensorRT LLM's Guess-Verify-Refine approach, which reuses the previous step's selection as a guess and is 2.1x to 2.4x faster than radix select on DeepSeek V3.2 and V4 decode, and FlashInfer's open-source selective Top-k path, which fuses scoring, reduction and filtering so the full logits matrix is never written.
Finally, selection granularity shapes the core attention kernel. Token-level selection scatters selected keys across the cache, making cross-query sharing rare. Block-level selection allows bulk addressing and fetching, and queries that choose the same block share one fetch. At a budget of 2,048 selected keys, halving block size nearly doubles prefill and decode time, because every block carries a query load, partial result and merge step. The authors recommend block-level selection with large blocks, paired with a large core attention group size so many query heads share each KV head.
These results come from measurements on a specific FP8 kernel and configuration and amount to engineering guidance for NVIDIA hardware, not universal rules; developers should re-check them against their own context lengths, batch sizes and decoding strategy.