09 — State-space models and Mamba, intuitively¶
flowchart LR
X["each time step"] --> GATE{"input-dependent gate"}
GATE -->|sharp QRS| WRITE["write into memory"]
GATE -->|flat baseline| DECAY["decay, save compute"]
WRITE --> STATE["running summary\n(state)"]
DECAY --> STATE
STATE --> POOL["pool over time\nmean + max"]
POOL --> VOTE["5-logit vote"]
An SSM carries a compact running summary instead of rereading the whole window per step. Mamba's trick is selectivity: the gate opens for spikes, closes for silence — keep the QRS, forget the baseline.
| Model | Cost vs length | Memory | Fit for 360 Hz ECG |
|---|---|---|---|
| LSTM | linear, but slow steps | notebook, fussy | crawls on long windows |
| Transformer | length-squared | full attention | overkill, expensive |
| Mamba SSM | linear and fast | selective summary | keeps spikes, skips silence |
No math needed to proceed; ../research/literature.md holds the equations for later.
Next: 10-fusion-loss-thresholds.md