SAMBA: Toward a Long-Context EEG Foundation Model via Spatial Embedding and Differential Mamba

TL;DR

SAMBA model leverages spatial embedding and differential Mamba for long-context EEG modeling, significantly improving accuracy.

cs.LG 🔴 Advanced 2025-11-24 9 views
Jiazhen Hong Geoffrey Mackellar Soheila Ghane
EEG long-sequence modeling self-supervised learning spatial embedding differential Mamba

Key Findings

Methodology

SAMBA employs a self-supervised learning framework with a Mamba-based U-shaped encoder-decoder architecture. Core components include Temporal Semantic Random Masking, Multi-Head Differential Mamba module, and Spatial-Adaptive Input Embedding, effectively capturing long-range temporal dependencies and spatial variability in EEG data.

Key Results

  • Experiments on 13 EEG datasets show SAMBA outperforms existing methods in accuracy and AUROC. For instance, on the Crowdsourced dataset, SAMBA achieved an accuracy of 84.84%, significantly higher than the raw data's 51.30%.
  • SAMBA demonstrates robustness and scalability across different electrode configurations and sequence lengths.
  • The spatial weight maps align closely with task-relevant neurophysiological regions, confirming SAMBA's learnability and interpretability.

Significance

SAMBA provides a scalable foundation model for real-time brain-computer interface applications, addressing memory consumption and inference time issues in long-sequence EEG modeling while exhibiting excellent generalization across devices and tasks.

Technical Contribution

By introducing differential Mamba and spatial-adaptive input embedding, SAMBA overcomes the complexity limitations of traditional Transformer models in long-sequence modeling. Its linear time complexity design significantly reduces memory usage and improves inference efficiency.

Novelty

SAMBA is the first to apply differential Mamba to long-sequence EEG modeling, combined with spatial-adaptive embedding to achieve cross-device generalization. This innovative design is unprecedented in the EEG field.

Limitations

  • SAMBA may exhibit performance degradation when handling extremely low signal-to-noise ratio EEG signals.
  • The model's generalization on certain specific tasks requires further validation.
  • Adaptability to different devices needs verification on larger datasets.

Future Work

Future research could explore SAMBA's performance in more real-time applications, further optimize its robustness to low SNR signals, and extend its application to other biosignals.

AI Executive Summary

Long-sequence EEG modeling is crucial for capturing complex neurological patterns in brain activity. However, existing Transformer models struggle to scale to long sequences due to their quadratic complexity. SAMBA introduces differential Mamba and spatial-adaptive input embedding, offering an efficient self-supervised learning framework that effectively captures long-range temporal dependencies and spatial variability in EEG data.

On 13 datasets with diverse tasks and electrode configurations, SAMBA demonstrated superior performance, with accuracy and AUROC surpassing existing methods. Notably, on the Crowdsourced dataset, SAMBA's performance significantly exceeded that of the raw data, validating its robustness and scalability across devices and tasks.

The spatial weight maps closely align with task-relevant neurophysiological regions, showcasing SAMBA's strong learnability and interpretability. This research provides a scalable foundation model for real-time brain-computer interface applications, addressing memory consumption and inference time challenges in long-sequence EEG modeling. Future studies could further optimize its robustness to low SNR signals and extend its application to other biosignals.

Deep Analysis

Background

Long-sequence EEG modeling is essential for various real-world applications, such as Alzheimer's detection and driver fatigue monitoring. However, due to the high sampling rate and long recording durations of EEG data, existing Transformer models struggle to handle these long sequences effectively. While some self-supervised learning methods have succeeded in short-sequence EEG modeling, they still face challenges in memory consumption and inference time for long-sequence modeling.

Core Problem

The core problem in long-sequence EEG modeling is capturing long-range temporal dependencies and spatial variability without increasing memory consumption and inference time. Additionally, variability in electrode configurations and inter-subject differences in brain signals pose challenges for model generalization.

Innovation

SAMBA introduces differential Mamba and spatial-adaptive input embedding to address complexity issues in long-sequence EEG modeling. The differential Mamba module enhances robustness by contrasting multi-head state-space dynamics to suppress noise. The spatial-adaptive input embedding aligns input signals using 3D coordinates, achieving cross-device generalization.

Methodology

  • �� SAMBA employs a U-shaped encoder-decoder architecture with Mamba's long-sequence processing capability.
  • �� Temporal Semantic Random Masking is used for semantic-level sequence reconstruction.
  • �� Multi-Head Differential Mamba module suppresses redundancy and emphasizes salient temporal structures.
  • �� Spatial-Adaptive Input Embedding learns unified embeddings in a 3D Euclidean space for cross-device robustness.

Experiments

Experiments were conducted on 13 EEG datasets, covering various tasks, electrode configurations, and sequence lengths. Baseline methods included MAEEG, BENDR, EEG2Rep, etc. Evaluation metrics were accuracy and AUROC. Results showed SAMBA outperformed all existing methods, particularly excelling in long-sequence tasks.

