MOIRA: Mass-Oriented Indexing with Ragged Attention for Long-Context Decoding
Abstract
Long-context decoding is limited by memory bandwidth, because every output token reads the KV cache of every layer. Sparse decoding reduces this cost by reading only part of the KV cache. We observe that the number of pages a query needs varies widely across KV heads, layers and steps. Fixed budgets are simple, but they are sized for demanding cases and tuned per workload; adaptive budgets follow this variation more flexibly, but existing designs pay for it with extra selection cost or training. At the kernel level, FlashAttention-3 (FA3) and FlashInfer are designed for rows of similar length: with page lists whose length differs per KV head, they either pad the lists (forfeiting much of the sparse saving), leave thread blocks unbalanced, or rely on a host-side plan that runs outside the CUDA graph. We propose MOIRA, a training-free sparse decode path in vLLM whose budget adapts per KV head and per layer. For every request, layer, KV head and step, a coverage rule keeps the smallest set of pages whose estimated attention mass reaches a fraction . A new kernel, self-planning attention, lets each thread block derive its own share of the work from the list lengths, so the whole decode step stays inside the CUDA graph. On an H200, at RULER's 128k context, MOIRA with matches dense accuracy while reading about 30% of the pages and reduces the time per output token (TPOT) by 2.2-2.5 relative to dense FA3; with it reduces TPOT by 2.7 and stays within the noise of dense. Under high serving load it raises throughput by up to 51%. These results suggest that a budget adapted per head and layer, paired with a kernel that keeps such budgets inside the CUDA graph, makes sparse decoding both flexible and fast.
Create a lesson
Metadata
- Comments
- 19 pages, 7 figures, 7 tables
Related papers
SharpDraft: Accelerating Long-Context Speculative Decoding with Cardinality-Aware Query Scaling
Shared title terminologycs.AIJeonghoon Park, Seongwoon Jo, Jongwon Lee et al.
DMC-5: Dual-Model Collaboration with Cache-aware Context Compression for Long-horizon Agents
Shared title terminologycs.AIHaochen Li, Xiaobing Tu, Yinggui Wang et al.
When Does Optical Context Compression Pay Off? A Decode-Aware Cost Analysis of Reasoning VLMs
Shared title terminologycs.AIZiqing Ge
Look Before You Commit: Visual-Evidence-Guided Decoding for Multimodal Diffusion Language Models
Shared title terminologycs.AITongxiao Hu, Yikai Zhao, Qiyan Zhao et al.
E2SIM: Long-Horizon Simulation of Everyday Human Behavior with Evolving States
Shared title terminologycs.AIZiwei Gong, Xiangyang Yin, Thai Quoc On et al.
Wavefront: Low-Rank Drafting with Parallel Causal Refinement for Speculative Decoding
Shared title terminologycs.AIHuy Huu Nguyen, Xin Huang