Related Experiment Video
Updated: Jun 26, 2026

03:14
Augmenting Large Language Models via Vector Embeddings to Improve Domain-Specific Responsiveness
Published on: December 6, 2024
SPELL: A scalable NLP method using regular expressions and large language models for clinical information extraction.
Ricardo Kleinlein1, David W Bates2, Carolyn Guan1
1Department of Anesthesiology, Perioperative and Pain Medicine, Brigham and Women's Hospital, Harvard Medical School, Boston, MA, USA.
Computer Methods and Programs in Biomedicine
|June 24, 2026
Summary
SPELL, a novel NLP pipeline, efficiently extracts structured data from clinical notes using regex and LLMs. This method significantly speeds up data analysis compared to manual annotation and full-document processing.
Area of Science:
- Natural Language Processing (NLP)
- Machine Learning (ML)
- Clinical Informatics
Background:
- Electronic Health Records (EHRs) contain valuable unstructured clinical narratives.
- Analyzing unstructured EHR data at scale is challenging for research and decision-making.
- SPELL (Snippet-Primed rEgex LLM Pipeline) was developed to address this challenge.
Purpose of the Study:
- To develop a scalable NLP workflow for extracting structured variables from large collections of clinical narratives.
- To combine regular-expression-based snippet retrieval with locally hosted large language model (LLM) inference.
- To enable accurate and computationally efficient extraction of information from unstructured EHR data.
Main Methods:
- SPELL retrieves text snippets using task-specific regular expressions and applies LLM inference on these snippets.
- All processing is conducted within institutional computing environments.
- Accuracy and efficiency were evaluated on obstetric tasks (blood loss, estimated due date, HELLP syndrome) and a generalizability task (ventricular tachycardia detection).
Main Results:
- SPELL processed 31 million clinical notes, demonstrating scalability.
- Snippet-based inference reduced processing time by 71-87% compared to full-document LLM inference.
- High accuracy was achieved: 98% for blood loss, 92% for estimated due date, and 94% F1 for HELLP syndrome.
Conclusions:
- A hybrid regex-snippet-LLM pipeline enables accurate and computationally efficient extraction from unstructured EHR narratives.
- SPELL offers a scalable solution for leveraging valuable information within clinical notes.
- This approach enhances the utility of EHR data for research and clinical decision support.