Results

SAMBA achieved an accuracy of 84.84% on the Crowdsourced dataset, significantly higher than the raw data's 51.30%. It demonstrated robustness and scalability across different electrode configurations and sequence lengths. The spatial weight maps aligned closely with task-relevant neurophysiological regions, confirming its learnability and interpretability.

Applications

SAMBA can be used in real-time brain-computer interface applications such as emotion recognition and fatigue monitoring. Its low memory consumption and fast inference capabilities make it suitable for deployment on resource-constrained devices, with significant industrial application potential.

Limitations & Outlook

SAMBA may exhibit performance degradation when handling extremely low SNR EEG signals. Additionally, the model's generalization on certain specific tasks requires further validation. Future research could explore its performance in more real-time applications and further optimize its robustness to low SNR signals.

Plain Language Accessible to non-experts

Imagine you're at a large concert, trying to hear your favorite band play amidst the noisy crowd. SAMBA acts like an efficient sound system that extracts the band's music from the chaotic noise. It uses a technique called differential Mamba to filter out unnecessary noise and retain important musical segments. It can also adapt to different venues, providing clear sound quality whether indoors or outdoors. This is how SAMBA works with EEG signals: extracting meaningful patterns from complex brainwaves and adapting to different devices and environments.

ELI14 Explained like you're 14

Hey there! Imagine you're playing a super complex puzzle game. Each puzzle piece represents a tiny signal in your brain. SAMBA is like a smart puzzle master that quickly finds the right spot for each piece, even if they come from different boxes. This master can work in different lighting, like during the day or night. That's how SAMBA handles brainwaves: it can quickly and accurately interpret your brain signals in various situations, helping scientists understand what your brain is thinking!

Glossary

EEG (Electroencephalogram)

A technique for recording electrical activity of the brain, widely used in neuroscience research and clinical diagnosis.

Used to analyze brain activity patterns and aid in developing brain-computer interfaces.

Transformer

A deep learning model for processing sequential data, particularly effective in natural language processing.

Traditional Transformer models face complexity issues in long-sequence EEG modeling.

Mamba

A state-space model for long-sequence processing with linear time complexity.

SAMBA utilizes Mamba's capabilities to handle long-duration EEG data.

Self-supervised Learning

A learning method that does not require manually labeled data, training through the structure of the data itself.

Used to train the SAMBA model, capturing temporal and spatial patterns in EEG data.

Spatial Embedding

A technique for mapping data into a spatial coordinate system, used to handle signals from different devices.

SAMBA achieves cross-device generalization through spatial embedding.

Open Questions Unanswered questions from this research

  • 1 How to improve SAMBA's robustness under extremely low SNR conditions? Current methods perform poorly under such conditions, requiring further optimization.
  • 2 How to further validate SAMBA's generalization ability in more real-time applications? Larger datasets and diverse tasks are needed.
  • 3 How to extend SAMBA's application to other biosignals? Exploring the characteristics and adaptation methods of different signals is necessary.

Applications

Immediate Applications

Emotion Recognition

Analyze EEG signals to recognize user emotional states in real-time, applicable to smart devices and human-computer interaction.

Fatigue Monitoring

Monitor user fatigue state during driving or prolonged work, providing safety alerts.

Long-term Vision

Brain-Computer Interface

Achieve more efficient human-computer interaction, helping paralyzed patients control devices through brainwaves.

Abstract

Long-sequence electroencephalogram (EEG) modeling is essential for developing generalizable EEG representation models. This need arises from the high sampling rate of EEG data and the long recording durations required to capture extended neurological patterns in brain activity. Transformer-based models have shown promise in modeling short sequences of a few seconds; however, their quadratic complexity limits scalability to longer contexts. Moreover, variability in electrode montage across available datasets, along with inter-subject differences in brain signals, pose significant challenges to developing a generalizable and robust foundation model. We propose \textit{SAMBA}, a self-supervised learning framework with a Mamba-based U-shaped encoder-decoder architecture, which effectively captures long-range temporal dependencies and spatial variability in EEG data. Leveraging the inherent ability of Mamba in processing long context sizes, we introduce: (1) \textit{Temporal Semantic Random Masking} for semantic-level sequence reconstruction, (2) a \textit{Multi-Head Differential Mamba} module to suppress redundancy and emphasize salient temporal structures, and (3) a \textit{Spatial-Adaptive Input Embedding} that learns unified embeddings in a three-dimensional Euclidean space, enabling robustness across devices. Experiments on thirteen EEG datasets across diverse tasks, electrode configurations, and sequence durations demonstrate that SAMBA consistently outperforms state-of-the-art methods while maintaining low memory consumption and inference time. We also show the learned spatial weight maps from our embedding module align closely with task-relevant neurophysiological regions, demonstrating the learnability and interpretability of SAMBA. These results highlight SAMBA's scalability and practical potential as a foundation model for real-time brain-computer interface applications.

cs.LG