Zero-shot extraction of seizure outcomes from clinical notes using generative pretrained transformers

William K.s. Ojemann, Kevin Xie, Kevin Liu, Ellie Chang, Dan Roth, Brian Litt, Colin A. Ellis

Abstract

Purpose: Pre-trained encoder transformer models have extracted information from unstructured clinic note text but require manual annotation for supervised fine-tuning. Large, Generative Pre-trained Transformers (GPTs) may streamline this process. In this study, we explore GPTs in zero- and few-shot learning scenarios to analyze clinical health records.

Materials and Methods: We prompt-engineered LLAMA2 13B to optimize performance in extracting seizure freedom from epilepsy clinic notes and compared it against zero-shot and fine-tuned Bio+ClinicalBERT models. Our evaluation encompasses different prompting paradigms, including one-word answers, elaboration-based responses, prompts with date formatting instructions, and prompts with dates in context.

Results: We found promising median accuracy rates in seizure freedom classification for zero-shot GPT models: one-word – 62%, elaboration – 50%, prompts with formatted dates – 62%, and prompts with dates in context – 74%. These outperform the zero-shot Clinical BERT model (25%) but fall short of the fully fine-tuned BERT model (84%). Furthermore, in sparse contexts, such as notes from general neurologists, the best performing GPT model (76%) surpasses the fine-tuned BERT model (67%) in extracting seizure freedom.

Conclusion: This study demonstrates the potential of GPTs in extracting clinically relevant information from unstructured EMR text, offering insights into population trends in seizure management, drug effects, risk factors, and healthcare disparities. Moreover, GPTs exhibit superiority over task-specific models in contexts with the potential to include less precise descriptions of epilepsy and seizures, highlighting their versatility. Additionally, simple prompt engineering techniques enhance model accuracy, presenting a framework for leveraging EMR data with zero clinical annotation.

Introduction

Electronic Health Records (EHRs) contain a wealth of information in unstructured text, but extracting specific outcomes—like whether an epilepsy patient has been "seizure-free"—is notoriously difficult. Traditionally, researchers use "encoder" models like BERT, which require hundreds or thousands of manually annotated examples to perform well (supervised fine-tuning). This creates two major bottlenecks: the labor intensity of expert annotation and the brittleness of models that fail when applied to notes from different clinical settings.

The authors investigate whether Large Language Models (LLMs) can bypass these hurdles using zero-shot learning and clever prompt engineering, focusing on the Llama 2 13B model.

Methods and Prompt Engineering

The study centered on comparing Llama 2 13B against Bio+ClinicalBERT. The core methodology involved testing five distinct prompt engineering strategies to optimize the extraction of "seizure freedom" (defined as no seizures since the last visit or within the past year).

Table of the five prompt engineering strategies used to optimize Llama 2 performance.

These strategies ranged from simple one-word constraints to complex "Date-in-context" prompts. The latter used a simulated conversation to anchor the model's temporal reasoning, helping it distinguish between historical medical history and recent events mentioned in the note.

Illustration of the simulated conversation format used for instruction fine-tuning and date-in-context prompts.

Key Results

  • Accuracy Benchmarks: The best zero-shot Llama 2 configuration (Date-in-Context) achieved 74% accuracy, vastly outperforming zero-shot BERT (25%) but trailing the fully fine-tuned BERT (84%).
  • Generalization Win: On notes from non-specialist neurologists, Llama 2 (76%) outperformed the fine-tuned BERT model (67%). This suggests that LLMs generalize better to varied phrasing than models over-fitted to specialist dialects.
  • The Annotation Gap: A BERT model required at least 420 manually labeled notes before it could consistently beat the zero-shot LLM, highlighting the significant resource savings offered by GPTs.
  • Population Science Utility: Despite lower absolute accuracy, the LLM successfully reproduced 91% of the significant findings in a large-scale health disparity study, proving its utility for epidemiological research.

Discussion and Insights

A primary insight from this work is that temporal reasoning is the bottleneck in clinical extraction. The hardest part of the task is determining when a seizure happened relative to the note's date. The success of the "Date-in-context" prompt stems from its ability to explicitly anchor the model's timeline.

Interestingly, the researchers found that adding few-shot examples (Instruction Fine-tuning) actually decreased Llama 2's performance. The model appeared to prioritize the format of the examples over the actual reasoning required for the task.

Limitations

There are significant trade-offs in inference latency; processing 10,000 notes took 30 hours for Llama 2, compared to just 13 minutes for BERT. Additionally, the authors noted a sex-based bias where Llama 2 systematically under-predicted seizure freedom for female patients, emphasizing the need for rigorous bias auditing before clinical deployment.

Summary updated

BibTeX
@article{ojemann2025zero,
  author = {William K.S. Ojemann and Kevin Xie and Kevin Liu and Ellie Chang and Dan Roth and Brian Litt and Colin A. Ellis},
  title = {{Zero-shot extraction of seizure outcomes from clinical notes using generative pretrained transformers}},
  journal = {J. Heal. Informatics Res.},
  year = {2025},
  doi = {10.1007/s41666-025-00198-5},
}
Figure