bio.rodeo
ModelsOrganizationsProvidersLeaderboardAboutSign in
bio.rodeo

The authoritative source for evaluating biological foundation models. No hype, just honest analysis.

Categories
  • DNA & Gene
  • RNA
  • Protein
  • Small molecule
  • Single-cell
  • Spatial omics
  • Pathology
  • Imaging
  • Metabolomics
  • Biosignals
  • Language model
bio.rodeoModelsOrganizationsProvidersLeaderboardAboutFAQSubmit a modelContact
© 2026 Pulsatance. All rights reserved. ~
Built by Pulsatance
Biosignals foundation models
Biosignals

CodeBrain

National University of Singapore / Nanyang Technological University / Chinese Academy of Sciences

EEG foundation model pairing a decoupled time-frequency tokenizer with a multi-scale state-space encoder for generalization under distribution shift.

Released: June 2025
Parameters: 15.2 Million

EEG foundation models promise to replace the sprawl of task-specific classifiers — one for sleep staging, another for seizure detection, another for motor imagery — with a single pretrained encoder. In practice most have inherited two weaknesses. They compress temporal waveform and spectral rhythm into a single entangled token stream, which makes the learned codes hard to relate back to recognizable neural events, and they lean on either global attention or purely local convolution, capturing one scale of dependency at the cost of the other.

CodeBrain, from the Saw Swee Hock School of Public Health and Institute of Data Science at the National University of Singapore with collaborators at Nanyang Technological University and the Institute of Automation of the Chinese Academy of Sciences, attacks both. Its two-stage design first learns separate discrete codebooks for the temporal and frequency views of each EEG patch, then trains a multi-scale encoder to predict those codes from masked input. The architecture is motivated explicitly by the brain's small-world topology: sparse long-range connections handled by structured global convolution, dense local structure by sliding window attention.

It sits directly in the lineage of tokenizer-based EEG models such as LaBraM and CBraMod, and the paper benchmarks against both. CodeBrain was published at ICLR 2026.

#Key Features

  • Decoupled time-frequency tokenization: TFDual-Tokenizer maintains independent temporal and frequency codebooks, quadratically expanding the representable token space and letting individual codes be traced to spectral rhythms or transient neural events.
  • Multi-scale EEGSSM encoder: Structured global convolution, computed by FFT at O(N log N) cost, captures sparse long-range dependencies while sliding window attention preserves local events that global-only models blur out.
  • Masked code prediction: Stage two is trained self-supervised by predicting the discrete tokens of masked patches, avoiding direct raw-waveform reconstruction, which is brittle given EEG's noise floor.
  • Distribution-shift evaluation: All ten downstream datasets differ from the pretraining corpus in cohort and channel configuration, so reported gains reflect transfer rather than in-domain fit.
  • Published scaling analysis: The authors sweep 1,000 to 9,000 hours of pretraining data and 3.86M to 146.75M parameters, extending prior EEG scaling studies that stopped at 1,000 hours.

#Technical Details

Pretraining uses the Temple University Hospital EEG Corpus (TUEG), the largest public EEG dataset. Recordings are standardized to 19 channels at 200 Hz, split into 30-second segments, amplitude-filtered, and divided into 1-second patches — 570 patches per sample, yielding 1,109,545 samples or roughly 9,246 hours after preprocessing. The tokenizer uses temporal and frequency codebooks of 4,096 codes at 32 dimensions each, trained for 20 epochs across six A100 GPUs. The released backbone is an 8-layer EEGSSM with hidden size 200 and 15.17M parameters, trained for 10 epochs at a 0.5 masking ratio.

Across eight tasks and ten datasets, CodeBrain leads the strongest prior foundation model, CBraMod, on the representative benchmarks: Cohen's Kappa of 0.5406 versus 0.5041 on 9-class FACED emotion recognition, 0.2735 versus 0.2569 on 5-class SEED-V, 0.7671 versus 0.7407 on ISRUC-S3 sleep staging, and 0.5127 versus 0.4216 on BCIC 2020-T3 imagined speech. The comparison set also includes task-specific models (EEGNet, EEGConformer, ST-Transformer) and foundation models BENDR, BIOT, LaBraM, and EEGPT. Scaling experiments run from a 3-layer/3.86M model to a 24-layer/146.75M model; Kappa improves monotonically with both data and parameters but with diminishing returns, which is why the 8-layer configuration is the released default.

#Applications

The pretrained encoder is a general-purpose starting point for clinical and research EEG pipelines — sleep staging, seizure and abnormality detection from hospital recordings, emotion recognition, motor imagery and imagined-speech brain-computer interfaces, and mental stress monitoring. Because it is small enough to fine-tune on a single GPU, it is practical for labs without large compute budgets. The interpretable codebook gives neuroscientists an additional handle: token identity can be inspected against spectral bands rather than treated as an opaque embedding.

#Impact

CodeBrain's main contribution is showing that architectural choices, not just corpus size, determine whether an EEG foundation model generalizes across cohorts and montages. Pretrained weights for both the tokenizer and the EEGSSM encoder are on Hugging Face under Apache 2.0, and training, fine-tuning, and preprocessing code is on GitHub, though the code repository itself carries no license file. One honest caveat the authors raise: TUAB and TUEV both derive from the same TUH corpus used for pretraining, so those two benchmarks partially overlap the pretraining distribution and pretraining is deliberately stopped early to limit overfitting to it.

Citation

Preprint

DOI: 10.48550/arXiv.2506.09110

Recent citations

Papers that recently cited this model.

Not enough citation data yet.

Top citations

The most-cited papers that cite this model.

Not enough citation data yet.

Where to run CodeBrain

Providers that host CodeBrain for inference, fine-tuning, or weight download.

No providers recorded yet. Browse all providers

Fields of citing research

Not enough data

Openness

bio.rodeo opennessClosed · low usability and reproducibility
33Closed
Usability — can I run it?39
Reproducibility — can I retrain it?26

Tags

eegeeg_decodingfoundation_modelself_supervisedstate_space_model

Resources

GitHub RepositoryResearch PaperHuggingFace Model