[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-detail-83825-en":3,"doc-seo-83825-105":29,"detail-sidebar-cat-0-en-105":91},{"code":4,"msg":5,"data":6},0,"success",{"doc_id":7,"user_id":8,"nickname":9,"user_avatar":10,"doc_module":4,"category_id":11,"category_name":12,"doc_title":13,"doc_description":14,"doc_content":15,"file_id":16,"file_url":17,"file_type":18,"file_size":19,"view_count":20,"is_deleted":4,"is_public":20,"is_downloadable":20,"audit_status":20,"page_count":21,"language":22,"language_code":23,"site_id":24,"html_lang":23,"table_of_contents":25,"faqs":26,"seo_title":13,"seo_description":14,"update_tm":27,"read_time":28},83825,2336464648322,"Aria","https://ap-avatar.wpscdn.com/avatar/2200025388227c56fec?_k=1778556882303663488",8,"Research & Report","EEG SpikeAgent Agentic Closed Loop Program Synthesis for Automated EEG Spike Detection","Automated detection of interictal epileptiform discharges in scalp EEG is clinically important, yet many high-accuracy deep models sacrifice interpretability. EEGSpikeAgent introduces a closed-loop program-synthesis framework where an LLM agent iteratively proposes deterministic EEG signal-processing feature modules, executes generated code to produce tabular features, evaluates via a tabular classifier, and returns structured diagnostics for refinement. On VEPISET, five-fold cross-validation with a gradient-boosted tree yields AUROC 0.935, balanced accuracy 0.699, F1 0.557.","EEG-SpikeAgent: Agentic Closed-Loop Program Synthesis for Automated EEG Spike Detection  \nSonali Santhosh 1 , Kelly Shuhong Yu2 , Eugene Chang2  \nJonathan Kim3 , Kie Shidara4 , Danilo Bernardo4,5  \n1Dept. of Brain and Cognitive Sciences, Massachusetts Institute of Technology, Cambridge, MA, USA  \n2Dept. of Neuroscience, University of California, Berkeley, Berkeley, CA, USA  \n3Dept. of Neurology and Neurologic Sciences, Stanford University, Palo Alto, CA, USA  \n4Weill Institute of Neurology and Neurosciences, University of California, San Francisco, San Francisco, CA, USA  \n[5](5 dbernardoj@gmail.com)[ dbernardoj@gmail.com](5 dbernardoj@gmail.com)  \narXiv :2607 .04558v 1 [ cs .CL] 6 Jul 2026  \nAbstract—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 EEGSpikeAgent, 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.  \nIndex Terms—LLM, agent, EEG, spike detection, agentic AI  \nI. INTRODUCTION  \nAutomated detection of interictal epileptiform discharges (IEDs) in scalp EEG remains challenging [1]–[3] . Human interpreters rely on spatial cues such as phase reversals in bipolar chains [4],[5] and temporal features such as distinctive spike morphology [6]–[10] . Purely data-driven methods can perform well but often require large labeled corpora, may learn brittle shortcuts, and lack interpretability [1]–[3] . Physicsbased pipelines are interpretable and data-efficient yet typically evolve via slow, manual iteration [11]–[13] . We previously demonstrated the potential of LLM agents in EEG analysis [14], and here, we were motivated to use LLM agents to automate manual engineering of physics-based pipeline for EEG analysis.  \nRecent deep learning systems have substantially improved upon automating EEG marker detection, with several models  \nhaving achieved expert-level accuracy in identifying interictalepileptiform discharges (IEDs) . Nonetheless, these systems continuously raise interpretability and generalizability concerns, as their performance effectiveness may differ based on varying datasets or recording conditions [15]–[17] . Featureengineered EEG pipelines provide a transparent alternative by incorporating predefined characteristics, namely signal morphology, spectral content, spatial organization, and artifact signatures. However, these pipelines often encounter limitations stemming from their dependence on manually curated feature sets and the prolonged refinement processes required from exper","cbCaikiBCMpaQkPB","https://ap.wps.com/l/cbCaikiBCMpaQkPB","pdf",925042,1,7,"English","en",105,"# Introduction\n# Methods\n## Problem formulation and dataset organization\n## Closed-loop program-synthesis workflow","[{\"question\":\"What problem does EEG-SpikeAgent address in EEG analysis?\",\"answer\":\"It targets automated detection of interictal epileptiform discharges (IEDs) in scalp EEG, where interpretability and robust feature engineering remain challenging despite strong deep-learning performance.\"},{\"question\":\"How does the closed-loop framework work?\",\"answer\":\"The LLM agent proposes deterministic EEG feature modules as code, the system executes the code to generate tabular features, evaluates performance with a classifier, summarizes diagnostics, and uses those diagnostics to refine the next proposal.\"},{\"question\":\"What dataset and evaluation setup are used to test the method?\",\"answer\":\"The method is evaluated on VEPISET, using five-fold cross-validation with a gradient-boosted tree classifier on 4-second epochs labeled for spike versus non-spike cases.\"}]",1784190677,18,{"code":4,"msg":30,"data":31},"ok",{"site_id":24,"language":23,"slug":32,"title":13,"keywords":33,"description":14,"schema_data":34,"social_meta":86,"head_meta":88,"extra_data":90,"updated_unix":27},"eeg-spikeagent-agentic-closed-loop-program-synthesis-for-automated-eeg-spike-detection","",{"@graph":35,"@context":85},[36,53,68],{"@type":37,"itemListElement":38},"BreadcrumbList",[39,43,47,50],{"item":40,"name":41,"@type":42,"position":20},"https://docshare.wps.com","Home","ListItem",{"item":44,"name":45,"@type":42,"position":46},"https://docshare.wps.com/document/","Document",2,{"item":48,"name":12,"@type":42,"position":49},"https://docshare.wps.com/document/research-report/",3,{"item":51,"name":13,"@type":42,"position":52},"https://docshare.wps.com/document/eeg-spikeagent-agentic-closed-loop-program-synthesis-for-automated-eeg-spike-detection/83825/",4,{"url":51,"name":13,"@type":54,"author":55,"headline":13,"publisher":57,"fileFormat":60,"inLanguage":23,"description":14,"dateModified":61,"datePublished":62,"encodingFormat":60,"isAccessibleForFree":63,"interactionStatistic":64},"DigitalDocument",{"name":9,"@type":56},"Person",{"url":40,"name":58,"@type":59},"DocShare","Organization","application/pdf","2026-07-17","2026-07-16",true,{"@type":65,"interactionType":66,"userInteractionCount":20},"InteractionCounter",{"@type":67},"ViewAction",{"@type":69,"mainEntity":70},"FAQPage",[71,77,81],{"name":72,"@type":73,"acceptedAnswer":74},"What problem does EEG-SpikeAgent address in EEG analysis?","Question",{"text":75,"@type":76},"It targets automated detection of interictal epileptiform discharges (IEDs) in scalp EEG, where interpretability and robust feature engineering remain challenging despite strong deep-learning performance.","Answer",{"name":78,"@type":73,"acceptedAnswer":79},"How does the closed-loop framework work?",{"text":80,"@type":76},"The LLM agent proposes deterministic EEG feature modules as code, the system executes the code to generate tabular features, evaluates performance with a classifier, summarizes diagnostics, and uses those diagnostics to refine the next proposal.",{"name":82,"@type":73,"acceptedAnswer":83},"What dataset and evaluation setup are used to test the method?",{"text":84,"@type":76},"The method is evaluated on VEPISET, using five-fold cross-validation with a gradient-boosted tree classifier on 4-second epochs labeled for spike versus non-spike cases.","https://schema.org",{"og:url":51,"og:type":87,"og:title":13,"og:site_name":58,"og:description":14},"article",{"robots":89,"canonical":51},"index,follow",{"doc_id":7,"site_id":24},{"code":4,"msg":5,"data":92},[93,97,101,105,110,115,119,122,127,130,134],{"id":20,"doc_module":4,"doc_module_name":45,"category_name":94,"show_sort_weight":95,"slug":96},"Story & Novel",90,"story-novel",{"id":46,"doc_module":4,"doc_module_name":45,"category_name":98,"show_sort_weight":99,"slug":100},"Literature",80,"literature",{"id":52,"doc_module":4,"doc_module_name":45,"category_name":102,"show_sort_weight":103,"slug":104},"Exam",70,"exam",{"id":106,"doc_module":4,"doc_module_name":45,"category_name":107,"show_sort_weight":108,"slug":109},5,"Comic",60,"comic",{"id":111,"doc_module":4,"doc_module_name":45,"category_name":112,"show_sort_weight":113,"slug":114},6,"Technology",50,"technology",{"id":21,"doc_module":4,"doc_module_name":45,"category_name":116,"show_sort_weight":117,"slug":118},"Healthcare",40,"healthcare",{"id":11,"doc_module":4,"doc_module_name":45,"category_name":12,"show_sort_weight":120,"slug":121},30,"research-report",{"id":123,"doc_module":4,"doc_module_name":45,"category_name":124,"show_sort_weight":125,"slug":126},9,"Religion & Spirituality",20,"religion-spirituality",{"id":125,"doc_module":4,"doc_module_name":45,"category_name":128,"show_sort_weight":125,"slug":129},"World Cup","world-cup",{"id":131,"doc_module":4,"doc_module_name":45,"category_name":132,"show_sort_weight":131,"slug":133},10,"Lifestyle","lifestyle",{"id":135,"doc_module":4,"doc_module_name":45,"category_name":136,"show_sort_weight":106,"slug":137},19,"General","general"]