g12bftd commited on
Commit
a46585f
·
verified ·
1 Parent(s): 8313e20

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +229 -0
README.md ADDED
@@ -0,0 +1,229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-nd-4.0
3
+ language:
4
+ - en
5
+ library_name: pytorch
6
+ tags:
7
+ - eeg
8
+ - biosignal
9
+ - foundation-model
10
+ - self-supervised
11
+ - masked-modeling
12
+ - windowed-alternating-attention
13
+ - neuroscience
14
+ datasets:
15
+ - TUEG
16
+ - SEED
17
+ - BOAS
18
+ - SleepEDFx
19
+ - BCI-NER
20
+ - GWD
21
+ - CHB-MIT
22
+ - Neonate
23
+ - PhysioNet-MI
24
+ - SHU-MI
25
+ - TUAB
26
+ - STEW
27
+ - SEED-VIG
28
+ - ISRUC
29
+ - Mumtaz
30
+ - MentalArithmetic
31
+ - SEED-V
32
+ metrics:
33
+ - roc_auc
34
+ - f1
35
+ - nrmse
36
+ model-index:
37
+ - name: S-CEReBrO
38
+ results:
39
+ - task:
40
+ type: time-series-classification
41
+ name: Seizure Detection
42
+ dataset:
43
+ type: CHB-MIT
44
+ name: CHB-MIT
45
+ metrics:
46
+ - type: roc_auc
47
+ value: 87.45
48
+ name: AUROC
49
+ - task:
50
+ type: time-series-classification
51
+ name: Motor Imagery Classification
52
+ dataset:
53
+ type: PhysioNet-MI
54
+ name: PhysioNet-MI
55
+ metrics:
56
+ - type: f1
57
+ value: 60.93
58
+ name: Weighted F1
59
+ - task:
60
+ type: time-series-classification
61
+ name: Abnormal Classification
62
+ dataset:
63
+ type: TUAB
64
+ name: TUAB
65
+ metrics:
66
+ - type: roc_auc
67
+ value: 89.30
68
+ name: AUROC
69
+ ---
70
+ <div align="center">
71
+ <h1>S-CEReBrO: Breaking the Memory Barrier in Continuous EEG Monitoring</h1>
72
+ </div>
73
+ <p align="center">
74
+ <a href="https://github.com/pulp-bio/biofoundation">
75
+ <img src ="https://img.shields.io/github/stars/pulp-bio/biofoundation?color=ccf" alt="Github">
76
+ </a>
77
+ <a href="https://creativecommons.org/licenses/by-nd/4.0/">
78
+ <img src="https://img.shields.io/badge/License-CC_BY--ND_4.0-lightgrey.svg" alt="License">
79
+ </a>
80
+ <a href="https://arxiv.org/abs/2607.27913">
81
+ <img src="https://img.shields.io/badge/arXiv-2607.27913-b31b1b.svg" alt="Paper">
82
+ </a>
83
+ </p>
84
+
85
+ **S-CEReBrO** (Streaming CEReBrO) is an **EEG foundation model** designed for **continuous monitoring**.
86
+ S-CEReBrO addresses the memory overflow bottleneck of continuous monitoring by utilizing a novel **Windowed Alternating Attention mechanism**. This factorizes attention computation into fixed-size spatiotemporal windows, guaranteeing a **constant KV cache memory** as only the active window requires resident attention maps.
87
+
88
+ ---
89
+
90
+ ## 🔒 License & Usage Policy (Weights)
91
+
92
+ **Weights license:** The released model weights are licensed under **Creative Commons Attribution–NoDerivatives 4.0 (CC BY-ND 4.0)**. This section summarizes the practical implications for users. *This is not legal advice; please read the full license text.*
93
+
94
+ ### ✅ You may
95
+ - **Use** and **redistribute** the **unmodified** S-CEReBrO weights (including in commercial settings) **with proper attribution** to the S-CEReBrO authors.
96
+ - **Fine-tune / adapt** the weights **for your internal use** (research or production) **without redistributing** the modified weights.
97
+ - **Publish your code, configs, logs, and papers** describing experiments with S-CEReBrO (please cite the paper).
98
+
99
+ ### 🚫 You may not
100
+ - **Share, host, or redistribute any modified weights** (including LoRA/adapter/delta checkpoints or pruned/quantized variants). Any parameter set that encodes an adaptation is considered a derivative and cannot be shared under CC BY-ND 4.0.
101
+ - **Imply endorsement** by the S-CEReBrO authors for any derivative or evaluation without our written permission.
102
+ - **Use the S-CEReBrO name** in a way that suggests your modified model is an official S-CEReBrO release.
103
+
104
+ ### 🤝 How to contribute improvements (PR-gated releases)
105
+ We welcome community improvements via a **pull-request (PR)** workflow. If you believe your improvements should become an **official S-CEReBrO release**:
106
+ 1. **Open a PR** in the [BioFoundation repository](https://github.com/pulp-bio/biofoundation) describing the change (architecture/head/training recipe, datasets, preprocessing, compute).
107
+ 2. Include **reproducibility artifacts**: configs, seeds, scripts, environment details, training/validation logs, and the **evaluation protocol** with exact splits.
108
+ 3. Provide **comprehensive results** (AUROC/AUPR/BA, FLOPs, memory) vs. the baselines reported in the S-CEReBrO paper.
109
+ 4. After **maintainer review**, approved changes will be **retrained/validated** and, if accepted, **released by the maintainers** as a new **official S-CEReBrO** checkpoint under **CC BY-ND 4.0**.
110
+
111
+ > Rationale: CC BY-ND protects users from fragmented, lower-quality variants, while still enabling internal fine-tuning and a path for the community to upstream improvements through review.
112
+
113
+ ---
114
+
115
+ ## 🔎 Model Summary
116
+
117
+ - **Goal:** Realize efficient, generalizable, and continuous EEG monitoring while breaking the memory barrier of Transformer-based architectures.
118
+ - **Core idea:** **Windowed Alternating Attention** interleaves spatial and temporal attention blocks. This restricts interactions to local neighborhoods in time and space, allowing the model to process long signals while maintaining a constant resident memory. Complexity is $\mathcal{O}(CT)$.
119
+ - **Pre-training data:** **>25,000 hours** of EEG from **>12,000 subjects**. Includes TUEG, SEED series, BOAS, SleepEDFx, BCI-NER, and GWD. Downstream subjects (e.g. TUAB) are strictly excluded to prevent leakage.
120
+ - **Downstream tasks:** Seizure detection (CHB-MIT, Neonate), Motor Imagery (PhysioNet-MI, SHU-MI), Abnormal classification (TUAB), Mental Workload (STEW), Vigilance Estimation (SEED-VIG), Sleep Staging (ISRUC), Mental Disorder Diagnosis (Mumtaz), Mental Stress (Mental Arithmetic), and Emotion Recognition (SEED-V).
121
+
122
+ ---
123
+
124
+ ## 🚀 Model Variants
125
+
126
+ S-CEReBrO is highly compact, utilizing only 2.4M parameters. This design allows it to achieve state-of-the-art performance with up to 60% fewer parameters than existing foundation models.
127
+
128
+ ---
129
+
130
+ ## 📊 Results
131
+
132
+ S-CEReBrO achieves state-of-the-art performance on 7 of 11 downstream public benchmarks.
133
+
134
+ - **CHB-MIT (seizure detection):** 87.45 AUROC.
135
+ - **Neonate (seizure detection):** 85.76 AUROC.
136
+ - **PhysioNet-MI (motor imagery):** 60.93 Weighted F1.
137
+ - **SHU-MI (motor imagery):** 66.48 AUROC.
138
+ - **TUAB (abnormal classification):** 89.30 AUROC.
139
+ - **STEW (mental workload):** 52.90 Weighted F1.
140
+ - **SEED-VIG (vigilance estimation):** 0.93 NRMSE.
141
+ - **ISRUC (sleep staging):** 78.23 Weighted F1.
142
+ - **Mumtaz (mental disorder diagnosis):** 98.23 AUROC.
143
+ - **Mental Arithmetic (mental stress detection):** 68.97 AUROC.
144
+ - **SEED-V (emotion recognition):** 28.16 Weighted F1.
145
+
146
+ **Efficiency & Scaling:** Without low-level optimzations, windowed Alternating Attention can process signals 100x longer than full self-attention (up to 14 hours / 50,000 seconds). It also processes signals 3x longer than low-rank linear attention. Compared to low-rank linear attention on long contexts (15,000 seconds), it requires 55% of the memory while increasing inference throughput by 2.1x.
147
+
148
+ ---
149
+
150
+ ## 🧠 Intended Use & Limitations
151
+
152
+ **Intended use.** Research on continuous EEG representation learning and classification (clinical diagnostics, BCI, state monitoring) where long context and memory efficiency are necessary.
153
+
154
+ **Limitations.**
155
+ - **Not a medical device.** Do **not** use for clinical decisions without proper validation & regulatory clearance.
156
+ - **Unseen topologies:** Zero-shot transfer to **very different/dense** layouts can underperform SOTA despite positive scaling; consider augmenting pre-training montage diversity and spatial encodings.
157
+ - **Distribution shifts:** Performance varies across cohorts, devices, and label protocols; validate locally and consider domain adaptation.
158
+
159
+ ---
160
+
161
+ ## 🏗️ Architecture & Training
162
+
163
+ **Spatiotemporal Tokenization.** The raw EEG recording is tokenized using a sliding window. A shared convolutional encoder projects each patch into a latent embedding. Spatiotemporal topology is preserved via an index-based matrix for temporal order and a continuous spatial embedding mapped via an MLP from 3D electrode coordinates.
164
+
165
+ **Windowed Temporal Attention (WTA).** WTA layers model temporal dependencies independently for each channel. Each query attends only to keys within a local neighborhood, avoiding memory accumulation.
166
+
167
+ **Windowed Spatial Attention (WSA).** WSA layers facilitate cross-channel information exchange at a fixed time index. Attention computation is restricted to a local neighborhood. Layer-specific dilation and shift factors stagger receptive fields to enable distant, physiologically related channels to interact.
168
+
169
+ **Pre-training objectives.** The model is pre-trained using Masked Autoencoding (MAE). The objective minimizes the weighted sum of reconstruction losses for masked and visible patch positions.
170
+
171
+ ---
172
+
173
+ ## 🔧 How to Use
174
+
175
+ S-CEReBrO is supported within the BioFoundation framework. Experiments and setups follow similar pipeline structures:
176
+
177
+ 1. **Install & read data prep**: clone the [BioFoundation repo](https://github.com/pulp-bio/biofoundation). Set up the environment as described there, then open `make_datasets/README.md` for dataset-specific notes.
178
+ 2. **Point to weights**: set `pretrained_safetensors_path` to the downloaded weights in your experiment YAML.
179
+ 3. **Preprocess data**: acquire fine-tuning dataset and follow preprocessing protocol to generate `train/test/val.lmdb` files.
180
+ 4. **Update data module config**
181
+ 5. **Task settings**: Configure `classification_type`, `model.num_classes`, and task modes inside your YAML config based on downstream objectives.
182
+ 6. **Launch fine-tuning (Hydra)**:
183
+ ```bash
184
+ python -u run_train.py +experiment=s_cerebro_finetune
185
+
186
+ ---
187
+
188
+
189
+ ## 🔗 Sources
190
+
191
+ - **Code:** https://github.com/pulp-bio/BioFoundation
192
+ - **Paper:** S-CEReBrO: Breaking the Memory Barrier in Continuous EEG Monitoring (arxiv:2607.27913)
193
+
194
+ ---
195
+
196
+ ## 📜 Citation
197
+
198
+ If you use S-CEReBrO, please cite:
199
+
200
+ ```bibtex
201
+ @misc{bucagu2026scerebrobreakingmemorybarrier,
202
+ title={S-CEReBrO: Breaking the Memory Barrier in Continuous EEG Monitoring},
203
+ author={Glenn Anta Bucagu and Thorir Mar Ingolfsson and Yawei Li and Luca Benini},
204
+ year={2026},
205
+ eprint={2607.27913},
206
+ archivePrefix={arXiv},
207
+ primaryClass={cs.LG},
208
+ url={https://arxiv.org/abs/2607.27913},
209
+ }
210
+ ```
211
+
212
+ ---
213
+
214
+ ## 🛠️ Maintenance & Contact
215
+
216
+ - **Issues & support:** please open a GitHub issue in the BioFoundation repository.
217
+
218
+ ---
219
+ ---
220
+
221
+ ## 🔗 Related Models
222
+
223
+ - **[LUNA](https://huggingface.co/PulpBio/LUNA)** — Transformer-based topology-agnostic EEG foundation model (NeurIPS 2025). Source of the channel-unification cross-attention module that LuMamba reuses.
224
+ - **[FEMBA](https://huggingface.co/PulpBio/FEMBA)** — Bidirectional Mamba foundation model for EEG. Source of the linear-complexity temporal backbone that LuMamba reuses.
225
+ - **[TinyMyo](https://huggingface.co/PulpBio/TinyMyo)** — Tiny foundation model for flexible EMG signal processing at the edge.
226
+
227
+ ## 🗒️ Changelog
228
+
229
+ - **v1.0:** Initial release of LuMamba model card with task-specific checkpoints and instructions.