Preprint
Large Language Models

Improving large language models for clinical named entity recognition via prompt engineering

Yan Hu(Museum of Fine Arts, Houston), Qingyu Chen(National Institutes of Health), Jingcheng Du(Museum of Fine Arts, Houston), Xueqing Peng(Yale University), Vipina K. Keloth(Yale University), Xu Zuo(Museum of Fine Arts, Houston), Yujia Zhou(Museum of Fine Arts, Houston), Zehan Li(Museum of Fine Arts, Houston), Xiaoqian Jiang(Museum of Fine Arts, Houston), Zhiyong Lu(National Institutes of Health), Kirk Roberts(Museum of Fine Arts, Houston), Hua Xu(Yale University)
January 27, 2024Journal of the American Medical Informatics Association364 citations

364

Citations

15

Influential Citations

Journal of the American Medical Informatics Association

Venue

2024

Year

Abstract

IMPORTANCE: The study highlights the potential of large language models, specifically GPT-3.5 and GPT-4, in processing complex clinical data and extracting meaningful information with minimal training data. By developing and refining prompt-based strategies, we can significantly enhance the models' performance, making them viable tools for clinical NER tasks and possibly reducing the reliance on extensive annotated datasets. OBJECTIVES: This study quantifies the capabilities of GPT-3.5 and GPT-4 for clinical named entity recognition (NER) tasks and proposes task-specific prompts to improve their performance. MATERIALS AND METHODS: We evaluated these models on 2 clinical NER tasks: (1) to extract medical problems, treatments, and tests from clinical notes in the MTSamples corpus, following the 2010 i2b2 concept extraction shared task, and (2) to identify nervous system disorder-related adverse events from safety reports in the vaccine adverse event reporting system (VAERS). To improve the GPT models' performance, we developed a clinical task-specific prompt framework that includes (1) baseline prompts with task description and format specification, (2) annotation guideline-based prompts, (3) error analysis-based instructions, and (4) annotated samples for few-shot learning. We assessed each prompt's effectiveness and compared the models to BioClinicalBERT. RESULTS: Using baseline prompts, GPT-3.5 and GPT-4 achieved relaxed F1 scores of 0.634, 0.804 for MTSamples and 0.301, 0.593 for VAERS. Additional prompt components consistently improved model performance. When all 4 components were used, GPT-3.5 and GPT-4 achieved relaxed F1 socres of 0.794, 0.861 for MTSamples and 0.676, 0.736 for VAERS, demonstrating the effectiveness of our prompt framework. Although these results trail BioClinicalBERT (F1 of 0.901 for the MTSamples dataset and 0.802 for the VAERS), it is very promising considering few training samples are needed. DISCUSSION: The study's findings suggest a promising direction in leveraging LLMs for clinical NER tasks. However, while the performance of GPT models improved with task-specific prompts, there's a need for further development and refinement. LLMs like GPT-4 show potential in achieving close performance to state-of-the-art models like BioClinicalBERT, but they still require careful prompt engineering and understanding of task-specific knowledge. The study also underscores the importance of evaluation schemas that accurately reflect the capabilities and performance of LLMs in clinical settings. CONCLUSION: While direct application of GPT models to clinical NER tasks falls short of optimal performance, our task-specific prompt framework, incorporating medical knowledge and training samples, significantly enhances GPT models' feasibility for potential clinical applications.

Analysis

Why This Paper Matters

This paper addresses a critical challenge in clinical NLP: the high cost of creating large annotated datasets for named entity recognition (NER). By systematically exploring prompt engineering for GPT-3.5 and GPT-4, the authors demonstrate that large language models (LLMs) can achieve competitive performance with minimal training examples. This is particularly important for clinical domains where annotated data is scarce and expensive to produce.

The study is timely given the rapid adoption of LLMs in healthcare. It provides a practical framework for practitioners to adapt general-purpose LLMs to specialized clinical tasks without extensive fine-tuning. The comparison with BioClinicalBERT, a state-of-the-art clinical BERT model, sets a clear benchmark and highlights the trade-offs between prompt-based approaches and traditional fine-tuned models.

Technical Contributions

The paper's main technical contribution is a four-component prompt framework:

  • Baseline prompts: Simple task description and output format specification.
  • Annotation guideline-based prompts: Incorporation of domain-specific guidelines to guide model reasoning.
  • Error analysis-based instructions: Iterative refinement of prompts based on common model errors.
  • Annotated samples for few-shot learning: Providing a small number of labeled examples to improve performance.

Each component is evaluated independently and in combination, showing additive benefits. The framework is task-agnostic and can be adapted to other clinical NER tasks.

Results

Key quantitative results:

  • MTSamples dataset: Baseline GPT-3.5 F1=0.634, GPT-4 F1=0.804; with full prompt framework GPT-3.5 F1=0.794, GPT-4 F1=0.861; BioClinicalBERT F1=0.901.
  • VAERS dataset: Baseline GPT-3.5 F1=0.301, GPT-4 F1=0.593; with full prompt framework GPT-3.5 F1=0.676, GPT-4 F1=0.736; BioClinicalBERT F1=0.802.

The improvements are substantial, especially for GPT-3.5 on VAERS (more than doubling F1). However, both models still lag behind BioClinicalBERT, indicating that prompt engineering alone cannot fully close the gap with fine-tuned models.

Significance

This work has broad implications for AI in healthcare. It shows that LLMs can be effectively adapted to clinical NER with minimal data, reducing the barrier to entry for clinical NLP applications. The prompt framework provides a reusable methodology that can be extended to other clinical tasks like relation extraction or text classification.

The study also underscores the importance of evaluation schemas that account for LLM-specific behaviors (e.g., relaxed matching). As LLMs continue to improve, prompt engineering may become a key technique for deploying AI in clinical settings, complementing or even replacing traditional fine-tuning approaches.