Mamba forecaster methodology for implicit behavioral decoding from next-step spike forecasts at population scale. A single sequence model trained only on next-step Poisson rate prediction produces predicted firing rates that decode animal behavior better than raw spike counts under matched temporal context. Enables closed-loop BCI without separate behavioral decoding networks.
Scanned 9/11/2026
Install to Claude Code
npx -y skills add hiyenwong/ai_collection --skill mamba-spike-behavioral-decoding --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Mamba Spike Behavioral Decoding?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/hiyenwong-mamba-spike-behavioral-decoding-ai-collection)More formats (shields.io, HTML) on the badges page.
---
name: mamba-spike-behavioral-decoding
description: >
Mamba forecaster methodology for implicit behavioral decoding from next-step
spike forecasts at population scale. A single sequence model trained only on
next-step Poisson rate prediction produces predicted firing rates that decode
animal behavior better than raw spike counts under matched temporal context.
Enables closed-loop BCI without separate behavioral decoding networks.
category: neuroscience
tags: [spike-forecasting, mamba, bci, neural-population, neuromorphic, behavioral-decoding, state-space-model]
related_skills:
- autoregressive-flow-matching-neural-dynamics
- neural-population-dynamics
- eeg-ieeg-bridge-bci
- mind2drive-eeg-driver-intention
activation_keywords:
- mamba forecaster
- spike forecast behavioral decoding
- implicit behavioral decoding
- neural population rate prediction
- closed-loop bci decoding
- poission rate forecasting bci
- next-step spike prediction
- neuropsychixels behavioral readout
---
# Mamba Spike-Based Behavioral Decoding
**Paper**: *Implicit Behavioral Decoding from Next-Step Spike Forecasts at Population Scale*
**Authors**: John R. Minnick, Jesus Gonzalez-Ferrer, Kamran Hussain, Jinghui Geng, Ash Robbins, Mohammed A. Mostajo-Radji, David Haussler, Jason Eshraghian, Mircea Teodorescu
**Institution**: UC Santa Cruz (ECE, Genomics Institute, Biomolecular Engineering)
**arXiv**: 2605.12999 (May 13, 2026)
**Category**: q-bio.NC, cs.LG
## Overview
Closed-loop brain-computer interfaces (BCIs) require two capabilities: forecasting neural population dynamics ahead of time, and decoding the subject's behavioral state. This paper demonstrates that a single Mamba sequence model, trained only to predict next-step population firing rates (Poisson NLL), implicitly encodes behavioral information in its predicted rates -- eliminating the need for a separate behavioral decoding network.
## Core Methodology
### Problem Formulation
Given a sliding window of H population spike-count vectors, predict the next time bin:
```
X_t = {x(t-H+1), ..., x(t)} -> lambda_hat(t+1) in R^M
```
- **M**: number of simultaneously recorded neurons (up to 1,998)
- **delta_t**: 50 ms bin width
- **H = 10** bins (500 ms context)
- Model outputs predicted firing rates via softplus activation
- Trained with **Poisson negative log-likelihood (NLL)** on spike counts only
- **Behavioral labels are NEVER used during training**
### Architecture
**Mamba (Selective State-Space Model)**:
- Selective SSM with causal recurrence and content-aware gating
- 1.95M parameters
- Multi-session training with per-sample channel masking (padded to M_max=1,998)
- Well-matched to spike-count autoregression on long session-length sequences
**Architecture Controls Tested**:
- Transformer (causal self-attention, 2.22M params)
- LRU (linear recurrent unit, 1.23M params)
- NDT2-style bidirectional masked-attention variant
### Key Discovery: Implicit Behavioral Decoding
The predicted firing rates from the forecaster serve as behaviorally informative compression of the recent population state. A lightweight per-session linear readout over these predicted rates:
1. **Decodes behavior WITHOUT any behavioral training** in the forecaster
2. **Outperforms matched-context raw spike count baselines** by +4-6 pp
3. Works across Transformer, LRU, and NDT2 architectures (not Mamba-specific)
**Mechanism**: The Poisson NLL training objective forces the model to integrate 500ms of population history into a smoothed rate estimate. Single-bin raw counts at 50ms are dominated by Poisson noise; matched-context summed raw counts ignore population structure. Mamba's predicted rate lies at the intersection -- same temporal context, plus cross-neuron dependency exploitation.
## Results
### Dataset
- **Steinmetz visual-discrimination benchmark**: 39 sessions, ~27,000 neurons, 1,994 held-out trials
- **IBL Repeated Site**: 66 sessions, ~63K neurons (cross-laboratory extension)
- 105 sessions total, 89,768 real channels across 42 Allen CCF regions
### Behavioral Decoding Performance
| Decoder | Response 3-class (trial vote) | Stim Side 3-class (trial vote) |
|---------|-------------------------------|-------------------------------|
| Linear / 1-bin raw | 72.1% | 49.8% |
| Linear / H=10 sum | 69.6% | 60.5% |
| Ridge / H=10 flat | 71.3% | 61.5% |
| **Mamba (3-seed)** | **75.7% ± 0.2** | **66.1% ± 0.6** |
| Chance | 33.3% | 33.3% |
- Mamba decodes mouse choice at **2.3x chance level**
- Mamba wins at trial vote by **+4-6 pp** on both response and stimulus side
- Architecture controls (Transformer, LRU) reproduce gains within ~1-3 pp
### Cross-Neuron Coupling Verification
Population shuffle test: shuffling each neuron's time series independently drops mean per-neuron r by **48.4%** (median 50.7%), with 38/39 sessions showing >25% degradation. Direct evidence that Mamba exploits cross-neuron temporal coupling, not single-neuron autocorrelation.
### Forecasting Accuracy
- Per-neuron Pearson r = 0.176 (modest due to Poisson noise at 50ms bins)
- Population-rate r = 0.783
- Population-cosine = 0.648
- DTW alignment reduces average error by 41% vs naive bin-to-bin
### Calibration Budget
- **100-150 trials** (~5-8 minutes) of session-start calibration brings per-session readout within 1-2 pp of asymptotic accuracy
- Response decoding asymptotes at ~120 trials; stimulus side at ~140
### Deployment Latency
- Single 50ms-bin Mamba forward pass: ≤6.4 ms per batch of 512 windows
- RTX 5000 Ada, M=1,240 neurons, 152 MB peak VRAM
- Per-session linear head: sub-millisecond
- Total: well within 50 ms bin budget
## Implementation Patterns
### Pipeline Architecture
```
Spike-sorted Neuropixels (M neurons, 50ms bins)
-> Window into X_t in R^(MxH) (H=10, 500ms context)
-> Mamba SSM: h_t = A_bar * h_{t-1} + B_bar * x_t, y_t = C * h_t
-> Predicted next-bin firing rates lambda_hat_{t+1} in R^M
-> Per-session multinomial LR: y_hat = softmax(W * lambda_hat + b)
-> Decoded: mouse response / stimulus side (3-class each)
```
### Training Configuration
- Poisson NLL loss on spike counts only
- AdamW with cosine LR + warmup, 50 epochs
- Per-session temporal 70/15/15% train/val/test split
- 20% trial-level holdout for behavioral evaluation
### Matched-Context Baselines
Three non-forecasting reference baselines for fair comparison:
1. **Linear / 1-bin**: Single 50ms count vector
2. **Linear / H=10 sum**: Sum past 10 bins, same M-dim features
3. **Ridge / H=10 flat**: Flatten past 10 bins (M*H ≈ 12,000 features), more capacity
## Deployment Considerations
### Closed-Loop BCI Pipeline
1. **Fixed forecaster**: Single Mamba checkpoint, trained once on combined substrate
2. **Per-session calibration**: 100-150 trials to fit linear readout
3. **Online operation**: 500ms history -> rate prediction -> class probabilities per bin
4. **Hardware**: Workstation-class external GPU (on-implant not claimed)
### Limitations
1. H=1 horizon; greedy rollout regresses to session mean over ~3-5 bins
2. 50ms bins miss <20ms dynamics relevant to some motor BCIs
3. Cross-laboratory extension is partial (stimulus side gain survives, response/contrast don't on IBL)
4. Per-session linear head does not transfer across sessions
5. Modest per-neuron r=0.18 at 50ms bins is the binding constraint
## Applications
1. **Closed-loop BCI**: Single model replaces separate forecasting + decoding networks
2. **Neural population analysis**: Rate predictions as behaviorally-informed latent space
3. **Neuromorphic computing**: Efficient SSM-based spike processing at Neuropixels scale
4. **Neuroscience research**: Cross-neuron coupling as computational substrate
## Comparison to Related Work
| Method | Behavioral Labels | Spike Prediction | Matched-Context Baseline |
|--------|-------------------|------------------|--------------------------|
| NEDS (Zhang 2025) | Yes (joint) | Yes (Poisson) | No |
| LFADS (Pandarinath 2018) | No | Smoothed rates | No |
| NDT2 (Ye 2023) | Yes (masked) | No | No |
| CEBRA (Schneider 2023) | Yes | No | No |
| **This Work** | **No** | **Yes (Poisson)** | **Yes (3 baselines)** |
## Key Equations
**Mamba SSM recurrence**:
```
h_t = A_bar * h_{t-1} + B_bar * x_t
y_t = C * h_t
lambda_hat = softplus(y_t)
Loss = -sum(x * log(lambda_hat) - lambda_hat) # Poisson NLL
```
**Biological decoding**:
```
y_hat = softmax(W * lambda_hat + b) # Per-session multinomial LR
```
## Pitfalls
1. **Matched-context is critical**: Comparing against baselines with same temporal context window is essential to isolate the forecasting contribution from raw temporal integration
2. **Per-neuron r is misleading**: Single-neuron Pearson r at 50ms bins underestimates fidelity due to Poisson noise; population-level metrics (cosine similarity, DTW) are more informative
3. **Cross-laboratory transfer**: Gains may not fully transfer across different task structures (binary forced-choice vs. no-go designs)
4. **Calibration is per-session**: Linear readout must be re-fit for each recording session
## References
- Gu & Dao (2023): Mamba selective state-space model
- Steinmetz et al. (2019): Visual discrimination dataset
- IBL et al. (2025): Repeated Site release
- Pandarinath et al. (2018): LFADS
- Ye & Pandarinath (2021): NDT
- Linderman et al. (2017): rSLDS
- Schneider et al. (2023): CEBRA
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!