Zero- and few-shot Named Entity Recognition and Text Expansion in medication prescriptions using large language models

Isaradech N, Riedel A, Sirikul W, Kreuzthaler M, Schulz S (2025)


Publication Type: Journal article

Publication year: 2025

Journal

Book Volume: 167

Article Number: 103165

DOI: 10.1016/j.artmed.2025.103165

Abstract

Medication prescriptions in electronic health records (EHR) are often in free-text and may include a mix of languages, local brand names, and a wide range of idiosyncratic formats and abbreviations. Large language models (LLMs) have shown a promising ability to generate text in response to input prompts. We use ChatGPT3.5 to automatically structure and expand medication statements in discharge summaries and thus make them easier to interpret for people and machines. Named Entity Recognition (NER) and Text Expansion (EX) are used with different prompt strategies in a zero- and few-shot setting. 100 medication statements were manually annotated and curated. NER performance was measured by using strict and partial matching. For the EX task, two experts interpreted the results by assessing semantic equivalence between original and expanded statements. The model performance was measured by precision, recall, and F1 score. For NER, the best-performing prompt reached an average F1 score of 0.94 in the test set. For EX, the few-shot prompt showed superior performance among other prompts, with an average F1 score of 0.87. Our study demonstrates good performance for NER and EX tasks in free-text medication statements using ChatGPT3.5. Compared to a zero-shot baseline, a few-shot approach prevented the system from hallucinating, which is essential when processing safety-relevant medication data. We tested ChatGPT3.5-tuned prompts on other LLMs, including ChatGPT4o, Gemini 2.0 Flash, MedLM-1.5-Large, and DeepSeekV3. The findings showed most models outperformed ChatGPT3.5 in NER and EX tasks.

Authors with CRIS profile

Involved external institutions

How to cite

APA:

Isaradech, N., Riedel, A., Sirikul, W., Kreuzthaler, M., & Schulz, S. (2025). Zero- and few-shot Named Entity Recognition and Text Expansion in medication prescriptions using large language models. Artificial Intelligence in Medicine, 167. https://doi.org/10.1016/j.artmed.2025.103165

MLA:

Isaradech, Natthanaphop, et al. "Zero- and few-shot Named Entity Recognition and Text Expansion in medication prescriptions using large language models." Artificial Intelligence in Medicine 167 (2025).

BibTeX: Download