EEG-SpikeAgent: Agentic Closed-Loop Program Synthesis for Automated EEG Spike Detection
2026-07-06 • Computation and Language
Computation and LanguageArtificial IntelligenceMachine Learning
AI summaryⓘ
The authors developed EEG-SpikeAgent, a system that uses a large language model to create simple, explainable features for detecting epileptic spikes in brain wave recordings. The system makes one feature at a time, tests how well it works, and then improves the features based on the results. When tested on a public EEG dataset, EEG-SpikeAgent produced features that helped detect epileptic activity with good accuracy while keeping the detection method clear and understandable. Their approach also improved performance by considering noise and artifacts in the data. Overall, the authors show that AI can help design understandable detection methods for medical EEG analysis.
Electroencephalography (EEG)Epileptiform dischargesInterictal spikesLarge language model (LLM)Program synthesisFeature engineeringGradient-boosted treesArtifact detectionSensitivity and specificityVEPISET dataset
Authors
Sonali Santhosh, Kelly Shuhong Yu, Eugene Chang, Jonathan Kim, Kie Shidara, Danilo Bernardo
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.