Mamba and state space models vs transformers: where they help
THE QUESTION
When does a state space model's fixed-size memory beat a transformer's growing one: for an always-on agent, a fast live stream, or short texts on a phone?
Founder, Bodham LabsUpdated
The idea in one picture
How a transformer and a state space model remember
Token stream
- call
- the
- clinic
- about
- the
- report
- on
- Friday
Attention (transformer)
KV cache: one block kept for every token
State space model (Mamba, RWKV)
One state of fixed size, updated by every token
Hybrid (what our RAMU design proposed)
State space model
always-on loop
external memory
hard facts are written here
Transformer
called only for hard decisions
Step 4 of 4: HybridOur hybrid design: the state space model runs the always-on loop, hard facts go to external memory, and a transformer is called only for hard decisions.
What did we build?
- A GPU Mamba (S6) context model, running in a container on 11 Mar 2026.
- Before that, a component we called an "SSM" that was in fact a GRU PPO actor-critic exported to OpenVINO. We ran a 3-config tournament: 2×256, 1×512 and 3×128.
- A data integrity audit of the model's inputs.
- A documented next design, "Mamba-4": a Micro-Jamba hybrid with 24–36M parameters planned. It is not built. Its status reads "PRE-DEVELOPMENT (Phase 0)".
- The test bed was live market data streams, in paper mode only, with no real money.
What does the evidence show?
| WHAT | VALUE | SOURCE |
|---|---|---|
| Hidden state after 1,024 steps | about ±10¹⁵ | data integrity audit, Mar 2026 |
| GPU memory of the running S6 model | 396 MiB | container log, 11 Mar 2026 |
| Raw EMA input values (not normalised) | around 69,000 | data integrity audit, Mar 2026 |
| One "z-score" input | 86.74 | data integrity audit, Mar 2026 |
| How far it drowned out 14 other features | about 10¹³ | data integrity audit, Mar 2026 |
| Features that were always zero | 3 | data integrity audit, Mar 2026 |
| Earlier GRU hidden-state norm, n = 100 to 96,900 | constant at 1.3850 | model run log |
How did the work unfold?
Early 2026
A recurrent model we called an SSM
An early component labelled "SSM" was really a GRU actor-critic. Its hidden-state norm stayed at 1.3850 from step 100 to 96,900: the state was stuck, and the log showed it.
10 Mar 2026
A hybrid design for an always-on agent
A written trade-off for our RAMU agent: a state space model (Mamba or RWKV) runs the always-on loop, a transformer is called only for hard decisions, and hard facts go to external memory because an SSM's details fade.
10 Mar 2026
A Mamba encoder with an actor-critic head
A small PyTorch model: one Mamba block (d_model 128, d_state 64) feeding an actor-critic head. Code only; it was never trained, and we report no results from it.
11 Mar 2026
The first GPU run, and why it diverged
A Mamba (S6) model ran on live data streams in paper mode. Inputs were not normalised, and the hidden state reached about ±10¹⁵ within 1,024 steps.
Late Mar 2026
"Mamba-4": a staged design
Nine design phases for a 24–36M-parameter hybrid: a Micro-Jamba core, Hopfield-style recall, sleep-time consolidation, BitNet compression, an MoE overlay and safety gates. Status: pre-development.
12 Oct 2026
A shipped app says no
Our voice-memo app, Mementos (codename), considered SSMs to save memory and dropped them: a model's memory is mostly its size, and an SSM only saves memory on very long texts. Memos are short.
Where has it led us?
The model ran, but the inputs were not normalised. EMA values were around 69,000. The hidden state grew to about ±10¹⁵ over 1,024 steps and drowned out 14 other features. Three features were always zero.
Our earlier "SSM" was not an SSM at all. It was a GRU. Its hidden-state norm stayed at exactly 1.3850 from step 100 to step 96,900, which means the state was stuck. Reading the norm in the log is what showed us.
Neither failure tells us yet whether the model idea works. Both were found in the data and the logs. The lesson: check input ranges and the hidden-state norm before judging the model.
The next design adds shadow-mode gates. If the model underperforms in shadow mode for two weeks, we revisit the architecture and do not go live. It is a staged evaluation, not a result.
On a phone the question changed. A model's memory is mostly its weights, and an SSM's flat state saves memory only on very long texts. Voice memos are short, so our app dropped SSMs. The rule we keep: SSMs for long streams, not for short texts.
What is still open?
- With normalised inputs, does a small Mamba model beat a simple baseline on the same stream?
- Is a hybrid (some attention layers, some SSM layers, like Jamba) worth the extra complexity at 24–36M parameters?
- How long a context does a fast stream actually need?
NEXT STEP · NOT DONE YET
What would we do next?
Normalise every input, log the hidden-state norm from the first step, and re-run the S6 model against a simple baseline before building Mamba-4.
Have a problem that needs this kind of research?
Tell us about it