Accelerating Mixture of Block Attention via Dynamic Routing, KV-Centric Execution and Runtime Pipelining
Abstract
LightningMoBA combines dynamic routing, KV-centric ownership, and runtime pipelining to accelerate long-context attention while maintaining or improving quality.
Mixture of Block Attention (MoBA) reduces long-context computation by selecting key-value (KV) blocks for each query. FlashMoBA implements MoBA efficiently but retains a fixed Top-k budget and query-centric schedule. Fixed Top-k applies one budget across different score distributions and couples routing to task granularity; query-range ownership fragments K/V reuse when several ranges select the same column. We present LightningMoBA, which co-designs selection and execution through dynamic routing, KV-centric ownership, and runtime pipelining. Dynamic routing thresholds MoBA's per-query block scores and directly emits variable-cardinality sparse metadata. KV-centric ownership groups selected rows by (query head, KV block) column, splits high-fanout columns into bounded tasks, and reuses each task's loaded KV tile. On Hopper, pipelining overlaps regular K/V transfers and irregular query gathers with Tensor Core computation. Together, these mechanisms decouple retention from GPU scheduling granularity. At matched Top-16 retention across five checkpoints, LightningMoBA accelerates end-to-end generation by 1.20 to 1.60x while raising mean RULER score from 74.42 to 75.28.
Community
Sparse attention improves efficiency by reducing unnecessary computation. On GPUs, however, sparse-index construction, irregular memory access, and task scheduling can offset part of those savings. MoBA reduces computation by routing each query to relevant KV blocks, while FlashMoBA further optimizes GPU execution. Building on this foundation, we address two limitations: fixed Top-k budgets do not adapt to different query score distributions, and query-centric task ownership can lead to repeated KV-block loads across tasks, limiting data reuse.
We designed LightningMoBA to jointly optimize routing and GPU kernel execution, with three main improvements over FlashMoBA:
🔹 Dynamic routing:​ Replace fixed Top-k with a relative threshold, allowing each query to retain a different number of relevant blocks. Sparse indices are generated directly during scoring, without maintaining an ordered Top-k candidate set or training an additional indexer.
🔹 KV reuse:​ Within each attention head, group queries that access the same KV block so that each task reuses its loaded K/V. Work for heavily accessed blocks is split across multiple tasks to bound the per-task workload.
🔹 Pipelined execution:​ On Hopper GPUs, overlap data movement and query gathers with Tensor Core computation to reduce stalls.
🚀 Our experiments evaluate both end-to-end performance and the contributions of individual optimizations. Across five models and context lengths from 4K to 128K on the full RULER suite, matching the average retention budget to Top-16 yields 1.20–1.60× average end-to-end speedups per model over FlashMoBA, while the overall mean RULER score increases from 74.42 to 75.28. To separate routing gains from execution-backend improvements, we also compare both routing strategies under the same optimized backend. Across six configurations on two models, dynamic routing at the Top-64 budget improves both speed and quality, achieving 1.16–1.56× end-to-end speedups and 0.85–5.95 percentage-point gains in RULER scores.
We also extend LightningMoBA to training. In a 100-step Qwen3-4B training experiment with 128K context, both routing strategies use the same optimized forward and adapted backward implementations. Dynamic routing achieves 1.23× and 1.60× end-to-end training speedups at Top-32 and Top-64, respectively, while training cross-entropy remains close between the two strategies.
We hope LightningMoBA can further improve MoBA’s training and inference efficiency and provide useful guidance for implementing other dynamic sparse attention methods on GPUs.
Variable per-query block budgets are the first thing I'd stress. A kernel whose shape changes per request is a bad fit for CUDA graph capture and pre-allocated KV pools — you either pad back to the worst case and give up the win, or drop off the fast path entirely. In continuous batching it's worse than per-request: the noisiest query in the batch drags everyone's block budget up, so the saving holds on a single stream and thins out at the tail where latency actually matters. KV-centric ownership worries me for a different reason — blocks get reclaimed on a schedule the prefix cache doesn't know about, and I'd expect hit rates to sag quietly rather than fail loudly. The per-kernel number is the easy one to report. I want tokens/sec at a fixed p99 SLO under skewed arrivals, and how much of it survives once the router threshold has to be retuned per layer instead of set once.
Thanks for raising these deployment concerns. We would like to clarify a few distinctions between variable sparse budgets, GPU execution, and serving-level memory management.
First, variable per-query retention does not inherently require variable kernel launch shapes or worst-case attention computation. LightningMoBA represents the actual selected query–KV-block pairs using CSC/Q-CSR metadata. Our KV-centric kernel reads the valid column counts and skips empty or out-of-range work, while fanout-aware splitting limits each work item to at most 4,096 selected query rows. Therefore, a query with a larger retention budget does not force other queries to execute the same number of attention blocks.
Regarding CUDA Graphs, our implementation includes a fixed-capacity, threshold-based routing path, demonstrating a practical direction for handling variable sparse patterns with stable metadata storage. We have also verified graph replay with changing runtime inputs and context lengths in a fixed-TopK single-request decode configuration. However, our standard compact routing path currently involves data-dependent allocation, and these experiments do not establish full CUDA Graph compatibility for arbitrary dynamic-threshold prefill workloads. Fixed-capacity metadata and padded KV gathering also introduce overheads that must be considered.
Second, KV-centric ownership refers to attention execution, not KV-cache ownership or reclamation. The serving adapter continues to access K/V through the framework's preallocated paged KV pool and block tables. Dynamic routing changes which KV blocks participate in attention, without introducing a separate cache eviction policy or changing the KV pool's allocation contract. We do not claim KV-cache capacity savings from this mechanism.
Finally, we agree that continuous batching introduces additional scheduling and tail-latency considerations beyond per-CTA load balancing. Our current full-graph experiments are limited to single-request decode, so they should not be interpreted as production-serving throughput or p99 SLO results under skewed arrivals. Evaluating multi-request serving and threshold-calibration sensitivity remains an important next step.
We appreciate the questions, as they help clarify the distinction between the efficiency demonstrated by our sparse attention implementation and the additional requirements of a production serving system.
This is an automated message from the Librarian Bot. I found the following papers similar to this paper.
The following papers were recommended by the Semantic Scholar API
- KPage: Cross-Block Page Compaction for Hardware-Efficient Sparse Attention (2026)
- CISA: Retrofitting Dense Attention Models with Chunk-Indexed Sparse Attention (2026)
- TileWeave: Heterogeneous Tiling for Sparse Prefill on Mobile SoCs (2026)
- LiquidCP: Decoupling Attention Tasks from Communication and Kernel Boundaries in Context Parallelism (2026)
- Jet-QSparse: Accelerating Agentic LLM Inference with 4-Bit Sparse Attention (2026)
- PageWeaver: KV-Guided Query Unions for Sparse Attention (2026)
- QUILT: Rethinking Sparse-Attention Prefill through Shared Query Execution (2026)
Please give a thumbs up to this comment if you found it helpful!
If you want recommendations for any Paper on Hugging Face checkout this Space
You can directly ask Librarian Bot for paper recommendations by tagging it in a comment: @librarian-bot recommend
Get this paper in your agent:
hf papers read 2611.26268 Don't have the latest CLI?
curl -LsSf https://hf.co/cli/install.sh | bash Models citing this paper 0
No model linking this paper
Datasets citing this paper 0
No dataset linking this paper
Spaces citing this paper 0
No Space linking this paper