PATCHCODE: Discrete Latent Predictive Learning for EEG Foundation Model

Kieren Yu, Ziyang Liu, Chang Huang, Kaishun WuICML 2026 · OpenReview

Electroencephalography (EEG) is a vital tool for understanding brain activity, but its signals are notoriously difficult to process. Buried under high-frequency noise from muscle movements and equipment, and varying significantly between individuals, EEG data poses a unique challenge for machine learning. While foundation models have revolutionized other domains, applying standard pre-training techniques to EEG often forces models to "learn the noise." To overcome this, researchers introduce PATCHCODE, a novel foundation model that decouples continuous input from discrete supervision, achieving state-of-the-art performance across 16 diverse tasks.

The Core Problem: Learning Noise Instead of Signal

Current large-scale models pre-trained on massive unlabeled datasets typically rely on Masked Autoencoding (MAE), where the model attempts to reconstruct missing pieces of a raw signal. For EEG, the signal-to-noise ratio is exceptionally low. Consequently, MAE wastes model capacity on reconstructing stochastic fluctuations rather than capturing consistent neurophysiological structures. Contrastive learning methods also struggle, as creating EEG augmentations that preserve actual brain activity without introducing artifacts is highly complex.

The PATCHCODE Methodology

PATCHCODE shifts the paradigm from raw waveform reconstruction to latent predictive learning via a two-stage framework. By keeping the input continuous but the supervision discrete, the model retains fine-grained temporal detail while using discrete codes as "noise-filtered prototypes" to stay grounded in real neurophysiology.

Stage A: Region-Aware Tokenizer

Instead of treating all data points equally, a tokenizer maps EEG patches into a discrete neural vocabulary (or "codes"). Crucially, this tokenizer is supervised using spectral targets (FFT amplitude and phase) rather than time-domain waves. Supervising in the frequency domain acts as a natural low-pass filter, ensuring the vocabulary captures meaningful brain oscillations (like Alpha or Beta waves) while ignoring high-frequency stochastic noise.

Stage B: PatchCode Pre-training

This stage employs a Joint-Embedding Predictive Architecture (JEPA). A "Student" model processes masked continuous EEG signals and predicts the representations of a "Teacher" model. The innovation lies in the multi-pathway objectives: the Student predicts both continuous embeddings (Patch-to-Patch) and the discrete codes generated by the frozen Stage A tokenizer (Patch-to-Code and Code-to-Patch).

Underpinning this is a Region-Bias Transformer, which incorporates a learnable spatial prior. It forces the attention mechanism to prioritize biologically relevant connections, recognizing which electrodes belong to the same functional brain region (e.g., Frontal vs. Occipital) and respecting the brain's natural topology.

Experimental Setup and Datasets

The model was pre-trained on the Temple University Hospital EEG Corpus (TUH-EEG), a massive clinical dataset containing over 30,000 hours of recordings. To validate its generalizability, PATCHCODE was evaluated on 16 downstream datasets spanning seven domains:

  • Emotion Recognition: SEED-V, FACED
  • Motor Imagery: BCI-IV-2a, PhysioNet-MI, SHU-MI
  • Sleep Staging: HMC, ISRUC
  • Clinical/Seizure: CHB-MIT, Siena, TUAB, TUEV
  • Others: Vigilance (SEED-VIG), Stress (MentalArithmetic), and Disorder Diagnosis (Mumtaz2016)

Key Findings and Results

  • State-of-the-Art Performance: PATCHCODE (Large) outperformed major baselines like BIOT, LaBraM, and CSBrain across almost all tasks. For instance, it achieved 43.46% balanced accuracy on the SEED-V emotion task, a ~1.5% lead over the previous best.
  • Exceptional Data Efficiency: In clinical settings where labeled data is scarce, PATCHCODE demonstrated its most impressive capability: models trained on just 25% of labeled data matched or exceeded the performance of baseline models trained on 100% of the data.
  • Biological Interpretability: Attention map visualizations confirmed the model focuses on biologically relevant regions—the motor cortex for movement tasks, frontal regions for emotions, and temporal lobes for seizures.
  • Scaling Laws: The architecture scales effectively, showing steady performance improvements from "Tiny" (2M parameters) to "Large" (37M parameters) configurations.

Limitations and Future Directions

While highly effective, PATCHCODE's two-stage training adds computational overhead compared to end-to-end models. Additionally, its reliance on interpolating diverse EEG setups into a canonical 21-channel layout may discard high-density information from 64- or 128-channel caps.

Future research will focus on multi-modal pre-training (combining EEG with fMRI or eye-tracking), dynamic region partitioning based on real-time brain communication, and broader prospective clinical validation to integrate these models into real-world healthcare workflows.

Summary updated

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.
BibTeX
@inproceedings{yu2026patchcode,
  author = {KIEREN YU and Ziyang LIU and Chang Huang and Kaishun Wu},
  title = {{PATCHCODE: Discrete Latent Predictive Learning for EEG Foundation Model}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=NWcZ5vualM},
}
Figure