---
title: Bidirectional Selective SSM Layers
url: https://www.emergentmind.com/topics/bidirectional-selective-ssm-layers
type: topic
---

# Bidirectional Selective SSM Layers

Bidirectional Selective State Space Model (SSM) layers constitute a recent class of neural sequence modeling blocks that achieve efficient, context-rich feature extraction by integrating linear-complexity state space recurrences with bidirectional (forward and reverse) processing, and—crucially—by making state transitions input-selective and/or spatially structured. These layers generalize unidirectional SSMs, such as Mamba, to bidirectional, context-aggregating modules capable of replacing self-attention in domains including vision, language, point clouds, speech, and graphs, while maintaining strict $O(L)$ sequence scaling and achieving state-of-the-art results across tasks. The following sections present a rigorous overview of mathematical definitions, architectural instantiations, bidirectionality mechanisms, complexity profiles, and empirical impacts as seen in recent literature.

## 1. Mathematical Foundation of Selective SSMs

At their core, selective SSM layers discretize continuous-time linear state-space models:
\[
\dot h(t) = A h(t) + B u(t), \qquad y(t) = C h(t) + D u(t)
\]
where $h(t) \in \mathbb{C}^N$ is the hidden state, $u(t)$ is the input, with $A, B, C, D$ learned or parameterized matrices. Discretizing using a step size $\Delta$ yields
\[
h_k = \overline{A} h_{k-1} + \overline{B} u_{k-1}, \qquad y_k = C h_k + D u_k
\]
with $\overline{A} = e^{A \Delta}$, $\overline{B} = \int_0^\Delta e^{A \tau} B d\tau$. The defining innovation of Mamba and successors is *selectivity*: the SSM parameters ($\overline{B}_k, C_k, D_k$) become functions of each token embedding, typically realized via learned projections or small neural networks. Thus, each time step can adapt memory updates and outputs to local content [2408.03540, 2411.06968, 2511.07823, 2403.18257, 2402.08678].

## 2. Achieving Bidirectionality

Bidirectionality is realized by applying the SSM scan both in the canonical and reverse order over the token sequence. For a sequence $x_{1:L}$:
\[
y^{\rightarrow}_{1:L} = \mathrm{SSM}(x_{1:L}), \qquad y^{\leftarrow}_{1:L} = \mathrm{reverse}(\mathrm{SSM}(\mathrm{reverse}(x_{1:L})))
\]
with shared SSM parameters for both passes. Outputs are fused, typically by elementwise addition, concatenation, or residual summation:
\[
z_i = y^{\rightarrow}_i + y^{\leftarrow}_i,\quad\forall\,i\in\{1,\dots,L\}
\]
This gives each position access to *both* past and future context, substantially improving long-range modeling (e.g., for 3D pose, speech, point cloud geometry, graph motifs). In some cases, such as MADEON for ASR, only a prefix segment (e.g., speech tokens) receives bidirectional SSM processing [2411.06968].

Specialized fusions arise, e.g., the “chainedMamba” of CloudMamba, where the backward scan is applied to the *output* of the forward scan (i.e., backward on high-level features), increasing context mixing while preserving causality in each direction [2511.07823].

## 3. Structured and Selective Gating Mechanisms

Selectivity is achieved by making the SSM's state transitions (and optionally the state update gates) input-dependent. For each token $x_k$, selection masks or parameters such as $S_k, U_k = \sigma(W x_k + b)$ modulate the recurrence:
\[
h_k = (\bar{A} \odot \mathrm{diag}(S_k)) h_{k-1} + (\bar{B} \odot \mathrm{diag}(U_k)) x_k
\]
as used in e.g., HSIDMamba [2404.09697]. Analogously, pointwise gates (sigmoid-activated) modulate contributions of each directional output (forward/backward) or of individual state components, allowing the layer to suppress or amplify information flow depending on spatial, spectral, or semantic context [2403.18257, 2406.06069]. In bidirectional networks for graphs and speech, gating is often coupled with nonlinearities (e.g., SiLU or softplus) and small MLPs.

In event-based eye tracking (MambaPupil), the time-varying selection mechanism is integrated into input-adaptive SSM parameter construction, leading to context-dependent gating and significantly improved stability for abrupt or ambiguous events [2404.12083].

## 4. Architectural Design: Spatial, Temporal, and Domain-Specific Structure

Modern bidirectional selective SSM blocks often integrate both global and local context, for instance:

- **Global-local splits**: In PoseMamba [2408.03540], bidirectional SSMs model joint tokens both in global (skeleton-wide) and local (limb-centric, reordered geometrically) scan orders per frame. The local scan uses skeleton-driven reordering (e.g., spine$\to$left arm$\to$\ldots) to enforce anatomical adjacency, leading to enhanced limb-wise correlation modeling.

- **Dual-path and multi-axis fusion**: CloudMamba creates three sequences per axis (X/Y/Z) via sorting, runs chained bidirectional SSM on each, and merges the features, capturing rich 3D geometry without causing order confusion—even in unordered point clouds [2511.07823].

- **Temporal-spatial stacking**: Dual-path Mamba for speech separation alternates bidirectional SSMs over intra-chunk (local) and inter-chunk (global) axes, drastically improving separation performance under linear cost [2403.18257].

