SAMBA: Toward an EEG Foundation Model via Differential Mamba and Coordinate-Driven Spatial Embedding
Update: Jan. 2026
SAMBA is a scalable self-supervised framework for long-sequence EEG foundation modeling. It integrates 3D coordinate-driven spatial embedding and differential Mamba modules to enable robust, efficient, and generalizable EEG representation learning across diverse recording configurations and cognitive tasks.
Modeling long EEG sequences is critical for developing generalizable neural representations, particularly due to the high temporal resolution and extended durations often required to capture brain dynamics. While transformer-based models have shown success on short EEG segments, their quadratic complexity prevents effective scaling to long contexts. Additionally, the diversity in EEG montages and subject variability presents significant generalization challenges.
We introduce SAMBA, a self-supervised learning framework featuring a U-shaped encoder-decoder architecture built on the linear-time Mamba module. SAMBA incorporates:
- Temporal Semantic Random Masking — to reconstruct semantically masked segments in long sequences;
- Multi-Head Differential Mamba — to reduce redundancy and enhance salient temporal features;
- Coordinate-Driven Spatial Embedding (CDSE) — to learn robust 3D spatial representations across heterogeneous EEG devices.
Evaluations across 13 EEG datasets covering a range of tasks, montages, and sequence lengths demonstrate that SAMBA consistently outperforms state-of-the-art baselines, while maintaining low memory usage and fast inference. In addition, the learned spatial weights exhibit strong alignment with task-relevant neurophysiological regions, suggesting that SAMBA is both learnable and interpretable.
The figure below illustrates the Coordinate-Driven Spatial Embedding (CDSE) module and its alignment with neurophysiological topology:
[2] G. Li et al. Drivers’ EEG responses to different distraction tasks. Auto. Innov., 6(1):20–31, 2023.
[3] G. Berretz et al. Acute stress increases left hemispheric activity measured via changes in frontal alpha asymmetries. iScience, 25(2), 2022.
[4] S. Lopez et al. Automated identification of abnormal adult EEGs. In Proc. IEEE SPMB, pp. 1–5, 2015.
[5] J. Hong et al. A deep learning framework based on dynamic channel selection for early classification of left and right hand motor imagery tasks. In Proc. IEEE EMBC, pp. 3550–3553, 2022.
- The full architecture is implemented under
Models/. - Two pretrained checkpoints are provided under
Checkpoints/:SAMBA-E: trained using PyTorch LightningSAMBA-T: trained using native PyTorch
- The accompanying paper is currently in preparation. More features and documentation will be released soon.
SAMBA/
├── Env-requirement/ # Environment configs with dated backups
├── Checkpoints/ # Pretrained SAMBA models (SAMBA-E, SAMBA-T)
├── Models/ # Model architecture implementations
├── Experiments/ # PyTorch Lightning training modules
├── utility/ # Supporting functions: data loading, masking, loss, evaluation
├── Figures/ # Diagrams and visualizations
├── Montage/ # EEG montage metadata for multiple devices
└── README.md # Project overview






