TL;DR
State-space models (SSMs) are fast alternatives to Transformers, but they usually force a painful choice: make them lightning-fast with simple math that struggles to track complex logic, or make them logically expressive at the cost of crushing GPU memory. FLASH PD-SSM breaks this compromise by discretely selecting from a small dictionary of pre-sparsified matrices at each step. The result is an SSM that tracks complex state transitions like an unconstrained model while training nearly as fast—and using less memory—than popular SSMs at the 3-billion-parameter scale.
What Problem Does This Paper Address?
Transformers are brilliant, but their memory and compute costs balloon quadratically as sequences get longer. State-space models (SSMs)—like Mamba—solve this by processing tokens sequentially through a compressed hidden state, scaling linearly with sequence length.
How well an SSM remembers and updates information depends on its transition matrix, which governs how the hidden state evolves from one token to the next. To train at scale, popular SSMs restrict this matrix to a simple diagonal structure. While computationally cheap, diagonal matrices have a glaring blind spot: they mathematically cannot emulate certain Finite-State Automata (FSAs)—think tracking parity, modular arithmetic, or complex state changes in code and math.
Recently, a model called PD-SSM solved this expressivity problem using structured sparse matrices (specifically, column one-hot matrices mixed with diagonal ones). However, generating those matrices on the fly required blending dense matrices at every single time step, eating up $\mathcal{O}(LN^2)$ memory (where $L$ is sequence length and $N$ is state size). In practice, Mamba2 ran over 40× faster, leaving PD-SSM stuck on the theoretical drawing board.
Methods
The authors noticed a wasteful middleman in PD-SSM: at every token, it took a weighted average of $K$ dense matrices and then sparsified the result.
FLASH PD-SSM flips the order of operations using a novel hard-selection mechanism:
- Sparsify once: At the start of a training step, the model takes its trainable dictionary of $K$ dense matrices and extracts the largest value in each column (
argmax), creating $K$ sparse matrices. Because each column only has one active entry, an $N \times N$ matrix compresses into a tiny array of $N$ integers. - Select discretely: At each time step $t$, the input token passes through a linear layer to pick one sparse matrix from the dictionary via another
argmax.
This drops the memory footprint from $\mathcal{O}(LN^2)$ down to $\mathcal{O}(LN)$ while preserving exact FSA expressivity guarantees. Because argmax operations aren't differentiable, the authors propagate gradients using a slope-annealed straight-through estimator (approximating the hard selection with a tempered softmax during the backward pass).
Finally, they wrap this mechanism into a standard Mamba-style multi-head block and write custom three-phase chunk-wise CUDA and Triton kernels so GPUs can process sequences in parallel chunks rather than waiting step-by-step.
Datasets
The authors test FLASH PD-SSM across an unusually broad spectrum of benchmarks:
- Synthetic State-Tracking & Mechanistic Suites: 4 FSA emulation tasks from Delétang et al. (Cycle Navigation, Even Pairs, Modular Arithmetic, Parity) testing length generalization (trained on length 40, tested up to 256), plus the MAD (Mechanistic Architecture Design) suite testing recall and memorization.
- Long-Range Time-Series: The UEA multivariate classification archive (sequences over 17,000 steps) and PPG-DaLiA regression.
- Extended Box Dataset (Modified Benchmark): A natural language state-tracking dataset (tracking objects moving between boxes). The authors extend the out-of-distribution evaluation from its original length to up to 26 state transitions (while training on just 6).
- Language Modeling: Pretraining on FineWeb-Edu (20B tokens for 100M/230M models; 500B tokens for 3B models) and zero-shot evaluation via LM-Eval-Harness (Wikitext, LAMBADA, HellaSwag, PIQA, ARC, WinoGrande, OBQA, BoolQ).
Key Insights and Ideas
- Hard selection beats soft mixing: You don't need to softly blend transition matrices at every token to get maximum state-tracking power. Picking a single pre-sparsified matrix per step gives the exact same theoretical FSA guarantees at a fraction of the memory cost.
- Complementary strengths in hybrids: On the MAD benchmark, pure FLASH PD-SSM excels at state-tracking but lags on pure context-recall tasks (like LAMBADA). Pairing it with attention or DeltaNet creates a "best of both worlds" hybrid where recall and state-tracking cover each other's blind spots.
- Surgical LLM upgrades: You don't even need to pretrain from scratch to get the benefits. Dropping just 4 FLASH PD-SSM layers into frozen, pretrained 300M–30B hybrid LLMs (less than 10% of the layers) dramatically boosts their ability to track states over long horizons.
Key Results
- Near-40× Speedup & Lower Memory: FLASH PD-SSM achieves nearly a 40× single-layer speedup over PD-SSM. Up to 3B parameters, it trains within 6% of DeltaNet's speed (and up to 1.3× faster at 0.1B), decodes 7–8% faster, and uses 4–12% less training memory than DeltaNet and Gated DeltaNet.
- Synthetic State-Tracking: Achieves 96.3% average length-generalization accuracy, crushing Mamba2 (58.9%), Mamba3 (73.0%), and Gated DeltaProduct (80.7%).
- Frozen LLM Drop-In (Box Dataset): Inserting FLASH PD-SSM layers into Granite4 (300M–7B) and Nemotron-H (9B–30B) improves out-of-distribution state-tracking accuracy by up to 10% over Mamba2 and 8% over DeltaNet.
- 3B Scale Pretraining: On a 500B-token run based on the Granite4 hybrid architecture, swapping 8 SSM layers for FLASH PD-SSM (
Gated DeltaNet-PD) reaches the highest zero-shot average accuracy (59.7%), beating pure Gated DeltaNet (58.1%), Mamba2 (59.4%), and Mamba3 (59.5%), alongside the lowest LAMBADA perplexity (6.66).
Limitations and Future Work
Because FLASH PD-SSM relies twice on discrete argmax selections, training depends heavily on straight-through gradient estimators, which introduce biased gradients. While it works remarkably well in practice, the authors note that current theory doesn't fully explain why straight-through estimation behaves so reliably inside deep sequential recurrences. Untangling these optimization dynamics—and understanding whether gradient bias contributes to pure FLASH PD-SSM's weaker standalone performance on recall-heavy language tasks—remains an open direction for future work.
Summary updated