- **Unique domain conditioning**: MADEON reverses and processes only speech tokens bidirectionally within the decoder, leaving text prefix strictly causal [2411.06968]. In HSIDMamba, multiple scanning directions (including diagonal and corner-to-corner) are used per spectral block, extending bidirectional context to eight orientations in denoising [2404.09697].

## 5. Complexity Analysis

A primary advantage of bidirectional selective SSMs is the preservation of strict $O(L d)$ time and space complexity per sequence (where $L$=sequence length, $d$=hidden size), even after introducing bidirectionality. This is in stark contrast to attention-based layers, which scale as $O(L^2d)$ in both compute and memory. The extra cost for bidirectionality is a constant factor—parallel or sequential forward/backward SSM scans. More elaborate designs (e.g., chained bidirectional or multi-path expansions) remain $O(Ld)$, though with increased constant scaling [2408.03540, 2511.07823, 2403.18257, 2406.06069].

## 6. Empirical Findings and Ablations

Multiple datasets and tasks demonstrate substantial accuracy and efficiency improvements due to bidirectional selective SSMs.

- **3D Pose Estimation (PoseMamba)**: Adding the local branch to global bidirectional SSM yields a 0.6 mm MPJPE absolute gain, for a total ≈1.2 mm improvement over unidirectional SSM [2408.03540].
- **Point Cloud Analysis**: ChainedMamba (bidirectional chained forward/backward) yields a +0.96% OA gain (93.65% $\to$ 92.69%) over parallel bidirectional, at no extra complexity [2511.07823]. In PointABM, bidirectional SSM layers increase accuracy by 1–1.6 pp across benchmarks [2406.06069].
- **Speech and Speech Separation**: MADEON achieves ~0.5% WER improvement from bidirectional context (LibriSpeech 100h), and on larger corpora matches or surpasses Transformer decoders with lower GPU memory [2411.06968]. Dual-path Mamba outperforms attention- and RNN-based models at a fraction of their cost [2403.18257].
- **Event-based Eye Tracking**: Combining Bi-GRU and LTV-SSM (bidirectional SSM) reduces error from 2.77 px (ConvLSTM) to 2.35 px, with improved localization probability [2404.12083].
- **Hyperspectral Denoising**: Introduction of bidirectional scanning raises PSNR by 0.9–2.6 dB depending on the configuration [2404.09697].
- **Graphs**: The bidirectional selective SSM encoder is identified as the critical ingredient—ablations removing bidirectionality drop accuracy by 4–5 points on multiple datasets [2402.08678].

| Model/Paper                 | Task/Domain                      | Empirical Gain of Bidirectional Layer         |
|-----------------------------|-----------------------------------|----------------------------------------------|
| PoseMamba [2408.03540]      | 3D pose estimation                | $-1.2$ mm MPJPE (vs. unidirectional)        |
| CloudMamba [2511.07823]     | Point cloud classification        | $+0.96\%$ OA (chain vs parallel)            |
| MADEON [2411.06968]         | ASR (LibriSpeech)                 | $-0.5\%$ WER (vs. unidirectional)           |
| PointABM [2406.06069]       | Point cloud analysis              | $+1.1$–$1.6$ pp Acc. (vs. unidirectional)   |
| MambaPupil [2404.12083]     | Event eye tracking                | Error $2.35$ px vs $2.77$ (prior best)      |
| HSIDMamba [2404.09697]      | Hyperspectral denoising           | PSNR $+0.9$–$2.6$ dB                        |
| Graph Mamba [2402.08678]    | Graph node classification         | $-4$–$-5$ accuracy pts (if removed)         |

## 7. Domain-Specific Adaptations and Extensions

- **Spatial and Anatomical Ordering**: Reordering input tokens to follow structural priors (skeleton chains, geometric sorted axes, graph motifs) further enhances local context extraction. This is critical for domains with underlying spatial, topological, or anatomical structure [2408.03540, 2511.07823, 2402.08678].
- **Grouped Parameterization**: Grouped selective SSMs (GS6) tie parameters across axes/groups to reduce overfitting (notably in point clouds) [2511.07823].
- **Selective Domain Application**: Speech-specific adaptations (e.g., selective bidirectionality only for audio tokens) avoid causality violations in autoregressive decoding [2411.06968].

## References

- PoseMamba: Monocular 3D Human Pose Estimation with Bidirectional Global-Local Spatio-Temporal State Space Model [2408.03540]
- Mamba-based Decoder-Only Approach with Bidirectional Speech Modeling for Speech Recognition [2411.06968]
- CloudMamba: Grouped Selective State Spaces for Point Cloud Analysis [2511.07823]
- MambaPupil: Bidirectional Selective Recurrent model for Event-based Eye tracking [2404.12083]
- PointABM:Integrating Bidirectional State Space Model with Multi-Head Self-Attention for Point Cloud Analysis [2406.06069]
- Dual-path Mamba: Short and Long-term Bidirectional Selective Structured State Space Models for Speech Separation [2403.18257]
- Graph Mamba: Towards Learning on Graphs with State Space Models [2402.08678]
- HSIDMamba: Exploring Bidirectional State-Space Models for Hyperspectral Denoising [2404.09697]

Source: https://www.emergentmind.com/topics/bidirectional-selective-ssm-layers