MiniMax Sparse Attention: per-GQA-group block selection that cuts attention compute 28.4× at 1M context
MSA (MiniMax, 2026) adds an index branch to GQA that picks top-k KV blocks per group and attends exactly over only those. On a 109B MoE it matches full attention while cutting per-token attention compute 28.4× at 1M context. We verify the FLOPs figure and the coverage limits of block selection.
On this page
MiniMax Sparse Attention (MSA) is the sparse attention mechanism MiniMax published in June 2026 and shipped in MiniMax-M3. The problem is familiar: softmax attention costs grow quadratically with context length, while agents, repository-scale code work and persistent memory all need hundreds of thousands to a million tokens. MSA keeps softmax attention itself and turns “which KV to look at” into a learned, block-level selection.
The method: one index branch, one block selection
MSA adds only two projection matrices to a standard GQA layer. The index branch has one index query head per GQA group and a single index key head shared by all groups. For query position i it computes token-level index scores, then takes the maximum inside each KV block of size Bk=128 as the block score, with causally invisible blocks set to −∞. Each GQA group independently selects its top k=16 blocks, and all query heads in the group share that selection; the local block containing the query is always selected regardless of score, so the immediate neighbourhood is never dropped. The main branch then runs standard exact softmax attention over the causally visible tokens in the selected blocks — at most k·Bk=2048 of them.
Because top-k is non-differentiable, training uses a KL loss that aligns the index distribution with the main branch’s group-averaged attention over the selected tokens, plus three stabilizers: stop-gradient on the index input, a 40B-token indexer warmup, and the forced local block. The design clearly borrows from DeepSeek’s Native Sparse Attention and DSA (see our DeepSeek-V3.2 reading), but deliberately subtracts: no compression branch, no sliding-window branch, block rather than token granularity, and per-group rather than globally shared selection.
Kernel co-design
The paper’s second contribution is turning sparsity into wall-clock speed. Two key decisions: first, softmax is order-preserving, so top-k selection runs directly on raw scores, skipping max/exp/sum (our check below confirms this); second, the main attention loop iterates KV blocks on the outside and gathers the queries that selected each block, concatenating them to fill tensor-core MMAs — with queries on the outside this packing is impossible because each query selects different blocks. Hot KV blocks (like the first block, selected by nearly every query) are split along the query dimension by a scheduler kernel; partial results go to preassigned slots and a combine kernel merges them with logsumexp weights, with no atomic adds.
What we verified ourselves
The paper’s benchmark tables are images, so item-by-item checking is impossible. We verified what can be computed, with NumPy only:
- The FLOPs figure is self-consistent. Per the paper’s formulas, GQA costs 2·64·128·N²≈1.64×10¹⁶ attention FLOPs per token at 1M context. If the overall reduction is 28.4×, the implied index-branch cost corresponds to an index head dimension of 127.4, matching the model’s head dimension of 128; plugging in d_idx=128 gives 28.3×, matching the paper’s 28.4× up to rounding. The main-branch budget k·Bk=2048 is independent of context length, which is exactly why the reduction grows with N.
- Exp-free top-k is exact. Softmax is monotone; on 1000 random scores, the top-k indices of the raw scores and of their softmax are identical, so skipping exp introduces no approximation.
- Block selection has a coverage ceiling. In a toy attention setup (N=8192, Bk=128, k=16, 8 query-head groups) with an oracle indexer (block max-pooling on the true scores, then top-16), the selected blocks cover about 0.63 of the dense attention mass with purely random scores, and about 0.77 once the keys carry topic-cluster structure. In other words, even a perfect indexer with block granularity and a 16-block budget misses roughly a quarter of the mass when relevance is scattered — which explains why the paper trains the indexer with a KL loss toward the main branch’s distribution instead of trusting a scoring function to be right, and why a residual long-context retrieval gap remains.
How to read the results
Experiments use a 41-layer MoE with 109B total and 6B active parameters, trained natively multimodal on a 3T-token budget. Two routes: MSA-PT, sparse from scratch, and MSA-CPT, which replaces dense attention in a full-attention checkpoint trained on 2.6T tokens and continues for 400B tokens (40B of indexer warmup first). The paper reports LM loss curves and gradient norms nearly identical to the full-attention baseline; on downstream evaluations the two sparse models trade wins with the baseline, MSA-PT stronger on math, image, video and long-context retrieval, MSA-CPT closer to the original checkpoint. An extra ~140B tokens of long-context extension training leaves MSA-CPT close to full attention on HELMET and RULER — while each query still sees only 2048 KV tokens. The head-to-head numbers live in image tables we could not re-check item by item, so cite them as vendor-reported.
Limitations
First, all speedups come from custom kernels on H800; portability to other GPUs and frameworks is unknown. Second, 28.4× is the attention FLOPs ratio, not whole-model speedup — attention is only part of long-context cost. Third, the paper itself concedes a residual gap in long-context retrieval and lists it as future work. Fourth, “on par with GQA” holds at a 3T-token budget; whether longer training widens the gap is unanswered.
What to remember
MSA’s value is not a novel structure but being simple enough to deploy: one index branch, block-level selection, per-GQA-group sharing — and per-token attention compute drops by more than an order of magnitude at 1M context while benchmarks hold. Like GQA, it is the kind of work that is cheap to adopt and easy to copy, which makes it the most likely design for other teams to pick up. For the full context of this mechanism family, read it together with efficient attention and KV cache.
FAQ
- How does MSA differ from NSA and DSA?
- All three are trainable sparse attention. NSA uses three parallel branches (compression, block selection, sliding window); DSA (DeepSeek V3.2) selects at token level on top of MLA with one shared top-k index for all query heads; MSA takes the minimal route: a single index branch, block-level selection, and each GQA group picks its own top-k blocks, shared within the group. The paper's pitch is 'good enough and easy to deploy': block granularity keeps KV reads contiguous and maps onto a wide range of GPUs.
- How is the index branch trained?
- Top-k selection is non-differentiable, so a KL alignment loss trains the index branch on its own: the index distribution must match the group-averaged main-branch attention distribution over the selected tokens. Three stabilizers come with it: stop-gradient on the index branch input (the KL updates only the index Q/K projections, never the backbone), a 40B-token indexer warmup (train the index projections under full attention before switching to sparse), and a forced local block so the query's own neighbourhood is always selected.
- Where does the 28.4× come from?
- It is the theoretical ratio of per-token attention FLOPs at 1M context, not end-to-end speedup. From the paper's formulas F_GQA=2·Hq·dh·N² and F_MSA=Hkv·d_idx·N²+4·Hq·dh·N·k·Bk with Hq=64, Hkv=4, dh=128, k=16, Bk=128, N=1M, reproducing 28.4× requires an index head dimension of about 128; we back-solved 127.4, consistent with the model's head dimension, so the number is internally coherent. Measured wall-clock speedups are smaller: 14.2× prefill and 7.6× decode on H800.
- Can ordinary developers use MSA today?
- The inference kernels are open at github.com/MiniMax-AI/MSA, and MiniMax-M3, a production multimodal model built on MSA, has released weights. But reproducing the paper's results takes multi-GPU H800-class hardware; on a single machine the paper is best read as material for understanding the 'index plus block selection' paradigm.