GPU Hierarchy Meets Structured Matrices: Fast Algorithms for State-Space Models
Berlin Chen, Caitlin Wang, Aakash Lahoti, Kevin Li, Jay Shah, Jack Carlisle, Timmy Liu, Mengyu Guo, J Zico Kolter, Albert Gu, Tri Dao
NeurIPS 2026
TL;DR. 4x faster GPU hierarchy-aware algorithms and CuTe-DSL kernels for SSMs
Abstract. Linear-time sequence models such as State Space Models (SSMs) offer an efficient alternative to self-attention and have demonstrated strong language modeling performance at scale. In practice, however, their asymptotic advantage is often lost at common training and prefill lengths---optimized FlashAttention kernels remain faster than existing SSM implementations up to 8k tokens. In this work, we substantially narrow this performance gap with novel algorithmic improvements: First, we introduce a split-sequence algorithm that decouples the compute tile from the sequence-parallel split length, preserving efficient matrix multiplication tiles while substantially reducing boundary-state traffic and latency. Second, we resolve a longstanding speed--stability tradeoff in computing the 1-semiseparable (SS) decay mask, the main non-matmul bottleneck shared by all chunk-wise linear-time kernels (Mamba-2, Mamba-3, GDN, KDA). Existing kernels use the fast diff segsum (prefix subtraction), which suffers monotonicity violations and catastrophic cancellation---failures observed in real pretraining (e.g., Nemotron-H); the stable alternative (direct segsum) materializes the dense mask and is slower. Our hierarchy-aware segsum decomposes the SS mask into 1-SS diagonal blocks and rank-one off-diagonal blocks, computed via warp-level scans and cross-warp aggregation directly in registers, achieving the stability of direct segsum at the speed of diff segsum. We implement these algorithms using CuTe-DSL with warp specialization, asynchronous TMA, WGMMA, and layout-aware accumulator fragments. Across a large range of sequence length, our H100 kernels reach 91% of measured memcpy bandwidth, improve prefill time by over the official Triton Mamba-2 kernel, and outperform the highly-optimized FlashAttention-4 starting at 1-2k sequence length---to our knowledge, the first time a linear-time sequence layer is faster than state-of-the-art attention at the 2-4k sequence lengths used in common pretraining and prefill workloads, where prior linear-time kernels only reached parity at k. Our hierarchy-aware segsum is - faster than a naive stable direct-segsum implementation.
Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.
Claim this paperedit · history
NeurIPS 2026
Accept (poster) · 3 reviews · OpenReview
Updated 25 Nov 2026, 03:48 UTC.
- Decision
- Accept (poster)
Read decision
Meta-review
The paper proposes an approach for accelerating SSM computation using split sequence scheduling and hierarchy aware stable segsum. This lets to an implementation outeperforming the official mamba-2 and other highly optimized methods as well as its potential to change the crossover in terms of sequence length at which SSM can provide benefits. The reviewers appreciated the methods and the performance. The main concerns are:
- Reproducibility - it is not clear if the code will be released, critical for the current contribution.
- Reviewers requested more explicit FA4 comparisons and end to end model speed measurements.
- Concerns about over specialization to older Hopper GPU
Final justification
The authors addressed each major reviewer concern releasing code, porting to Blackwell, and performing an end to end comparison. Overall the reviews lean positive and thus I am recommending acceptance.
Read meta-review
Meta-review
The paper proposes an approach for accelerating SSM computation using split sequence scheduling and hierarchy aware stable segsum. This lets to an implementation outeperforming the official mamba-2 and other highly optimized methods as well as its potential to change the crossover in terms of sequence length at which SSM can provide benefits. The reviewers appreciated the methods and the performance. The main concerns are:
- Reproducibility - it is not clear if the code will be released, critical for the current contribution.
- Reviewers requested more explicit FA4 comparisons and end to end model speed measurements.
- Concerns about over specialization to older Hopper GPU
Final justification
The authors addressed each major reviewer concern releasing code, porting to Blackwell, and performing an end to end comparison. Overall the reviews lean positive and thus I am recommending acceptance.
1 comment
- Rating
- 5/6
- Confidence
- 5/5
- Quality
- 4/4
- Clarity
- 2/4
- Significance
- 4/4
- Originality
- 4/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
This paper addresses the problem of inefficient usage of hardware by SSM-style attention alternatives, causing them to be slower than flash attention implementations of attention for short sequences. The paper identifies unnecessary chunk-boundary state writes to HBM and redundant segment-sum implementations as bottlenecks. It addresses the former by decoupling chunk size (which is determined by the optimized WGMMA kernel tile sizes) from split size (which determines the granularity of chunk assignments to CTAs) to enable inter-chunk communication through shared memory at cost to parallel execution potential (which is unused anyway due to the hardware constraints on Hopper architecture). It addresses the latter by materializing decay value matrix tiles in CUDA core registers instead of in shared memory. The overall result is a 4x speedup against the official Triton Mamba implementation, leading the proposed method to be 4x faster than Flash Attention 4 at sequence lengths >8K.
Strengths and weaknesses
Quality
The paper's claims are well tested, being compared against state of the art implementations of respective algorithms, including those optimized by industrial experts for real-world deployment. The methods are compared against a variety of architectures with a variety of implementations, demonstrating a significant speedup. I was also impressed by the memcpy baseline, as well as the demonstrated near-optimality of the proposed methods.
Clarity
The paper is very well written and generally very clear, with the glaring exception of Section 5.1, which describes a key part of the paper. The bottlenecks being addressed are explained well, and the split-sequence algorithm is also presented clearly. However, the hierarchy-aware segsum algorithm remains a mystery to me.
I believe this section would benefit significantly from the inclusion of diagrams, pseudocode, a toy example, and a motivation-style explanation of the algorithm. The current presentation introduces a large number of variables and implementation details before providing a clear bird's-eye overview of the proposed approach, making the section difficult to follow. The highly detailed explanation could even be moved to the appendix, with the main text focusing first on intuition and high-level understanding.
Unfortunately, the clarity of this key section is currently poor enough that I cannot support accepting the paper in its present form. However, I believe the paper otherwise makes a very significant contribution to the community, and I would be willing to raise my score to an accept if the authors substantially rewrite this section to improve clarity. Please also see my questions below, which should be addressed as part of such a revision.
The split-sequence algorithm is wll-motivated and clear enough to understand in its current form, however it would be best for the paper to refer the reader to the pseudocode and diagrams in the appendix (which currently are not referenced at any point in the main body of the paper). Furthermore, in order for the paper to be self-contained, a brief overview of the Hillis-Steele scan (which is repeatedly cited in the paper) should be added to the appendix alongside a reference to it in the main body of the paper; this is particularly important because it would help establish how the examples in Appendix D arise in practical workloads. .
Significance
The issue addressed by the paper is highly significant, and the solutions posed appear to be robust and adaptible without significantly affecting the algorithm's original output, which may allow the methods to be applied to models that were originally pretrained with other implementations with low effort. The bottleneck analysis is also a valuable contribution offered by this paper.
Originality
The algorithms proposed appear to be highly novel, I expect future work to draw inspiration from them for future innovation.
Questions
-
The related work appendix claims that Tiled Flash Linear Attention adds tiling inside the larger chunk, which sounds quite similar to the proposed split-sequence algorithm from the paper. Can you explain the difference between your proposed method and TFLA's method?
-
The paper claims to require only 2 warp-shuffle steps. Please give a short explanation of the warp-shuffle steps you are referring to and indicate their effect on overall latency (based on experiments or previous work) to explain the significance of this claim.
-
Lines 305-307 were unclear to me. Can you explain your speed comparison against the diff segsum from section 4.1? I understood the diff segsum algorithm and why it is fast (O(C) complexity for the cumsum and then each segsum can becomputed just-in-time in O(1) complexity), however I do not understand how your algorithm is more efficient than the direct segsum method from section 4.2.
-
Line 290 says that the proposed algorithm traverses the chunks first right-to-left (while line 169 says that the former algorithm is run left-to-right, which makes sense to me assuming the sequence indices grow from left to right). Given that states are computed in order of the sequence (left-to-right) due to the recurrent nature of SSM architectures, how can you perform this algorithm right-to-left? You need all of the first states in a chunk to be computed before you can compute the final state.
Limitations
Yes
Final justification
The concerns and questions I raised in my review have been satisfiably resolved, conditioned on the author's responses being incorporated into the camera-ready version of the paper.
Formatting concerns
No paper formatting concerns
3 comments
Response to Reviewer xAAb 1/
We thank the reviewer for the careful and constructive review. We are encouraged that they were impressed by the "demonstrated near-optimality of the proposed methods" and viewed the paper as making "a very significant contribution to the community"
Their primary concern is the clarity of Section 5.1, and we agree with their diagnosis: the original presentation introduced detailed variables and GPU mapping considerations before providing a clear bird’s eye view of the algorithm.
We have therefore substantially rewritten the exposition. The new version begins with the diagonal and rank-one block structure of the 1-SS mask, illustrates it through a toy example, and then progressively maps this structure onto the GPU hierarchy, the local scan and two warp-shuffle steps, and the complete algorithm. As the PDF cannot be revised during the discussion period, we provide the full exposition in the global response and will incorporate it into the revised Section 5.1; we thank the reviewer for feedback that materially improved how we present one of the paper’s central contributions.
Furthermore, we will also add explicit main-text references to the appendix schematic and pseudocode, together with a brief overview of the Hillis–Steele scan in the revised manuscript.
Below, we answer each of the reviewer’s specific questions directly.
- The related work appendix claims that Tiled Flash Linear Attention adds tiling inside the larger chunk, which sounds quite similar to the proposed split-sequence algorithm from the paper. Can you explain the difference between your proposed method and TFLA's method?
The reviewer is correct in noting that TFLA is closely related to the Split-Sequence algorithm: both methods introduce a larger sequence unit to reduce the number of recurrent states written to HBM while retaining enough GPU parallelism.
The key difference is how computation is performed within this larger sequence unit. In TFLA, the larger unit is a chunk in the chunkwise-parallel formulation. TFLA computes a quadratic interaction over the larger chunk, increasing FLOPs. It tiles the matrix multiplications to reduce memory use and expose some additional parallelism, but the extra computation remains. For a sequence of length and TFLA chunk size , the total FLOPs scale as
Split Sequence instead keeps the tensor-core compute tile, or chunk size, fixed at . A split of length , analogous to , is a separate scheduling unit containing fixed-size chunks. One CTA recurrently processes these chunks while keeping their intermediate states in registers. It therefore never performs a quadratic interaction over the full split. The total FLOPs scale as
For comparable state-materialization granularity, , so Split Sequence requires substantially fewer intra-chunk FLOPs.
We will revise the related-work discussion to acknowledge the shared motivation and make this distinction explicit.
Response to Reviewer xAAb 2/
- The paper claims to require only 2 warp-shuffle steps. Please give a short explanation of the warp-shuffle steps you are referring to and indicate their effect on overall latency (based on experiments or previous work) to explain the significance of this claim.
Short explanation of the warp-shuffle steps.
As described in Part 4 of the global exposition, the two warp-shuffle rounds are used in the local scans that construct the diagonal 1-SS blocks. For completeness, we summarize their main use here.
Given decay values , the scan computes [ α2:8, α3:8, α4:8, α5:8, α6:8, α7:8, α8, 1], where .
- Four threads begin with two adjacent decay values each and compute their local pair product:
t0: [α1, α2] t1: [α3, α4] t2: [α5, α6] t3: [α7, α8]
t0: P0=α1:2 t1: P1=α3:4 t2: P2=α5:6 t3: P3=α7:8
- The first warp shuffle communicates with the thread immediately to the right:
t0: P1 t1: P2 t2: P3 t3: 1
- The second warp shuffle communicates with the thread two positions to the right, producing the complete suffixes:
t0: P1 P2 P3 t1: P2 P3 t2: P3 t3: 1
Combining these suffixes with the original local values gives the required scan entries above.
The effect of number of warp-shuffle steps on overall latency
Our goal is to keep the construction of cheap enough to hide behind the computation of . More warp shuffles would make it slower and will place constructing E on the critical path, since tensor-core matrix multiplication is already very fast in GPUs.
To test this, we run the following two sets of experiments:
Experiment 1: Measuring prefill latency increase from additional warp shuffles
We insert additional dependent warp-shuffle rounds into the mask-construction path while leaving the rest of the kernel unchanged. The modified kernels are used only to measure latency and are not intended to compute the correct mask. We benchmark prefill latency and throughput with , , , one head, , , and on an H100.
| Extra shuffles | Latency (ms) | Effective GB/s |
|---|---|---|
| 0 | 0.354 | 2347.54 |
| 1 | 0.359 | 2310.81 |
| 2 | 0.362 | 2295.72 |
| 4 | 0.370 | 2246.11 |
| 8 | 0.384 | 2162.32 |
| 16 | 0.415 | 2002.56 |
| 32 | 0.473 | 1754.65 |
| 64 | 0.607 | 1367.83 |
Here, extra shuffles denotes the original kernel, which still contains the two shuffle rounds described above.
The added latency grows approximately linearly with the number of dependent shuffles, at about per added shuffle. Thus, additional shuffles directly lengthen the mask-construction dependency path: 16 extra shuffles increase latency by approximately , while 64 increase it by approximately . This motivates minimizing the number of shuffles used in mask construction, which is why our local scan is designed to require only two shuffle rounds.
Experiment 2: Forward pass latency cost of scanning off-diagonal blocks
Recall that in the revised Section 5.1 exposition, Algorithms 2 and 3 both construct directly in the MMA accumulator layout, eliminating the SMEM round trip. They differ only in how they compute the lower off-diagonal blocks. Accumulator-aligned segsum (Algorithm 2) performs a two-shuffle scan in every causal block. A complete 64-entry row spans eight such blocks, resulting in a maximum row-wise dependency chain of warp-shuffle steps. In contrast, hierarchy-aware segsum (Algorithm 3) retains the two-shuffle scan only for diagonal blocks and computes the off-diagonal blocks from precomputed rank-one factors.
To measure the overall latency cost of these additional shuffles, we compare Algorithms 2 and 3 for , , , one head, , , and on an H100. Replacing rank-one reconstruction with block-wise scans increases forward-pass latency from ms to ms, a increase. Thus, even after eliminating the SMEM round trip, scanning every causal block substantially lengthens the mask-construction dependency path. Exploiting the rank-one structure of the off-diagonal blocks avoids these additional shuffles and reduces overall kernel latency.
Response to Reviewer xAAb 3/3
- Lines 305-307 were unclear to me. Can you explain your speed comparison against the diff segsum from section 4.1? I understood the diff segsum algorithm and why it is fast ( complexity for the cumsum and then each segsum can becomputed just-in-time in complexity), however I do not understand how your algorithm is more efficient than the direct segsum method from section 4.2.
We thank the reviewer for pointing out this ambiguity. The advantage of Hierarchical Segsum over Direct Segsum is not a better asymptotic complexity, but a more GPU-friendly mapping.
Diff Segsum is fast because it maps naturally to the MMA accumulator layout: pre-compute the length- cumulative-sum vector; each thread independently construct the mask entries it owns using two cumulative-sum values in RMEM, with no additional communication.
A straightforward Direct Segsum implementation is not compatible with MMA layout. It first constructs and scans the mask in a row-major SMEM layout, then reloads it in the MMA accumulator layout. This dense SMEM round trip due to layout incompatibility contributes to its higher latency.
Hierarchical Segscan avoids this layout mismatch by exploiting the block structure of the 1-SS mask. It directly computes mask in MMA accumulator registers, eliminating the SMEM round trip. Furthermore, only the diagonal blocks require short warp-level scans, while the off-diagonal blocks are constructed locally from their rank-one factors. This further reduces communication and incurs lower latency.
- Line 290 says that the proposed algorithm traverses the chunks first right-to-left (while line 169 says that the former algorithm is run left-to-right, which makes sense to me assuming the sequence indices grow from left to right). Given that states are computed in order of the sequence (left-to-right) due to the recurrent nature of SSM architectures, how can you perform this algorithm right-to-left? You need all of the first states in a chunk to be computed before you can compute the final state.
The right-to-left traversal at line 290 does not refer to traversing sequence chunks, nor does it reverse the causal SSM state recurrence. It refers only to the order in which the block columns of the within-chunk mask are constructed inside a single 64-token chunk.
These blocks depend solely on the input decay factors , rather than on recurrent states, and therefore may be evaluated in either order. We use a right-to-left order because it permits the row-side factor to be updated efficiently as
This is an algebraic recurrence over decay products, not the SSM recurrence over states. All forward state propagation, both within and across chunks, remains left-to-right.
We will revise the text to replace “right-to-left traversal” with “right-to-left traversal of the within-chunk mask’s column blocks” and explicitly clarify this distinction.
- Rating
- 3/6
- Confidence
- 4/5
- Quality
- 2/4
- Clarity
- 3/4
- Significance
- 3/4
- Originality
- 3/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
The paper proposes a split-sequence algorithm and a hierarchy-aware segsum algorithm, and implements high-performance H100 kernels using CuTe-DSL. Experiments show that the proposed kernels are significantly faster than the official Mamba kernels and FlashAttention-4.
Strengths and weaknesses
-
This paper tackles that mismatch between asymptotic complexity and GPU performance. Decoupling the chunk size used for tensor-core matmul from the split size used for sequence parallelism is a simple but effective way.
-
Many of the reported gains rely on Hopper-specific features such as WGMMA, TMA, warp specialization, and the particular accumulator layout used by H100 GPUs. While this level of hardware-aware optimization is appropriate for a systems paper, the authors should more clearly distinguish the broadly applicable algorithmic ideas from the implementation choices that may not transfer directly to other GPU architectures.
Questions
How is the split size T selected in practice? Is there an automatic heuristic based on batch size, number of heads, sequence length, and SM count?
Limitations
The authors do mention some limitations, such as the focus on training and prefill rather than autoregressive decoding, and the reliance on Hopper/H100-specific hardware features.
Formatting concerns
No.
1 comment
Response to Reviewer R78h
the authors should more clearly distinguish the broadly applicable algorithmic ideas from the implementation choices that may not transfer directly to other GPU architectures.
We thank the reviewer for their suggestion for disentangling the algorithmic improvements from hardware-specific gains. In our shared response to the meta review, we show that our implementation is not specific to the older Hopper GPU and extends to the newer generation of hardware, e.g., Blackwell, demonstrating the broad applicability of our algorithmic ideas.
On Blackwell, our hierarchy-aware algorithm continues to outperform current baselines, achieving a nearly constant ms latency. This is consistently faster than the official Mamba-2 baseline and overtakes Blackwell-optimized FlashAttention-4 between 2K and 4K tokens and reaches a advantage at 16K. These sustained results show that our algorithmic contributions transfer across evolving GPU architectures. We will add these new benchmarks to our paper.
- How is the split size T selected in practice? Is there an automatic heuristic based on batch size, number of heads, sequence length, and SM count?
Split size is automatically determined using the batch size , number of heads , full sequence length , and the device SM count . Without splitting, the kernel exposes roughly independent work items. Splitting each sequence into segments increases this to approximately .
We first compute
which increases greater parallelism so that we can saturate all SMs on the hardware without deliberately creating a small additional wave. We then cap this value so that each segment contains approximately 4096 tokens or more:
The segments are balanced and their boundaries are aligned to 128-token state tiles. Consequently, no splitting is normally used when already provides sufficient parallelism, while longer sequences permit additional splits. This automatic heuristic reduces underutilization while limiting the additional state traffic and scheduling overhead introduced at split boundaries. Standard attention decode such as Flash Decoding uses the same split to partition KV cache at small batches and long sequence lengths [1]. We aim to partition enough work to utilize all SMs on the target GPU; for example, 132 on the H100 SXM and 148 on the B200.
[1] T. Dao, D. Haziza, F. Massa, and G. Sizov. "Flash-Decoding for long-context inference." PyTorch Blog, 2023.
- Rating
- 5/6
- Confidence
- 3/5
- Quality
- 3/4
- Clarity
- 3/4
- Significance
- 4/4
- Originality
- 3/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
The paper proposes two kernel improvements for chunk-wise scalar-decay SSM layers such as Mamba-2/3. First, it introduces a split-sequence schedule that decouples the tensor-core compute tile size from the sequence-parallel split length, reducing HBM traffic from materializing recurrent states at every chunk boundary while preserving enough parallelism to saturate an H100. Second, it proposes a hierarchy-aware segsum algorithm for the 1-semiseparable decay mask: diagonal blocks are handled as small local segsum problems, while off-diagonal blocks exploit rank-one structure and are applied directly in WGMMA accumulator fragments.
The empirical claim is that these changes make the Mamba-2/3 SSD kernels substantially faster than existing Triton implementations and competitive with, or faster than, FlashAttention-4 at common prefill/training sequence lengths. On H100, the reported forward kernel reaches about 91% of measured memcpy bandwidth, is roughly 4.1x faster than the official Mamba-2 Triton kernel, crosses causal FA4 around 1-2k tokens in forward and 2-4k in forward+backward, and avoids the numerical failure modes of diff segsum without the ~1.35-1.40x overhead of naive stable direct segsum.
Strengths and weaknesses
Strengths
Originality
- The split-sequence schedule is a clean systems contribution: it separates the tile size needed for efficient tensor-core use from the split granularity needed for GPU occupancy, which directly targets a real bottleneck in chunk-wise SSM kernels.
- The hierarchy-aware segsum is a nice use of mathematical structure: mapping the 1-semiseparable mask to GPU hierarchy via local diagonal scans and rank-one off-diagonal blocks is more than a straightforward kernel rewrite.
Quality
- The technical story is coherent and well motivated by concrete bottlenecks: HBM state traffic, prefix-subtraction numerical instability, and non-matmul work on the tensor-core critical path.
- The paper includes useful ablations: no-split versus split-sequence throughput, hierarchy-aware segsum versus unstable diff segsum and naive stable direct segsum, and comparisons to Mamba-2/3 and FA4.
- The numerical analysis of diff segsum identifies two distinct issues, monotonicity violations and catastrophic cancellation, and the experiments demonstrate that clamping only fixes the sign violation, not the cancellation error.
Clarity
- The paper is generally well organized. The recurrence, chunked formulation, split-sequence algorithm, and segsum decomposition are explained in a way that should be reproducible by readers familiar with SSM kernels and GPU programming.
- Figures 1-3 make the core performance claim easy to inspect, and the appendix provides useful pseudocode and comparisons to nearby optimized linear-time kernels.
Significance
- If the results hold up with released code, this is a practically meaningful kernel-level advance for SSM training and prefill. Moving the crossover with highly optimized attention from >=8k to the 1-4k regime would materially affect the practical case for linear-time layers.
- The stability contribution is also important: the paper targets a real failure mode observed in Mamba-style training, not only a synthetic numerical corner case.
Weaknesses
-
Reproducibility is currently the biggest technical gap. The paper says the kernels will be open-sourced, but the checklist says no code is provided with the submission. For a systems paper whose main claims are highly implementation-dependent, an anonymized code release or at least exact build/run scripts would substantially increase confidence.
-
The headline comparisons are kernel-level rather than end-to-end layer/model measurements. The paper focuses on the SSD kernel and FA4 kernel timing, but practical prefill/training speed also depends on projections, gating, normalization, launch overheads, memory layout integration, and framework overhead. The conclusions about common pretraining/prefill workloads would be stronger with full Mamba block or hybrid-model measurements.
-
The FA4 comparison needs more explicit normalization. Figure 3 notes that Mamba uses H=64 while FA4 uses H=16, with D=128 and Dv=64. It is not fully clear whether the compared kernels are matched by hidden width, bytes moved, FLOPs, output dimensionality, or model-equivalent work. A table specifying total model dimension, Q/K/V dimensions, bytes moved, arithmetic intensity, and total tokens would help rule out a shape-driven comparison artifact.
-
The numerical stability evidence is convincing mechanistically, but mostly synthetic. The paper refers to real pretraining failures in Nemotron-H, yet the experiments sweep constructed prefix scales and tail-to-ULP ratios. A real-decay-distribution experiment from Mamba-2/3 training, including output/gradient error versus a high-precision or direct-segsum reference and NaN incidence, would better support the practical stability claim.
-
The main evidence is specialized to Hopper/H100. The implementation is tightly coupled to WGMMA/CuTe details and C=64 accumulator structure. The paper briefly mentions preliminary B200 results but does not show A100, B200, or broader shape sweeps in the main results. It would be useful to know how much of the algorithmic win survives without Hopper-specific features.
-
Backward-pass evidence is thinner than forward-pass evidence. Figure 3 includes forward+backward timing, but the detailed breakdowns and segsum/stability discussion emphasize forward. Since training is a central claimed workload, the paper should report backward kernel breakdowns, correctness/error checks for gradients, and whether the same stability advantages apply to dB/dX/dC paths.
Questions
-
Can you add end-to-end measurements for a full Mamba-2/3 block or a small hybrid model, including projections/gating/norms/framework overhead, and report tokens/s, latency, and peak memory for prefill and training?
-
Please clarify the FA4 comparison normalization in Figure 3. Are Mamba and FA4 matched by hidden dimension, output dimension, FLOPs, bytes moved, or model-equivalent layer work? A table with H, D, Dv, total width, total tokens, bytes moved, and arithmetic intensity would help.
-
Can you validate the stability claims on real decay distributions from trained or pretraining Mamba-2/3 runs, not only synthetic prefix-scale sweeps?
-
Can you provide more backward-pass details: timing breakdowns for dB/dX/dC, gradient correctness checks, and whether hierarchy-aware segsum gives the same stability/speed advantage in backward kernels?
-
How sensitive is the split-sequence schedule to T, batch size, number of heads, state dimension, and head dimension? Is T selected analytically from occupancy/traffic estimates or tuned per shape?
Limitations
Yes
Formatting concerns
No major formatting concern in the rendered paper.
3 comments
Response to Reviewer FrCh 1/
- Can you add end-to-end measurements for a full Mamba-2/3 block or a small hybrid model, including projections/gating/norms/framework overhead, and report tokens/s, latency, and peak memory for prefill and training?
Thank you for the suggestion. We added module-level end-to-end benchmarks for a representative Mamba-2 mixer (29.5M parameters, model width 2,048) on a single NVIDIA H100 80GB, using BF16 and microbatch size 2. This measures the complete block, including projections, convolution, SSD, dt processing, gating, normalization, autograd, and framework/allocation overhead. Only the block residual addition and optimizer step are excluded.
Latency is synchronized median wall time over 20 runs after warmup. Peak memory is the incremental allocation above the resident module/framework baseline.
Prefill
Paired values are Original / Hierarchical.
Static-cache prefill is measured under inference mode, without decode tokens.
| Prompt | Latency (ms) | Hierarchical speedup | Throughput (tokens/s) | Peak memory (MiB) |
|---|---|---|---|---|
| 1,024 | 1.226 / 0.820 | 1,670,454 / 2,497,131 | 197.8 / 100.3 | |
| 2,048 | 1.450 / 0.854 | 2,825,098 / 4,798,061 | 391.5 / 196.6 | |
| 4,096 | 2.675 / 0.994 | 3,062,698 / 8,241,363 | 779.0 / 389.3 | |
| 8,192 | 5.165 / 1.844 | 3,172,181 / 8,883,567 | 1,554.0 / 774.5 |
Training: forward + backward
| Sequence | Latency (ms) | Hierarchical speedup | Throughput (tokens/s) | Peak memory (MiB) |
|---|---|---|---|---|
| 1,024 | 4.203 / 2.216 | 487,229 / 924,105 | 302.3 / 293.0 | |
| 2,048 | 4.483 / 2.697 | 913,590 / 1,518,857 | 600.5 / 586.0 | |
| 4,096 | 5.158 / 4.161 | 1,588,273 / 1,968,793 | 1,197.1 / 1,172.0 | |
| 8,192 | 9.891 / 7.947 | 1,656,443 / 2,061,587 | 2,390.1 / 2,344.1 |
At the overall block level, the hierarchical method provides a – prefill speedup and a – training speedup over the original implementation. It reduces prefill peak memory by approximately and training peak memory by –.
- Please clarify the FA4 comparison normalization in Figure 3. Are Mamba and FA4 matched by hidden dimension, output dimension, FLOPs, bytes moved, or model-equivalent layer work? A table with H, D, Dv, total width, total tokens, bytes moved, and arithmetic intensity would help.
We designed our benchmark set-up to simulate the kernels' realistic usage. In particular, for FA4, we use headdim_qkv = 128 as it is one of the most commonly-used setting and is the most efficient configuration for FA4. Mamba-based models default to headdim_qk = 128,headdim_v = 64 with an expansion factor of 2, as recommended by the original authors, whereas FA4 by default has an expansion factor of 1. Using these configuration and the same hidden dimension, Mamba-2 uses while FA4 uses , a setting which provides FA4 with a more favorable performance advantage (smallest expansion factor with the more efficient headdim_v = 128).
We provide the table enumerating the requested information:
| Attention Mechanism | H | D | D_v | Expanded Width | Model Width | Total Tokens | Bytes Moved (Forward) |
|---|---|---|---|---|---|---|---|
| Mamba-2 | 64 | 128 | 64 | 4096 | 2048 | 32768 | 0.554 GB |
| FA4 | 16 | 128 | 64 | 2048 | 2048 | 32768 | 0.403 GB |
| B | T | Mamba TFLOPs | Mamba AI | FA4 TFLOPs | FA4 AI |
|---|---|---|---|---|---|
| 32 | 1024 | 0.121 | 218 | 0.104 | 256 |
| 16 | 2048 | 0.121 | 218 | 0.206 | 512 |
| 8 | 4096 | 0.121 | 218 | 0.412 | 1024 |
| 4 | 8192 | 0.121 | 218 | 0.825 | 2048 |
| 2 | 16384 | 0.121 | 218 | 1.649 | 4096 |
To compute FLOPS for Mamba, we use BH(4TDD_v + 2TCD + 2TCD_v + 2TDD_v/C), where B = batch size, T = sequence length, and C = chunk size. To compute FLOPS for causal Flash Attention, we use BH(2T^2D_v + 2T^2D) // 2.
Response to Reviewer FrCh 2/
- Can you validate the stability claims on real decay distributions from trained or pretraining Mamba-2/3 runs, not only synthetic prefix-scale sweeps?
Yes. In fact, the instability studied in this paper was motivated by the instability observed during the pretraining of Nemotron-H-8B-Base, an 8-billion-parameter Mamba-2/Transformer hybrid trained over a 15-trillion-token horizon. Our synthetic prefix-scale sweeps were designed to isolate and explain the mechanism behind that observed failure.
To provide direct quantitative evidence on learned decay values, we obtained an activation capture from approximately 9 trillion tokens into the run, at the 51st hybrid layer (a Mamba-2 layer). The capture contains one tensor-parallel shard: two 8192-token sequences across 16 local heads, giving token/head timestep inputs.
Starting from the captured bf16 timestep projection dt and the learned A and dt_bias, we reproduced the training kernel's fp32 preprocessing:
We then passed these real values through the Triton parallel prefix scan used by the existing implementation. From its prefix sums , diff segsum computes each log-decay as . We compared this with zero-clamped diff segsum and direct segsum, which instead computes . All methods used identical fp32 inputs, and direct summation in fp64 served as the reference.
The captured values span to , and the magnitude of an fp32 prefix reaches . With chunking, we evaluated valid segment sums and observed one violation of the required invariant . For this adjacent-token segment, the correct log-decay is . However, the parallel scan produced the rounded prefixes
whose subtraction gives . Thus, a true decay was converted into growth, and fp32 exponentiation of returned infinity. This is the monotonicity failure studied in our controlled experiment.
While clamping to be non-positive prevents the overflow, it does not recover the correct decay. In the example above, clamping changes to , giving a decay factor of , whereas the correct value is . More broadly, for the near-diagonal entries , the the 99th percentile of the absolute entrywise errors in is for clamped diff segsum and for direct segsum. At , matching the chunk size in our kernel experiments, the corresponding errors are and . Direct segsum also reduces the mean near-diagonal error by approximately at and at .
Response to Reviewer FrCh 3/3
- Can you provide more backward-pass details: timing breakdowns for dB/dX/dC, gradient correctness checks, and whether hierarchy-aware segsum gives the same stability/speed advantage in backward kernels?
The same hierarchical idea applies in backward kernels. The chunk-local contributions to dC, dB, dX, dt, and dA depend on the same decay mask () used in the forward pass. The dB/dX computation accesses (), while dA/dt requires a gradient through . As such, we use the same hierarchy-aware approach to compute in backward kernels. Our backward pass uses two kernels: a forward-time kernel that recomputes states on the fly, eliminating the need to save them during the forward pass and reducing activation memory, and a reverse-time kernel that processes chunks from last to first to propagate gradients with respect to the recurrent state. Since dC does not depend on dState, we compute dC during the forward-time kernel, which computes with the same hierarchical algorithm as forward pass (described in detail in 5.1). For dB and dX, we compute by leveraging the GPU layout in a similar way, where we reconstruct the off-diagonal blocks in the upper-right triangle and zero the lower-left blocks instead to obtain the transpose. We reuse the same to compute dA and dt.
The latency for the kernel that computes dC for batch = 16, seqlen = 2k, nheads = 64, nheads_bc = 1, headdim_bc = 128, headdim_x = 64 is 1.214 ms while the latency for the kernel that computes dB/dX is 1.005 ms for a total of 2.219 ms. Compared with a naive implementation of segscan with the same kernels, our optimized version is 20% faster over the baseline, which has a latency of 1.356 for dC and 1.305 for dB /dX for a total of 2.661 ms.
To validate gradient correctness, we compare gradients from our bf16 CuTe kernel against a fp32 PyTorch autograd reference. As a baseline for the numerical error expected from bf16 arithmetic, we also compare PyTorch’s bf16 gradients against the same fp32 reference. We find the numerical difference between the CuTe kernel and the fp32 reference matches the difference between the bf16 and fp32 reference.
| Gradient | CuTe BF16 vs. PyTorch FP32 | PyTorch BF16 vs. PyTorch FP32 |
|---|---|---|
dC |
3.98543105e-02 | 5.51970899e-02 |
dB |
3.88540253e-02 | 5.38356341e-02 |
dX |
4.14450141e-03 | 5.63682662e-03 |
ddt |
3.13574433e-01 | 5.46298921e-01 |
dA |
1.09343421e+00 | 1.73326802e+00 |
dD |
1.01390824e-01 | 1.23054042e-01 |
dZ |
4.04468831e-03 | 5.36589604e-03 |
- How sensitive is the split-sequence schedule to T, batch size, number of heads, state dimension, and head dimension? Is T selected analytically from occupancy/traffic estimates or tuned per shape?
The schedule is primarily sensitive to the sequence length , batch size , and number of heads . Without splitting, the kernel exposes roughly independent work items. Increasing or therefore reduces the need for sequence splitting, whereas increasing permits more splits while retaining sufficiently long segments.
We estimate the useful number of splits from the number of GPU compute units :
We separately limit the split count so that each segment remains approximately 4096 tokens or longer. This avoids excessive kernel-launch overhead and boundary-state traffic. The final split count is the smaller of the parallelism-based estimate and this sequence-length-based limit, and the nominal split size is
The state and head dimensions affect the amount of computation per work item and the size of the state communicated across split boundaries, so larger dimensions can reduce the relative benefit of splitting. They do not directly enter the current split-count formula; instead, we use a conservative minimum segment length.
Thus, the policy combines an analytical, shape-based parallelism estimate with a single empirically chosen minimum segment length of 4096 tokens. We do not perform online benchmarking or tune () separately for each shape.
Comments on the paper
7 comments
Hierarchy-Aware Segsum Algorithm Exposition (Section 5.1), 1/
Introduction
To improve the exposition of Section 5.1, we state the algorithm's central idea upfront and then develop it step by step.
The central idea is that the 1-SS decay mask decomposes into diagonal blocks—smaller 1-SS matrices that genuinely require scans—strictly lower off-diagonal blocks that are rank one, and upper blocks that are zero by causality. The nonzero off-diagonal blocks can be computed cheaply from precomputed factors. Furthermore, this decomposition maps directly onto the layout of the MMA accumulator, allowing the algorithm to be implemented efficiently on GPUs.
We develop this algorithm in three stages. We start with a baseline row-wise direct-segsum algorithm (Algorithm 1), which provides stable mask computation but must materialize the full mask in shared memory (SMEM) because of a layout mismatch with the MMA accumulator. Our first improvement, accumulator-aligned segsum (Algorithm 2), constructs each mask value in the thread that owns the corresponding accumulator entry, eliminating the expensive SMEM round trip; however, it computes a scan for every causal block, creating long row-wise chains of warp shuffles. Our hierarchy-aware segsum (Algorithm 3) removes this cost by exploiting the block structure of the 1-SS mask: it retains scans only on diagonal blocks and computes off-diagonal blocks from precomputed factors.
Algorithm 1: Row-wise direct segsum
stable, but materializes the dense mask in shared memory
|
| match the MMA accumulator layout
v
Algorithm 2: Accumulator-aligned segsum
no shared-memory round trip, but scans every causal block
|
| exploit the 1-SS block structure
v
Algorithm 3: Hierarchy-aware segsum
scans only diagonal blocks; computes off-diagonal
blocks from reusable factors
Hierarchy-Aware Segsum Algorithm Exposition (Section 5.1), 2/
Setup: Target computation and 1-SS block structure
Recall that for each chunk, the intra-chunk term requires computing
where is the causal 1-semiseparable (1-SS) decay mask,
Here, is the decay at position .
The matrix multiplication is performed by a tensor-core MMA. The remaining task is to construct the matching entries of and multiply them into the MMA result with as little extra work and data movement as possible.
Note that all three algorithms below are direct: writing , each segment sum is formed directly in the log domain and is exponentiated afterward, avoiding the catastrophic cancellation of diff segsum (Section 4.1). The three algorithms therefore share the same stability guarantee and differ only in where each entry of is constructed and how much of the work is shared.
Structure of the 1-SS mask
For compact notation, define for .
To make the block structure concrete, consider a mask partitioned into a grid of blocks:
[ 1 0 0 | 0 0 0 | 0 0 0 ]
[ α1 1 0 | 0 0 0 | 0 0 0 ]
[ α1:2 α2 1 | 0 0 0 | 0 0 0 ]
-------------------------+-------------------------+-------------------------
[ α1:3 α2:3 α3 | 1 0 0 | 0 0 0 ]
[ α1:4 α2:4 α3:4 | α4 1 0 | 0 0 0 ]
[ α1:5 α2:5 α3:5 | α4:5 α5 1 | 0 0 0 ]
-------------------------+-------------------------+-------------------------
[ α1:6 α2:6 α3:6 | α4:6 α5:6 α6 | 1 0 0 ]
[ α1:7 α2:7 α3:7 | α4:7 α5:7 α6:7 | α7 1 0 ]
[ α1:8 α2:8 α3:8 | α4:8 α5:8 α6:8 | α7:8 α8 1 ]
At the block level, there are only three types of submatrices:
block column
0 1 2
+-----+-----+-----+
block row 0 | D | 0 | 0 |
+-----+-----+-----+
1 | R | D | 0 |
+-----+-----+-----+
2 | R | R | D |
+-----+-----+-----+
D : a smaller 1-SS matrix
R : a rank-one off-diagonal block
0 : zero by causality
Each diagonal block is itself a smaller 1-SS matrix. Every strictly lower off-diagonal block is rank one: every entry can be formed from one value for its row, one value for its column, and one scalar shared by the block.
For example, block can be written as
off-diagonal block row factor middle column factor
[ α1:6 α2:6 α3:6 ] [ α6 ]
[ α1:7 α2:7 α3:7 ] = [ α6:7 ] x α3:5 x [ α1:2 α2 1 ]
[ α1:8 α2:8 α3:8 ] [ α6:8 ]
We note that the matrix above is for illustration; our current kernel operates on a mask. From this point onward, all dimensions refer to that implementation; the same diagonal, zero, and rank-one structure appears when the mask is divided into and blocks. The underlying decomposition is not specific to a particular MMA instruction or hardware generation. Before exploiting that structure, we first consider a stable row-wise direct-segsum baseline.
Hierarchy-Aware Segsum Algorithm Exposition (Section 5.1), 3/
Part 1: Baseline row-wise direct segsum
The algorithm constructs a stable in a straightforward manner, one row at a time. Writing , it directly forms each segment sum and sets . Specifically, for each 64-entry row, two threads split the row, compute these values, and write the completed row of to SMEM. However, this row-wise thread ownership does not match the MMA accumulator layout described below—the threads that construct a row are generally not the threads that hold the corresponding entries of . Therefore, after the MMA produces , the accumulator threads must reload the corresponding entries of from SMEM.
Although this method is numerically stable because it forms each segment sum directly, avoiding catastrophic cancellation when subtracting large prefix sums, the resulting SMEM materialization and redistribution are expensive: in our measurements, the row-wise direct-segsum baseline is -- slower than the hierarchy-aware implementation.
This motivates a different goal: each thread should construct exactly the mask entries for the values that it already holds. We call this accumulator-layout-aware blockwise computation. In plain terms, the mask is produced where it will be used.
From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.
Loading the discussion…
Response to the Meta Reviewer / General Response
Code Release
To address the reproducibility concern, we have provided the link to the AC containing anonymized code during the discussion period, following NeurIPS’s prescribed procedure. The repository contains standalone CuTe-DSL implementations of our optimized Mamba-2 SSD forward and backward kernels for NVIDIA H100 (SM90), together with documented dependencies, build instructions, and scripts and commands for reproducing the reported latency benchmarks. Following the review process, we plan to open-source the complete codebase associated with this work. We hope this addresses the reproducibility concern and would be happy to provide any additional information or clarification.
FA4 Comparison and Integrated Speed Measurement
We refer to our response to Reviewer FrCh, questions 2 and 3, where we elaborate the comparison to FA4 and provide detailed benchmarks on prefill and training speed for the full Mamba layer.
Blackwell Benchmark
We demonstrate that our implementation extends past the Hopper architecture to Blackwell, demonstrating that algorithmic improvements are not specific to Hopper. We ported our forward kernel to Blackwell SM100 and benchmarked it on an NVIDIA GB200. The table reports BF16 latency with B×L=32,768, using the same model dimensions as our main experiments.
Our hierarchy-aware algorithm maintains nearly constant 0.30−0.32 ms latency and is consistently 3.23–3.50× faster than the official Mamba-2 baseline across the full sweep. It overtakes Blackwell-optimized FA4 between 2K and 4K tokens and reaches a 4.03× advantage at 16K. These results demonstrate that the performance improvements are sustained when moving from Hopper to Blackwell, rather than depending on a peculiarity of the older architecture. More broadly, they support our premise that the techniques can be mapped effectively onto evolving GPU architectures. We will update our paper with these new Blackwell results.