Table of Contents
Fetching ...

Tokenizing Single-Channel EEG with Time-Frequency Motif Learning

Jathurshan Pradeepkumar, Xihao Piao, Zheng Chen, Jimeng Sun

TL;DR

TFM-Tokenizer tackles EEG tokenization for foundation-model workflows by learning a discrete, time–frequency motif vocabulary from single-channel data. Through a dual-path encoder, frequency masking, and a vector-quantized codebook, it produces interpretable tokens that downstream transformers can leverage across channels and devices. The approach yields consistent accuracy gains across four EEG benchmarks, improves integration with existing foundation models, and demonstrates cross-device scalability to ear-EEG sleep staging. These results establish principled, reusable EEG tokens that enhance representation quality and model generalization for practical, device-agnostic EEG analysis.

Abstract

Foundation models are reshaping EEG analysis, yet an important problem of EEG tokenization remains a challenge. This paper presents TFM-Tokenizer, a novel tokenization framework that learns a vocabulary of time-frequency motifs from single-channel EEG signals and encodes them into discrete tokens. We propose a dual-path architecture with time-frequency masking to capture robust motif representations, and it is model-agnostic, supporting both lightweight transformers and existing foundation models for downstream tasks. Our study demonstrates three key benefits: Accuracy: Experiments on four diverse EEG benchmarks demonstrate consistent performance gains across both single- and multi-dataset pretraining settings, achieving up to 17% improvement in Cohen's Kappa over strong baselines. Generalization: Moreover, as a plug-and-play component, it consistently boosts the performance of diverse foundation models, including BIOT and LaBraM. Scalability: By operating at the single-channel level rather than relying on the strict 10-20 EEG system, our method has the potential to be device-agnostic. Experiments on ear-EEG sleep staging, which differs from the pretraining data in signal format, channel configuration, recording device, and task, show that our tokenizer outperforms baselines by 14%. A comprehensive token analysis reveals strong class-discriminative, frequency-aware, and consistent structure, enabling improved representation quality and interpretability. Code is available at https://github.com/Jathurshan0330/TFM-Tokenizer.

Tokenizing Single-Channel EEG with Time-Frequency Motif Learning

TL;DR

TFM-Tokenizer tackles EEG tokenization for foundation-model workflows by learning a discrete, time–frequency motif vocabulary from single-channel data. Through a dual-path encoder, frequency masking, and a vector-quantized codebook, it produces interpretable tokens that downstream transformers can leverage across channels and devices. The approach yields consistent accuracy gains across four EEG benchmarks, improves integration with existing foundation models, and demonstrates cross-device scalability to ear-EEG sleep staging. These results establish principled, reusable EEG tokens that enhance representation quality and model generalization for practical, device-agnostic EEG analysis.

Abstract

Foundation models are reshaping EEG analysis, yet an important problem of EEG tokenization remains a challenge. This paper presents TFM-Tokenizer, a novel tokenization framework that learns a vocabulary of time-frequency motifs from single-channel EEG signals and encodes them into discrete tokens. We propose a dual-path architecture with time-frequency masking to capture robust motif representations, and it is model-agnostic, supporting both lightweight transformers and existing foundation models for downstream tasks. Our study demonstrates three key benefits: Accuracy: Experiments on four diverse EEG benchmarks demonstrate consistent performance gains across both single- and multi-dataset pretraining settings, achieving up to 17% improvement in Cohen's Kappa over strong baselines. Generalization: Moreover, as a plug-and-play component, it consistently boosts the performance of diverse foundation models, including BIOT and LaBraM. Scalability: By operating at the single-channel level rather than relying on the strict 10-20 EEG system, our method has the potential to be device-agnostic. Experiments on ear-EEG sleep staging, which differs from the pretraining data in signal format, channel configuration, recording device, and task, show that our tokenizer outperforms baselines by 14%. A comprehensive token analysis reveals strong class-discriminative, frequency-aware, and consistent structure, enabling improved representation quality and interpretability. Code is available at https://github.com/Jathurshan0330/TFM-Tokenizer.

Paper Structure

This paper contains 40 sections, 3 equations, 11 figures, 15 tables.

Figures (11)

  • Figure 1: (a) Our TFM-Tokenizer converts single-channel EEG into discrete tokens by capturing time-frequency motifs. (b) It is adaptable to any different multi-channel settings, (c) can be integrated with existing foundation models to enhance their performance, and (d) enables cross-device scalability.
  • Figure 2: Overview of our framework. (a) TFM-Tokenizer Pretraining: Through dual-path encoding and masked prediction, learns to capture time-frequency motifs into discrete tokens. (b) Masking Strategy: A combination of frequency band masking and temporal masking is used for TFM-Tokenizer pretraining. (c) Localized Spectral Window Encoder: Processes individual spectral windows from $\mathbf{S}$, extracts frequency band information, and aggregates features across all bands into a single compact embedding per window. (d) Downstream Transformer Encoder Pretraining: Trains on learned EEG tokens using masked token prediction.
  • Figure 3: Performance comparison of existing foundation models with and without integration of TFM-Tokenizer on the TUEV, IIIC, and CHB-MIT datasets. For each dataset, the first three bars show single-dataset pretraining and the latter three show multi-dataset pretraining. Percentage values above each bar indicate the relative performance gain achieved by incorporating TFM-Tokenizer.
  • Figure 4: (a) Frequency and temporal token encoder ablation on TUEV. (b) Comparison of class-token uniqueness scores across all classes and (c) Class-wise token consistency analysis.
  • Figure 5: Overview of motifs captured by TFM-Tokenizer on TUEV: (a) three samples from the PLED class and (b) three samples from the GPED.
  • ...and 6 more figures