---
title: 'Mamba-2S: Minimal Linear-Attention Model'
url: https://www.emergentmind.com/topics/mamba-2s
type: topic
---

# Mamba-2S: Minimal Linear-Attention Model

Searching arXiv for the cited paper and closely related works mentioned in the supplied data.
Mamba-2S is a simplified variant of Mamba-2 that retains only the most fundamental components that empirically drive accuracy while removing architectural elements that add complexity without clear benefit. Introduced in "2Mamba2Furious: Linear in Complexity, Competitive in Accuracy" [2602.17363], it is positioned as a minimal linear-attention construction built around a strictly negative softplus-based A-mask, a lightweight input convolution on $Q$, $K$, and $V$, time discretization applied to values, output RMSNorm, and a causal selective state mechanism. Within the same work, Mamba-2S serves both as an ablated endpoint in its own right and as the base from which 2Mamba is derived.

## 1. Origin, scope, and defining objective

Mamba-2S is defined as a simplified variant of Mamba-2 that retains only the most fundamental and important components while discarding elements whose empirical contribution is negligible or negative. The stated objective is to identify which specific choices make Mamba-2 most accurate, then preserve those choices in a simpler model. In that sense, Mamba-2S is not merely a smaller implementation of Mamba-2; it is an ablation-derived re-specification of the architecture [2602.17363].

The simplification has a specific technical motivation. Linear attention transformers are described as a strong alternative to softmax attention because of efficiency, but linear attention tends to be less expressive and results in reduced accuracy compared to softmax attention. Mamba-2S is therefore designed as a more accurate linear-attention variant by isolating the components that most improve test loss. This suggests that the model should be understood less as a generic state-space simplification and more as a targeted answer to the accuracy deficit of linear attention.

Within the paper’s overall progression, Mamba-2S is the first-order formulation. It preserves the linear-in-$N$ recurrence and selective forgetting mechanism, then provides the structural basis for 2Mamba, which increases the order of the hidden state from $p=1$ to $p=2$.

## 2. Architectural simplification of Mamba-2

The defining simplifications from Mamba-2 to Mamba-2S are explicit and component-wise. The most consequential modification is the replacement of the original A-mask parametrization
$$
A=-\exp(A_{\log})\odot dt
$$
with the decoupled, strictly negative parameterization
$$
A=-\operatorname{softplus}(h\cdot W_A).
$$
The rationale given is that this enforces negativity for stability and decouples forgetting from $dt$ for greater flexibility; it is also described as the empirically most impactful ablation.

A lightweight input convolution on $Q$, $K$, and $V$ is retained, with kernel size $2$ and no activation. Its function is to improve inductive bias and accuracy with minimal overhead, and it is reported as the empirically second-most impactful component. Mamba-2S also keeps time discretization
$$
dt=\operatorname{softplus}(h\cdot W_{dt}),
$$
applied to values through
$$
V_{dt}=V\odot dt.
$$
The paper states that this gives a small additional gain at small scale, although it is later removed for larger models in 2Mamba for numeric stability.

Output normalization is handled by RMSNorm after attention rather than by softmax-like normalization on $QK$. The stated rationale is that this allows inner-product values to be signed, enabling a broader ablation space and avoiding constraints on the $QK$ image being strictly positive. By contrast, the multiplicative $Z$ gate, the additive $D$ residual, and the SiLU activations in the QKV convolution are removed. Their removal is justified by ablations showing negligible or negative gains and by the resulting reduction in architectural complexity [2602.17363].

A compact summary of the retained and removed components is as follows.

| Category | Components |
|---|---|
| Retained | Softplus A-mask, input convolution with window size 2 on $Q$, $K$, $V$, time discretization applied to $V$, output RMSNorm, causal mask |
| Removed or altered | Original A-log plus exp plus dt coupling for $A$, $Z$ gate, $D$ residual, SiLU in conv, specialized dt\_bias initialization |

The resulting model is explicitly described as using a minimal conv-only setup and learning $W_A$ and $W_{dt}$ directly.

## 3. State-space formulation and recurrent realization

