EEG-SpikeAgent: Agentic Closed-Loop Program Synthesis for Automated EEG Spike Detection

📅 2026-07-05
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
This study addresses the poor interpretability of existing automated models for detecting epileptiform discharges in scalp electroencephalography (EEG) by proposing the first large language model (LLM)-agent-driven, closed-loop program synthesis framework. This framework automatically generates, executes, and optimizes interpretable, deterministic signal processing feature modules. Integrating gradient-boosted tree classifiers with a structured performance feedback mechanism, the approach enables auditable EEG spike detection and incorporates an artifact-aware feature generation strategy to enhance robustness. Evaluated via five-fold cross-validation on the VEPISET dataset, the model achieves an AUC of 0.935, balanced accuracy of 0.699, and an F1 score of 0.557; at a sensitivity of 0.80, it attains a mean precision of 0.470 and specificity of 0.900.
📝 Abstract
Automated detection of interictal epileptiform discharges in scalp electroencephalography (EEG) is clinically important, but recent high-performing deep-learning models often trade interpretability for accuracy. We introduce EEG-SpikeAgent, a closed-loop program-synthesis framework that uses a large language model (LLM) agentic system to generate signal-processing features for spike detection in scalp EEG. The system iteratively proposes one deterministic EEG feature module at a time, executes the resulting code on EEG to generate tabular features, evaluates performance via a tabular classifier, summarizes run-level metrics, and feeds structured diagnostics back to the model for refinement. Across iterations, EEG-SpikeAgent proposes and refines candidate signal features and decision rules informed by model performance. We evaluated EEG-SpikeAgent on VEPISET, a public 29-channel dataset of 4-second epochs containing 2,516 discharge-containing and 22,933 non-discharge epochs. Across five-fold cross-validation with a gradient-boosted tree classifier, agent-generated features achieved an area under the receiver operating characteristic curve of 0.935, balanced accuracy of 0.699, F1 score of 0.557, sensitivity of 0.401, and specificity of 0.996 at the default operating point. At an operating point with sensitivity 0.80, mean precision was 0.470 and mean specificity was 0.900. Artifact-aware feature generation improved balanced accuracy and F1 score over spike-only feature search. These results indicate that LLM-based program synthesis can automate EEG feature engineering in auditable and inspectable code-driven manner for clinical and methodological review.
Problem

Research questions and friction points this paper is trying to address.

EEG spike detection
interpretability
automated feature engineering
interictal epileptiform discharges
scalp electroencephalography
Innovation

Methods, ideas, or system contributions that make the work stand out.

program synthesis
large language model
EEG spike detection
closed-loop optimization
interpretable feature engineering
S
Sonali Santhosh
Dept. of Brain and Cognitive Sciences, Massachusetts Institute of Technology, Cambridge, MA, USA
K
Kelly Shuhong Yu
Dept. of Neuroscience, University of California, Berkeley, Berkeley, CA, USA
Eugene Chang
Eugene Chang
University of Chicago
Microbiome MedicineHost-Microbe interactionsMicrobiomeMetabolismComplex Immune Disorders
J
Jonathan Kim
Dept. of Neurology and Neurologic Sciences, Stanford University, Palo Alto, CA, USA
K
Kie Shidara
Weill Institute of Neurology and Neurosciences, University of California, San Francisco, San Francisco, CA, USA
Danilo Bernardo
Danilo Bernardo
University of California, San Francisco
EpilepsyPediatric Epilepsy