做脑机接口或神经信号处理的团队终于有了能实时处理长序列 EEG 的工具——CaMBRAIN 解决了注意力机制的计算瓶颈,吞吐量提升 10 倍,做实时监测或临床诊断的开发者可以直接用。
CaMBRAIN 是首个基于 Mamba 的因果状态空间模型,专为脑电图(EEG)信号实时推理设计。现有深度学习模型依赖注意力机制,序列长度增加时计算量呈二次增长,且需滑动窗口处理,无法理解全局信号。CaMBRAIN 利用因果状态空间模型保持线性复杂度,并引入多阶段自监督训练,增强长程记忆能力。在三个 EEG 数据集上,CaMBRAIN 达到最先进性能,吞吐量比现有模型高 10 倍以上,首次实现变长 EEG 信号的连续推理。
CaMBRAIN: Real-time, Continuous EEG Inference with Causal State Space Models
Electroencephalography (EEG) is a critical, non-invasive method to monitor electrical brain activity. EEGs can span anywhere from a couple seconds to multiple hours, posing a major hurdle for existing deep learning methods due to two major factors: (1) existing EEG models are predominantly built upon the attention mechanism, incurring quadratic scaling as the sequence length increases, and (2) raw EEG signals must be processed in a sliding-window fashion due to fixed-length input requirements, preventing global understanding of the entire signal. To this extent, we propose CaMBRAIN - the first Causal, Mamba-based state space model (SSM) capable of real-time inference of EEG signals, arguing that bidirectional approaches are needlessly expensive given the causal, unidirectional nature of EEG. However, training such a model is non-trivial, as crucial EEG events can be extremely brief - within fractions of a second - yet separated by long intervals spanning minutes. Current EEG methods use self-supervised objectives that optimize for signal reconstruction, but these are not well suited for streaming SSMs; they fail to explicitly train the hidden state to retain the salient long-range context needed for streaming inference. We therefore introduce a multi-stage self-supervised training pipeline specifically tailored to encourage long-range memory retention and strong performance on EEG signals, while preserving the linear-time complexity of state space models. CaMBRAIN achieves state-of-the-art (SOTA) results across 3 different EEG datasets with >10x higher throughput than existing models, enabling the first model capable of long-range, continuous inference of variable-length EEG signals.