Faculty, Staff and Student Publications
Language
English
Publication Date
7-1-2025
Journal
Journal of the American Medical Informatics Association
DOI
10.1093/jamia/ocaf084
PMID
40460022
PMCID
PMC12203503
PubMedCentral® Posted Date
6-3-2025
PubMedCentral® Full Text Version
Post-print
Abstract
Objective: Unlocking clinical information embedded in clinical notes has been hindered to a significant degree by domain-specific and context-sensitive language. Identification of note sections and structural document elements has been shown to improve information extraction and dependent downstream clinical natural language processing (NLP) tasks and applications. This study investigates the viability of a dynamic example selection prompting method to section classification using lightweight, open-source large language models (LLMs) as a practical solution for real-world healthcare clinical NLP systems.
Materials and methods: We develop a dynamic few-shot prompting approach to classifying sections where section samples are first embedded using a transformer-based model and deposited in a vector store. During inference, the embedded samples with the most similar contextual embeddings to a given input section text are retrieved from the vector store and inserted into the LLM prompt. We evaluate this technique on two datasets comprising two section schemas, including varying levels of context. We compare the performance to baseline zero-shot and randomly selected few-shot scenarios.
Results: The dynamic few-shot prompting experiments yielded the highest F1 scores in each of the classification tasks and datasets for all seven of the LLMs included in the evaluation, averaging a macro F1 increase of 39.3% and 21.1% in our primary section classification task over the zero-shot and static few-shot baselines, respectively.
Discussion and conclusion: Our results showcase substantial performance improvements imparted by dynamically selecting examples for few-shot LLM prompting, and further improvement by including section context, demonstrating compelling potential for clinical applications.
Keywords
Natural Language Processing, Electronic Health Records, Humans, Information Storage and Retrieval, Large Language Models, section classification, clinical natural language processing, large language model, electronic health records
Published Open-Access
yes
Recommended Citation
Miller, Kurt; Bedrick, Steven; Lu, Qiuhao; et al., "Dynamic Few-Shot Prompting for Clinical Note Section Classification Using Lightweight, Open-Source Large Language Models" (2025). Faculty, Staff and Student Publications. 991.
https://digitalcommons.library.tmc.edu/uthshis_docs/991