Loading…
Topic
State Space Models
5 posts about State Space Models. Every summary links to the original.
- 5 posts
- 3 companies
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
Newest first
Posts
On the Importance of Gating: Memorization vs. In-Context Learning in State Space Models
State Space Models (SSMs) offer constant memory and linear compute as an alternative to Transformers but lag on in-context learning and precise retrieval tasks. This work shows that the gating mechanism, common in modern recurrent networks, explains both the success and failure of SSMs in these domains. Through theory and experiments, the authors demonstrate that gating causes SSMs to first learn an in-weights memorization solution while delaying or preventing convergence to a correct in-context learning solution. This occurs even when the architecture has no fundamental limitations in memory capacity. However, gating is often beneficial for improving generalization to long sequence lengths, illuminating its crucial role in shaping training dynamics and generalization.
Weighted State Souping for Efficient Long-Context Retrieval
State space models (SSMs) offer fast inference and fixed state size, and state souping independently encodes chunks like documents to cache and recombine states for downstream queries. However, both standard SSMs and state souping degrade on long, crowded contexts, limiting their use in long-horizon tasks. Weighted state souping addresses this by learning query-dependent weights for composing cached states, improving performance on single- and multi-hop document question answering, needle-in-a-haystack retrieval, variable tracking, and tool use. The method can be adapted into a sparse variant that achieves near-constant encoding cost relative to context length while preserving or improving performance. Theoretical arguments explain why souping works and when it may fail, and weighted souping combines reusable context representations with selective retrieval for efficient language modeling over large collections.
Attention to Mamba: A Recipe for Cross-Architecture Distillation
State Space Models like Mamba offer lower memory and higher throughput than Transformers, but naive cross-architecture distillation from Transformers to Mamba fails to preserve teacher performance. The authors propose a principled two-stage distillation recipe: first distill a Transformer into a linearized Attention model via a kernel trick, then distill that into a Mamba model without any Attention blocks. The distilled Mamba model reaches a perplexity of 14.01, close to the teacher Pythia-1B Transformer’s 13.86. This performance largely carries over to downstream tasks, though gaps appear on tasks relying on in-context recall. The recipe is validated through ablations at 1B scale with 10B tokens, scaling analysis on model sizes and total distillation tokens, and sensitivity analysis on token allocation between stages.
Can we change an AI model’s architecture without retraining it from scratch?
The Transformer architecture’s memory cost scales with token count, making long-context AI agents expensive. In controlled comparisons of three state space models - Gated KalmaNet, Gated DeltaNet, and Mamba-2 - Gated KalmaNet performed best, offering variable-length inference without retraining. Priming identifies which attention layers can be replaced by state space models using a sliding-window attention proxy, then reuses pre-trained weights to convert them into hybrid architectures without retraining, reducing pretraining cost by over 99%. A 32-billion-parameter hybrid model matches the original Transformer’s reasoning quality while decoding up to twice as fast or reaching correct answers in two-thirds of wall-clock time. The team extended hybrid context to 256K tokens without additional training and released primed models at 8B and 32B scales along with training code, kernels, and a vLLM plugin under Apache 2.0.
ReplaySSM: Rethinking State Storage for Faster Hybrid-Model Decoding
Hybrid models interleave state-space model (SSM) layers with attention layers, but SSM layers can become a decoding bottleneck at serving batch sizes due to memory-bound state updates. ReplaySSM represents the SSM state as a checkpoint plus a buffer of recent inputs, separating output computation from state updates. This reduces state memory traffic by roughly half, simplifies rollback for speculative decoding by avoiding state snapshots, and supports low-precision state reads without propagating rounding error through the recurrence, enabling separate precision for output computation and state updates. Evaluated on Nemotron 3 and Qwen3.5 models from 4B to 120B parameters on H100 and B300 GPUs, ReplaySSM achieves 1.20× to 1.47× faster decode steps at batch size 256, with end-to-end gains growing with batch size. The technique is integrated into TensorRT-LLM, vLLM, SGLang, and FlashInfer, and runs in production in GLM-5.3-Flash and Kimi-K3.
Related topics
All topics →Weekly digest
The best engineering reads, once a week.