---
kind: concept
slug: state-space-model
title: State-space model (SSM)
summary: >-
  A state-space model carries a fixed-size state through a sequence, so cost grows linearly with length. Covered: selective scans (Mamba), diagonal S5, 2D image scans, hybrid backbones, scalar-decay SSD (Mamba-2), video, LiDAR occupancy (OccMamba) and robot control (LocoMamba). xLSTM is a recurrent neighbour, not an SSM. Numbers are author-reported.
tags: [sequence-model, linear-cost, image-restoration, image-classification, video-understanding, hybrid-architecture, language-modelling, long-range-sequences, architecture-search, robot-locomotion, reinforcement-learning, 3d-occupancy]
papers: ["2208.04933", "2312.00752", "2402.15648", "2403.06977", "2407.08083", "2405.21060", "2405.04517", "2403.09338", "2408.10618", "2508.11849", "2604.12374"]
related: [image-super-resolution, image-denoising, channel-attention, vision-transformer, masked-image-modeling, knowledge-distillation, self-attention, efficient-vision-backbone, linear-attention, multi-query-attention, recurrent-neural-network, long-short-term-memory, parallel-scan, mixture-of-experts, low-precision-arithmetic, differentiable-architecture-search, proximal-policy-optimization, domain-randomization, curriculum-learning, bev-representation, semantic-segmentation]
status: draft
updated_at: 2026-10-25
---

## Overview

A state-space model (SSM) keeps a hidden state `h` that is updated from each
input and read out as an output. The continuous form is
`h'(t) = A h(t) + B x(t)` and `y(t) = C h(t) + D x(t)`, with a state of size N
[arxiv:2402.15648 §3.1] [arxiv:2402.15648 eq. 1]. After discretisation, the
same map is a recurrence over a sequence, `h_k = Ā h_{k-1} + B̄ x_k`, which
costs one update per token [arxiv:2402.15648 eq. 3]. The shared invariant is
that the memory has a fixed size, so the cost grows linearly with sequence
length, not quadratically as in full self-attention [arxiv:2402.15648 §1]
[arxiv:2407.08083 §1] [arxiv:2405.21060 §1].

Mamba-style "selective" SSMs make `B̄`, `C` and the step size Δ depend on the
input, which lets the model decide what to keep in its state
[arxiv:2402.15648 §3.1] [arxiv:2312.00752 §3.2]. Mamba (Mamba-1) introduced
this for sequence modelling, and the Mamba-2 paper narrows the state transition
to one scalar decay per head. Under that restriction the recurrence and a
masked attention-like matrix are two forms of the same map
[arxiv:2405.21060 §5.3] (see the scalar-decay variant below).

Not every variant is selective. S5 keeps fixed parameters per layer and gets
its long-range results from a diagonal state and a parallel scan
[arxiv:2208.04933 §3.2]. The variants below share the core above but differ in
how the state transition is chosen, how a 2D image or a video is fed to a
sequence model, and how a sequence model is combined with attention. Outside
vision and language, one variant uses the same block for LiDAR occupancy in a
navigation stack [arxiv:2408.10618 §3.1], and another fuses sensor tokens
inside a reinforcement-learning policy [arxiv:2508.11849 §3.2].

A common complaint is that a sequential scan sees pixels in one order and so
has limited access to global context. The image papers argue this and answer
it differently: MambaIR scans four directions, MambaVision mixes scan blocks
with attention, and LocalMamba keeps small windows contiguous and searches
over eight scan directions per layer [arxiv:2402.15648 §1]
[arxiv:2407.08083 §1] [arxiv:2403.09338 §4.1] [arxiv:2403.09338 §4.2].
VideoMamba orders
the spatiotemporal tokens and runs each block in both directions
[arxiv:2403.06977 §3.2].

xLSTM (see its variant below) is not a state-space model. It is included
because it is a recurrent model with a fixed-size state that the authors
compare against Mamba in their own tables [arxiv:2405.04517 tab. 1].

VMamba (arXiv:2401.10166) has no card here, so nothing from it is used on this
page.

## Variants

### Input-dependent selection with a fused scan (Mamba-1)

Mamba makes the step size Δ, the input matrix B and the output matrix C
functions of each token, and keeps A fixed [arxiv:2312.00752 §3.2]. This lets
the model keep or drop each input. The authors report 99.8% on Selective
Copying, where the positions of the tokens to keep vary, against 18.3% for S4
[arxiv:2312.00752 §4.1]. Making the parameters input-dependent removes the
convolution form that made earlier models efficient, so the authors write a
fused GPU kernel. It discretises, scans in fast on-chip memory and recomputes
the intermediate states in the backward pass [arxiv:2312.00752 §3.3, app. D].
The block is repeated with no separate attention or MLP, and its SSM branch
goes through a short causal convolution [arxiv:2312.00752 §3.4, app. E.2.2].

Author-reported zero-shot results: Mamba-1.4B averages 59.7 on the paper's six
tasks, against 55.2 for Pythia-1.4B, and only compares with models that share
its tokenizer and data [arxiv:2312.00752 §4.2.2]. Inference throughput is
reported at 4 to 5 times that of a Transformer of similar size
[arxiv:2312.00752 §4.5].

Selection does not help raw audio. On YouTubeMix, the selective layer is worse
than the fixed one in every block, and the authors use the fixed layer near the
signal and the selective one only for discrete tokens such as text and DNA
[arxiv:2312.00752 app. E.4.1] [arxiv:2312.00752 §5].

