Accelerating Mixture of Block Attention via Dynamic Routing, KV-Centric Execution and Runtime Pipelining
Yingqi Shi, Junru Lu, Yun Liu, Di Yin, Xing Sun
cs.DC
2026-11-19
LightningMoBA replaces fixed Top-k with per-query thresholds and KV-column execution. At matched Top-16, five models run 1.20–1.60× faster; mean RULER rises from 74.42 to 75.28.
MoBA scores each KV block with a mean-pooled key and runs softmax only on the tokens inside the blocks a query keeps. FlashMoBA makes that pattern fast on a GPU, but every query still keeps a fixed Top-k, and each CTA (a thread block) owns a band of queries.
A fixed budget ignores how the scores are shaped. A query with a sharp distribution keeps weak blocks just to fill k. A query with a flat distribution drops blocks that still score well. An ordered candidate set also gets more expensive as k grows, and k doubles as the knob for task size. Query-band ownership has a separate cost: queries that pick the same KV block often sit far apart, so several bands load that column again.
The block scorer and the softmax over retained tokens stay as they are. Weights stay put. What changes is the rule that turns scores into a kept set, and the way that variable set is scheduled.
Dynamic routing draws a per-query score margin. Sink blocks at the start of the sequence and a local window ending at the query's own block are always kept. The reported setup uses one sink and a two-block window. Optional blocks are not sorted. Let r be the best score among complete blocks before the query's own. A block is kept when its score sits within Δ = −log(α)/σ of r, where α is the threshold and σ is the softmax scale. The test uses raw score gaps, so it does not normalize first. The current block is kept, with token-level causal masking, but its pooled key is left out of r because the block can hold future tokens. Two streaming passes write variable-length CSC metadata, a column-compressed index, directly. There is no ordered Top-k set and no learned indexer.
Execution is owned by columns. Under one query head, every row that selected a KV block shares one owner, and that owner's K/V tile is reused across those rows. Fanout, the number of queries that selected the block, is badly skewed. On one 128K high-tail trace the median column fanout is 0.064× the mean, while P99 and the max reach 28.1× and 64.5×. Handing a whole column to one CTA leaves a tail that synchronization has to wait on. Each work item is therefore capped at T selected rows, with T = 4096 by default. A hot column splits into several items. Each item loads K/V for itself, and partial outputs merge with online softmax, which is exact in real arithmetic. T is a multiple of the matrix-multiply row width, 64, so the column's tile count does not change. The cost is extra loads of popular columns.
Contiguous K/V moves through Hopper's TMA, the copy engine for dense tensor tiles. Indexed query rows move on a separate producer path. Both overlap WGMMA, the Tensor Core matrix multiply. Tile shape and warp roles do not depend on how many blocks a query kept.
The end-to-end baseline is FlashMoBA at fixed Top-16, with the same one sink and two-block window. LightningMoBA uses the threshold rule with average retention matched to Top-16. Five checkpoints run the full 6,500-example RULER suite at tensor parallelism 8 and batch size 1. Decoding stays dense, with CUDA Graph on. Times are generation-loop wall clock, excluding load, data prep, and serialization.
| Model | Avg. minutes | Speedup | RULER |
| Qwen3-4B | 188.3 → 122.8 | 1.53× | 72.43 → 75.53 |
| GQA-30B-A3B | 162.1 → 102.8 | 1.58× | 71.87 → 71.01 |
| Qwen3-235B-A22B | 616.1 → 386.1 | 1.60× | 82.18 → 83.08 |
| Llama-3.1-8B | 177.6 → 125.2 | 1.42× | 73.99 → 75.47 |
| Qwen3-32B-YaRN4 | 431.5 → 358.7 | 1.20× | 71.65 → 71.29 |
The mean of the five model scores moves from 74.42 to 75.28. Three models rise. GQA-30B-A3B drops 0.86 and Qwen3-32B-YaRN4 drops 0.36. Length matters. Gains are largest from 8K to 32K. At 4K and 128K the two methods stay within one point. At 64K every model drops, by 1.41 to 5.67 points. Under the Top-32 reference budget, all 30 model-length cells are faster, with per-model average speedups of 1.23–1.49×.
Same-backend runs isolate the router. At Top-16, dynamic routing is slower in four of six settings, and RULER is uneven. The 1.20–1.60× against original FlashMoBA is mostly the execution backend. At Top-32 all six settings are faster, 1.10–1.26×. At Top-64 all six are faster and more accurate, 1.16–1.56×, with RULER up 0.85 to 5.95 points. Routing plus CSC construction, at matched pair counts, is 3.15–4.13× faster at k=32 and 6.99–11.25× at k=64. At k=16 and 128K the threshold router is slower on both models.
Device-path replays include routing, CSC, attention, and the merge. Against FlashMoBA they land at 1.56–1.65× for Top-16 and 2.16–2.56× for Top-32. Against dense FlashAttention-3, Qwen3-4B is still slower at 32K (15.8 ms vs. 13.0 ms) and ahead at 128K (83.2 ms vs. 213.2 ms). Replay speedups are not full-model speedups.
On identical Top-16 metadata, column ownership cuts attention-stage latency by 18.9% at 32K and 33.8% at 128K on Qwen3-4B, and by 16.9% and 31.0% on GQA-30B-A3B. Capping tasks at T=4096 cuts another 15.0–16.0%. The longest item falls from 512 tiles at 32K and about 2,048 tiles at 128K down to 64, while structural reload multiplicity rises only to 1.034–1.094. The query-gather pipeline adds 2.53–2.65× on that same partition, with zero measured error on 8,192 sampled rows per case.
Training is one run: Qwen3-4B, 128K PG19 windows, 100 steps. Forward and backward share the column backend. Only the router changes. Average block counts differ by under 0.5%. At Top-16 the step time is 22.280 s for fixed Top-k and 22.361 s for the threshold (0.996×). Top-32 reaches 1.225× and Top-64 reaches 1.602×, from 85.645 s to 53.470 s. Mean cross-entropy at Top-64 is 2.1802 vs. 2.1810. Routing is a constant. Gradients flow only through the kept pattern.
The 64K drop is concentrated in variable tracking, the multi-hop subtask. Across five models it falls 25.77 points on average, about 55.3% of the drop in the 13-task macro score. Raising the budget to Top-64 moves Qwen3-4B at 64K from −5.67 to +4.73 overall against FlashMoBA, and VT from −36.96 to −0.40. Inside LightningMoBA, block size 8 versus 128, at a matched token budget, lifts VT by 10.20–23.80 points and overall RULER by 3.03–7.73, at 2.25–2.48× the latency. Block size 128 stays the default.
Dropped matmuls often come back as indexing and irregular loads. Separating the retention rule from task size means a serving stack can keep MoBA's scorer and stop using k as a scheduler parameter.
At the deployed Top-16 budget, the time saved comes from column ownership, the fanout cap, and the Hopper pipeline. On the same backend, dynamic routing is both faster and more accurate in all six settings only at Top-64, at 1.16–1.56×. Qwen3-4B training picks up 1.602× step time at that budget, and cross-entropy over 100 steps stays close.
Weights do not change, and there is no trained indexer. The five-model mean at Top-16 rises by 0.86, and two of the five models score lower.
The abstract's speedup is the full system against original FlashMoBA. The same-backend table is explicit that dynamic routing is often slower at Top-16. Assigning 1.20–1.60× to the threshold overstates that rule.
The 64K regression sits in multi-hop tracking. A larger budget or block size 8 repairs it, and block size 8 costs more than 2× latency. Mean pooling can dilute a local signal inside a long block. That account was checked on two models and two lengths.
At 32K the full attention path is still slower than dense FA3. Metadata overhead needs a longer context before saved matmuls pay it back. Every end-to-end number is batch 1 and TP 8. How column reuse and the fanout tail behave at higher concurrency is not measured.
Training is one model, 100 steps, one seed. The threshold is calibrated on other PG19 windows and then frozen. Because routing does not receive gradients, the model cannot adapt its representations to the new keep-rule. GQA-30B-A3B is internal. The pipeline targets Hopper TMA and WGMMA.