Paper deep dive
SpecMoE: Spectral Mixture-of-Experts Foundation Model for Cross-Species EEG Decoding
D. Darankoum, C. Habermacher, J. Volle, S. Grudinin
Intelligence
Status: succeeded | Model: google/gemini-3.1-flash-lite-preview | Prompt: intel-v1 | Confidence: 96%
Last extracted: 3/22/2026, 5:45:56 AM
Summary
SpecMoE is a spectral-anchored foundation model for EEG decoding that utilizes a novel Gaussian-smoothed masking strategy on STFT spectrograms to prevent information leakage and bias. It employs a U-shaped hierarchical architecture, SpecHi-Net, and a spectral gating mechanism to route information through a Mixture-of-Experts framework, achieving state-of-the-art performance across diverse cross-species EEG tasks.
Entities (5)
Relation Signals (3)
SpecMoE â performs â EEG decoding
confidence 100% · SpecMoE achieves state-of-the-art performance across a diverse set of EEG decoding tasks
SpecMoE â utilizes â SpecHi-Net
confidence 100% · we design SpecHi-Net, a U-shaped hierarchical architecture... We then combine these models through SpecMoE
SpecMoE â applies â Gaussian-smoothed masking
confidence 95% · SpecMoE operates in the time-frequency domain using a novel Gaussian-smoothed masking strategy
Cypher Suggestions (0)
No Cypher suggestions yet.
Abstract
Abstract:Decoding the orchestration of neural activity in electroencephalography (EEG) signals is a central challenge in bridging neuroscience with artificial intelligence. Foundation models have made strides in generalized EEG decoding, yet many existing frameworks primarily relying on separate temporal and spectral masking of raw signals during self-supervised pretraining. Such strategies often tend to bias learning toward high-frequency oscillations, as low-frequency rhythmic patterns can be easily inferred from the unmasked signal. We introduce a foundation model that utilizes a novel Gaussian-smoothed masking scheme applied to short-time Fourier transform (STFT) maps. By jointly applying time, frequency, and time-frequency Gaussian masks, we make the reconstruction task much more challenging, forcing the model to learn intricate neural patterns across both high- and low-frequency domains. To effectively recover signals under this aggressive masking strategy, we design SpecHi-Net, a U-shaped hierarchical architecture with multiple encoding and decoding stages. To accelerate large-scale pretraining, we partition the data into three subsets, each used to train an independent expert model. We then combine these models through SpecMoE, a mixture of experts framework guided by a learned spectral gating mechanism. SpecMoE achieves state-of-the-art performance across a diverse set of EEG decoding tasks, including sleep staging, emotion recognition, motor imagery classification, abnormal signal detection, and drug effect prediction. Importantly, the model demonstrates strong cross-species and cross-subject generalization, maintaining high accuracy on both human and murine EEG datasets.
Tags
Links
- Source: https://arxiv.org/abs/2603.16739v1
- Canonical: https://arxiv.org/abs/2603.16739v1
Trouble viewing inline? Open PDF directly â
Full Text
94,887 characters extracted from source content.
Expand or collapse full text
SpecMoE: Spectral Mixture-of-Experts Foundation Model for Cross-Species EEG Decoding Davy Darankoum 1,2 , ChloĂ© Habermacher 2 , Julien Volle 2 * (), and Sergei Grudinin 1 * () 1 University Grenoble Alpes, LJK, 38000 Grenoble, France 2 SynapCell SAS, ZAC ISIPARC, 38330 Saint-Ismier, France * These authors jointly supervised the work. jvolle@synapcell.fr sergei.grudinin@univ-grenoble-alpes.fr Abstract. Decoding the orchestration of neural activity in electroencephalography (EEG) signals is a central challenge in bridging neuroscience with artificial intelligence. Founda- tion models have made strides in generalized EEG decoding, yet many existing frameworks primarily relying on separate temporal and spectral masking of raw signals during self- supervised pretraining. Such strategies often tend to bias learning toward high-frequency oscillations, as low-frequency rhythmic patterns can be easily inferred from the unmasked signal. We introduce a foundation model that utilizes a novel Gaussian-smoothed masking scheme applied to short-time Fourier transform (STFT) maps. By jointly applying time, frequency, and time-frequency Gaussian masks, we make the reconstruction task much more chal- lenging, forcing the model to learn intricate neural patterns across both high- and low- frequency domains. To effectively recover signals under this aggressive masking strategy, we design SpecHi-Net, a U-shaped hierarchical architecture with multiple encoding and decod- ing stages. To accelerate large-scale pretraining, we partition the data into three subsets, each used to train an independent expert model. We then combine these models through SpecMoE, a mixture of experts framework guided by a learned spectral gating mechanism. SpecMoE achieves state-of-the-art performance across a diverse set of EEG decoding tasks, including sleep staging, emotion recognition, motor imagery classification, abnormal signal detection, and drug effect prediction. Importantly, the model demonstrates strong cross- species and cross-subject generalization, maintaining high accuracy on both human and murine EEG datasets. These findings suggest that spectral-aware Gaussian-smoothed mask- ing combined with hierarchical feature integration provides a powerful inductive bias for next-generation EEG foundation models and brainâcomputer interface systems. Keywords: EEG Foundation Models· Mixture of Experts· Self-Supervised Learning· Time-Frequency Masking· Cross-Species Neural Decoding. 1 Introduction Electroencephalography (EEG) remains the primary non-invasive gateway to understanding human cortical dynamics, offering superior temporal resolution for clinical diagnostics and Brain-Computer Interface (BCI) development. However, the inherent challenges of EEG: high non-stationarity, low signal-to-noise ratio, and significant inter-subject variability, have historically confined decoding models to narrow, task-specific applications. The emergence of EEG foundation models has recently shifted the decoding paradigm to- ward large-scale self-supervised pretraining [1,2,3]. By leveraging masked signal reconstruction, these models learn generalized representations across massive unlabeled datasets. However, cur- rent frameworks predominantly apply rectangular masks to raw temporal or spectral data inde- pendently. This approach suffers from two critical flaws. First, sharp masking boundaries introduce high-frequency edge artifacts that bias the model toward "discontinuity recovery" in addition to endogenous neural features. In the context of EEG, this is particularly problematic, as neural oscillations are fundamentally smooth and rhythmic. Forcing the model to reconstruct artificial transients at every mask boundary acts as a spectral interference, diverting a portion of the opti- mization process away from the underlying neural manifold. Second, standard masking strategies are susceptible to information leakage in the low-frequency domain. Because these slow oscilla- tions span across long temporal windows, the model can straightforwardly infer the low-frequency arXiv:2603.16739v1 [cs.LG] 17 Mar 2026 2D. Darankoum et al. 05101520 10 0 05101520 0.25 0 0.25 05101520 10 0 05101520 0.2 0 0.2 05101520 1 0 1 05101520 0 0.05 Our masking strategyRaw EEG signals Previous masking strategies Fig. 1. Left: previous masking strategies, where rectangular masks remove some time frames. Middle: original EEG signals. Right: proposed Gaussian masks remove some frequency oscillations (mostly low frequencies) in addition to certain time frames. The horizontal axis represents time in seconds, and the vertical axis is voltage in ÎŒV. patterns from the unmasked EEG segments. Consequently, the pretraining task becomes trivial in the lower bands, preventing foundation models from grasping the critical long-range rhythmic structures that characterize many cognitive and pathological states. To address these limitations, we introduce SpecMoE, a spectral-anchored foundation model. Unlike previous methods, SpecMoE operates in the time-frequency domain using a novel Gaussian- smoothed masking strategy on short-time Fourier transform (STFT) spectrograms (see Fig. 1 for a comparison with other masking strategies). By replacing sharp boundaries with smooth tran- sitions, we eliminate the bias toward non-physiological transients, ensuring that the optimization process remains focused on physiological neural rhythms. Furthermore, our joint time and fre- quency masking geometry, where specific frequency bands are masked over the entire duration of the EEG segment, prevents any low-frequency leakage between the masked and remaining signals. Such masking geometry forces the model to learn the complex long-range dependencies of the neural manifold rather than relying on simple interpolation. To effectively recover signals under this more challenging masking regime, we design SpecHi-Net, a U-shaped hierarchical architecture. By utilizing multiple encoding and decoding stages, SpecHi-Net captures multi-scale temporal and spectral features, providing the structural depth necessary for high-fidelity reconstruction where shallower, non-hierarchical transformers typically fail. Finally, to improve domain-specific adap- tation on downstream applications, we propose a Spectral-guided Mixture of Experts (SpecMoE) framework. Governed by a learned spectral gating mechanism that routes information based on the signalâs Power Spectral Density (PSD), our model dynamically weights expert contributions to match the rhythmic content of the task at hand. This approach enables state-of-the-art perfor- mance and robust cross-species generalization across nine heterogeneous benchmarks. In summary, our work comprises the following main contributions: â A novel Gaussian-smoothed masking strategy for self-supervised pretraining â An architecture with emphasis on multi-level encoder-decoder (SpecHi-Net) â A novel spectral gating mechanism for a Mixture of Experts framework â A novel cross-species validation approach for EEG foundation models The code and pretrained models are available at https://github.com/TeraXj78/SpecMoE. 2 Related Work Recent Evaluations EEG-FM-Bench is a recent comprehensive resource that compares founda- tion EEG models on 14 open-source datasets across 10 common EEG paradigms [4]. According to the benchmark, EEGPT [5] and CBraMod [6] are the top-performing models, being both compact and effective. The authors also emphasize the importance of fine-tuning with all parameters from the pretrained weights, and critically evaluate single-task versus multi-task fine-tuning objectives. Liu et al. [3] recently provided another evaluation of 12 open-source foundation models and com- petitive task-specific baselines across 13 EEG datasets spanning nine BCI paradigms. They also concluded that full-parameter fine-tuning is beneficial and noted that task-specific models can still be competitive. Overall, CBraMod [6] was again the top-performing foundation model in this study, while EEGNet [7] demonstrated the best performance among task-specific models. Brain4FMs [2] and Kuruppu et al. [1] are yet another recent attempts to benchmark foundation models, but they EEG Foundation Model - SpecMoE3 did not include some state-of-the-art approaches, e.g., CSBrain. Interestingly, the event-related potential (ERP) benchmark revealed that the EEG foundation models do not outperform the su- pervised task-specific baselines in ERP tasks [8], where EEGConformer [9] achieved the highest accuracy for ERP classification. Task-Specific and Foundation Models Despite the emergence of foundation EEG models, smaller, task-specific architectures continue to serve as strong baselines. For instance, EEGNet [7] is a lightweight CNN-based model that utilizes depthwise and separable convolutions to extract robust features. FFCL [10] combines parallel CNN and LSTM branches, allowing CNNs to extract spatial features while LSTMs capture temporal dynamics. The features from these multiple branches are then fused using a fully connected layer. Another notable task-specific baseline is EEGConformer [9], which employs self-attention mechanisms to capture long-range temporal dependencies and global contextual information. LaBraM [11] is one of the pioneering EEG foundation models, pre-trained on 2,500 hours of data using vector quantized variational autoencoders for dual frequency-phase mask learning. CBraMod [6] introduces criss-cross attention to separately capture spatial and temporal features within the same transformer layer, enhancing its representational capabilities. CSBrain [12] builds upon CBraMod and incorporates cross-scale spatiotemporal tokenization along with structured sparse attention to create robust EEG representations. A novel decoder-centric paradigm, inspired by developments in large language models (LLMs), was introduced in ECHO [13]. LEAD [14] uses separate temporal and spatial attentions followed by a learnable gating fusion. During pretraining, it employs one of five augmentation strategies, including individual temporal, frequency, or channel masking. REVE [15] introduced 4D spatial-temporal positional encoding with massive-scale pre- training. Similarly, DeeperBrain [16] leverages the spatial and temporal organization of the data by modeling 3D electrode geometry and a learnable spatial decay kernel. It also introduces neu- rodynamics statistics learning during pretraining. UNI-NTFM [17] is currently the largest EEG foundation model, featuring up to 1.9 billion parameters. It encodes time, frequency, and raw sig- nal representations separately, followed by cross-attention. Additionally, it introduces spatial priors into input features and optimizes fine-tuning using a mixture-of-experts neural transformer. The most popular pretraining objective comprises randomly masked time-domain signal re- construction [3]. Yet, classical BrainBERT [18] and BrainWave [19] approaches are pretrained on masked STFT spectrograms, while BioCodec [20] employs an STFT-based spectral loss computed at multiple scales, EEGFormer [21] reconstructs spectral amplitudes, and ALFEE [22] reconstructs the PSD. Notably, TFM-Tokenizer [23] introduces an explicit dual-path time-frequency rectangu- lar masking objective to disentangle temporal and spectral motifs, encouraging the model to learn frequency-specific patterns across time. The Mixture of Experts (MoE) framework is gaining traction in EEG foundation models. The MGEC model [24] combines shared and routed experts, and incorporates a MoE architecture for the latter. UNI-NTFM [17] also applies the MoE concept during fine-tuning optimization. Additionally, BrainMoE [25] seeks to develop a channel-wise MoE structure. 3 SpecMoE Framework Pretraining Design SpecMoE pretraining (Fig. 2) follows a self-supervised generative paradigm designed to reconstruct signals from spectral-temporal corruption. The pretraining pipeline is struc- tured into three phases: EEG signal corruption, latent space learning, and multi-scale signal re- construction. Phase I: EEG Signal Corruption. The input xâ R CĂL , where C denotes the number of recording channels and L denotes the sequence length (total number of time steps), is first projected into the time-frequency domain via an STFT, yielding the complex-valued representation z â C CĂFĂT . Here, F and T represent the frequency bins and temporal frames, respectively. We then apply a proposed Gaussian-smoothedmaskingstrategy to z, designed to prevent spectral leakage and preserve low-frequency physiological rhythms. The corrupted temporal signal Ë x â R CĂL is subse- quently recovered through an inverse STFT (iSTFT), serving as the input for the neural backbone. 4D. Darankoum et al. Skip Skip Skip Concat on Sequence dim Split on Sequence dim Concat on Hidden dim Expert 1Expert 2Expert 3 PSD O 1 O 2 O 3 PSD Gating MLP Prediction Down 2 Small k Down 2 Large k Global Transformer Down 3 Small k Down 3 Large k Down 1 Small k Down 1 Large k B C Aux Loss 1 Aux Loss 2 Up 2 Small k Up 2 Large k Global Transformer Up 1 Small k Up 1 Large k Up 3 Small k Up 3 Large k ... Reconstructed EEG Reconstructed EEG Main Loss 1 Main Loss 2 ... DE ... Raw EEG signals STFT Gaussian masking Corrupted Raw EEG ... A Global Transformer Bottom 1 Bottom 2 Fig. 2. SpecMoE overview. A) Gaussian-based masking pipeline. B) Hierarchical encoder, with âkâ standing for âkernelâ. C) Hierarchical decoder. D) Reconstruction objective. E) Fine-tuning pipeline. Phase I: Hierarchical Latent Space Encoding. The corrupted signal Ë x is processed bySpecHi-Net, aSpectral-HierarchicalNetwork that adopts a U-Net-like hierarchical structure to enable multi- scale feature extraction and high-fidelity signal recovery. The encoder of SpecHi-Net consists of three successive downsampling stages (Down 1 , Down 2 , and Down 3 ), each employing a dual-path convolutionalencoder to capture simultaneously transient micro-states and long-range oscillatory patterns. To capture global dependencies across channels, these convolutional features are inter- leaved withGlobalTransformer layers utilizing Rotary Positional Encodings (RoPE) [26]. We specifically do not encode channel absolute positions, processing them equally by the architecture, which ensures its channel-size invariance. Phase I: Multi-Scale EEG signal Reconstruction. The symmetric decoder of SpecHi-Net inte- grates the latent representations learned by the encoder, through a series of upsampling stages (Up 1 , Up 2 , and Up 3 ) and skip-connections. To enforce structural and physiological consistency, the decoder generates reconstructions at multiple levels of granularity: one intermediate signal reconstructed after Up 1 layer (interm-x 1 ), a second intermediate signal reconstructed after Up 2 layer (interm-x 2 ) and finally two reconstructions from Up 3 outputs ( Ì x 1 , Ì x 2 ). The entire system is optimized via a multi-objectivelossfunction that minimizes error in both the temporal and spectral domains. Gaussian-Smoothed Masking Strategy To compel SpecHi-Net to learn the intrinsic spectral- temporal dynamics of neural signals, we propose a novel Gaussian-smoothedmaskingstrategy applied in the time-frequency domain. Unlike traditional temporal masking, which creates sharp discontinuities and high-frequency edge artifacts, our approach utilizes STFT coefficients to apply "soft" masks that respect the biological rhythmic structures of the EEG (see Fig. 1). Given an input EEG signal xâ R CĂL , we first compute its STFT representation zâ C CĂFĂT , where F and T denote the frequency and time-frame dimensions, respectively. We define a 2D mask map M(f,t) â [0, 1] FĂT , initialized as a matrix of ones. We iteratively subtract Gaussian kernels from x until a target mask ratio Ï = 0.5 is reached. A single Gaussian kernel G(f,t) centered at coordinates (f 0 ,t 0 ) is defined as: G(f,t) = exp â (f â f 0 ) 2 2Ï 2 f ! exp â (tâ t 0 ) 2 2Ï 2 t ,(1) EEG Foundation Model - SpecMoE5 where we set parameters Ï f and Ï t to 5% of the total range of the frequency domain F and time domain T, respectively. The mask map is updated via: M(f,t)âM(f,t)· (1â G(f,t)).(2) The same mask M is applied to all the channels C of the STFT representation z. Finally, the masked signal Ë x is generated via the inverse STFT: Ë x = iSTFT(zâM).(3) Multi-Type Masking Strategy We simultaneously employ three distinct masking geometries governed by a probability distribution P = [0.6, 0.3, 0.1] for frequency, time, and joint time- frequency masking, respectively: Frequency Masking (Ï t â â): This mode obscures specific spectral bands across the entire tem- poral window, compelling SpecHi-Net to reconstruct frequency-domain information from broader cross-temporal correlations. By extending the mask across the full duration of the segment, we effectively eliminate spectral information leakage; since a masked frequency bin is unavailable at any time point, the network is forced to learn the underlying physiological dependencies between different neural oscillations. Time Masking (Ï f â â): This mode removes contiguous temporal segments across the entire spectrum. By obscuring all frequency components for a given time frame, the strategy forces the model to capture the long-range temporal dynamics of the signal. SpecHi-Net must therefore learn to interpolate transient neural events by leveraging the temporal continuity and phase consistency of the preceding and succeeding spectral contexts. Joint Time-Frequency Masking: This mode utilizes localized 2D Gaussian "blobs" to obscure spe- cific regions in the time-frequency plane. Unlike the previous modes, this geometry targets discrete neuro-spectral events. By masking localized clusters of energy, it challenges the model to perform joint spectral-temporal inference, reconstructing the missing information by simultaneously utiliz- ing neighboring frequency bands and adjacent time steps. This simulates the recovery of obscured biological biomarkers while promoting a robust, multi-dimensional latent representation. Spectral-Band Bias A critical innovation of SpecMoE is the band-informedbias. During the selection of frequency centers f 0 , we specifically constrain 50% of the masks to correspond to the primary EEG physiological bands: ÎŽ (1â4 Hz), Ξ (4â8 Hz), α (8â12 Hz), and ÎČ (12â30 Hz). By prioritizing the masking of these low-frequency rhythmic structures, which are often not targeted in previous masking strategies, we ensure that our model develops a high-fidelity understanding of a broad range of clinically relevant biomarkers. Hierarchical Dual-Path Convolutional Encoder To address the multi-scale nature of EEG signals, SpecHi-Net utilizes a hierarchical encoder composed of three primary levels (Down 1 , Down 2 , and Down 3 ). Following previous works [27,28], each stage features a dual-path archi- tecture: one path employs small-kernel convolutions for transient detection, while the parallel path utilizes large-kernel, dilated convolutions to capture long-range rhythmic structures. This design ensures that both localized micro-states and global oscillatory patterns are encoded into the latent space. Interleaved Global Transformer We inserted three transformer layers interleaved at hierar- chical transitions and within the architectural bottleneck (Bottom 1 and Bottom 2 ) utilizing Multi- Head Attention (MHA). To ensure the learned representations remain robust to the varying se- quence lengths encountered across diverse downstream tasks, we adopt Rotary Positional Encodings (RoPE) [26]. We strategically selected RoPE over more traditional absolute positional embeddings. Indeed, it allows the model to maintain temporal consistency across the 1s to 60s windows found 6D. Darankoum et al. in our downstream datasets and ensures resolution invariance as the signal is compressed through the hierarchy of SpecHi-Net. A distinguishing feature of our transformer implementation is the processing of the dual-path encoder outputs. Before entering the attention blocks, the feature maps from the short-range and long-range convolutional paths are flattened and concatenated along the temporal dimension. This operation enables the transformer to: (1)Learncross-featurerelationships: By observing features from both small (k = 4) and wide (k = 65) kernels simultaneously, the model can learn how localized transients (e.g., spikes) correlate with broader rhythmic oscillations (e.g., slow waves). (2)Captureglobaldependencies: Operating on the flattened channel-time representation allows the model to integrate context across the entire electrode manifold. Since the Gaussian mask is applied uniformly across all channels, this architecture compels the model to reconstruct obscured spectral-temporal regions by modeling the complex oscillations inherent in large-scale brain networks rather than relying on local temporal redundancies. Multi-Objective Loss Design To ensure that SpecHi-Net captures both the high-fidelity tempo- ral morphology and the essential spectral characteristics of EEG signals, we optimize the framework using a composite loss function L total . This function integrates multi-scale temporal reconstruc- tion errors with a channel-wise spectral penalty. For any predicted signal p and its corresponding ground truth y, we define a base composite loss L(p,y) that balances time-domain mean squared error (MSE) with frequency-domain consistency: L(p,y) = MSE(p,y) + w spec L spec (p,y),(4) where w spec = 0.02 to reach the same order of magnitude as the temporal loss. We designed the spectral loss component L spec with a specific goal to be sensitive to the reconstructed signal amplitudes |STFT(p c )| but not the phases, L spec (p,y) = 1 C C X c=1 (|STFT(p c )|â|STFT(y c )|) 2 .(5) This spectral regularizer ensures that the model preserves the biological power distribution across frequency bands, even when temporal alignments are subtly shifted. To facilitate stable training and enforce structural consistency across the hierarchical depth of the decoder, we utilize multi- level supervision. The total loss L total combines the primary dual-path reconstruction losses with intermediate auxiliary losses: L total = X iâ1,2 L( Ì x i ,x) + X jâ1,2 α j L(interm-x j ,xâ),(6) where Ì x 1 and Ì x 2 are the final outputs from Up 3 , interm-x 1 is the intermediate output from Up 1 and interm-x 2 is the intermediate output from Up 2 . For auxiliary supervision, the ground truth x is dynamically downsampled via a linear interpolation (xâ) to match the specific temporal resolution of the intermediate decoder stages. The auxiliary weights are set to α 1 = 0.2 and α 2 = 0.3 to prioritize the final high-resolution reconstruction while providing sufficient gradient guidance to the lower hierarchical layers. Fine-Tuning Design: The Spectral Mixture of Experts Once the SpecHi-Net backbones are pretrained, they are transitioned into a Spectral Mixture of Experts (SpecMoE) framework for downstream fine-tuning. This architecture enables the model to dynamically weight representations from multiple foundation models based on the spectral characteristics of the input signal. Fine-Tuning Pipeline The fine-tuning pipeline transforms a raw EEG segment x â R CĂL into a task-specific prediction through four primary stages: (1)ParallelExpertEncoding: the input x is processed by three pretrained SpecHi-Net encoders (referred to as Experts E 1 , E 2 , and E 3 ) in parallel. Each expert produces a high-level embedding O i â R CĂD , where C is the channel dimension and D the embedding dimension.(2)SpectralGating: simultaneously, the Power EEG Foundation Model - SpecMoE7 Spectral Density (PSD) of the raw input x is computed to generate a gating signal. This signal determines the relevance of each expertâs features based on the inputâs rhythmic content.(3)Gated Fusion: the expert embeddings are modulated by their respective spectral gates and concatenated to form a unified representation outâ R CĂ3D . (4)HierarchicalPoolingandPrediction: the fused features undergo a pooling process on the spatial dimension before being passed to an MLP-based predictor for the final classification or regression task. Pretrained Experts We employ three distinct SpecHi-Net instances as our experts. Each expert develops complementary feature representations due to training on different data partitions with independent random masking seeds. During the initial phase of fine-tuning, these SpecHi-Net encoders can be either "frozen" to preserve the learned foundation features or "unfrozen" for task- specific adaptation. Each expert specializes in different aspects of the signal due to the stochastic nature of the pretraining masking process, providing the ensemble with a diverse set of perspectives on the neural data. Spectral Gating The core innovation of the fine-tuning framework is the spectralgatingmechanism. Unlike traditional MoE models that use a learned router on latent features, SpecMoE utilizes the frequency information of the signal. We compute the Power Spectral Density PSD x â R CĂK (where K is the frequency dimension) using a differentiable Welchâs method. This provides a clear finger- print of the signalâs frequency distribution. For each expert E i , a gating tensor G i is generated through a linear transformation of PSD x followed by a sigmoid activation: G i = Ï(W i · PSD x + b i ).(7) These gates act as specific masks over the expert embeddings, amplifying or suppressing features based on whether the input signalâs spectral profile matches the expertâs learned "specialization". Predictor and Loss Functions Following gated fusion, the representation is regularized through a spatial pooling layer across the channel dimension C. This yields a compact vector h â R 3D representing the global state of the EEG segment. The final Predictor is a Multi-Layer Perceptron (MLP) with layer normalization and GELU activations. The framework is optimized based on the task: (1)Classification, optimized through a weighted cross-entropy loss to account for class imbalances when necessary.(2)Regression, optimized through Root Mean Squared Error (RMSE). 4 Experimental design Pretraining Dataset We pretrained SpecMoE on three subsets of the Temple University Hospi- tal EEG dataset (TUEG) [29], comprising approximately 27,000 hours of clinical recordings from 14,987 subjects. To ensure data quality and consistency, we follow established preprocessing pro- tocols for the EEG foundation models [11,6,12], resulting in a curated set of 1,109,545 30-second samples (â9,000 hours). We partitioned this corpus into three sequential subsets based on subject identifiers to prevent data leakage and facilitate parallel expert training. Detailed preprocessing steps, including channel selection, filtering criteria, and bad-sample removal thresholds, are pro- vided in the Supplementary Information (SI). Pretraining Implementation We trained each SpecHi-Net expert independently on an NVIDIA Tesla V100 4-GPU cluster. We utilized the AdamW optimizer with a cosine annealing learning rate scheduler to handle the large-scale self-supervised objective. Hyperparameter configurations, including learning rates, batch sizes, and hardware specifications, are detailed in the SI. Fine-Tuning Setup To comprehensively evaluate the generalizability of SpecMoE, we selected nine heterogeneous datasets representing distinct BCI paradigms and clinical diagnostics. These benchmarks cover a broad spectrum of neural activity, ranging from cognitive states and motor intent to drug-induced effects detection. A summary of the downstream tasks and their correspond- ing dataset characteristics is provided in Table 1. To maintain consistency with the pretraining 8D. Darankoum et al. Table 1. Summary of downstream EEG datasets and task specifications. Spec. are the species (H: Human, M: Murine), S.Freq is the sampling frequency, #Ch. is the number of channels, Len is the sample length, #Subj. is the number of subjects. TaskDatasetSpec. S.Freq #Ch. Len #Samples #Subj. Label Motor ImageryPhysioNet-MI H160 Hz 644s9,8371094-class Emotion Recognition SEED-VH 1000 Hz 621s117,744165-class Sleep StagingHMCH256 Hz430s 137,2431514-class Therapeutic AreaMACOM 1024 Hz 260s61,9003365-class Drug EffectDA-Pharmaco M 1000 Hz 560s2,800105-class Imagined SpeechBCIC2020-3H256 Hz 643s6,000155-class Abnormal Detection TUABH256 Hz 16 10s 409,4552,3832-class Seizure DetectionSienaH512 Hz 29 10s51,307142-class Vigilance Estimation SEED-VIGH200 Hz 178s20,35521continuous phase, we resampled all EEG signals to 200 Hz. While we maintain a standardized backbone, spe- cific artifact removal and segmenting procedures were tailored to the requirements of each task; detailed descriptions of these dataset-specific preprocessing pipelines are provided in the SI. We benchmark SpecMoE against two categories of models: task-specific architectures and state- of-the-art foundation models. Among task-specific architectures, we selected three widely recog- nized baselines: EEGNet [7], EEG-Conformer [9], and FFCL [10]. Regarding EEG foundation architectures, we selected three leading models: LaBraM [11], CBraMod [6], and CSBrain [12]. Detailed architectural differences are further discussed in the SI. We quantified the performance on classification tasks using balanced accuracy, weighted F1- score, weighted AUROC, and weighted AUPRC. For the vigilance estimation regression task, we report the coefficient of determination (R 2 ), root mean square error (RMSE), and the Pearson correlation coefficient (r). 5 Results Table 2 summarizes the performance of SpecMoE compared to the baselines. For the sake of read- ability, we only report the primary metric for each task here. Detailed results can be found in the SI. SpecMoE achieves thebestperformancein7outof9downstreamtasks, demonstrating robustness across diverse recording conditions, including transfer to murine EEG data not seen during pretraining. Our model exhibits its most significant gains in tasks characterized by complex spectral signatures and non-stationary dynamics. Notably, on the MACO and SIENA datasets, our model maintains a substantial performance lead over the second-best foundation models (CBraMod and CSBrain) by 7.2% and 9.9%, respectively. In the MACO dataset, the challenge lies in distin- guishing drug-induced modifications in murine brain activity across five classes (compounds from four therapeutic areas and solvents). In contrast, the SIENA dataset requires the identification of ictal (seizure) events against a background of interictal human EEG. The consistent efficacy of SpecMoE in these two distinct benchmarksâone pharmacological and one pathologicalâindicates that our architecture framework is uniquely capable of prioritizing the specific expert features rele- vant to either the spectral signatures of pharmaceutical interventions or the high-energy discharges characteristic of seizures. This competitive advantage is further highlighted in the DA-Pharmaco task, where SpecMoE achieves a balanced accuracy of 0.6229, surpassing the second-best model, EEGConformer, by 6%. This task requires the classification of five distinct dopaminergic compounds from multi-site murine EEG recordings. The success of SpecMoE here indicates that our architecture effectively decodes the complex neuro-spectral signatures and cross-regional dependencies induced by different dopaminergic modulators. Furthermore, in the vigilance estimation regression task (SEED-VIG), SpecMoE nearly halves the error rate of competing models, achieving an RMSE of 0.1522. This improvement underscores the utility of the SpecMoE architecture in tracking subtle oscillatory shifts that characterize transitions between alertness and drowsiness. A critical advantage of SpecMoE over recent transformer-based foundation models lies in its architectural flexibility. Many state-of-the-art models, such as CBraMod and CSBrain, rely on EEG Foundation Model - SpecMoE9 Table 2. Performance comparison on diverse EEG datasets. Balanced accuracy (â) is reported for classi- fication tasks, and RMSE (â) is reported for SEED-VIG. Each value reported corresponds to the average across 5 random seeds, along with their standard deviations. Bold indicates the best performance; underline indicates the second best. Task-Specific ModelsFoundation Models DatasetEEGNet EEGConf FFCL LaBraM CBramod CSBrain SpecMoE PhysioNet- MI 0.58140.6049 0.5726 0.61730.61740.63040.6444 ±0.0125 ±0.0104 ±0.0092 ±0.0122 ±0.0036 ±0.0090 ±0.0109 SEED-V 0.29610.3537 0.3641 0.39760.40910.41970.4033 ±0.0102 ±0.0112 ±0.0092 ±0.0138 ±0.0097 ±0.0033 ±0.0084 HMC 0.65340.7149 0.4427 0.72770.72690.73450.7479 ±0.0122 ±0.0086 ±0.0702 ±0.0101 ±0.0041 ±0.0047 ±0.0086 MACO 0.66590.6119 0.4325 0.6250.76450.6926 0.8527 ±0.0166 ±0.0217 ±0.0105 ±0.0272 ±0.0118 ±0.0117 ±0.0033 DA- Pharmaco 0.48160.55970.3074 0.46010.53440.4526 0.6229 ±0.0159 ±0.0345 ±0.0336 ±0.0487 ±0.021 ±0.0142 ±0.0231 BCIC2020-3 0.44130.4506 0.4678 0.50600.53730.6004 0.6262 ±0.0096 ±0.0133 ±0.0197 ±0.0155 ±0.0108 ±0.0187 ±0.0166 TUAB 0.76420.7758 0.7848 0.81400.7891 0.81720.7742 ±0.0036 ±0.0049 ±0.0038 ±0.0019 ±0.0030 ±0.0043 ±0.0069 SIENA 0.74870.7556 0.6616 0.70820.73170.76620.8655 ±0.0521 ±0.0210 ±0.0391 ±0.0329 ±0.0647 ±0.0471 ±0.0038 SEED-VIG (â) 0.28470.2829 0.2885 0.28710.30570.27740.1522 ±0.0076 ±0.0041 ±0.0093 ±0.0166 ±0.0027 ±0.0094 ±0.0029 position-specific or channel-dependent embeddings that scale linearly with input dimensions. For datasets like MACO and DA-Pharmaco, which feature long sequence lengths (60 secs) or non- standard channel configurations, the parameter counts of these models escalate significantlyâoften exceeding 20 million parameters. More details on the parameters count can be found in the SI. In contrast, SpecMoE utilizes RoPE and a hierarchical dual-path structure that are inherently invariant to sequence length and channel count. This allows SpecMoE to maintain a compact, standardized parameter footprint while delivering better accuracy, making it a more practical solution for real-world deployment across heterogeneous clinical environments and varying sensor montages. Ablation Studies To investigate the contribution of each component within the SpecMoE frame- work, we conducted a series of 6 ablation experiments across three representative datasets: BCIC2020- 3 (imagined speech), DA-Pharmaco (pharmacology), and PhysioNet-MI (motor imagery). All ab- lation studies were performed using 3 random seeds. Figure 3 illustrates the results. A fundamental premise of our pretraining is that neural oscillations are best captured through a multi-dimensional corruption process. Our ablation results confirm this assumption. Indeed, all single-type masking strategies consistently underperform compared to the mixed-geometry ap- proach. Training foundation models exclusively with time-only, frequency-only, or time-frequency- only masks results in a noticeable performance degradation across all benchmarks (see SI for the specific configuration of these single-type ablation experiments). For example, in the pharmacolog- ical task (Fig. 3 middle), the balanced accuracy drops from 0.6229 to 0.5794 (Time-only), 0.6137 (Freq-only), and 0.5777 (TF-only), indicating that a joint spectral-temporal objective is required to internalize the full complexity of EEG dynamics. Furthermore, replacing our Gaussian-smoothed masks with traditional rectangular masks (Non-Gaussian experiment) leads to a significant drop 10D. Darankoum et al. SpecMoE Time-only Freq-only TF-only Non- Gaussian Full mask+ CBramod Gating without PSD SpecMoE Time-only Freq-only TF-only Non- Gaussian Full mask+ CBramod Gating without PSD SpecMoE Time-only Freq-only TF-only Non- Gaussian Full mask+ CBramod Gating without PSD 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 Balanced Accuracy 62.62% -6.02% -0.68% -1.34% -21.99% -38.14% -9.17% BCIC2020-3 62.29% -4.35% -0.92% -4.52% -6.43% -9.73% -2.55% DA-Pharmaco 64.44% -2.03% -1.56% -2.51% -4.60% -23.33% -2.04% PhysioNet-MI Fig. 3. SpecMoE ablation results. We show the absolute value of the balanced accuracy for the SpecMoE model and relative differences for six ablation experiments. TF stands for time-frequency. See SI for other metrics. in accuracy. For example, the balanced accuracy drops by more than 20% in the imagined speech task (Fig. 3 left). A critical finding of our study is the performance gap observed when replacing our SpecHi-Net backbone with the CBraMod architecture within our MoE framework (Full mask+CBraMod). We specifically selected CBraMod as a baseline because its backbone represents the current stan- dard for high-performance, non-hierarchical EEG Transformersâan architecture it shares with CSBrain. By selecting CBraMod, we aimed to evaluate whether a competitive, flat transformer architecture could achieve performance parity with our model without the added complexity of the region-specific channel encoding layers found in CSBrain. Our goal was to isolate the impact of the hierarchical feature extraction process itself. On the BCIC2020-3 dataset, this swap results in a catastrophic performance collapse from 0.6262 to 0.2448 (Fig. 3 left). Finally, we assess the benefit of using power spectral density (PSD) as a gating signal compared to a standard learned input encoding network (Gating without PSD). Detailed architecture and training parameters for this alternative learned gating network are provided in the SI. Our results show that utilizing a raw-data-driven encoding network consistently underperforms compared to our spectral gating strategy. The difference is particularly striking on the imagined speech task (Fig. 3 left). 6 Conclusion In this work, we introduced SpecMoE, a spectral-anchored foundation model that utilizes a novel Gaussian-smoothed masking strategy to mitigate the "artificial transient" bias common in rectan- gular masking. By shifting the pretraining objective toward the reconstruction of smooth, endoge- nous neural rhythms, our framework develops a more physiologically grounded representation of EEG dynamics. Across nine heterogeneous datasets, SpecMoE achieves competitive performance, establishing a new baseline for several benchmarks. SpecMoEâs success on both human and murine recordings highlights that the representations learned from human EEG transfer effectively to murine data after fine-tuning, suggesting shared spectral-temporal structure across species. Abla- tion studies indicate that the hierarchical SpecHi-Net architecture is instrumental for high-fidelity signal recovery in complex tasks, while the spectral-guided mixture-of-experts framework enables structured feature integration based on input rhythmic content. Together, these components pro- vide a robust inductive bias for the next generation of universal EEG foundation models. Limitations Despite state-of-the-art results, our work has several limitations that provide av- enues for future research. First, the requirement for full-parameter fine-tuning to achieve optimal performance on downstream tasks indicates that, while SpecMoE learns robust representations, a "zero-shot" universal EEG foundation model remains an open challenge. Second, while our mixed Gaussian masking strategy effectively mitigates boundary artifacts, we have not yet ex- plored the impact of varying masking ratios; the current 50% ratio selected following previous EEG Foundation Model - SpecMoE11 studies in EEG foundation models may be suboptimal. Finally, the specialization of the experts within the MoE framework results from a stochastic data partitioning. Future work could investi- gate whether pretraining different experts using specific datasets from physiological domains such as sleep, pathology, or cognitive motor tasks would further enhance the efficiency of the spec- tral gating mechanism and therefore lead to better task predictions. The current choice of three experts reflects a practical trade-off: the TUEG corpus naturally partitions into three subsets of sufficient size (âŒ300kâ400k samples each) to train robust individual models, while keeping the total computational cost tractable. Ethical Considerations This work utilizes de-identified human and murine EEG data; all experi- mental protocols were approved by their respective Institutional Review Boards (IRB) or equivalent ethical committees. While SpecMoE is designed to advance clinical diagnostics and drug discovery, we acknowledge the inherent dual-use risks associated with high-capacity neural decoders, such as unauthorized cognitive surveillance. We strongly oppose any application of this technology that infringes upon cognitive liberty or is conducted without explicit informed consent. Furthermore, we emphasize that all automated assessments must undergo professional validation to mitigate risks from algorithmic bias and ensure patient safety across diverse populations. Acknowledgment This work was funded by SynapCell SAS through the Cortex project, awarded at the 9th edition of the i-Nov competition organized for French companies. This work was also granted access to the HPC resources of IDRIS under the allocation 2025-AD011016062R1 made by GENCI and the HPC ressources from GRICAD infrastructure which is supported by Grenoble research communities. References 1. Gayal Kuruppu, Neeraj Wagh, and Yogatheesan Varatharajah. EEG foundation models: A critical review of current progress and future directions. In NeurIPS2025WorkshoponFoundationModels fortheBrainandBody. 2. Fanqi Shen, Enhong Yang, Jiahe Li, Junru Hong, Xiaoran Pan, Zhizhang Yuan, Meng Li, and Yang Yang. Brain4FMs: A benchmark of foundation models for electrical brain signal.arXivpreprint arXiv:2602.11558, 2026. 3. Dingkun Liu, Yuheng Chen, Zhu Chen, Zhenyao Cui, Yaozhi Wen, Jiayu An, Jingwei Luo, and Don- grui Wu. EEG foundation models: Progresses, benchmarking, and open problems. arXivpreprint arXiv:2601.17883, 2026. 4. Wei Xiong, Jiangtong Li, Jie Li, Kun Zhu, and Changjun Jiang. EEG-FM-Bench: A comprehensive benchmark for the systematic evaluation of EEG foundation models.arXivpreprintarXiv:2508.17742, 2025. 5. Guangyu Wang, Wenchao Liu, Yuhong He, Cong Xu, Lin Ma, and Haifeng Li. EEGPT: Pretrained transformer for universal and reliable representation of EEG signals.AdvancesinNeuralInformation ProcessingSystems, 37:39249â39280, 2024. 6. Jiquan Wang, Sha Zhao, Zhiling Luo, Yangxuan Zhou, Haiteng Jiang, Shijian Li, Tao Li, and Gang Pan. CBraMod: A criss-cross brain foundation model for EEG decoding. InTheThirteenthInternational ConferenceonLearningRepresentations, 2025. 7. Vernon J Lawhern, Amelia J Solon, Nicholas R Waytowich, Stephen M Gordon, Chou P Hung, and Brent J Lance. EEGNet: a compact convolutional neural network for EEG-based brainâcomputer interfaces.J.NeuralEng., 15:056013, 2018. 8. Yihe Wang, Zhiqiao Kang, Bohan Chen, Yu Zhang, and Xiang Zhang. Benchmarking ERP analysis: Manual features, deep learning, and foundation models.arXivpreprintarXiv:2601.00573, 2026. 9. N Kasthuri, R Ramyea, VS Arunprasshath, S Abhineeth, and S Bharathraj. EEG conformer model based epileptic seizure prediction using deep learning. In 202415thInternationalConferenceon ComputingCommunicationandNetworkingTechnologies(ICCCNT), pages 1â7. IEEE, 2024. 10. Hongli Li, Man Ding, Ronghua Zhang, and Chunbo Xiu. Motor imagery EEG classification algorithm based on CNN-LSTM feature fusion network.Biomedicalsignalprocessingandcontrol, 72:103342, 2022. 11. Weibang Jiang, Liming Zhao, and Bao-liang Lu. Large brain model for learning generic represen- tations with tremendous EEG data in BCI. InTheTwelfthInternationalConferenceonLearning Representations, 2024. 12D. Darankoum et al. 12. Yuchen Zhou, Jiamin Wu, Zichen Ren, Zhouheng Yao, Weiheng Lu, Kunyu Peng, Qihao Zheng, Chun- feng Song, Wanli Ouyang, and Chao Gou. CSBrain: A cross-scale spatiotemporal brain foundation model for EEG decoding. TheThirty-ninthAnnualConferenceonNeuralInformationProcessing Systems-NeurIPS, 2025. 13. Chenyu Liu, Yuqiu Deng, Tianyu Liu, Jinan Zhou, Xinliang Zhou, Ziyu Jia, and Yi Ding. ECHO: Toward contextual seq2seq paradigms in large EEG models. arXivpreprintarXiv:2509.22556, 2025. 14. Yihe Wang, Nan Huang, Nadia Mammone, Marco Cecchi, and Xiang Zhang. LEAD: An EEG foun- dation model for Alzheimerâs disease detection.arXivpreprintarXiv:2502.01678, 2025. 15. Yassine El Ouahidi, Jonathan Lys, Philipp Thölke, Nicolas Farrugia, Bastien Pasdeloup, Vincent Gripon, Karim Jerbi, and Giulia Lioi. REVE: A foundation model for EEG-adapting to any setup with large-scale pretraining on 25,000 subjects. InTheThirty-ninthAnnualConferenceonNeural InformationProcessingSystems. 16. Jiquan Wang, Sha Zhao, Yangxuan Zhou, Yiming Kang, Shijian Li, and Gang Pan. DeeperBrain: A neuro-grounded EEG foundation model towards universal BCI.arXivpreprintarXiv:2601.06134, 2026. 17. Zhisheng Chen, Yingwei Zhang, Qizhen Lan, Tianyu Liu, Huacan Wang, Yi Ding, Ziyu Jia, Rong- hao Chen, Kun Wang, and Xinliang Zhou. Uni-NTFM: A unified foundation model for EEG signal representation learning. arXivpreprintarXiv:2509.24222, 2025. 18. Christopher Wang, Vighnesh Subramaniam, Adam Uri Yaari, Gabriel Kreiman, Boris Katz, Ignacio Cases, and Andrei Barbu. BrainBERT: Self-supervised representation learning for intracranial record- ings. In TheEleventhInternationalConferenceonLearningRepresentations, 2023. 19. Zhizhang Yuan, Fanqi Shen, Meng Li, Yuguo Yu, Chenhao Tan, and Yang Yang. BrainWave: A brain signal foundation model for clinical applications.arXivpreprintarXiv:2402.10251, 2024. 20. Kleanthis Avramidis, Tiantian Feng, Woojae Jeong, Jihwan Lee, Wenhui Cui, Richard M Leahy, and Shrikanth Narayanan. Neural codecs as biosignal tokenizers.arXivpreprintarXiv:2510.09095, 2025. 21. Zhijiang Wan, Manyu Li, Shichang Liu, Jiajin Huang, Hai Tan, and Wenfeng Duan. EEGformer: A transformerâbased brain activity classification method using EEG signal. Frontiersinneuroscience, 17:1148855, 2023. 22. Wei Xiong, Junming Lin, Jiangtong Li, Jie Li, and Changjun Jiang. ALFEE: Adaptive large foundation model for EEG representation. arXivpreprintarXiv:2505.06291, 2025. 23. Jathurshan Pradeepkumar, Xihao Piao, Zheng Chen, and Jimeng Sun. Tokenizing single-channel EEG with time-frequency motif learning.arXivpreprintarXiv:2502.16060, 2025. 24. Zhi Zhang, Yan Liu, Zhejing Hu, Gong Chen, Jiannong Cao, Shenghua Zhong, Sean Fontaine, Changhong Jing, and Shuqiang Wang. Mutual-guided expert collaboration for cross-subject EEG classification.arXivpreprintarXiv:2602.01728, 2026. 25. Fan Ma, Mingyang Jiang, Lingfei Qian, Zhiling Gu, and Hua Xu. BrainMoE: Towards universal EEG foundation models with channel-wise mixture-of-experts. 26. Jianlin Su, Murtadha Ahmed, Yu Lu, Shengfeng Pan, Wen Bo, and Yunfeng Liu. Roformer: Enhanced transformer with rotary position embedding.Neurocomputing, 568:127063, 2024. 27. Davy Darankoum, ChloĂ© Habermacher, Julien Volle, and Sergei Grudinin. CoSupFormer: A contrastive supervised learning approach for EEG signal classification.arXivpreprintarXiv:2509.20489, 2025. 28. Emadeldeen Eldele, Zhenghua Chen, Chengyu Liu, Min Wu, Chee-Keong Kwoh, Xiaoli Li, and Cuntai Guan. An attention-based deep learning approach for sleep stage classification with single-channel EEG.IEEETrans.NeuralSyst.Rehabil.Eng., 29:809â818, 2021. 29. Iyad Obeid and Joseph Picone. The temple university hospital EEG data corpus.Frontiersin neuroscience, 10:196, 2016. 30. Gerwin Schalk, Dennis J McFarland, Thilo Hinterberger, Niels Birbaumer, and Jonathan R Wolpaw. Bci2000: a general-purpose brain-computer interface (bci) system. IEEETransactionsonbiomedical engineering, 51(6):1034â1043, 2004. 31. Wei Liu, Jie-Lin Qiu, Wei-Long Zheng, and Bao-Liang Lu. Comparing recognition performance and robustness of multimodal deep learning models for multimodal emotion recognition.IEEETransactions onCognitiveandDevelopmentalSystems, 2021. 32. Diego Alvarez-Estevez and Roselyne Rijsman. Haaglanden Medisch Centrum sleep staging database. PhysioNet, March 2022. Version 1.1. 33. Sampath KT Kapanaiah, Holger Rosenbrock, Bastian Hengerer, and Dennis KĂ€tzel. Neural effects of dopaminergic compounds revealed by multi-site electrophysiology and interpretable machine-learning. Frontiersinpharmacology, 15:1412725, 2024. 34. Ji-Hoon Jeong, Jeong-Hyun Cho, Young-Eun Lee, Seo-Hyun Lee, Gi-Hwan Shin, Young-Seok Kweon, JosĂ© del R MillĂĄn, Klaus-Robert MĂŒller, and Seong-Whan Lee. 2020 international brainâcomputer interface competition: A review. Frontiersinhumanneuroscience, 16:898300, 2022. 35. Paolo Detti. Siena Scalp EEG Database.PhysioNet, August 2020. Version 1.0.0. 36. Wei-Long Zheng and Bao-Liang Lu. A multimodal approach to estimating vigilance using EEG and forehead EOG.JournalofNeuralEngineering, 14(2):026017, 2017. EEG Foundation Model - SpecMoE13 Supplementary Information A Pretraining Setup A.1 Pretraining Dataset and Preprocessing Dataset Description We pretrained SpecMoE on 3 subsets of the large Temple University Hos- pital EEG dataset [29] (TUEG). The TUEG dataset comprises a diverse archive of 69,652 clinical EEG recordings from 14,987 subjects across 26,846 sessions, totaling 27,062 hours in duration. The archive features over 40 different channel configurations and recordings of varying durations. Most of the recordings are sampled at 256 Hz. Unfortunately, the TUEG dataset suffers from significant data contamination, including a substantial amount of unmarked noise, artifacts, and faulty channels. To homogenize the pretraining process and reduce the dataset inconsistencies, we preprocessed it following previous studies on EEG foundation models. These include LaBraM [11], CBraMod [6], and CSBrain [12]. Preprocessing To begin with, we remove recordings that have a total duration of less than 5 minutes. Next, we discard the first and last minute of each recording to eliminate as much low- quality data as possible. We then select 19 common EEG channels (Fp1, Fp2, F7, F3, Fz, F4, F8, T3, C3, Cz, C4, T4, T5, P3, Pz, P4, T6, O1, O2) that comply with a subset of the 10-20 international electrode placement system standards. This ensures that we obtain clean and uniformly formatted pre-training data. Afterward, we apply a band-pass filter (0.3 Hzâ75 Hz) to eliminate low-frequency and high- frequency noise. Additionally, a notch filter (60 Hz) is utilized to remove power line noise. All EEG signals are resampled to 200 Hz and segmented into non-overlapping 30-second EEG samples. However, the preprocessing steps mentioned above may not completely resolve the quality issues present in the EEG data. To further enhance the quality, we implement an automated scheme for the removal of bad EEG samples. Specifically, we identify samples as bad if any data point exceeds an absolute amplitude of 100ÎŒV and remove these from the dataset. We also normalize the EEG signals by scaling the units to 100ÎŒV, ensuring that the values predominantly range between -1 and 1, in line with previous work on EEG foundation models (LaBraM [11], CBraMod [6], CSBrain[12]). After removing bad samples, we are left with 1,109,545 remaining 30-second segments, totaling 9,000 hours of data. Finally, we divide the preprocessed samples into three subsets. Subset-1 contains samples 1 to 400,000, subset-2 consists of samples 400,001 to 800,000, and subset-3 includes the remaining samples from 800,001 to 1,109,545. This sequential splitting strategy is based on the hierarchical storage structure of the corpus, where patients are organized into folders according to randomized database identifiers. This ensures that each subset represents a diverse and unbiased cross-section of the 14,987 unique subjects. Furthermore, considering the large number of samples per subset and the relatively low average number of sessions per patient (1.79), this approach effectively minimizes the risk of data leakage between the three training partitions. Computational Details and Hyperparameters SpecMoE was implemented using the PyTorch framework (v2.6.0) and trained in a high-performance computing environment. To develop the three specialized experts within our foundation ensemble, each model was trained independently on one of the three TUEG subsets described in Section 4.1.2. The hardware configuration consisted of 4 NVIDIA Tesla V100-SXM2-32GB GPUs operating in parallel. Each pretraining session spanned approximately 200 hours to complete 50 epochs. We utilized the AdamW optimizer with an initial learning rate of 1Ă10 â3 and a weight decay coefficient of 5Ă10 â2 . To ensure stable convergence, we employed a CosineAnnealingLR scheduler. The effective batch size was set to 256 samples, achieved through a distributed strategy of 64 samples across the 4 GPUs with 4 gradient accumulation steps. Signal processing and data management were supported by NumPy (v2.3.3) and SciPy (v1.16.2) within a Python 3.12.8 environment. All computations were executed using CUDA 12.4 to leverage hardware acceleration. Table S1 lists the hyperparameters used for the pretraining phase. 14D. Darankoum et al. Table S1. Hyperparameters for SpecMoE pre-training. CategorySetting Input EEG Data Channels (C)19 Sampling Frequency200 Hz Sample Duration (L)30s (6000 points) Amplitude NormalizationUnit 100 ÎŒV Signal Transformation (STFT) Window Typehann_periodic Window Length (n_fft)400 Hop Length (n_overlap)200 Frequency Bins (F)201 Time Frames (T)31 Gaussian Masking Total Mask Ratio (Ï)0.5 Geometries Probability (P)[Freq: 0.6, Time: 0.3, TF: 0.1] Kernel parameters (Ï f ,Ï t )5% of respective range Spectral-Band Bias50% on ÎŽ,Ξ,α,ÎČ bands SpecHi-Net Backbone Hierarchy Stages3 Downsampling / 3 Upsampling Dual-Path Kernels (k)Small: 4, Large: 65 Transformer Layers1 Attention Heads8 Hidden Dimension (D)128 Position EncodingRotary Positional Embedding (RoPE) Optimization Loss FunctionMulti-Objective (MSE + Spectral Loss) Spectral Loss Weight (w spec )0.02 Auxiliary Loss Weights (α 1 ,α 2 )0.2, 0.3 OptimizerAdamW Learning Rate 1Ă 10 â3 Weight Decay 5Ă 10 â2 SchedulerCosineAnnealingLR Batch Size256 (64 per GPU Ă 4 steps) Epochs50 Gradient Clipping5.0 B Details on Downstream Tasks B.1 Finetuning Settings Details Baselines â EEGNet: A compact, specialized CNN for EEG that utilizes depthwise and separable convo- lutions to extract robust features with a minimal parameter footprint [7]. Code available at: https://github.com/vlawhern/arl-eegmodels. â EEGConformer: A hybrid architecture that leverages CNNs for local feature extraction and Transformer blocks to capture long-range temporal dependencies [9]. Code available at: https: //github.com/eeyhsong/EEG-Conformer. â FFCL: A framework integrating parallel CNN and LSTM branches to fuse spatial and temporal dynamics through a shared fully connected layer [10]. We implemented the code ourselves, following the architecture design and the detailed hyperparameter description in the paper. â LaBraM: A unified foundation model that enables cross-dataset learning through neural chan- nel patching and a vector-quantized neural spectrum tokenizer. It utilizes a Transformer back- bone and dual-domain (frequency/phase) mask learning for large-scale pretraining [11]. Code available at: https://github.com/935963004/LaBraM/tree/main. EEG Foundation Model - SpecMoE15 â CBraMod: A foundation model featuring criss-cross attention to capture spatial and tempo- ral features separately, achieving efficient yet powerful representations [6]. Code available at: https://github.com/wjq-learning/CBraMod/tree/main. â CSBrain: A model employing cross-scale spatiotemporal tokenization and structured sparse attention to optimize robustness in EEG signal decoding [12]. Code available at: https:// github.com/yuchen2199/CSBrain/tree/main. Metrics Classification Metrics. For a given class c â 1,...,C, let TP c , TN c , FP c , and FN c represent the True Positives, True Negatives, False Positives, and False Negatives, respectively. We define the fundamental components for each class as: Precision c (P c ) = TP c TP c + FP c , Recall c (R c ) = TP c TP c + FN c .(8) Additionally, for threshold-based curves, we define the True Positive Rate (TPR = Recall) and the False Positive Rate (FPR = F P F P+T N ). Based on these, the following metrics are employed: â Balanced Accuracy: The arithmetic mean of class-specific Recall scores, which prevents inflated performance estimates on imbalanced datasets: Balanced Acc. = 1 C C X c=1 R c .(9) â Weighted F1-Score: The harmonic mean of Precision and Recall, weighted by the number of samples (N c ) in each class relative to the total samples (N total ): Weighted F1 = C X c=1 N c N total 2· P c · R c P c + R c .(10) â AUROC: The area under the curve obtained by plotting TPR against FPR at various decision thresholds: AUROC = Z 1 0 TPR(f )df, f = FPR.(11) â AUPRC: The area under the curve obtained by plotting Precision against Recall, providing a stringent assessment for minority class detection: AUPRC = Z 1 0 P (r)dr, r = Recall.(12) Regression Metrics (Vigilance Estimation). For the SEED-VIG dataset, let y i be the ground truth, Ëy i the predicted value, and Ìy the mean of the ground truth for n samples. â Pearson Correlation Coefficient (r): Measures the linear relationship between predicted and true labels: r = P n i=1 (y i â Ìy)(Ëyiâ Ì Ëy) q P i = 1 n (y i â Ìy) 2 P n i=1 (Ëy i â Ì Ëy) 2 .(13) â Coefficient of Determination (R 2 ): Represents the proportion of variance explained by the model: R 2 = 1â P n i=1 (y i â Ëy i ) 2 P n i=1 (y i â Ìy) 2 .(14) â Root Mean Square Error (RMSE): Quantifies the standard deviation of the prediction residuals: RMSE = v u u t 1 n n X i=1 (y i â Ëy i ) 2 .(15) 16D. Darankoum et al. Table S2. Hyperparameters for SpecMoE downstream finetuning. CategorySetting Architecture Setup Number of Experts3 (Pretrained SpecHi-Net encoders) Expert Backbone StateUnfrozen (Full-parameter finetuning) Embedding Dimension (D)128 (per expert) Fused Representation Dim384 (3Ă D) Spectral Gating (PSD) PSD MethodDifferentiable Welchâs method Gating Input Dim201 (Frequency Bins F) Gating ActivationSigmoid Downstream Predictor Spatial PoolingAverage pooling across channels MLP Layers2 (Linear â GELU â Linear) Dropout Rate0.2 Optimization Loss Function (Classification) Weighted Cross-Entropy Loss Function (Regression)Root Mean Square Error (RMSE) OptimizerAdam Learning Rate 1Ă 10 â3 Weight Decay 0 SchedulerReduceLROnPlateau Batch Size64 Max Epochs100 Hyperparameters In Table S2, we specify the default hyperparameter setup used for the fine- tuning tasks. Details on each dataset can be found in the code: https://github.com/TeraXj78/ SpecMoE. B.2 Motor Imagery Task The PhysioNet-MI dataset [30] serves as a large-scale benchmark for decoding motor intent, fea- turing 109 subjects performing four mental imagery tasks: left/right fist, both fists, and both feet. Data from 64 channels were resampled to 200 Hz and windowed into 4-second trials, totaling 9,837 samples. We evaluate the model using a strict subject-independent protocol, allocating subjects 1â70 for training, 71â89 for validation, and 90â109 for testing. As detailed in Table S3, foundation models demonstrate a clear advantage over task-specific baselines in generalizing across a diverse population. SpecMoE achieves the highest performance with a balanced accuracy of 0.6444 and a weighted F1-score of 0.6476. Notably, SpecMoE sur- passes the strongest foundation model baseline, CSBrain, by 1.40% in balanced accuracy and 1.68% in weighted F1. Compared to the best-performing task-specific model (EEGConformer), our framework yields a substantial improvement of 3.95% in accuracy. The results suggest that our spectral mixture-of-experts is effective at capturing the rhythmic signatures necessary for high- fidelity motor imagery classification across unseen subjects. B.3 Emotion Recognition Task SEED-V [31] is a benchmark dataset for EEG-based emotion recognition, featuring five emotional categories: happy, sad, neutral, disgust, and fear. EEG signals were collected from 16 subjects across three sessions using 62 channels at a sampling rate of 1000 Hz. Following standard preprocessing, the data was resampled to 200 Hz and segmented into 1-second windows, resulting in 117,744 samples. We employ a within-session split protocol, dividing the 15 trials of each session into three equal parts (5:5:5) for training, validation, and testing. As shown in Table S4, decoding high-granularity emotional states remains a significant chal- lenge for all architectures, with performance across the board generally lower than on simpler motor EEG Foundation Model - SpecMoE17 Table S3. Detailed performance comparison on the PhysioNet-MI motor imagery task. Values repre- sent the average and standard deviation across five random seeds. Bold indicates the best performance; underline indicates the second best. Task-Specific ModelsFoundation Models Sub-metric EEGNet EEGConf FFCL LaBraM CBramod CSBrain SpecMoE # Params â5.8 M34.2 M38.2 M4.3 M Bal. Acc Mean0.58140.60490.5726 0.61730.61740.63040.6444 Std Dev ±0.0125 ±0.0104 ±0.0092 ±0.0122 ±0.0036 ±0.0090 ±0.0109 Weighted F1 Mean0.57960.60620.5701 0.61770.61790.63080.6476 Std Dev ±0.0115 ±0.0095 ±0.0079 ±0.0141 ±0.0035 ±0.0095 ±0.0082 or clinical tasks. While SpecMoE does not achieve the top rank in this specific paradigm, it re- mains highly competitive with a balanced accuracy of 0.4033 and a weighted F1-score of 0.4142. Specifically, SpecMoE performs within a 1.64% margin of the state-of-the-art CSBrain and con- tinues to outperform earlier foundation models like LaBraM, as well as all task-specific baselines. These results suggest that while the spectral gating mechanism is effective, the extremely short 1-second temporal context of SEED-V may limit the full potential of hierarchical spectral modeling compared to datasets with longer rhythmic signatures. Table S4. Detailed performance comparison on the SEED-V emotion recognition task. Values repre- sent the average and standard deviation across five random seeds. Bold indicates the best performance; underline indicates the second best. Task-Specific ModelsFoundation Models Sub-metric EEGNet EEGConf FFCL LaBraM CBramod CSBrain SpecMoE # Params â5.8 M14.3 M18.3 M4.3 M Bal. Acc Mean0.29610.35370.3641 0.39760.40910.41970.4033 Std Dev ±0.0102 ±0.0112 ±0.0092 ±0.0138 ±0.0097 ±0.0033 ±0.0084 Weighted F1 Mean0.27490.34870.3645 0.39740.4101 0.42800.4142 Std Dev ±0.0098 ±0.0136 ±0.0132 ±0.0111 ±0.0108 ±0.0023 ±0.0091 B.4 Sleep Stages Classification Task The HMC (Haaglanden Medisch Centrum) dataset [32] is a standard benchmark for sleep stage scoring. It contains polysomnography (PSG) recordings from 151 subjects, from which we extract the EEG signals from four channels (F4-M1, C4-M1, O2-M1, and C3-M2). The task involves classifying 30-second epochs into five stages defined by the American Academy of Sleep Medicine manual: Wake (W), Non-REM 1 (N1), Non-REM 2 (N2), Non-REM 3 (N3), and REM (R). The signals were resampled to 200 Hz, consistent with our pretraining configuration. For this task, we followed the subject-independent split used in recent literature [12]. As shown in Table S5, SpecMoE achieves the highest balanced accuracy of 0.7479, surpassing the best foundation baseline, CSBrain (0.7345), by 1.34%. In terms of the weighted F1-score, SpecMoE (0.7503) remains highly competitive, performing on par with CSBrain (0.7506) within a negligible margin. Notably, all foundation models demonstrate a massive performance leap over the FFCL baseline, which struggled with the temporal complexity of sleep stages. The success of SpecMoE here is particularly meaningful; sleep stages are characterized by specific spectral land- marks like slow-wave delta activity, which our spectrally-anchored mixture-of-experts is designed to isolate and prioritize during the learning process. 18D. Darankoum et al. Table S5. Detailed performance comparison on the HMC sleep stages classification task. Values repre- sent the average and standard deviation across five random seeds. Bold indicates the best performance; underline indicates the second best. Task-Specific ModelsFoundation Models Sub-metric EEGNet EEGConf FFCL LaBraM CBramod CSBrain SpecMoE # Params â5.8 M20.3 M24.3 M4.3 M Bal. Acc Mean0.65340.71490.4427 0.72770.72690.73450.7479 Std Dev ±0.0122 ±0.0086 ±0.0702 ±0.0101 ±0.0041 ±0.0047 ±0.0086 Weighted F1 Mean0.65360.70800.2902 0.74540.7395 0.75060.7503 Std Dev ±0.0168 ±0.0039 ±0.0485 ±0.0027 ±0.0089 ±0.0042 ±0.0024 B.5 Drug Therapeutic Area Classification Task The MACO dataset is a large-scale, private repository designed to investigate the therapeutic po- tential of various pharmacological compounds through EEG signatures. It comprisesâŒ1,032 hours of recordings from 336 mice, covering four major therapeutic classes: antidepressants, antipsy- chotics, antiepileptics, and anxiolytics, alongside a fifth control group receiving solvent adminis- tration. The EEG was recorded from two brain regionsâthe prefrontal and parietal cortices, using 2-channel setups at a sampling rate of 1024 Hz. Following our standard pipeline, signals were re- sampled to 200 Hz and segmented into 60-second windows, totaling 61,900 samples. We employed a strict subject-independent split, allocating 70% of the mice for training, 10% for validation, and 20% for testing. As shown in Table S6, SpecMoE achieves its strongest performance on this benchmark, reaching a balanced accuracy of 0.8527 and a weighted F1-score of 0.8499. This represents an absolute improvement of 8.82% in accuracy over the second-best model, CBraMod (0.7645), and a 16.01% lead over CSBrain. Notably, these results were achieved with a significantly more efficient parameter footprint; while models like CBraMod and CSBrain utilize more than 20 million parameters, SpecMoE maintains high-fidelity decoding with approximately 4.3 million parameters. The success on the MACO dataset is highly significant for two reasons. First, it demonstrates that our spectral-anchored pretraining, which was primarily conducted on human data, gener- alizes effectively to murine EEG, validating the cross-species utility of the foundation model. Second, the substantial performance gap suggests that therapeutic drug effects are deeply embed- ded in certain frequency-domain bands that our spectral mixture-of-experts model was specifically designed to capture. These results indicate that SpecMoE is a powerful tool for pharmacological research and drug discovery, outperforming much larger models in identifying the neural signatures of therapeutic compounds. Table S6. Detailed performance comparison on the MACO drug therapeutic area classification task. Values represent the average and standard deviation across five random seeds. Bold indicates the best performance; underline indicates the second best. Task-Specific ModelsFoundation Models Sub-metric EEGNet EEGConf FFCL LaBraM CBramod CSBrain SpecMoE # Params â5.8 M20.3 M24.3 M4.3 M Bal. Acc Mean0.66590.61190.4325 0.62500.7645 0.6926 0.8527 Std Dev ±0.0166 ±0.0218 ±0.0105 ±0.0272 ±0.0119 ±0.0117 ±0.0033 Weighted F1 Mean0.68280.65850.4190 0.67360.80130.7292 0.8499 Std Dev ±0.0182 ±0.0192 ±0.0935 ±0.0388 ±0.0044 ±0.0189 ±0.0083 EEG Foundation Model - SpecMoE19 B.6 Drug Effects Classification Task The DA-Pharmaco dataset [33] is a specialized pharmacological benchmark consisting of Local Field Potential (LFP) recordings from depth electrodes in ten mice. Electrodes were implanted across five key regions: the prelimbic cortex (PrL), mediodorsal thalamus (MD), dorsal hippocampal fissure (dCA1), dorsal hippocampal CA3 subfield (dCA3), and ventral hippocampal fissure (vHC). The original study followed a within-subject, randomized Latin-squares design testing seven condi- tions: Saline, TWEEN80/saline, two doses of Clozapine (1 and 3 mg/kg), Raclopride, SCH23390, and Amphetamine. To evaluate the modelâs capacity to decode fundamental pharmacological ef- fects, we designed a specific 5-class grouping strategy: (1) Vehicles (Saline and TWEEN80), (2) Amphetamine, (3) Clozapine (grouping both 1 and 3 mg/kg doses), (4) SCH23390, and (5) Raclo- pride. We extracted a 40-minute window starting 5 minutes post-injection for each session. Signals were resampled to 200 Hz and segmented into 60-second samples (2,800 in total). We utilized a subject-independent split, assigning six subjects for training, two for validation, and two for testing. As detailed in Table S7, SpecMoE demonstrates a significant performance advantage, achieving a balanced accuracy of 0.6230 and a weighted F1-score of 0.6329. This represents an improvement of 6.33% over the best task-specific model (EEGConformer) and a 8.86% lead over CBraMod. Notably, while larger foundation models like CSBrain (0.4526) and LaBraM (0.4601) struggled to distinguish these self-designed pharmacological classes, SpecMoEâs spectral-anchored gating effectively isolated the regional oscillatory signatures associated with each drug category. These results suggest that SpecMoE is sensitive to the fine-grained spectral shifts that define specific neurotransmitter modulations, even in complex depth-electrode recordings. Table S7. Detailed performance comparison on the DA-Pharmaco drug effects classification task. Values represent the average and standard deviation across five random seeds. Bold indicates the best perfor- mance; underline indicates the second best. Task-Specific ModelsFoundation Models Sub-metric EEGNet EEGConf FFCL LaBraM CBramod CSBrain SpecMoE # Params â5.8 M38.7 M42.7 M4.3 M Bal. Acc Mean0.48160.55970.3074 0.46010.53440.4526 0.6230 Std Dev ±0.0159 ±0.0345 ±0.0336 ±0.0487 ±0.0210 ±0.0142 ±0.0231 Weighted F1 Mean0.46580.53090.3080 0.45830.5389 0.4575 0.6329 Std Dev ±0.0127 ±0.0520 ±0.0403 ±0.0710 ±0.0288 ±0.0155 ±0.0206 B.7 Imagined Speech Recognition Task Imagined speech classification aims to decode phonological representations embedded in neural ac- tivity without any physical speech. This task is critical for developing augmentative communication technologies for individuals with severe speech impairments resulting from stroke or amyotrophic lateral sclerosis (ALS). We evaluate our model on the BCIC2020-3 dataset [34], released for the 2020 International BCI Competition. In this experiment, 15 subjects imagined five speech-related categories ("hello", "help me", "stop", "thank you", and "yes"). EEG signals were recorded from 64 channels at 256 Hz and resampled to 200 Hz for our experiments. Following the competitionâs rigorous split, each subject provided 60 trials per class for training, 10 for validation, and 10 for testing, with each sample consisting of a 3-second recording. As shown in Table S8, imagined speech recognition represents a high-complexity decoding task where task-specific models often struggle to exceed 50% accuracy. SpecMoE achieves the highest performance across all models, with a balanced accuracy of 0.6262 and a weighted F1-score of 0.6264. This represents a substantial improvement of 2.58% over the previous best-performing foundation model, CSBrain (0.6004). Furthermore, SpecMoE surpasses the strongest task-specific baseline (FFCL) by 15.84%, demonstrating that the spectral mixture-of-experts architecture is capable of isolating the subtle, high-frequency oscillatory patterns associated with internal phono- logical processing. 20D. Darankoum et al. Table S8. Detailed performance comparison on the BCIC2020-3 imagined speech recognition task. Values represent the average and standard deviation across five random seeds. Bold indicates the best performance; underline indicates the second best. Task-Specific ModelsFoundation Models Sub-metric EEGNet EEGConf FFCL LaBraM CBramod CSBrain SpecMoE # Params â5.8 M27.7 M31.7 M4.3 M Bal. Acc Mean0.44130.45060.4678 0.50600.53730.60040.6262 Std Dev ±0.0096 ±0.0133 ±0.0197 ±0.0155 ±0.0108 ±0.0187 ±0.0166 Weighted F1 Mean0.44130.44880.4689 0.50540.53830.60030.6264 Std Dev ±0.0102 ±0.0154 ±0.0205 ±0.0205 ±0.0096 ±0.0192 ±0.0158 B.8 Abnormal Signal Detection Task Abnormal detection facilitates the identification of pathological neuronal activity, potentially re- ducing the clinical workload by providing automated alerts during continuous monitoring. We evaluate our model on the TUAB dataset [29], a standard benchmark for pathological signal de- tection. The dataset contains EEG recordings from 23 channels at 256 Hz, annotated as normal or abnormal. Following existing literature, we utilize 16 bipolar montage channels based on the inter- national 10â20 system. Signals were resampled to 200 Hz and segmented into 10-second windows, totaling 409,455 samples. Using the datasetâs predefined splits, we further partitioned the training subjects into training and validation sets at an 8:2 ratio. To accelerate the finetuning process and assess model efficiency, we randomly selected a subset of 50,000 samples for training and 50,000 samples for validation. As shown in Table S9, clinical abnormality detection remains a competitive domain for founda- tion models. SpecMoE maintains a robust stance, reaching a balanced accuracy of 0.7742 and an AUROC of 0.8554. While certain models like CSBrain (0.8172) currently lead the benchmark, it is important to note that our results were achieved using a significantly reduced subset of the available training data. This preliminary result suggests that the spectral-anchored gating mecha- nism may offer high data efficiency, as the model captured essential pathological signatures despite using only a fraction of the available training data. Extensive tests utilizing the full dataset are planned for future work to further characterize the scaling behavior of SpecMoE in this specific task. Table S9. Detailed performance comparison on the TUAB abnormal signal detection task. Values rep- resent the average and standard deviation across five random seeds. Bold indicates the best performance; underline indicates the second best. Task-Specific ModelsFoundation Models Sub-metric EEGNet EEGConf FFCL LaBraM CBramod CSBrain SpecMoE # Params â5.8 M24.4 M28.4 M4.3 M Bal. Acc Mean0.76420.77580.7848 0.8140 0.7891 0.81720.7742 Std Dev ±0.0036 ±0.0049 ±0.0038 ±0.0019 ±0.0030 ±0.0043 ±0.0070 AUPRC Mean0.82990.84270.8448 0.89650.8636 0.90050.8548 Std Dev ±0.0043 ±0.0054 ±0.0065 ±0.0016 ±0.0063 ±0.0066 ±0.0092 AUROC Mean0.84120.84450.8569 0.90220.86060.89570.8554 Std Dev ±0.0031 ±0.0038 ±0.0051 ±0.0009 ±0.0057 ±0.0046 ±0.0082 B.9 Seizure Detection Task The Siena dataset [35] is a clinical database comprising video-EEG monitoring from 14 adult pa- tients. EEG signals were recorded at 512 Hz using the international 10â20 system, with seizure EEG Foundation Model - SpecMoE21 events rigorously annotated by clinical experts following the International League Against Epilepsy (ILAE) criteria. We utilized the 29 EEG channels consistently available across the cohort and resampled the signals to 200 Hz. The data was segmented into 10-second windows, totaling 51,307 samples. To ensure a robust evaluation of clinical generalization, we employed a subject- independent split: data from subjects PN16 and PN17 were held out for testing, while the remaining 12 subjects were used for training and validation (8:2 ratio). As demonstrated in Table S10, SpecMoE achieves remarkable performance on the Siena bench- mark, significantly outperforming all task-specific and foundation models. Notably, SpecMoE reaches a balanced accuracy of 0.8655 and an AUPRC of 0.9906. This represents a substantial lead of 9.93% in balanced accuracy and a 50.35% improvement in AUPRC over the previous state- of-the-art, CSBrain. While such a high AUPRC suggests nearly perfect identification of seizure events within this specific subject-independent split, these results underscore the power of spectral- anchored gating in isolating the distinct rhythmic discharges that characterize ictal activity. The hierarchical U-shaped architecture of SpecHi-Net appears particularly well-suited for capturing these multi-scale temporal dependencies, providing a clear advantage in clinical seizure monitor- ing. Table S10. Detailed performance comparison on the SIENA seizure detection task. Values represent the average and standard deviation across five random seeds. Bold indicates the best performance; underline indicates the second best. Task-Specific ModelsFoundation Models Sub-metric EEGNet EEGConf FFCL LaBraM CBramod CSBrain SpecMoE # Params â5.8 M37.7 M41.7 M4.3 M Bal. Acc Mean0.74870.75560.6616 0.70820.73170.76620.8655 Std Dev ±0.0521 ±0.0210 ±0.0391 ±0.0329 ±0.0647 ±0.0471 ±0.0038 AUPRC Mean0.37530.20910.3938 0.31220.41070.48710.9906 Std Dev ±0.0867 ±0.0786 ±0.0903 ±0.0976 ±0.0720 ±0.0343 ±0.0008 AUROC Mean0.86870.81590.8154 0.88140.90380.9076 0.9148 Std Dev ±0.0527 ±0.0261 ±0.1155 ±0.0328 ±0.0218 ±0.0119 ±0.0098 B.10 Vigilance Estimation Task SEED-VIG [36] is a specialized dataset designed for the continuous estimation of driver vigilance. The data was collected using a virtual driving simulator where 21 subjects performed a driving task while their vigilance levels were continuously monitored. Ground-truth vigilance labels were derived from eye-tracking data using the PERCLOS (Percentage of Closure) indicator. EEG signals were recorded from 17 channels at 200 Hz and segmented into 20,355 8-second windows. We follow a subject-independent split protocol, utilizing subjects 1â13 for training, 14â17 for validation, and 18â21 for testing. As shown in Table S11, vigilance estimation serves as a rigorous test for regression-based neu- ral decoding. SpecMoE achieves the highest overall performance in terms of error minimization and variance explanation, reaching a state-of-the-art RMSE of 0.1522 and an R 2 score of 0.2454. This represents a substantial 0.1252 reduction in RMSE compared to the previous best foundation model, CSBrain (0.2774). While LaBraM and CSBrain maintain a narrow lead in Pearsonâs correlation coefficient, the significantly lower RMSE of SpecMoE indicates that our spectral-anchored gating mechanism is more effective at minimizing large predictive deviations. C Additional results C.1 Detailed Ablation Studies Figures S1, S2, and S3 illustrate the relative impact of our core design choices across the BCIC2020- 3, DA-Pharmaco, and PhysioNet-MI datasets. By systematically removing or replacing key compo- 22D. Darankoum et al. Table S11. Detailed performance comparison on the SEED-VIG vigilance estimation (regression) task. Values represent the average and standard deviation across five random seeds. Bold indicates the best performance; underline indicates the second best. For RMSE, lower values are better. Task-Specific ModelsFoundation Models Sub-metric EEGNet EEGConf FFCL LaBraM CBramod CSBrain SpecMoE # Paramsâ5.8 M21.9 M25.9 M4.3 M Pearsonâs corr Mean0.51270.58000.4923 0.63470.55020.63140.5168 Std Dev ±0.0357 ±0.0174 ±0.0313 ±0.0135 ±0.0115 ±0.0356 ±0.0218 R 2 Score Mean0.19600.20650.1740 0.18080.07370.23630.2454 Std Dev ±0.0427 ±0.0230 ±0.0530 ±0.0958 ±0.0167 ±0.0519 ±0.0289 RMSE (â) Mean0.28470.28290.2885 0.28710.30570.27740.1522 Std Dev ±0.0076 ±0.0041 ±0.0093 ±0.0166 ±0.0027 ±0.0094 ±0.0029 nents, we demonstrate that the high performance of SpecMoE is derived from the synergy between our novel masking strategy and the spectral-guided mixture-of-experts. Impact of Gaussian-Smoothed Masking. The most critical component of our framework is the Gaussian-smoothed masking scheme. When replaced with standard Non-Gaussian (rectan- gular) masks, we observe a substantial drop in performance across all tasks. For instance, on BCIC2020-3, the balanced accuracy plummets from 0.6262 to 0.4063 (a relative decrease of ap- proximately 22%). This experiment confirms our hypothesis that "soft" Gaussian boundaries force the model to learn the complex neural oscillations from a large spectral context. Efficacy of Joint Time-Frequency (TF) Masking. We evaluated the necessity of joint masking by comparing it against Time-only and Frequency-only variants. On the DA-Pharmaco dataset, utilizing only time masks resulted in an F1-score drop from 0.6329 to 0.5861. The consistent superiority of the full TF-masking approach across all metrics suggests that simultaneous occlusion in both domains is essential for capturing the non-stationary rhythmic signatures of EEG signals, particularly in pharmacological and clinical benchmarks. Architecture and Gating Strategy. The ablation labeled "Full mask + CBramod" replaces our hierarchical SpecHi-Net and MoE structure with the CBramod backbone while keeping the Gaus- sian masking. The results show a massive decline (e.g., a drop to 0.2448 balanced accuracy on BCIC2020-3), indicating that non-hierarchical architectures lack the capacity to effectively solve the challenging reconstruction tasks posed by our aggressive masking strategy. Furthermore, the "Gating without PSD" experiment removes the Power Spectral Density prior from the routing network. This leads to a consistent performance degradationâmost notably on BCIC2020-3, where the AUPRC drops by over 12% (from 0.6874 to 0.5650). This validates that the PSD serves as a vital physical anchor, enabling the gating network to route signals to specialized experts based on their underlying rhythmic content rather than mere temporal patterns. C.2 Masking Effects Visualization on STFT Spectrograms Figures S4, S5, S6, S7 and S8 illustrate how the raw EEG signals and their corresponding STFT spectrograms are modified under different masking configurations. These visualizations contrast our proposed Gaussian-smoothed masks (Figures S4âS7) against standard rectangular masks (Figure S8), highlighting the different levels of information occlusion across the time and frequency domains. C.3 Pretraining Importance Analysis Figure S9 illustrates the critical role of self-supervised pretraining by comparing the performance of SpecMoE initialized with pretrained weights against a version trained from scratch (random ini- tialization). Across all three representative datasetsâBCIC2020-3, DA-Pharmaco, and PhysioNet- MIâthe pretrained model consistently achieves superior results in both balanced accuracy and AUPRC. EEG Foundation Model - SpecMoE23 SpecMoE Time-only Freq-only TF-only Non-Gaussian Full mask + CBramod Gating without PSD 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 Balanced accuracy 62.64% -6.06% -0.75% -1.33% -22.02% -38.79% -9.17% BCIC2020-3 SpecMoE Time-only Freq-only TF-only Non-Gaussian Full mask + CBramod Gating without PSD 63.29% -4.68% -0.61% -4.75% -5.25% -9.31% -2.91% DA-Pharmaco SpecMoE Time-only Freq-only TF-only Non-Gaussian Full mask + CBramod Gating without PSD 64.75% -1.65% -2.84% -4.79% -2.12% -23.77% -2.07% PhysioNet-MI Fig. S1. SpecMoE ablation results - balanced accuracy. We show the absolute value of the balanced accuracy for the SpecMoE model and relative differences for six ablation experiments. TF stands for time- frequency. SpecMoE Time-only Freq-only TF-only Non-Gaussian Full mask + CBramod Gating without PSD 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 AUPRC 68.74% -9.97% -2.97% -1.93% -27.04% -45.58% -12.24% BCIC2020-3 SpecMoE Time-only Freq-only TF-only Non-Gaussian Full mask + CBramod Gating without PSD 66.61% -1.39% +0.85% -3.22% -0.94% -8.73% +0.18% DA-Pharmaco SpecMoE Time-only Freq-only TF-only Non-Gaussian Full mask + CBramod Gating without PSD 73.60% -2.57% -4.74% -8.23% -2.66% -30.18% -2.44% PhysioNet-MI Fig. S2. SpecMoE ablation results - AUPRC. We show the absolute value of AUPRC for the SpecMoE model and relative differences for six ablation experiments. TF stands for time-frequency. 24D. Darankoum et al. SpecMoE Time-only Freq-only TF-only Non-Gaussian Full mask + CBramod Gating without PSD 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 F1-score 62.64% -6.06% -0.75% -1.33% -22.02% -38.79% -9.17% BCIC2020-3 SpecMoE Time-only Freq-only TF-only Non-Gaussian Full mask + CBramod Gating without PSD 63.29% -4.68% -0.61% -4.75% -5.25% -9.31% -2.91% DA-Pharmaco SpecMoE Time-only Freq-only TF-only Non-Gaussian Full mask + CBramod Gating without PSD 64.75% -1.65% -2.84% -4.79% -2.12% -23.77% -2.07% PhysioNet-MI Fig. S3. SpecMoE ablation results - F1-score. We show the absolute value of F1-score for the SpecMoE model and relative differences for six ablation experiments. TF stands for time-frequency. The most substantial impact is observed in the BCIC2020-3 imagined speech task, where balanced accuracy falls from 0.6262 to 0.4433 without pretrainingâan absolute decrease of 18.29 points. Similarly, the AUPRC for this task experienced a sharp decline of 0.2457. This indicates that decoding high-complexity tasks like imagined speech relies heavily on the generalized neural representations learned during large-scale pretraining. In the DA-Pharmaco and PhysioNet-MI datasets, we observe absolute accuracy gains of 5.56 and 1.42 points, respectively. The improvement in DA-Pharmaco is particularly noteworthy as it validates the cross-species utility of our foundation model; despite being pretrained on human EEG, the model learns universal spectral features that significantly accelerate and improve the decoding of rodent LFP signals. Overall, these results confirm that our Gaussian-smoothed masking task successfully forces the model to learn a robust, generalized representation of brain activity that serves as a high-quality initialization for diverse downstream applications. C.4 Experts Contribution Analysis Figure S10 visualizes the relative contribution of each expert across three datasets, revealing dis- tinct routing patterns tailored to each taskâs complexity. On the BCIC2020-3 dataset, we observe that the gating network primarily solicits Experts 1 and 2. This shared contribution suggests that the decoding of imagined speech, a high-complexity task, requires a collaborative representation where different experts likely specialize in complementary spectral features of internal phonological processing. In another task, the DA-Pharmaco dataset engages all three experts across the different classes and brain regions. This broad utilization reflects the high variance of the pharmacological signatures in murine LFP data, where different experts are required to isolate the unique oscillatory shifts induced by diverse compounds. Finally, for PhysioNet-MI, the routing logic is highly sparse, with Expert 2 being almost exclu- sively solicited. This indicates that for standard motor imagery tasks, the gating network identifies a consistent, dominant spectral profile across the motor cortex, which can be effectively modeled by a single specialized expert without the need for additional parameters from the others. C.5 Embeddings Visualization We qualitatively assess the modelâs representation space using t-SNE projections on the DA- Pharmaco and MACO test sets. Figure S11 displays the projections obtained using random weights from an untrained SpecMoE model. More specifically, we initialized the model with random weights and projected the output EEG Foundation Model - SpecMoE25 05101520 0.2 0.0 0.2 Raw EEG signal 05101520 Time (s) 0.02 0.00 0.02 0.04 Masked EEG signal 05101520 0 50 100 150 200 Original STFT 05101520 0 50 100 150 200 Masked STFT 12 10 8 6 4 12 10 8 6 4 Fig. S4. Overview of the proposed joint Gaussian masking strategy. The panels illustrate the simultaneous application of temporal, spectral, and joint time-frequency occlusions on raw EEG signals (top panel: raw, middle panel: masked) and their corresponding STFT spectrograms (bottom panel). 26D. Darankoum et al. 05101520 0 50 100 150 200 Original STFT 05101520 0 50 100 150 200 Masked STFT 12 10 8 6 4 12 10 8 6 4 05101520 0.2 0.0 0.2 Raw EEG signal 05101520 Time (s) 0.2 0.0 0.2 Masked EEG signal Fig. S5. Visualization of temporal domain masking. The panels illustrate the application of time-based occlusions on raw EEG signals (top panel: raw, middle panel: masked) and their corresponding STFT spectrograms (bottom panel). EEG Foundation Model - SpecMoE27 05101520 0.2 0.0 0.2 Raw EEG signal 05101520 Time (s) 0.02 0.00 0.02 Masked EEG signal 05101520 0 50 100 150 200 Original STFT 05101520 0 50 100 150 200 Masked STFT 12 10 8 6 4 12 10 8 6 4 Fig. S6. Visualization of frequency domain masking. The panels illustrate the application of spectral- based occlusions on raw EEG signals (top panel: raw, middle panel: masked) and their corresponding STFT spectrograms (bottom panel). 28D. Darankoum et al. 05101520 0 50 100 150 200 Original STFT 05101520 0 50 100 150 200 Masked STFT 12 10 8 6 4 12 10 8 6 4 05101520 0.2 0.0 0.2 Raw EEG signal 05101520 Time (s) 0.05 0.00 0.05 0.10 0.15 Masked EEG signal Fig. S7. Visualization of time-frequency domain masking. The panels illustrate the application of temporal- spectral blobs occlusions on raw EEG signals (top panel: raw, middle panel: masked) and their correspond- ing STFT spectrograms (bottom panel). EEG Foundation Model - SpecMoE29 05101520 0.2 0.0 0.2 Raw EEG signal 05101520 Time (s) 0.1 0.0 0.1 Masked EEG signal 05101520 0 50 100 150 200 Original STFT 05101520 0 50 100 150 200 Masked STFT 12 10 8 6 4 12 10 8 6 4 Fig. S8. Time, frequency and time-frequency masking with rectangular masks. The panels illustrate the simultaneous application of temporal, spectral, and joint time-frequency rectangular occlusions on raw EEG signals (top panel: raw, middle panel: masked) and their corresponding STFT spectrograms (bottom panel). 30D. Darankoum et al. SpecMoE No Pretrained weights 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 Balanced accuracy 62.62% -18.29% BCIC2020-3 SpecMoE No Pretrained weights 62.29% -5.56% DA-Pharmaco SpecMoE No Pretrained weights 64.44% -1.42% PhysioNet-MI SpecMoE No Pretrained weights 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 AUPRC 68.74% -24.57% BCIC2020-3 SpecMoE No Pretrained weights 66.61% -2.78% DA-Pharmaco SpecMoE No Pretrained weights 73.60% -2.99% PhysioNet-MI Fig. S9. SpecMoE pretraining ablations on six datasets. EEG Foundation Model - SpecMoE31 050100150200250300350 Expert 1 (Embedding dim : 0 to 127) | Expert 2 (Embedding dim : 128 to 255) | Expert 3 (Embedding dim : 256 to 383) Class 0 Class 0 Class 0 Class 0 Class 0 Class 0 Class 0 Class 1 Class 1 Class 1 Class 1 Class 1 Class 2 Class 2 Class 2 Class 2 Class 2 Class 2 Class 2 Class 2 Class 2 Class 2 Class 3 Class 3 Class 3 Class 3 Class 3 Class 3 Class 3 Class 3 Class 3 Class 3 Samples (Grouped by Class) PhysioNet-MI examples (Scaled 0 to 1 | Local Range: -0.00 to 0.09) 0.0 0.2 0.4 0.6 0.8 1.0 Relative Activation Intensity 050100150200250300350 Expert 1 (Embedding dim : 0 to 127) | Expert 2 (Embedding dim : 128 to 255) | Expert 3 (Embedding dim : 256 to 383) Class 0 Class 0 Class 0 Class 0 Class 0 Class 0 Class 0 Class 0 Class 0 Class 1 Class 1 Class 1 Class 1 Class 1 Class 2 Class 2 Class 2 Class 2 Class 2 Class 2 Class 2 Class 2 Class 2 Class 2 Class 2 Class 3 Class 3 Class 4 Class 4 Class 4 Class 4 Class 4 Samples (Grouped by Class) DA-pharmaco examples (Scaled 0 to 1 | Local Range: -0.07 to 0.49) 0.0 0.2 0.4 0.6 0.8 1.0 Relative Activation Intensity 050100150200250300350 Expert 1 (Embedding dim : 0 to 127) | Expert 2 (Embedding dim : 128 to 255) | Expert 3 (Embedding dim : 256 to 383) Class 0 Class 0 Class 0 Class 0 Class 0 Class 1 Class 1 Class 1 Class 1 Class 1 Class 1 Class 2 Class 2 Class 2 Class 2 Class 2 Class 3 Class 3 Class 3 Class 3 Class 3 Class 3 Class 3 Class 3 Class 3 Class 3 Class 3 Class 4 Class 4 Class 4 Class 4 Class 4 Samples (Grouped by Class) BCIC2020-3 examples (Scaled 0 to 1 | Local Range: 0.07 to 3.41) 0.0 0.2 0.4 0.6 0.8 1.0 Relative Activation Intensity Fig. S10. Visualization of expert contribution across different EEG paradigms: BCIC2020-3 (top), DA- Pharmaco (middle), and PhysioNet-MI (bottom). Each panel displays the routing activations for Experts 1, 2, and 3 (from left to right), with samples grouped by class labels. The color intensity represents the gating networkâs routing weights, ranging from low (darker tones) to high (brighter tones), reflecting the relative importance of each expert for a given sample. 32D. Darankoum et al. results without any training. For both datasets, the classes are entirely overlapped, confirming that raw signals lack intrinsic linear separability and highlighting the necessity for training. Figures S12 and S13 compare SpecMoE against baseline foundation models. On DA-Pharmaco, SpecMoE produces more compact clusters, particularly for the Saline and Amphetamine groups. On MACO, the distinction is even more pronounced: SpecMoE is the only model capable of clearly isolating the Antiepileptic class. These results visually confirm that SpecMoE effectively structures the latent space, mapping diverse pharmacological effects into distinct neural signatures. 100 50 0 50 100 10050050100 t-SNE Dimension 2 MACO Classes Solvent Antidepressant Antipsychotic Antiepileptic Anxiolytic Classes Sal & SalT Amph CLZ1 & CLZ3 SCH Raclo 200204060 t-SNE Dimension 1t-SNE Dimension 1 40 30 20 10 0 10 20 30 40 t-SNE Dimension 2 DA-Pharmaco Fig. S11. T-SNE DA-Pharmaco (left) and MACO (right) projections obtained by an untrained SpecMoE model containing random weights. EEG Foundation Model - SpecMoE33 20100102030 t-SNE Dimension 1 20 10 0 10 20 t-SNE Dimension 2 CBraMod Classes Sal & SalT Amph CLZ1 & CLZ3 SCH Raclo 3020100102030 t-SNE Dimension 1 20 10 0 10 20 30 t-SNE Dimension 2 CSBrain Classes Sal & SalT Amph CLZ1 & CLZ3 SCH Raclo 3020100102030 t-SNE Dimension 1 15 10 5 0 5 10 15 t-SNE Dimension 2 LaBraM Classes Sal & SalT Amph CLZ1 & CLZ3 SCH Raclo 40302010010203040 t-SNE Dimension 1 20 10 0 10 20 30 t-SNE Dimension 2 SpecMoE Classes Sal & SalT Amph CLZ1 & CLZ3 SCH Raclo Fig. S12. T-SNE DA-Pharmaco test data projection using four foundation models. Top left: CBraMod, top right: CSBrain, bottom left: LaBraM, bottom right: SpecMoE. 34D. Darankoum et al. 1007550250255075100 100 75 50 25 0 25 50 75 100 Classes Solvent Antidepressant Antipsychotic Antiepileptic Anxiolytic 1007550250255075100 Classes Solvent Antidepressant Antipsychotic Antiepileptic Anxiolytic 100 75 50 25 0 25 50 75 100 Classes Solvent Antidepressant Antipsychotic Antiepileptic Anxiolytic CBraModCSBrain LaBraM SpecMoE t-SNE Dimension 1 t-SNE Dimension 2 t-SNE Dimension 1 t-SNE Dimension 1 t-SNE Dimension 2 t-SNE Dimension 1 t-SNE Dimension 2 t-SNE Dimension 2 100 75 50 25 0 25 50 75 100 100 75 50 25 0 25 50 75 100 1007550250255075100 10050050100 Classes Solvent Antidepressant Antipsychotic Antiepileptic Anxiolytic Fig. S13. T-SNE MACO test data projection using four foundation models. Top left: CBraMod, top right: CSBrain, bottom left: LaBraM, bottom right: SpecMoE.