Transformer-Based Seizure Detector
- The paper introduces transformer-based seizure detectors that leverage self-attention to capture global temporal and spatial dependencies in modalities like EEG and video.
- Models employ diverse tokenization and preprocessing strategies, integrating raw signals, spectral images, and optical flow to enhance detection accuracy and patient-independence.
- Innovative computational strategies, including spiking neural paradigms and set transformers, reduce costs and enable real-time clinical deployment with improved interpretability.
Transformer-based seizure detectors are neural architectures that use self-attention mechanisms—originally introduced for sequence modeling in natural language tasks—to recognize, classify, and predict epileptic seizures from time-series data modalities such as electroencephalogram (EEG) or, in privacy-protecting scenarios, video representations. These detectors leverage transformers’ ability to model global dependencies across temporal and spatial features, often outperforming traditional convolutional or recurrent neural methods in seizure detection accuracy, robustness, and computational efficiency. Recent models incorporate architectural innovations, cost-efficient computation, patient-independence, explainability, and privacy-preserving modalities.
1. Architectural Foundations and Self-Attention Mechanisms
Transformer-based seizure detection models consistently employ encoder blocks composed of multi-head self-attention (MHSA) and position-wise feed-forward networks. Architectures vary by their input modalities (raw EEG, spectral images, band-power, optical flow) and tokenization strategies.
- Raw EEG Tokenization: Approaches such as the Lightweight Convolution Transformer (LCT) (Rukhsar et al., 2023) and CNN-Transformer hybrids (Peh et al., 2022, Darankoum et al., 2024, Koutsouvelis et al., 2024) employ 1D or 2D convolutions to extract low-level features from EEG and aggregate contiguous samples or channels as tokens. Tokens are augmented with learnable positional encodings, then processed by transformer blocks.
- Spectral Representations: ScatterFormer (Zheng et al., 2023) generates visual spectral encodings from channel-wise continuous wavelet transforms, creating multi-frequency images which are partitioned into non-overlapping patches; these feed into a hierarchical Vision Transformer (ViT) backbone.
- Privacy-preserving Video Modalities: SETR-PKD (Mehta et al., 2023) transforms seizure observation video into optical flow sequences, which are encoded into spatial tokens and classified via transformer encoders.
The standard attention computation: is used broadly, with modifications for domain-specific constraints (e.g., spiking attention (Chen et al., 2024)). Multi-head attention enables specialized heads to focus on different spatial, temporal, or frequency-context patterns, yielding better long-range dependency modeling and discriminability of ictal segments.
2. Data Preprocessing, Input Representation, and Temporal Context
Input preparation is critical for modeling seizure dynamics:
- EEG Preprocessing: Standardized downsampling (e.g., 256 Hz or 128 Hz), band-pass and notch filtering, and montage conversion (e.g., Longitudinal Bipolar Montage as in LookAroundNet (Sverrisson et al., 9 Jan 2026)) are typical. Sliding window segmentation, either non-overlapping (event detection) or overlapping (preictal/interictal prediction), balances signal access and class labeling.
- Context Extension: LookAroundNet (Sverrisson et al., 9 Jan 2026) explicitly models “look-behind” and “look-ahead” context, mimicking clinical seizure review, by concatenating temporal context windows before and after the segment of interest. This design boosts event-based F1 (from 63.6% in prior work to 72.1% single; ensembles reach 77.8%) and reduces false positives per day.
Input representations range from multi-channel raw signals (e.g., 1×22×1280 or 23×1280 per window (Chen et al., 2024, Koutsouvelis et al., 2024)), spectral images (ScatterFormer (Zheng et al., 2023)), or frequency-domain power features (two-stage Set Transformer (Zheng et al., 21 Jul 2025)), to privacy-preserving optical flow sequences (SETR-PKD (Mehta et al., 2023)).
3. Novel Computational Strategies and Efficiency Mechanisms
Transformer-based detectors incorporate mechanisms to curtail computational cost, addressing both clinical deployment and real-time operation:
- Spiking Neural Paradigms: The Spiking Conformer (Chen et al., 2024) encodes signal features using spiking Leaky Integrate-and-Fire (LIF) neurons, exploiting sparse spike-based addition operations. The approximate spike-triggered update rule skips 38% of synaptic updates without reducing accuracy. Computational cost for the seizure detection task drops from 4.1M (MUL+ADD) operations to 0.32M ADD + 1.0K MUL (>10× savings).
- Convolutional Tokenization and Sequence Pooling: LCT (Rukhsar et al., 2023) reduces parameter count (from ~1.8M in ViT to ~1.2M), halves FLOPs, and applies attention-based sequence pooling in place of a learnable class token, enhancing cross-patient generalization at 0.5 s window lengths.
- Set Transformers for Channel Reduction: By using permutation-invariant attention blocks, two-stage channel-aware Set Transformers (Zheng et al., 21 Jul 2025) aggregate temporal EEG segments per channel and then pool channel-level representations, enabling channel selection (reducing required electrodes from 18 to 2–3 per patient, with maintained or improved sensitivity).
Models designed for clinical viability (LookAroundNet (Sverrisson et al., 9 Jan 2026)) achieve >6× real-time inference at 2 GFLOPs/sec with only 0.5M parameters.
4. Supervised, Unsupervised, and Hybrid Learning Paradigms
Transformer-based seizure detectors span supervised, semi-supervised, and unsupervised domains:
- Supervised Detection/Prediction: Architectures such as SeizureTransformer (Wu et al., 1 Apr 2025) and CNN-TRF-BM (Peh et al., 2022) are trained using binary cross-entropy or domain-adapted calibration losses (e.g., Belief Matching) on labeled ictal, preictal, and interictal segments.
- Unsupervised Anomaly Detection: The multivariate time-series transformer autoencoder (Potter et al., 2023) is trained only on non-seizure data, using a reconstruction error anomaly score to flag unseen seizure windows (up to +16% recall, +9% AUC over supervised baselines).
- Hybrid and Knowledge Distillation: SETR-PKD (Mehta et al., 2023) progressively distills transformer knowledge from longer to shorter video segments for early, privacy-preserving detection; this process recovers >10pp of F1 at minimal input fractions versus direct distillation.
5. Clinical Performance and Generalization Across Datasets
Clinical assessment hinges on cross-dataset generalization, sensitivity/specificity, and false alarm rates:
| Model | Dataset | Sensitivity (%) | Specificity (%) | F1/AUC | FP/day | Ref |
|---|---|---|---|---|---|---|
| Spiking Conformer | CHB-MIT (EEG) | 94.9 (Detection) / 96.8 (Prediction) | 99.3 / 89.5 | 97.1 / 93.1 | — | (Chen et al., 2024) |
| LCT | CHB-MIT (EEG) (cross-pt) | 96.82 | 95.81 | 96.32 (F1) | — | (Rukhsar et al., 2023) |
| ScatterFormer | Rolandic Epil., Neonatal | 98.14 / 96.38 | 96.39 / 90.55 | AUC 98.14 | — | (Zheng et al., 2023) |
| SeizureTransformer | TUSZ (EEG) | — | — | AUROC 0.876 | 1 FP/day | (Wu et al., 1 Apr 2025) |
| CNN-TRF-BM | Multiple (6 centers, EEG) | 61.7–100 | 53.4–100 | — | 0.42–2.0/h | (Peh et al., 2022) |
| Set Transformer (2-stage) | CHB-MIT EEG | 80.1 (after ch. selection) | — | — | 0.11/h | (Zheng et al., 21 Jul 2025) |
| Unsupervised Transformer | MIT, UPenn, TUH EEG | — | — | AUC 0.94 | — | (Potter et al., 2023) |
| Video SETR-PKD | In-House, GESTURES | — | — | 83.9% | — | (Mehta et al., 2023) |
Models attain state-of-the-art sensitivity and specificity for detection tasks (CHB-MIT: Spiking Conformer 94.9/99.3%, LCT 96.82/95.81%), robust F1/AUC (ScatterFormer median AUCROC 98.14%), and competitive prediction horizon (CNN-Transformer: mean SPC 76.8 min before onset (Koutsouvelis et al., 2024)). False positive rates remain clinically acceptable (SeizureTransformer: 1 FP/day; Set Transformer 0.11/h).
Patient-independence is demonstrated (CNN-TRF-BM, LCT, ScatterFormer), with models trained and validated across multiple centers, ages, and modalities. Channel-aware transformers enable patient-specific channel reduction, facilitating wearable applications.
6. Interpretability, Clinical Deployment, and Limitations
Interpretability and deployment are addressed explicitly in several works:
- Attention-Based Explainability: Disentangled FAA in ScatterFormer (Zheng et al., 2023) yields attention maps that electrophysiologists find visually interpretable, with high-frequency branches matching expert annotations.
- Model Calibration and Uncertainty: CNN-TRF-BM’s BM loss improves output calibration, providing quantifiable thresholds for clinical integration (Peh et al., 2022).
- Real-Time Operation: LCT (Rukhsar et al., 2023), LookAroundNet (Sverrisson et al., 9 Jan 2026), and SETR-PKD (Mehta et al., 2023) report inference times and memory footprints compatible with real-time deployment (LCT: 6 ms/segment, LookAroundNet: 5.4 s/h EEG, SETR-PKD: <50 ms per 2 s video window).
- Limitations: Robustness to artifacts, minimum event durations, and cross-modality generalization are areas identified for further research. High specificity sometimes trades off against sensitivity for short or morphologically atypical seizures. False positive rates are dataset- and context-dependent.
7. Advancements in Seizure Prediction and Beyond
Transformer-based architectures extend beyond detection to prediction tasks:
- Preictal Period Optimization: CNN-Transformer models (Koutsouvelis et al., 2024) introduce the Continuous Input-Output Performance Ratio (CIOPR) for subject-specific labeling of preictal segments, achieving sensitivity of 99.31% and mean prediction horizons of 76.8 minutes.
- Set Transformer Channel Selection: By mining attention statistics, two-stage Set Transformers (Zheng et al., 21 Jul 2025) provide patient-tailored electrode selection, reducing device size for wearable seizure predictors without sacrificing accuracy (mean sensitivity 80.1%, mean channels used 2.8).
- Unsupervised Prediction: Fully unsupervised strategies (Potter et al., 2023) bypass the need for costly expert labeling and demonstrate superior recall, particularly in highly imbalanced datasets.
Transformers are thus central in the push toward accurate, resource-efficient, explainable, and patient-independent seizure detection and prediction—facilitating real-world deployment in clinics, wearables, and privacy-constrained settings.