The paper's discretisation of B̄ (eq. 4) is not what the released kernel
computes, so an implementation has to pick one
[arxiv:2312.00752 eq. 4] [code: mamba_ssm/ops/selective_scan_interface.py#L162-L164].
Card: [Mamba: Linear-Time Sequence Modeling with Selective State Spaces](/papers/2312.00752).

### Diagonal MIMO layer with a parallel scan (S5)

S5 replaces S4's bank of single-input, single-output SSMs with one
multi-input, multi-output SSM of latent size P [arxiv:2208.04933 §3.1]. The
continuous matrix is diagonalised, each diagonal mode gets a learnable
timescale Δ, and zero-order hold discretises the result
[arxiv:2208.04933 §3.2] [arxiv:2208.04933 eq. 6]. The diagonal recurrence runs
in the time domain as a parallel scan, so it needs no frequency-domain kernel.
The paper says its cost matches S4's when the state size is on the order of the
feature size [arxiv:2208.04933 §3.4]. The eigenvalues start from a diagonalised
HiPPO-N matrix with real part −½ [arxiv:2208.04933 app. B.1.1].

Author-reported results: the LRA average is 87.46%, against 86.09% for S4-LegS,
and Path-X reaches 98.58% against 96.35% [arxiv:2208.04933 tab. 1]. On 8 kHz
speech, zero-shot from a 16 kHz model, it reports 94.53% against 91.32% for
S4-LegS [arxiv:2208.04933 tab. 2]. On pendulum regression with irregular
samples it reports an MSE of 3.41 × 10⁻³ against 3.94 for its own re-run of CRU,
and about 86 times the speed per the same table [arxiv:2208.04933 tab. 3]. The
LRA-Image score is lower than S4-LegS (88.00 against 88.65) [arxiv:2208.04933
tab. 1].

Irregular sampling changes Δ for each step, from the time gaps, not from the
content [arxiv:2208.04933 §3.3]. The card does not compare S5 with Mamba on any
task, so the two should not be ranked from this page.

Card: [Simplified State Space Layers for Sequence Modeling](/papers/2208.04933).

### 2D selective scan for image restoration (MambaIR)

Images are two-dimensional, but an SSM reads a sequence. MambaIR flattens the
feature map into four 1D sequences: rows top-to-bottom, columns left-to-right,
and the reverse of each. It runs a selective scan on each one and sums the
four outputs back into the 2D map [arxiv:2402.15648 §3.5] [arxiv:2402.15648
fig. 2c]. The code gives each direction its own Δ, B and C projections and its
own A and D parameters [code: basicsr/archs/mambair_arch.py#L250-L274]. The
paper describes the four directions as corner-to-corner; the code's order
differs ([arxiv:2402.15648 §3.5] versus
[code: basicsr/archs/mambair_arch.py#L343-L344]).

The scan sits inside a residual block that also has a convolution bottleneck
and channel attention. The block adds learnable per-channel scaled skips
[arxiv:2402.15648 §3.3] [arxiv:2402.15648 eq. 5] [arxiv:2402.15648 eq. 6].
Card: [MambaIR: A Simple Baseline for Image Restoration with State-Space Model](/papers/2402.15648).

Author-reported results on Set5, Set14, Urban100 and Manga109 show MambaIR
above SwinIR at ×2, ×3 and ×4 classic SR [arxiv:2402.15648 tab. 3]. For
example, at ×2 on Urban100 it reports 34.15 dB against 33.81 dB for SwinIR. On
Gaussian colour denoising it leads SwinIR at all three noise levels on
BSD68, Kodak24, McMaster and Urban100 [arxiv:2402.15648 tab. 5]. On real
denoising, it lands within 0.2 dB of Restormer on SIDD and DND
[arxiv:2402.15648 tab. 6].

### Windowed scan with per-layer direction search (LocalMamba)

A flat row-by-row scan puts vertically adjacent patches far apart in the
sequence. LocalMamba adds a local scan that reads each w × w window in full
before moving to the next, with w = 2 and w = 7 in its search space
[arxiv:2403.09338 §4.1] [arxiv:2403.09338 §4.2]. Each block runs four
branches: a horizontal global scan, its flip, the local scan and its flip.
Each branch has its own selective SSM, is unscanned, reweighted by channel
attention, and the branches are summed [arxiv:2403.09338 §4.1]
[arxiv:2403.09338 fig. 3a]. Scanning only reorders tokens, so the paper
reports no added FLOPs [arxiv:2403.09338 §4.3].

Which directions suit a layer is searched rather than fixed. The candidates
are horizontal and vertical scans, each with its flip, plus the two local
scans with their flips. A softmax over learnable per-layer weights mixes
them in a supernet, and afterwards the four highest-probability directions
are kept for each layer [arxiv:2403.09338 §4.2] [arxiv:2403.09338 eq. 5].
The paper reports 28 GB of memory for the search supernet at 20 blocks
[arxiv:2403.09338 §4.2]. The searched layouts are reported in the paper as
local scans at the first and last layers and global scans in the middle for
LocalVim; this is an observation, with no quantitative analysis
[arxiv:2403.09338 §5.5] [arxiv:2403.09338 fig. 4].

Author-reported ImageNet-1K top-1: LocalVim-T reaches 76.2% at 1.5G FLOPs,
against 73.1% for Vim-Ti, and LocalVMamba-T reaches 82.7% against 82.2% for
VMamba-T [arxiv:2403.09338 tab. 2]. The fixed-direction LocalVim-T* without
search reaches 75.8%, and removing the channel attention drops it to 75.2%
[arxiv:2403.09338 tab. 5]. On COCO with Mask R-CNN at 1×, LocalVMamba-T
scores 46.7 box AP against 46.5 for VMamba-T, and on ADE20K with UperNet it
scores 47.9 mIoU in single-scale against 47.3 [arxiv:2403.09338 tab. 3]
[arxiv:2403.09338 tab. 4]. Those gains over VMamba-T are between 0.2 and 0.6
points.

Card: [LocalMamba: Visual State Space Model with Windowed Selective Scan](/papers/2403.09338).

### Hybrid Mamba-attention backbone (MambaVision)

MambaVision is a hierarchical image backbone with four stages
[arxiv:2407.08083 §3.1]. The first two stages are plain residual convolution
blocks. The last two are windowed layers, and inside them the first half of the
layers use a Mamba-style mixer while the second half use multi-head
self-attention [arxiv:2407.08083 §3.2.2]. Its ablation finds that this placement
(Mamba first, attention last) beats the other arrangements tested, reaching
82.3% top-1 against 81.3% for a random placement [arxiv:2407.08083 tab. 5].

The mixer is the part to get right. It replaces Mamba's causal convolution
with an ordinary convolution, because a causal one only lets information flow
in one direction [arxiv:2407.08083 §3.2.2]. It also adds a second, non-scan
branch made of one convolution and a SiLU activation. Both branches are
projected to half the channels, concatenated, and projected back
[arxiv:2407.08083 eq. 7]. The ablation in [arxiv:2407.08083 tab. 4] compares
the causal-convolution baseline (80.5% top-1), a convolution-only mixer
(80.9%), a gated combination (81.3%) and the final concatenation (82.3%).

Author-reported ImageNet-1K results, at 224 input unless noted, put the
Tiny model (31.8M parameters) at 82.3% top-1 and 6298 img/s on one A100 at
batch 128. For comparison the same table lists ConvNeXt-T at 82.0% and 3196
img/s, and Swin-T at 81.3% and 2758 img/s [arxiv:2407.08083 tab. 1]. The
largest model, L2 (241.5M parameters), reaches 85.3% at 1021 img/s
[arxiv:2407.08083 tab. 1]. The table also lists VMamba-T at 82.6% and 1282
img/s; those numbers are the MambaVision authors' table, not VMamba's paper.
Dense tasks follow the same pattern: with Cascade Mask R-CNN on COCO,
MambaVision-T reports 51.1 box AP against 50.4 for Swin-T and ConvNeXt-T
[arxiv:2407.08083 tab. 2], and with UperNet on ADE20K it reports 46.0 mIoU
against 44.5 for Swin-T [arxiv:2407.08083 tab. 3]. With ImageNet-21K
pre-training, the paper reports 86.1% for L at 224 [arxiv:2407.08083 §5.3].

Card: [MambaVision: A Hybrid Mamba-Transformer Vision Backbone](/papers/2407.08083).

### Scalar-decay SSM as masked attention (SSD, Mamba-2)

If each state transition is a single scalar times the identity, the SSM's
whole input-to-output map is a lower-triangular matrix. That matrix is a
product of a 1-semiseparable mask, built from cumulative products of the
scalars, with the matrix `C Bᵀ` [arxiv:2405.21060 §5.1]. Read this way, `C`
plays the role of queries, `B` of keys and the input `X` of values, so the
layer is masked linear attention with a decay mask [arxiv:2405.21060 §5.3].
The two forms, recurrent and quadratic, are exact duals in this case
[arxiv:2405.21060 §5.3].

The paper's algorithm, called SSD, exploits the duality for speed. It splits
the sequence into chunks of length `Q` and handles each part with the form
that suits it [arxiv:2405.21060 §6]:

- inside a chunk, the quadratic form, with a zero starting state;
- the state at the end of each chunk, as one batched matrix product;
- a short scalar recurrence across the chunk states, which gives the true state
  at each chunk boundary;
- the effect of that carried-in state on each chunk's outputs, again as one
  batched product.

The authors state training cost of `O(TN²)` FLOPs and `O(TN)` memory when the
head size and chunk length both equal `N` [arxiv:2405.21060 §6, theorem 6.1].
The paper's listing of the full layer is in [arxiv:2405.21060 §6, listing 1].

The Mamba-2 block built on SSD computes the gate, the SSM inputs and the step
sizes from one projection at the start. It adds one extra normalisation layer
before the output projection, following NormFormer [arxiv:2405.21060 §7.1].
The paper's head-pattern ablation favours the head sharing that Mamba uses
[arxiv:2405.21060 tab. 5]. The authors describe the block's `A` as a single
scalar per head, which is the restriction that makes SSD possible. SSD does not
cover Mamba's per-channel diagonal `A` [arxiv:2405.21060 §5] [arxiv:2405.21060
§7.2].

Author-reported results: SSD is 2 to 8 times faster than Mamba's fused scan at
state size 64, and faster than FlashAttention-2 from sequence length 2K, about
6 times faster at 16K [arxiv:2405.21060 fig. 10] [arxiv:2405.21060 §9.3]. On
seven zero-shot tasks, Mamba-2-2.7B averages 60.2 against 59.9 for the Mamba-1
2.8B model in the same table [arxiv:2405.21060 tab. 1]. Adding six attention
layers to a 2.7B Mamba-2 model gives Pile perplexity 5.95, against 6.09 for
pure Mamba-2 and 6.13 for Transformer++ [arxiv:2405.21060 tab. 3]. These
hybrid comparisons are single runs with no repeats [arxiv:2405.21060 tab. 3].

Card: [Transformers are SSMs](/papers/2405.21060).

### Hybrid Mamba-2 and attention LLM with MoE (Nemotron 3 Super)

Nemotron 3 Super is a 120.6B-total, 12.7B-active language model. Mamba-2
blocks are paired with mixture-of-experts layers, and a limited number of
attention layers act as global anchors [arxiv:2604.12374 §2.1.3] [arxiv:2604.12374
tab. 1]. The paper does not give the number or positions of the attention layers
in the text; they appear only in the layer-pattern figure [arxiv:2604.12374 fig. 2].
The Mamba blocks use a state dimension of 128, 8 groups and 128 heads of size 64
[arxiv:2604.12374 tab. 1].

The SSM state is the cache that matters for decoding. In the paper's
quantization study, reads of this cache from DRAM became the bottleneck, and the
default cache is FP32 [arxiv:2604.12374 §4.3]. Storing it in plain FP16 added
37 to 40% verbosity with BF16 or W8A8 weights, traced to round-to-nearest bias
accumulating through the recurrence. Stochastic rounding with 5 Philox rounds
brought the increase back to within about 2% of the FP32 baseline
[arxiv:2604.12374 §4.3] [arxiv:2604.12374 tab. 9]. The paper says the
stochastic rounding is supported in hardware on Blackwell GPUs, so it should not
be assumed on other hardware [arxiv:2604.12374 §4.3]. The FP8 checkpoint stores
the cache in FP16 while the Mamba GEMMs are FP8 [arxiv:2604.12374 tab. 6].

Author-reported throughput is 2.2 times that of GPT-OSS-120B and 7.5 times that
of Qwen3.5-122B at 8k input and 64k output [arxiv:2604.12374 §1] [arxiv:2604.12374
fig. 1]. The precisions and serving stacks differ per model, so the paper's
comparison is not like-for-like [arxiv:2604.12374 fig. 1].

Card: [Nemotron 3 Super: Open, Efficient Mixture-of-Experts Hybrid Mamba-Transformer Model for Agentic Reasoning](/papers/2604.12374).

### Bidirectional 3D scan for video (VideoMamba)

VideoMamba keeps the ViT layout. A 3D convolution with kernel and stride
(1, 16, 16) turns a clip into non-overlapping spatiotemporal tokens, and a stack
of blocks processes them with no downsampling [arxiv:2403.06977 §3.2]
[arxiv:2403.06977 eq. 7]. Each block runs a selective scan forward and a second
one on the reversed sequence, then adds the two outputs [arxiv:2403.06977 §3.1].
The authors state that the cost grows linearly with clip length
[arxiv:2403.06977 §3.2].

The token order is the main design choice. The paper compares several 3D scan
orders, including spatial-first, temporal-first and hybrid forms. On
Something-Something V2 the
spatial-first bidirectional scan scores 65.1%, against 62.4% for temporal-first
and 64.2% for the hybrid v2 order [arxiv:2403.06977 fig. 7]. Larger pure Mamba
models overfit in the authors' experiments. They add self-distillation from a
smaller trained VideoMamba, with an L2 loss on the final features added to the
classification loss [arxiv:2403.06977 §3.3] [arxiv:2403.06977 §4.1]
[arxiv:2403.06977 fig. 6]. For video self-supervision, the paper uses masked
alignment to a CLIP ViT-B teacher with 80% masking and aligns only the final
outputs [arxiv:2403.06977 §3.4] [arxiv:2403.06977 §4.2].

Author-reported results: 76.9% top-1 on ImageNet-1K at 224 px for the Ti size,
against 76.1% for Vim-Ti [arxiv:2403.06977 tab. 2]. Supervised Kinetics-400 at
64×384 px reaches 83.3%, against 83.0% for UniFormer-B at 32×224 px
[arxiv:2403.06977 tab. 3]. On Breakfast with end-to-end training, Ti reaches
94.3%, against 88.2% for ViS4mer on Swin-B features [arxiv:2403.06977 tab. 6].
The masked-pretraining K400 result at 8×224 px is 82.0%, below the 85.7% that
UMT-B reports in the same table [arxiv:2403.06977 tab. 3]. Memory and speed are
plotted in [arxiv:2403.06977 fig. 1]; the numbers are not restated here.

Card: [VideoMamba: State Space Model for Efficient Video Understanding](/papers/2403.06977).

### Sensor-token fusion inside a PPO locomotion policy (LocoMamba)

LocoMamba does not model an image or a clip as a sequence for its own sake. It
turns a quadruped's proprioceptive vector into one token through an MLP, and a
depth image into spatial tokens through a CNN. Both are projected to width 128
and concatenated, with the proprioceptive token first [arxiv:2508.11849 §3.1]
[arxiv:2508.11849 eq. 2–7] [arxiv:2508.11849 tab. 1]. Two stacked selective
state-space layers process these tokens. The output is pooled into one feature:
the proprioceptive token joined to the mean of the visual tokens
[arxiv:2508.11849 §3.2] [arxiv:2508.11849 eq. 12]. Separate MLP heads give the
Gaussian policy and the value estimate, and PPO trains the whole stack end to
end [arxiv:2508.11849 §3.3].

The visual token count is an explicit trade-off. On the training terrain, 32,
64 and 256 tokens give returns of 740.55, 762.34 and 797.46, but on rugged
terrain 256 tokens collide far more often (4166.64 against 470.27 for 64)
[arxiv:2508.11849 tab. 7]. The default of 64 is
labelled as the authors' choice in that table, and the text does not state it
[arxiv:2508.11849 tab. 7].

Author-reported results, PyBullet, 10 runs each, training on the Thin Obstacle
terrain: return 762.34 ± 156.53 against 511.96 ± 247.30 for a Transformer
proprio-vision baseline, and collisions per episode 72.53 against 141.83
[arxiv:2508.11849 tab. 4]. Zero-shot on unseen rugged terrain the return is
583.76 against 257.38, but the baseline's spread is larger than its mean
[arxiv:2508.11849 tab. 9]. On zero-shot dynamic obstacles the return is 749.09
against 685.49, and collisions are 38.47 against 121.63 [arxiv:2508.11849
tab. 10]. The authors' 48.9% return gain on the training terrain is computed
from these rows [arxiv:2508.11849 §5.2]. The paper reports no significance test.

The policy is also smaller: 300,070 parameters against 353,190, and 4.11 million
FLOPs per step against 5.01 million [arxiv:2508.11849 tab. 6]. Throughput
(104.68 against 98.87 samples per second) and memory were measured on a 4 GB
laptop GPU [arxiv:2508.11849 tab. 6] [arxiv:2508.11849 §4.1]. The text calls the FLOPs comparable
[arxiv:2508.11849 §5.3], which the table figures do not support as a strong
statement.

The state is carried from the end of one time step to the start of the next
[arxiv:2508.11849 §3.2]. The paper does not say whether it resets at episode
start, whether gradients pass through it during PPO updates, or how it is
recomputed for shuffled minibatches [arxiv:2508.11849 §4.4] [arxiv:2508.11849
alg. 1]. An implementation has to choose and document these.

Card: [LocoMamba: Vision-Driven Locomotion via End-to-End Deep Reinforcement Learning with Mamba](/papers/2508.11849).

### Mamba blocks over LiDAR voxels for 3D occupancy (OccMamba)

OccMamba predicts the semantic occupancy of a local 3D space from a LiDAR point
cloud [arxiv:2408.10618 §3]. It has a semantic branch, a geometric branch and a
BEV fusion network. The semantic branch voxelises the points, runs three stages
of sparse 3D convolution, and after each stage projects the voxels to a
bird's-eye-view (BEV) grid and applies a Mamba block there [arxiv:2408.10618
§3.1]. The geometric branch runs dense 3D convolutions with a Mamba block over
the voxels after each stage, then flattens height into channels [arxiv:2408.10618
§3.1]. A BEV U-Net fuses the scales of both branches [arxiv:2408.10618 §3.1].
The paper's linear-cost claim covers the Mamba layers, not the whole network
[arxiv:2408.10618 §3.1].

The paper says Mamba's parameters depend on the input [arxiv:2408.10618 §2],
but its equations are the fixed-parameter form [arxiv:2408.10618 eq. 1]
[arxiv:2408.10618 eq. 4]. The released code uses the selective `mamba_ssm`
module with state size 16, convolution width 4 and expansion 2
[code: networks/completion.py#L17-L22]. The code flattens the 3D voxels in
row-major order before the scan, and the paper gives no scan order
[code: networks/completion.py#L31-L33]. An implementation has to choose both.

Author-reported on the SemanticKITTI hidden test set, OccMamba reaches 59.9 IoU
and 25.0 mIoU at 22.1 FPS. The baselines are Co-Occ at 56.6 IoU and 1.1 FPS, and
SSC-RS at 59.7 IoU and 16.7 FPS [arxiv:2408.10618 tab. 2]. On the validation
set it has 23.8 M parameters and 505.1 GFLOPs, against 149.6 M and 501.8 GFLOPs
for MonoScene. Its per-batch training memory is 3.5 GB against 20.3 GB
[arxiv:2408.10618 tab. 3]. The saving is in parameters and memory, not in
compute. Removing the Geo-Mamba blocks lowers validation mIoU from 25.2 to 24.7,
and removing the Sem-Mamba blocks lowers it to 24.1 [arxiv:2408.10618 tab. 4].

OMEGA pairs OccMamba with AGR-Planner, which is not a state-space model. It
optimises a B-spline trajectory from a kinodynamic A* guide
[arxiv:2408.10618 §4]. In simulation, with the same planner, the authors report
98% planning success with OccMamba against 95% with SCONet
[arxiv:2408.10618 tab. 5]. That comparison isolates the perception network only.
Card: [OMEGA: Efficient Occlusion-Aware Navigation for Air-Ground Robot in Dynamic Environments via State Space Model](/papers/2408.10618).

### Matrix memory with exponential gating (xLSTM, not an SSM)

xLSTM extends the LSTM with exponential input and forget gates, a normaliser
state and a stabiliser state [arxiv:2405.04517 §2.2]. Its mLSTM cell has a
d × d matrix memory `C`, updated by adding the outer product of a value and a
key, and read out with a query [arxiv:2405.04517 §2.3]. The cell has no
hidden-to-hidden link, so it can be computed in parallel over the sequence
[arxiv:2405.04517 §2.3]. Its sLSTM cell keeps a scalar memory with recurrent
mixing inside each head, and the paper says it is not parallelisable
[arxiv:2405.04517 §2.2] [arxiv:2405.04517 §5 (i)].

The state does not grow with length, but the default training path does. The
parallel backend builds a T × T matrix per head [code: xlstm/blocks/mlstm/backends.py#L43-L88],
while recurrent decoding keeps only the state [code: xlstm/blocks/mlstm/backends.py#L117-L146].
The paper's own CUDA mLSTM kernel is about four times slower than FlashAttention
or Mamba's scan [arxiv:2405.04517 §5 (ii)].

Author-reported results, on SlimPajama validation perplexity: at 15B tokens,
xLSTM[1:0] reaches 13.43 against 13.70 for Mamba and 14.25 for Llama
[arxiv:2405.04517 tab. 1]. At 300B tokens and 1.3B parameters it reaches 8.89
against 9.14 for Mamba and 9.44 for Llama [arxiv:2405.04517 tab. 3]. The
exponential gates need a stabiliser to avoid overflow, and the paper's gate
forms are not all the ones the released code runs [arxiv:2405.04517 §2.2]
[code: xlstm/blocks/mlstm/backends.py#L42].

Card: [xLSTM: Extended Long Short-Term Memory](/papers/2405.04517).

## When to use which

The variants answer different questions, so choose by task first.

| Situation | Use | Why |
|---|---|---|
| Discrete tokens (text, DNA) where input-dependent selection and a fused kernel matter | Selective SSM (Mamba-1) | Selective Copying 99.8% against 18.3% for S4 [arxiv:2312.00752 §4.1]. Zero-shot average 59.7 at 1.4B against 55.2 for Pythia-1.4B [arxiv:2312.00752 §4.2.2]. Use selection for text and DNA, not for raw audio [arxiv:2312.00752 app. E.4.1]. |
| Long-range sequence classification, or irregularly sampled signals, where parameters should not depend on the content | Diagonal MIMO layer (S5) | LRA average 87.46% against 86.09% for S4-LegS [arxiv:2208.04933 tab. 1]. 8 kHz zero-shot speech 94.53% against 91.32% [arxiv:2208.04933 tab. 2]. Its results are against S4 and CRU, not Mamba [arxiv:2208.04933 Lineage]. |
| Image restoration (SR, denoising) where you want a global receptive field at SwinIR-like cost | 2D selective scan backbone (MambaIR) | Author-reported gains over SwinIR on SR and Gaussian denoising [arxiv:2402.15648 tab. 3] [arxiv:2402.15648 tab. 5]. GPU memory grows roughly like SwinIR's as the input grows, far below full attention; no numbers are given [arxiv:2402.15648 §4.3] [arxiv:2402.15648 fig. 5]. |
| Real denoising where the last few tenths of a dB matter | Restormer or MambaIR, by dataset | On SIDD, Restormer scores 40.02 dB against 39.89 dB for MambaIR. On DND, MambaIR scores 40.04 dB against 40.03 dB [arxiv:2402.15648 tab. 6]. Both gaps are under 0.2 dB and come from the authors' own tables. |
| Lightweight SR where MACs are the budget | Check both models' MACs before picking | At every scale, MambaIR-light reports more MACs than SwinIR-light (e.g. 167.1G against 122.2G at ×2) for a similar parameter count [arxiv:2402.15648 tab. 4]. |
| Image classification or dense prediction, where a Vim- or VMamba-style backbone is the base and 2D locality matters | Windowed scan (LocalMamba) | Author-reported +3.1 over Vim-Ti at 1.5G FLOPs and +0.5 over VMamba-T [arxiv:2403.09338 tab. 2]. The direction search needs a supernet holding all eight candidates per block, reported at 28 GB for 20 blocks [arxiv:2403.09338 §4.2]. The fixed-direction configs in the code skip the search [code: classification/lib/models/local_vim.py#L577-L598]. |
| Image classification or dense prediction, with throughput as a constraint | Hybrid backbone (MambaVision) | At Tiny size it reports higher throughput than ConvNeXt-T and Swin-T with higher top-1 [arxiv:2407.08083 tab. 1]. Throughput is measured on an A100 at batch 128 and depends on the scan kernel [arxiv:2407.08083 tab. 1]. |
| Maximum ImageNet accuracy at the largest size | MambaVision-L2 or a transformer model, by budget | L2 reports 85.3% at 1021 img/s; MaxViT-L reports 85.1% at 376 img/s in the same table [arxiv:2407.08083 tab. 1]. |
| Video classification or recognition on long clips, where attention cost is the constraint | Bidirectional 3D scan (VideoMamba) | Author-reported 65.1% with the spatial-first scan against 62.4% for temporal-first on SSv2 [arxiv:2403.06977 fig. 7]. Breakfast end-to-end Ti at 94.3% against 88.2% for ViS4mer [arxiv:2403.06977 tab. 6]. Short-clip K400 results are close to attention baselines, not clearly above them [arxiv:2403.06977 tab. 3]. |
| Language model training where GPU throughput is the bottleneck and decoding should keep a fixed-size state | SSD / Mamba-2 block | Author-reported 2 to 8 times faster than Mamba's fused scan at state size 64 [arxiv:2405.21060 fig. 10]. Zero-shot averages match or beat Mamba-1 at the same size on the paper's seven tasks [arxiv:2405.21060 tab. 1]. Results are for models up to 2.7B trained on the Pile [arxiv:2405.21060 §9.2]. |
| Language model that must recall exact details from far back in the context | Hybrid: Mamba-2 with a few attention layers | Six attention layers in a 2.7B model improve Pile perplexity over pure Mamba-2 and Transformer++ [arxiv:2405.21060 tab. 3]. At 350M, about 10% attention layers is reported as best, and their exact placement as not critical when spread out [arxiv:2405.21060 tab. 2] [arxiv:2405.21060 §9.2.3]. A 120B-scale MoE with Mamba-2 blocks and few attention layers is the Nemotron 3 Super design [arxiv:2604.12374 §2.1.3]. |
| Serving a large MoE model where decode memory traffic matters | Hybrid Mamba-2 and MoE (Nemotron 3 Super) | Author-reported 2.2 times and 7.5 times the throughput of two baselines at 8k/64k [arxiv:2604.12374 §1]. Keep the SSM cache at FP32, or use stochastic rounding if it is FP16; plain FP16 raised verbosity by 37 to 40% [arxiv:2604.12374 tab. 9]. |
| Language model where exponential gating and a matrix memory are wanted, and training memory for a T × T form is affordable | xLSTM (mLSTM blocks) | Author-reported 13.43 against 13.70 for Mamba at 15B tokens [arxiv:2405.04517 tab. 1]. The default parallel backend is quadratic in length for training [code: xlstm/blocks/mlstm/backends.py#L43-L88]. Its CUDA kernel is about four times slower than FlashAttention or Mamba's scan [arxiv:2405.04517 §5 (ii)]. |
| Per-channel or non-scalar state transition is needed | Not SSD | SSD covers only a scalar decay per head, and the paper's results do not show a per-channel SSM can use the same algorithm [arxiv:2405.21060 §5] [arxiv:2405.21060 §7.2]. S5's diagonal state is also not scalar, so SSD does not apply to it. |
| LiDAR 3D semantic occupancy on an onboard computer, where parameter count and memory matter more than FLOPs | Mamba blocks in a BEV-fused occupancy network (OccMamba) | Author-reported 22.1 FPS, against 16.7 for SSC-RS and 1.1 for Co-Occ, at 59.9 IoU on the hidden test set [arxiv:2408.10618 tab. 2]. Against MonoScene it has 23.8 M parameters against 149.6 M, but about the same GFLOPs (505.1 G against 501.8 G) [arxiv:2408.10618 tab. 3]. The FPS hardware is not stated [arxiv:2408.10618 tab. 2], and the TensorRT deployment code is not released [arxiv:2408.10618 §5.1]. |
| Robot locomotion policy that fuses proprioception and depth, where a Transformer fusion's cost in tokens is the constraint | Selective SSM fusion (LocoMamba) | Author-reported in simulation only: return 762.34 against 511.96 for a Transformer baseline on the training terrain [arxiv:2508.11849 tab. 4]. Zero-shot gains on rugged and dynamic terrain have overlapping spreads [arxiv:2508.11849 tab. 9] [arxiv:2508.11849 tab. 10]. No hardware tests were run [arxiv:2508.11849 §6], and the code release has no training code [code: README.md#L1-L3]. |
| Pure PyTorch stack, no CUDA kernel build | Partly covered | Both image models import `mamba_ssm`'s fused selective scan [code: basicsr/archs/mambair_arch.py#L11] [code: mambavision/models/mamba_vision.py#L26]. The Mamba-2 repository includes a minimal PyTorch SSD layer [code: mamba_ssm/modules/ssd_minimal.py#L53-L74]. The Mamba-1 reference scan is a Python loop meant for testing, not speed [code: mamba_ssm/ops/selective_scan_interface.py#L174-L175]. None of the papers benchmarks a pure-PyTorch port. |
| Commercial product that reuses the official code | Check the licence first | The MambaIR repository is Apache-2.0 [code: LICENSE]. The MambaVision repository is non-commercial, and its pretrained weights are non-commercial too [code: LICENSE] [code: README.md]. Implement MambaVision from the paper rather than copying its code. The Mamba-2 repository is Apache-2.0 [code: LICENSE]. The Mamba-1 and S5 cards record their code licences in `code_license`. |

## Implementation sketch

Language-agnostic pseudocode of the common core. The papers' own equations
are not always implementable as printed, so take the scan from an existing
kernel rather than from the equations [arxiv:2402.15648 eq. 2]
[code: basicsr/archs/mambair_arch.py#L356-L362]. This sketch is the plain,
unchunked recurrence. For scalar-decay SSMs the chunked form in the Mamba-2
variant above is usually faster on GPUs [arxiv:2405.21060 §6]. For a diagonal
layer such as S5, the same recurrence can be computed as a parallel scan over
pairs `(a, b)` with an associative operator [arxiv:2208.04933 app. H].

```pseudocode
# Discrete recurrence over a sequence x of length L  [arxiv:2402.15648 eq. 3]
def ssm_scan(x, A_bar, B_bar, C, D):
    # hidden state has fixed size N, whatever L is
    h = zeros(N)
    y = []
    for x_k in x:
        # update memory once per step (B_bar, C, step size depend on x in Mamba)
        h = A_bar @ h + B_bar * x_k
        # read out, plus direct skip through D
        y.append(C @ h + D * x_k)
    return y

# 2D selective scan over an image feature map  [arxiv:2402.15648 §3.5]
def selective_scan_2d(feature):           # feature: (H, W, D)
    # four orders: rows, columns, and both reversed
    # [code: basicsr/archs/mambair_arch.py#L343-L344]
    rows = flatten_row_major(feature)
    cols = flatten_column_major(feature)
    seqs = [rows, cols, reverse(rows), reverse(cols)]
    # each direction has its own parameters
    outs = [ssm_scan_fused(s, params[i]) for i, s in enumerate(seqs)]
    # undo the flips and transposes, then sum the four
    return sum(realign(o) for o in outs)
```

Notes for the hybrid backbone:

- **Placement.** Use Mamba-style mixers in the first half of the layers of the
  later stages and attention in the second half, as the ablation favours
  [arxiv:2407.08083 tab. 5].
- **Windows and padding.** At 224 input the last two stages fit in one window
  each, so attention and the scan see the whole map. When a feature map is not
  a multiple of the window size, the official code pads with zeros and does not
  mask the padding, so the scan sees padded tokens too
  [code: mambavision/models/mamba_vision.py#L606-L620].
- **Mixer.** Follow the equation for the two branches and the concatenation
  [arxiv:2407.08083 eq. 7]. The paper's listing of the mixer is not runnable as
  written [arxiv:2407.08083 alg. 1].

## Contradictions

No cross-paper disagreement is known on the same task. The papers evaluate
different tasks, so their numbers do not compete directly. One tension is worth
noting: Mamba-1 says selection hurts raw audio [arxiv:2312.00752 app. E.4.1],
while S5 reports fixed-parameter results on 8 kHz speech [arxiv:2208.04933 §6.2].
They are different models on different setups, so this page does not treat it as
a conflict. Within each paper, the text, the tables or the code disagree on some
points. Both sides are given here; this page does not resolve them.

- **VideoMamba, distillation warm-up.** The text gives 5 warm-up epochs for
  the M student, the ImageNet table 30 for M, and the distillation script 20
  [arxiv:2403.06977 §4.1] [arxiv:2403.06977 tab. XI]
  [code: videomamba/image_sm/exp_distill/videomamba_middle/run224.sh#L24].
- **Mamba-1, discretisation.** The paper's eq. 4 gives a ZOH factor for B̄. The
  released code uses Δ·B·u for the input term, so the two agree only to first
  order in Δ [arxiv:2312.00752 eq. 4]
  [code: mamba_ssm/ops/selective_scan_interface.py#L162-L164].
- **Mamba-1, Δ initialisation.** The paper samples Δ uniformly in the range
  0.001 to 0.1 [arxiv:2312.00752 §3.6]. The code samples uniformly in log Δ over
  the same range [code: mamba_ssm/modules/mamba_simple.py#L92-L97].
- **LocoMamba, safety penalties.** The introduction says safety is enforced by
  penalties for collisions and falls [arxiv:2508.11849 §1]. The reward has no
  collision or fall term; falls and unrecoverable collisions only end the
  episode [arxiv:2508.11849 eq. 21] [arxiv:2508.11849 eq. 24].
- **LocoMamba, depth frames.** Section 3.1 says the four depth frames are
  aggregated by the backbone. Section 4.2 stacks them as one observation
  [arxiv:2508.11849 §3.1] [arxiv:2508.11849 §4.2].
- **LocoMamba, efficiency.** Section 5.3 calls the policy FLOPs comparable.
  Table 6 gives 4.11 million against 5.01 million per step, about 18% fewer
  [arxiv:2508.11849 §5.3] [arxiv:2508.11849 tab. 6].
- **S5, readout factor.** The code returns twice the real part of the readout
  when conjugate symmetry halves the state. The paper states only that half the
  eigenvalues are used [arxiv:2208.04933 §3.2]
  [code: s5/ssm.py#L85-L86].
- **S5, learning rates.** The table gives LR 0.005 for LRA-Image, and the code
  script gives 0.0045 [arxiv:2208.04933 app. G.2]
  [code: bin/run_experiments/run_lra_cifar.sh#L2-L3].
- **MambaIR, equation vs code.** The printed discretisation in eq. 2 is
  inconsistent (B̄ uses exp(A) while Ā uses exp(ΔA)), and the code does not
  implement it [arxiv:2402.15648 eq. 2] [code: basicsr/archs/mambair_arch.py#L356-L362].
- **MambaIR, scan order.** The paper describes four corner-to-corner scans
  [arxiv:2402.15648 §3.5]. The code scans row-major, column-major and their
  reverses [code: basicsr/archs/mambair_arch.py#L343-L344].
- **OccMamba, Mamba form.** Section 2 says Mamba's parameters depend on the
  input, but the equations in section 3.1 show fixed parameters
  [arxiv:2408.10618 §2] [arxiv:2408.10618 eq. 1]. The code uses the selective
  module [code: networks/completion.py#L4]. This page follows the code's form
  when implementation detail is needed, and the paper's text for the claims.
- **LocalMamba, LocalVim gain.** The introduction and abstract give +3.1 for
  LocalVim-T over Vim-Ti. The results text gives +2.7 [arxiv:2403.09338 §5.1].
  Table 2 gives 76.2 against 73.1, which is +3.1 [arxiv:2403.09338 tab. 2].
  The +2.7 matches the no-search LocalVim-T* (75.8 against 73.1)
  [arxiv:2403.09338 tab. 5].
- **LocalMamba, token attention.** The paper describes a channel branch and a
  token (spatial) branch in SCAttn [arxiv:2403.09338 §4.1]
  [arxiv:2403.09338 fig. 3b]. The code implements only the channel branch; the
  spatial gate is commented out [code: classification/lib/models/mamba/multi_mamba.py#L156-L161].
- **MambaVision, ablation gain.** The text gives a +0.9 mIoU gain from
  concatenation [arxiv:2407.08083 §5.3]. Its Table 4 gives 46.0 against 45.7, a
  gain of +0.3 [arxiv:2407.08083 tab. 4].
- **MambaVision, compute saving.** The text says MambaVision-B uses 56% fewer
  GFLOPs than MaxViT-B [arxiv:2407.08083 §5.1]. Table 1 gives 15.0 against 23.4
  GFLOPs, about 36% fewer [arxiv:2407.08083 tab. 1].
- **MambaVision, appendix vs code.** The appendix's architecture table lists
  stage widths and block counts that do not match the code; the code is the
  reference for values [arxiv:2407.08083 tab. S.2].
- **SSD, chunk length.** The paper's listing defaults to a chunk length of 64
  [arxiv:2405.21060 §6, listing 1]. The reference Mamba-2 layer defaults to 256
  [code: mamba_ssm/modules/mamba2_simple.py#L44]. The paper gives no chunk length
  for its own experiments.
- **xLSTM, normaliser threshold.** The main text divides by max(|n·q|, 1)
  [arxiv:2405.04517 §2.3]. The code divides by max(|n·q|, exp(−m)) plus a
  small epsilon, and the two agree only when the stabiliser is zero
  [code: xlstm/blocks/mlstm/backends.py#L83-L85].
- **xLSTM, output gate.** The paper uses a sigmoid of a linear map of the
  input [arxiv:2405.04517 §2.3]. The code uses SiLU on half of the up-projection,
  and adds a skip connection and group norm the paper shows only in its block
  figure [code: xlstm/blocks/mlstm/layer.py#L105-L106]
  [arxiv:2405.04517 app. A.4].
- **SSD, inference cost.** Theorem 6.1 gives `O(TN)` inference FLOPs
  [arxiv:2405.21060 §6, theorem 6.1]. The cost table gives `O(N²)` per decoding
  step [arxiv:2405.21060 §6.3]. The per-step figure is the one that applies to a
  recurrent decode with a state of size `P × N`.

## Papers

- [Mamba: Linear-Time Sequence Modeling with Selective State Spaces](/papers/2312.00752): input-dependent step size, B and C with a fused parallel scan, and a single attention-free block. Author-reported results only.
- [Simplified State Space Layers for Sequence Modeling](/papers/2208.04933): S5, a diagonal MIMO SSM with a parallel scan and HiPPO-N initialisation, for long-range and irregularly sampled tasks. Author-reported results only.
- [MambaIR: A Simple Baseline for Image Restoration with State-Space Model](/papers/2402.15648): 2D four-direction selective scan inside a residual block for image restoration. Author-reported results only.
- [MambaVision: A Hybrid Mamba-Transformer Vision Backbone](/papers/2407.08083): hybrid backbone with a convolutional branch in the Mamba mixer and attention in the later layers, for classification and dense prediction. Author-reported results only.
- [LocalMamba: Visual State Space Model with Windowed Selective Scan](/papers/2403.09338): windowed local scan alongside global scans, with a per-layer search over eight scan directions for Vim- and VMamba-style backbones. Author-reported results only.
- [VideoMamba: State Space Model for Efficient Video Understanding](/papers/2403.06977): bidirectional Mamba blocks over 3D video tokens in a ViT-style stack, with self-distillation for scaling and masked alignment pretraining. Author-reported results only.
- [Transformers are SSMs](/papers/2405.21060): scalar-decay SSMs as masked attention, the chunked SSD algorithm and the Mamba-2 block, with language-model results. Author-reported results only.
- [LocoMamba: Vision-Driven Locomotion via End-to-End Deep Reinforcement Learning with Mamba](/papers/2508.11849): two selective SSM layers fuse proprioceptive and depth tokens inside a PPO quadruped policy, in simulation only. Author-reported results only.
- [Nemotron 3 Super](/papers/2604.12374): hybrid Mamba-2 and attention MoE language model, with the SSM cache precision study. Author-reported results only.
- [OMEGA: Efficient Occlusion-Aware Navigation for Air-Ground Robot in Dynamic Environments via State Space Model](/papers/2408.10618): Mamba blocks in the semantic and geometric branches of a LiDAR occupancy network (OccMamba), with a planner that is not state-space. Author-reported results only.
- [xLSTM: Extended Long Short-Term Memory](/papers/2405.04517): exponential gating, scalar sLSTM and matrix-memory mLSTM blocks; a recurrent comparator, not an SSM. Author-reported results only.
