HyperAIHyperAI

Command Palette

Search for a command to run...

A Zero-shot and Few-shot Study of Instruction-Finetuned Large Language Models Applied to Clinical and Biomedical Tasks

Yanis Labrak Mickael Rouvier Richard Dufour

Abstract

The recent emergence of Large Language Models (LLMs) has enabled significant advances in the field of Natural Language Processing (NLP). While these new models have demonstrated superior performance on various tasks, their application and potential are still underexplored, both in terms of the diversity of tasks they can handle and their domain of application. In this context, we evaluate four state-of-the-art instruction-tuned LLMs (ChatGPT, Flan-T5 UL2, Tk-Instruct, and Alpaca) on a set of 13 real-world clinical and biomedical NLP tasks in English, including named-entity recognition (NER), question-answering (QA), relation extraction (RE), and more. Our overall results show that these evaluated LLMs approach the performance of state-of-the-art models in zeroand few-shot scenarios for most tasks, particularly excelling in the QA task, even though they have never encountered examples from these tasks before. However, we also observe that the classification and RE tasks fall short of the performance achievable with specifically trained models designed for the medical field, such as PubMedBERT. Finally, we note that no single LLM outperforms all others across all studied tasks, with some models proving more suitable for certain tasks than others.

One-sentence Summary

Avignon Université, Nantes Université, and CNRS evaluate four instruction-tuned LLMs (ChatGPT, Flan-T5 UL2, Tk-Instruct, and Alpaca) on 13 clinical and biomedical NLP tasks in zero- and few-shot settings, finding that they approach state-of-the-art performance on question-answering but fall short of domain-specific models like PubMedBERT on classification and relation extraction.

Key Contributions

  • Evaluates four instruction-tuned LLMs, including ChatGPT, Flan-T5 UL2, Tk-Instruct, and Alpaca, on 13 real-world clinical and biomedical NLP tasks in English, covering named entity recognition, question answering, and relation extraction under zero- and few-shot settings.

  • Shows that these LLMs can approach state-of-the-art performance without task-specific training, especially for question answering, while specialized medical models such as PubMedBERT remain stronger for classification and relation extraction.

  • Compares model behavior across tasks, finding that no single LLM outperforms all others, and highlights domain-specific models with specialized instruction prompts or BERT-style models as practical alternatives for clinical and biomedical applications.

Introduction

Medical natural language processing increasingly depends on large textual databases and deep learning to support clinical and biomedical applications. Traditional masked language models such as BERT and PubMedBERT are effective, but they usually require substantial task-specific annotated data, which is expensive, privacy sensitive, and difficult to generalize across domains and languages. Large language models offer a promising alternative because instruction-tuned systems can perform many tasks in zero and few shot settings, but their evaluation in medicine has often been limited by small task sets, scarce sensitive data, and metrics that make comparison with established baselines difficult. The authors evaluate four instruction-tuned models, ChatGPT, Flan-T5 UL2, Tk-Instruct, and Alpaca, across 13 real-world medical tasks, including classification, question answering, relation extraction, natural language inference, and named entity recognition, using accuracy and F1 to compare fairly with fine-tuned PubMedBERT. They also introduce Recursive Chain-of-Thought, a prompt-based method that sequentially enriches reasoning to support named entity recognition on a broad range of LLMs.

Method

The method augments few-shot prompting with a semantic retrieval module and introduces a recursive decoding procedure for entity extraction. The overall framework has two connected stages: selecting demonstrations that are semantically similar to the current input, and generating entity labels token by token through an iterative state-dependent prompt.

For demonstration selection, the authors leverage a fixed Sentence-Transformers-based encoder, specifically PubMedBERT, to represent each instruction prompt from the training set. Each training prompt xix_ixi​ is mapped to a fixed embedding eie_iei​. When a test instance with query qqq arrives, the same encoder produces eqe_qeq​. The system then computes similarity between the query embedding and all stored training embeddings, using cosine similarity or cosine distance, and selects the top kkk most semantically related examples. In the described setup, k=5k=5k=5. The retrieved examples are inserted into the prompt as few-shot context, with the goal of improving generalization compared with randomly sampled demonstrations.

For prediction, the method uses a recursive reasoning loop over the token sequence. Given an input sequence w1,…,wNw_1,\ldots,w_Nw1​,…,wN​, the model does not attempt to generate the full labeled output in a single pass. Instead, it maintains a growing prediction state that includes the instruction, the retrieved examples, the token sequence, and the labels generated so far. At each step, the model is asked to predict the label for the next token, conditioned on the current state. This process continues until every token has an associated label. The token-by-token recursion helps guarantee that no token is skipped and reduces the risk of missing entities during generation.

The two inference strategies differ in prompt format and decoding behavior. One strategy uses a special separator pattern to encode word boundaries and label boundaries within a single generation pass, enabling a more direct decoding process. The other strategy is the Recursive Chain-of-Thought procedure, which iterates over the sequence and queries the model once per token. This recursive design is more compatible with generic generative models and mirrors an explicit step-by-step annotation process, but it introduces additional computational overhead because each token requires a separate state-conditioned generation step.

Experiment

Experiments benchmark four general-purpose LLMs against a biomedical baseline across 13 clinical and biomedical tasks, using structured prompts, task-specific output parsing, semantic few-shot retrieval, and recursive chain-of-thought inference to evaluate zero-shot, few-shot, and named entity recognition behavior. The results show that generative models are generally less effective than the fine-tuned baseline in zero-shot settings, with stronger performance mainly on question answering and uneven behavior across models, especially poor zero-shot classification for Alpaca. Few-shot prompting substantially improves generative performance, indicating that in-context examples, task-specific prompts, and structured inference strategies are important for adapting general LLMs to specialized biomedical applications.

The evaluation suite spans diverse clinical and biomedical tasks, including classification and question answering, to assess model behavior across classical and generative settings. Each task is paired with an evaluation split and a task-specific metric, such as F1 for classification and accuracy for question answering. The task set covers classification and question-answering tasks in clinical and biomedical domains. Evaluation uses task-specific metrics, including F1 and accuracy.

Fine-tuned PubMedBERT is generally stronger than generative models in zero-shot settings across clinical and biomedical tasks, except for question answering, where the generative models perform better. Five-shot prompting improves several generative models, with Alpaca showing the largest gains and ChatGPT gaining especially on question answering. Alpaca's poor zero-shot classification scores, associated with hallucinated outputs, are much improved when examples are provided. Generative models lag behind fine-tuned PubMedBERT in zero-shot settings but show stronger relative performance on question answering. Five-shot examples substantially reduce Alpaca's zero-shot weaknesses and further improve ChatGPT, particularly on question answering.

The evaluation compares fine-tuned and generative models on clinical and biomedical classification and question-answering tasks using task-specific metrics such as F1 and accuracy. Fine-tuned PubMedBERT generally outperforms generative models in zero-shot settings, although generative models show an advantage on question answering. Prompting with five examples improves several generative models, especially mitigating Alpaca's zero-shot weaknesses and enhancing ChatGPT's question-answering performance.


Build AI with AI

From idea to launch — accelerate your AI development with free AI co-coding, out-of-the-box environment and best price of GPUs.

AI Co-coding
Ready-to-use GPUs
Best Pricing

HyperAI Newsletters

Subscribe to our latest updates
We will deliver the latest updates of the week to your inbox at nine o'clock every Monday morning
Powered by MailChimp