Co-Designing Sparse Attention for Efficient Long-Context Inference

AI-generated summary of reporting by NVIDIA Developer Blog. Read the original for the full story.

Why it matters

Sparse attention's indexer and Top-k stages can eat nearly half of prefill time at 128K context, and NVIDIA's measured guidelines tell model designers how to avoid that hidden cost.

Read this as

NVIDIA published a guide on sparse attention, a technique where an AI model looks at only a few thousand relevant tokens instead of an entire 128,000-token document. Finding those tokens still costs time, and the guide explains how to design that part to run fast on NVIDIA chips. It matters to people building large language models for very long documents and codebases.

As AI workloads move to contexts of 128K tokens or more, attention becomes the dominant cost, and NVIDIA's measurements show the token-selection machinery takes 47% of prefill time in DeepSeek V3.2. Teams training long-context models gain concrete speed guidelines; those using hosted APIs are unaffected. Fused implementations already exist in TensorRT LLM and FlashInfer.

The post benchmarks an FP8 sparse-attention indexer, showing decode arithmetic intensity scales with group size G=QH/KH and draft length D+1, which must fit in one Tensor Core tile (~200 rows, 256 with FP16 epilogue). KH=1 with cross-head reduction avoids linear decode growth (7.6x cost at KH=8); Hsz=128 or 256 is optimal. Fusing Top-k plus reusing the prior step's selection gives 2.1x-2.4x Top-k speedup.

Questions this answers

The article above answers these:

  • why is sparse attention still expensive at 128K context length
  • how many indexer query heads and key heads should I use
  • how do I speed up Top-k selection in decode

Read the original

This summary exists to save you time, not to replace the source.

Key terms

NVIDIA TensorRT LLM FlashInfer DeepSeek V3.2 DeepSeek Sparse Attention GLM 5.2 MoBA

Was this summary useful?

One click, anonymous. It tells us which summaries to re-run.

Related reading