Mamba-2S is presented from the state-space model perspective. The continuous-time SSM is written as
$$
\frac{d x(t)}{dt}=A x(t)+B u(t), \qquad y(t)=C x(t).
$$
In the Mamba family, $A$ is interpreted as a per-head forget or decay rate, while $B$ and $C$ play roles analogous to key, value, and query projections and their combinations. Under discretization with step $\Delta$, the dynamics become
$$
x_{t+1}=e^{A\Delta}x_t+\int_0^\Delta e^{A\tau}Bu_t\,d\tau=\bar{A}x_t+\bar{B}u_t,
$$
with
$$
y_t=Cx_t,\qquad \bar{A}=e^{A\Delta},\qquad \bar{B}=\int_0^\Delta e^{A\tau}B\,d\tau.
$$

Mamba-2S introduces per-head scalar decay $A_t\in\mathbb{R}^H$ at each position $t$, constrained to be strictly negative through
$$
A_t=-\operatorname{softplus}(h_t\cdot W_A).
$$
The softplus constraint is stated to enforce negativity and stability, while time variation across positions and heads enables selectivity. The discretization variable is
$$
dt_t=\operatorname{softplus}(h_t\cdot W_{dt}),
$$
which is strictly positive and is applied to values through
$$
V_{dt,t}=V_t\odot dt_t.
$$

The first-order attention form is
$$
y=(QK^T\odot A^M\odot M)\cdot V_{dt},
$$
where output RMSNorm is applied before projection to $W_{\text{out}}$. The semiseparable structure induced by $A^M$ yields an efficient $O(N)$ recurrent realization. Defining a recurrent state $H_t$,
$$
H_t=\gamma_t H_{t-1}+K_t\otimes (V_t\odot dt_t),\qquad \gamma_t=\exp(A_t),\qquad H_0=0,
$$
and the output is obtained by per-head contraction
$$
y_t=Q_t\cdot H_t.
$$
The paper states that this recurrence is algebraically equivalent to the masked attention
$$
y_t=\sum_{j\le t}(Q_tK_j^T)\exp(A^{CS}_t-A^{CS}_j)(V_j\odot dt_j).
$$

This formulation is central to the identity of Mamba-2S. It is simultaneously an attention-like model, because it is written in masked $QK^T$ form, and an SSM-like model, because it admits a scan recurrence with a bounded decay factor.

## 4. The A-mask and selective forgetting

The A-mask is the key mechanism of Mamba-2S. It is defined through
$$
A_t=-\operatorname{softplus}(h_t\cdot W_A),
$$
followed by a cumulative sum over time,
$$
A^{CS}_t=\sum_{\tau=1}^t A_\tau,
$$
and then the mask itself,
$$
A^M_{ij}=\exp(A^{CS}_i-A^{CS}_j),
$$
with the causal mask $M_{ij}=1[i\ge j]$. The effective attention weight is therefore
$$
(QK^T)_{ij}\cdot A^M_{ij}\cdot M_{ij}.
$$

The constraint $A_t<0$ implies
$$
\gamma_t=\exp(A_t)\in(0,1),
$$
which is used to guarantee stability via exponential forgetting. In the paper’s formulation, sparsity comes from the causal mask, while semiseparability comes from exponentials of differences of cumulative sums. This gives Mamba-2S a selective state mechanism in which past information is retained or attenuated through learned, head-wise, time-varying decay.

The work contrasts this A-mask with the original Mamba-2 choice, which couples decay to $dt$. The improved form is described as decoupled from $dt$, smoother to learn because of softplus curvature, and empirically better in test loss. On the FineWeb small-model ablation, the isolated A-mask comparison is reported as test loss $2.98$ versus $2.88$, and with convolution of width $2$ the comparison is $2.80$ versus $2.77$ [2602.17363].

A plausible implication is that the A-mask in Mamba-2S is doing more than imposing stable forgetting. By decoupling forgetting from value scaling, it separates temporal attenuation from discretization, which broadens the effective design space without changing the linear-in-sequence recurrence.

## 5. Complexity, hidden-state order, and relation to 2Mamba

As a first-order model, Mamba-2S corresponds to hidden-state order $p=1$. In the paper’s terminology, the order of the hidden state is the degree of polynomial features used to approximate softmax attention through a Taylor or Maclaurin expansion of $\exp(QK^T)$. Linear attention is $p=1$, whereas 2Mamba sets $p=2$ by squaring the $QK$ inner product. Mamba-2S therefore occupies the first-order endpoint of this hierarchy.

