PATCHCODE: Discrete Latent Predictive Learning for EEG Foundation Model
Abstract
EEG foundation models aim to learn transferable representations, yet EEG recordings are dominated by high-frequency noise and large cross-subject variability. Existing pretraining strategies such as masked autoencoding or autoregressive modeling often treat waveform reconstruction as the learning signal, making the objective sensitive to stochastic fluctuations rather than consistent neurophysiological structure. To address this overlap, we propose PATCHCODE, a region-aware discrete predictive learning framework that keeps the encoder input continuous while introducing region-aware discrete codes as stable supervision targets. We pretrain a masked predictive encoder on continuous EEG patches with dual-granularity learning: it predicts missing patch-level representations to preserve fine spatiotemporal structure, while aligning them to discretized code targets from a frozen tokenizer to anchor robust semantics. Extensive experiments across sixteen downstream datasets spanning emotion recognition, motor imagery, sleep staging, seizure detection, vigilance estimation, stress detection, and clinical diagnosis demonstrate that PATCHCODE achieves competitive performance compared to state-of-the-art baselines, with notable gains in data efficiency under limited labels. Our code is available at https://github.com/kierenyyu/Patchcode.
Lay Summary
Brain signals recorded via EEG can help computers understand mental states such as emotions, sleep stages, or seizures, but EEG data is noisy and varies greatly between individuals. Current AI models often learn from noisy details rather than meaningful brain patterns. PATCHCODE is a new pre-training framework that teaches an AI model to make predictions about abstract, noise-resistant representations of brain signals rather than reconstructing raw waveforms. It works in two steps: first, it learns a compact "vocabulary" of brain signal patterns by working in the frequency domain to filter noise; second, it trains a powerful encoder to predict these vocabulary codes from incomplete input, learning robust representations that transfer to many different brain-signal analysis tasks. Tested across sixteen datasets covering emotion, motor imagery, sleep, seizures, and clinical diagnosis, PATCHCODE matches or outperforms state-of-the-art methods and needs far fewer labels to perform well, which is important for medical applications where labeled data is scarce.