EEGDM: EEG Representation Learning via Generative Diffusion Model

Jia Hong Puah, Sim Kuan Goh, Ziwei Zhang, Zixuan Ye, Chow Khuen Chan, Kheng Seang Lim, Si Lei Fong, Kok Sin Woon, Cuntai GuanarXiv 2025

Abstract

While electroencephalogram (EEG) has been a crucial tool for monitoring the brain and diagnosing neurological disorders (e.g., epilepsy), learning meaningful representations from raw EEG signals remains challenging due to limited annotations and high signal variability. Recently, EEG foundation models (FMs) have shown promising potential by adopting transformer architectures and self-supervised pre-training methods from large language models (e.g., masked prediction) to learn representations from diverse EEG data, followed by fine-tuning on specific EEG tasks. Nonetheless, these large models often incurred high computational costs during both training and inference, with only marginal performance improvements as the model size increases. In this work, we proposed an EEG representation learning framework building upon Generative Diffusion Model (EEGDM). Specifically, we developed a structured state-space model for diffusion pretraining (SSMDP) to better capture the temporal dynamics of EEG signals and trained it using Denoising Diffusion Probabilistic Model (DDPM) framework. Subsequently, the resulting latent EEG representations were then used for downstream classification tasks via our proposed latent fusion transformer (LFT). To evaluate our method, we used multi-event datasets covering both interictal epileptiform discharges (TUEV) and seizure (CHB-MIT) detection, and compared EEGDM with current state-of-the-art approaches, including EEG FMs. Empirical results showed that our method outperformed the existing methods. These findings suggested that EEGDM offered a promising alternative to current FMs.

Introduction

Electroencephalogram (EEG) data is notoriously difficult to process due to high inter-subject variability, low signal-to-noise ratios, and a scarcity of high-quality expert annotations. Recent attempts to build "EEG Foundation Models" (FMs) have adapted techniques from Large Language Models (LLMs), such as masked token prediction. However, these models often require massive computational resources and show diminishing returns as they scale. Furthermore, most existing models struggle with "distribution shift" when moving between different clinical datasets or hardware with varying sampling rates.

To address these challenges, we introduce EEGDM (EEG Representation Learning via Generative Diffusion Model). EEGDM is a novel framework that leverages generative diffusion models and structured state-space models (SSMs) to learn high-quality EEG representations. It outperforms massive FMs on clinical event detection tasks while being significantly more lightweight and inherently capable of handling varying sampling rates.

Methodology

EEGDM consists of two primary components designed to capture the complex temporal dynamics of brain activity:

  1. SSMDP (SSM-Based Diffusion Pretraining): Instead of masking and predicting discrete tokens, the model learns by denoising EEG signals. It utilizes a Structured State-Space Model (SSM) architecture—specifically a bidirectional version of S4D—within a Denoising Diffusion Probabilistic Model (DDPM) framework. SSMs are mathematically optimized to capture long-range temporal dependencies more efficiently than standard Transformers.
  2. LFT (Latent Fusion Transformer): Once the SSMDP is trained, its internal "latent activities" are extracted. These representations are fed into the LFT, a hierarchical transformer designed to fuse information across different EEG channels and time windows for downstream classification.
The architecture of the SSMDP pretraining module, highlighting the diffusion process and the internal S4D-based layers.

Key Technical Innovations

  • $\mu$-law Companding: Borrowed from audio processing, this technique squashes the wide dynamic range of EEG signals, suppressing extreme outliers and improving numerical stability.
  • Bidirectional SSMs: While standard SSMs are causal, EEGDM uses a bidirectional setup to capture context from both the past and the future of a signal segment.
  • Continuous-time Modeling: Built on SSMs, the model can handle different sampling rates by adjusting a discretization parameter ($\Delta$) without requiring retraining.

Experimental Results

We evaluated EEGDM on two major clinical EEG datasets: the TUEV (Temple University EEG Event Corpus) for detecting interictal epileptiform discharges (IEDs), and the CHB-MIT seizure detection dataset to test generalization to unseen recording conditions.

Performance and Efficiency

EEGDM achieved state-of-the-art performance on the TUEV dataset with a 74.23% Cohen’s Kappa, surpassing the previous best model, Gram-L (71.30%). Notably, EEGDM (12.8M parameters) is approximately 19x smaller than Gram-L (251M parameters), demonstrating that architecture tailored for time-series dynamics is more effective than simple scaling.

Comparison of EEGDM against various state-of-the-art models, showing superior performance in Kappa and Balanced Accuracy (BAcc) despite a smaller parameter footprint.

Key Insights

  • Diffusion vs. Masking: Learning to reconstruct a signal from noise (diffusion) provides richer representations for EEG than predicting missing chunks (masking).
  • The "Noiseless" Forward Trick: Using a "noiseless" forward process during feature extraction enhanced the quality of latent representations for classification.
  • Sampling Rate Flexibility: The model maintained robust performance even when the test data sampling rate was dropped from 200 Hz to 180 Hz, a significant challenge for token-based models.

Conclusion

EEGDM offers a promising, efficient alternative to current EEG Foundation Models. By combining the generative power of diffusion models with the temporal efficiency of SSMs, it achieves superior clinical event detection with a fraction of the computational cost. Future work will explore the framework's scalability across diverse biosignal datasets and tasks such as sleep staging or emotion recognition, as well as investigating discrete diffusion models for further representation improvements.

Summary updated

BibTeX
@misc{puah2025eegdm,
  author = {Jia Hong Puah and Sim Kuan Goh and Ziwei Zhang and Zixuan Ye and Chow Khuen Chan and Kheng Seang Lim and Si Lei Fong and Kok Sin Woon and Cuntai Guan},
  title = {{EEGDM: EEG Representation Learning via Generative Diffusion Model}},
  year = {2025},
  eprint = {2508.14086},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2508.14086},
}
Figure