Its per-layer, per-head recurrence has time complexity $O(Nd^2)$, linear in sequence length $N$. The hidden-state memory is $O(d^2+3d)$ per head. By contrast, 2Mamba has time complexity
$$
O(Nmd), \qquad m=\frac{d(d+1)}{2},
$$
and per-head memory
$$
O\!\left(\frac{d(d+1)^2}{2}+3d\right),
$$
which is constant in $N$ but larger in the hidden feature dimension. Softmax attention is described as requiring $O(Nd)$ memory per head because of the KV cache, specifically $2Nd$ elements [2602.17363].

The paper gives a threshold comparison for $d=64$ per head:
$$
2Nd>\frac{d(d+1)^2}{2}+3d
\quad\Rightarrow\quad
N>\frac{(d+1)^2}{4}+\frac{3}{2},
$$
so that for $d=64$, $N\gtrsim 1058$. Beyond approximately $1$K context, 2Mamba is reported to be more memory efficient than softmax with comparable accuracy. Mamba-2S is not described as matching softmax as closely as 2Mamba, but it is described as outperforming vanilla linear attention by a large margin and approaching Mamba-2 and softmax.

This positioning is important for interpretation. Mamba-2S is the low-order, simpler, robust baseline; 2Mamba is the higher-order construction that uses the same A-mask foundation to close the remaining accuracy gap to softmax attention.

## 6. Empirical behavior, implementation, and limitations

The experimental setup replaces attention blocks in a Llama-2-like base architecture with Mamba-2 variants and evaluates next-token prediction on HuggingFace FineWeb (CC-MAIN-2024-51), with $0.1\%$ held out and context lengths $2048$, $4096$, and $8192$. Additional datasets are The Pile and SlimPajama. For the small model, the reported architecture is hidden size $1024$, MLP $2048$ with SiLU, $16$ heads with $d=64$, $20$ layers, and vocab $32$K; for the medium model, hidden size $1536$, MLP $3072$ with SiLU, $24$ heads with $d=64$, $27$ layers, and vocab $32$K. Optimization uses AdamW with $\beta_1=0.9$, $\beta_2=0.999$, learning rate $10^{-4}$, weight decay $0.01$, no grad clipping, warmup $10$K steps, total steps reported as $90$K/$100$K, and batch size $32$ [2602.17363].

The key FineWeb ablation results for the small model are:

| Variant | Test loss |
|---|---|
| Plain linear attention (output norm) | 3.13 |
| + Conv (w=2) | 2.93 |
| + Conv + original A-mask | 2.80 |
| + Conv + softplus A-mask | 2.77 |
| + Conv + softplus A + discretization | 2.76 |

The final row is identified as the Mamba-2S baseline. The paper further states that the $Z$ gate or $D$ residual do not improve further, and that the $Z$ gate slightly hurts. The softplus A-mask and input convolution are identified as the most impactful components, while value discretization gives a modest gain at small scale.

Implementation emphasizes fused Triton kernels for attention with the A-mask, associative scan or cumulative sum on $A$ to build $A^M$ efficiently, and chunking for long sequences. The provided pseudocode keeps the structure minimal:
- input projections via conv1d with kernel size $2$;
- decay and discretization through $A_t=-\operatorname{softplus}(h_t\cdot W_A)$ and $dt_t=\operatorname{softplus}(h_t\cdot W_{dt})$;
- recurrent update $H_t=\gamma_t\cdot H_{t-1}+K_t\otimes V_{dt,t}$;
- output $y_t=Q_t\cdot H_t$, followed by RMSNorm and projection.

The principal limitation attached to Mamba-2S is the role of time discretization. The paper states that $dt$ improves small-scale accuracy but can cause numerical instability for larger models under TF32; it stabilizes under FP32 at substantial cost, and is therefore removed in some 2Mamba runs. More generally, higher hidden-state order improves expressivity but increases per-token compute and hidden-state memory, so additional kernel engineering is required to realize speed gains.

In practical guidance, Mamba-2S is recommended when a minimal, robust improvement over vanilla linear attention is desired, specifically with strictly negative $A$, convolution, $dt$, and output RMSNorm, while preserving linear complexity. The same guidance describes it as suitable for moderate sequence lengths and small or medium models. This suggests that Mamba-2S is best viewed as the simplified and stable first-order member of the paper’s family: more accurate than naive linear attention, architecturally leaner than the original Mamba-2, and foundational for the higher-order 2Mamba construction.

Source: https://www.emergentmind.com/topics/mamba-2s