Full text not available for this paper
Summary (Overview)
- State Space Attention (SSA) is a novel architecture that replaces the growing key-value cache of standard attention with a fixed-size memory and a learned retention policy, enabling constant inference memory while preserving the contextual reasoning capabilities of attention.
- SSA introduces a small scorer Transformer that decides which chunks of the input to retain in a bounded memory, rescores all residents against new candidates at every eviction, and is trained jointly with the main language backbone (the reader).
- A key training innovation is recovery, a counterfactual mechanism that replays training failures while forcing evicted chunks to stay available, providing credit to the scorer exactly where standard gradients are absent. A soft retention warmup phase approximates this counterfactual signal during early training.
- At 400M parameters, SSA matches or comes within a few points of full-attention Transformers on retrieval and multi-hop reasoning benchmarks (e.g., 96.57% vs. 99.60% on MKVT at 8K), while far outperforming Transformers with the same readable budget (8.13% for Transformer-576) and recurrent baselines like GDN and HOLA on long-context retrieval.
- SSA maintains a constant key-value cache (54 MiB vs. 6.0 GiB for a Transformer at 64K context) and its decoding time per token does not grow with context length, though training is slower (3.6–6.0× per update in pretraining).
Introduction and Theoretical Foundation
Standard attention mechanisms (Vaswani et al., 2017) require a key-value cache that grows linearly with sequence length, making long-context inference memory-intensive. State Space Models (SSMs) and recurrent linear attention (Gu & Dao, 2024; Dao & Gu, 2024; Katharopoulos et al., 2020) instead maintain a fixed-size state, but this compresses information and makes precise recall difficult due to input interference (Jelassi et al., 2024).
The authors pose a fundamental question: can a model keep the contextual reasoning of attention under the same constant-memory constraint? Their key insight is that a bounded state need not compress the tokens it holds—it can keep exact token representations as long as it caps how many it keeps. A standard Transformer with a fixed context window already has a bounded state managed by a first-in-first-out rule. SSA instead learns which tokens to keep, treating the eviction policy as a learnable degree of freedom.
The theoretical foundation rests on three requirements for accurate contextual retrieval with a bounded cache:
- Relevant information must fit within the state.
- The policy must learn to retain it (credit assignment for the scorer).
- The reader must learn to use the query.
The main difficulty is credit assignment for the scorer: a useful memory is often discarded long before the prediction that reveals its value, and hard selection provides no ordinary gradient. The paper addresses this through a combination of straight-through estimation, soft retention warmup, and counterfactual recovery.
Methodology
Architecture
An input of length is divided into chunks of tokens. At chunk step , SSA maintains at most retained chunks and a local window of preceding chunks. The reader has access to at most:
Attention over the accessible set uses standard softmax attention:
Here is the head dimension and is a learned segment embedding for memory slots.
The Scorer: A small Transformer (0.87M parameters beside a 3.18M reader at 3M scale; 13.8M, 3.5% of the model, at 400M) reads the reader's token embeddings (not hidden states) and produces a summary token for each resident chunk and the candidate. A linear head maps each summary token to a keep score ; the lowest-scoring of the chunks is evicted. One set of scores is shared by all layers and heads.
Training
Soft retention warmup: Negated scores define drop probabilities . Cumulative survival weights reduce chunk contributions:
Hard retention: Discrete evictions with stochastic selection for exploration. A centered straight-through estimator (Bengio et al., 2013) preserves hard forward reads. The local derivative for a chunk is:
Counterfactual recovery: For selected training failures (the examples with highest loss), recovery replays the example forcing a previously evicted chunk to stay available. If the prediction passes an acceptance criterion (), the scorer receives survival credit and a margin loss:
Parallel training: The scorer's features don't depend on reader activations, so a sequential sweep records retained sets; the reader then processes the whole sequence in parallel.
Empirical Validation / Results
3M and 20M Scale Experiments
- Cued copying (3072-token context, 24× SSA's 128-token state): SSA reaches 98.70% exact match vs. 100% for full attention, while fixed eviction rules fail completely (0.00% drop-oldest, 2.86% random).
- Multi-hop induction (20M, fresh data): SSA matches Transformers at 99.65% vs. 99.75% (same backbone) and 99.55% (larger), while GDN (34.40%) and HOLA (73.40%) fall far behind.
- MKVT (Multi-Key Variable Tracking): 44 of 48 SSA runs reach 90% first-stage accuracy; 40/48 reach ≥99% fixed-target exact match.
400M Scale Pretraining (15B tokens)
| Model | Parameters | NLL at 2K | NLL at 8K |
|---|---|---|---|
| Transformer (576) | 400.1M | 2.695 | 2.686 |
| Transformer (2K) | 400.1M | 2.615 | 5.039 |
| Transformer (8K) | 400.1M | 2.623 | 2.557 |
| Gated DeltaNet | 399.9M | 2.590 | 2.549 |
| HOLA | 399.8M | 2.591 | 2.558 |
| SSA, no recovery | 399.8M | 2.656 | 4.334 |
| SSA, recovery | 399.8M | 2.650 | 3.626 |
400M Post-Training Results (selected)
| Model | MKVT 8K | RULER 8K | k-hop (h=16) | PPL 8K |
|---|---|---|---|---|
| SSA, trainable scorer | 96.57 | 56.40 | 99.536 | 26.91 |
| Transformer 576→576 | 8.13 | 14.61 | 99.472 | 19.79 |
| Transformer 2K→576 | 7.93 | 15.76 | 48.251 | 20.77 |
| Transformer 2K→2K | 34.73 | 36.50 | 25.936 | 19.03 |
| Transformer 8K→8K | 99.90 | 76.86 | 99.457 | 18.59 |
| GDN | 99.50 | 68.91 | 25.594 | 18.57 |
| HOLA | 99.53 | 58.04 | 25.847 | 18.84 |
Key findings:
- SSA matches full attention on k-hop reasoning (within 0.2 points at every hop count).
- Composition under sustained eviction: With a k-hop source block at the start of an 8K input, SSA reaches 99.2% vs. 99.9% for full attention; GDN, HOLA, and Transformer-576 stay at chance (~25%).
- Component ablations: No run without recovery learned retrieval (0 of 2); hard-only training learned in 2 of 2 runs.
Theoretical and Practical Implications
-
Learned retention as a degree of freedom: The paper reframes the eviction policy as a learnable component, showing that a fixed-context Transformer is just the special case of always keeping the most recent tokens. This opens the door to learned selective memory as a route to contextual reasoning with constant inference state.
-
Memory representation matters: The stark gap between SSA and recurrent models (GDN, HOLA) at similar state budgets demonstrates that how memory is represented and used—exact token representations read by attention vs. compressed recurrent states—is as important as how much memory is available.
-
Credit assignment is the core challenge: The recovery mechanism provides counterfactual feedback exactly where read gradients are absent, and the paper shows it is essential (no run without it learned retrieval). This has implications for training any architecture with discrete, non-differentiable memory decisions.
-
Composability: SSA reads memory with standard attention, so it can be stacked with KV cache eviction methods and hybridized with recurrent layers (tested at 3M scale in Table 10).
-
Language modeling trade-off: SSA's perplexity is higher than baselines (23.07 vs. 18.77–21.49 at 2K), mostly due to its one-chunk local window. Widening the window to 13 chunks (208 tokens) recovers most of the gap (20.95 at 2K), consistent with prior findings that language models draw most predictive signal from the last few hundred tokens.
Conclusion
State Space Attention demonstrates that learned selective memory can preserve strong retrieval and reasoning performance under a constant-memory constraint. The training recipe—combining soft retention warmup, straight-through estimation, and counterfactual recovery—successfully develops both the reader and the retention policy jointly from scratch.
Key limitations acknowledged by the authors:
- All 400M results use a single seed; some smaller-scale experiments show seed sensitivity.
- SSA trails full attention on RULER (56.40% vs. 76.86%) and has the highest perplexity.
- Tasks whose relevant information exceeds the memory budget remain untested.
- Training is 2.3–6.0× slower per update than a Transformer.
Future directions suggested include: scaling analysis, testing SSA with KV cache eviction methods on top of its retained set, wider local windows for better language modeling, and exploring tasks where relevant information exceeds the memory budget. The paper positions SSA as a step toward making a fixed number of tokens useful over a longer context, framing the eviction policy as a learnable degree of freedom for Transformers.
Related papers
- The Teacher Is Already Inside: Self-Distilling Looped Language Models Beyond Their Last Loop
ELPSD enables a looped language model to self-distill without rewards by training its last loop against an extrapolated contrastive teacher from its own frozen weights, beating GRPO on math benchmarks.
- Self-WSP: Can Language Models Improve Themselves Through Weight-Space Programming?
A 0.8B model can self-improve by editing its own weights, quintupling GSM8K accuracy, but random edits match it, revealing search, not understanding, drives gains.
- FlyingStart: Learned Cross-Token Warm Starts for Fixed-Point Decoding in Recurrent-Depth Language Models
FlyingStart learns a linear warm-start map for recurrent-depth language models, cutting decoding layers by 14–19% while matching accuracy and preserving the exit rule's safety certificate.