MedAdapter: Efficient Test-Time Adaptation of Large Language Models towards Medical Reasoning

Wenqi Shi, Ran Xu, Yuchen Zhuang, Yue Yu, Hang Wu, Carl Yang, May D. Wang · DOI

TL;DR

This paper introduces MedAdapter, a novel method for efficiently adapting large language models (LLMs) to the complex domain of medical reasoning. MedAdapter achieves this by fine-tuning a small "adapter" model to rank candidate solutions generated by LLMs, offering significant performance gains without the computational cost or privacy concerns of traditional fine-tuning.

What Problem Does This Paper Address?

Adapting powerful Large Language Models (LLMs) to specialized fields like medicine is crucial for advancing healthcare. However, this adaptation faces significant hurdles:

  • Model Size and Computational Resources: LLMs are massive, requiring substantial computational power and memory for fine-tuning, which is often beyond the reach of academic institutions and medical centers.
  • Data Privacy: Medical data is highly sensitive and subject to strict regulations like HIPAA. Fine-tuning LLMs, especially black-box models accessed via APIs, raises concerns about data leakage and unauthorized access.
  • Existing Adaptation Methods:
    • White-box LLMs (e.g., LLaMA): While offering full parameter access for fine-tuning, they still require significant resources and can be less performant than larger black-box models. Parameter-efficient fine-tuning (PEFT) methods help, but often at the cost of performance.
  • Black-box LLMs (e.g., GPT-3.5): Fine-tuning these via APIs is costly, lacks transparency, and poses privacy risks. Current methods for adapting black-box models are often task-specific or limited in scope.

MedAdapter aims to bridge this gap by providing an efficient, privacy-preserving, and cost-effective solution for medical domain adaptation.

Methods

MedAdapter employs a two-stage approach:

  1. Candidate Solution Generation: A pre-trained LLM (the "generator") is used to produce multiple candidate reasoning solutions (e.g., chain-of-thought rationales) for a given medical question.
  2. Outcome-Supervised Adapter (MedAdapter): A small, BERT-sized language model (around 110M parameters) is trained as an "adapter." This adapter learns to rank the candidate solutions generated in the first stage. It's trained using outcome supervision, meaning it learns to distinguish between correct and incorrect solutions based on ground-truth answers. This adapter acts as a "verifier," assigning an adaptation score to each candidate solution.

During inference, MedAdapter uses the generator to produce candidate solutions and then employs the trained adapter to select the solution with the highest adaptation score as the final answer. This "best-of-K" inference strategy allows for efficient adaptation without modifying the original LLM's parameters or requiring direct access to them.

Datasets

The study evaluates MedAdapter on a range of biomedical datasets across different tasks:

  • Biomedical QA Tasks:
    • MedMCQA
    • MedQA
    • MMLU-Med (a subset of MMLU)
    • PubMedQA
    • BioASQ
  • Biomedical NLP Tasks:
    • MedNLI (Natural Language Inference)
    • MediQA-RQE (Recognizing Question Entailment)
    • PubHealth (Health Fact-Checking)

Key Insights and Ideas

  • Adapter as a Ranker: The core innovation is using a small adapter not to generate text, but to rank generated text. This shifts the adaptation burden from the massive LLM to a lightweight model, making it efficient.
  • Test-Time Adaptation for Medical Reasoning: MedAdapter offers a novel test-time adaptation strategy that is particularly well-suited for complex reasoning tasks where multiple potential solutions can be generated.
  • Privacy-Preserving Black-Box Adaptation: By avoiding direct fine-tuning of black-box LLMs via APIs and instead using them for generation, MedAdapter significantly mitigates privacy risks and reduces costs.
  • Complementary to Existing Methods: MedAdapter can be combined with train-time adaptation techniques (like LoRA) to further boost performance, showing its flexibility.
  • Label Efficiency: MedAdapter demonstrates strong performance gains even with a reduced amount of training data (40-60%), highlighting its efficiency.

Key Results

  • White-box LLMs: MedAdapter achieved average performance improvements of 25.48% for QA tasks, 12.66% for NLI, 3.48% for RQE, and 2.36% for fact-checking on white-box LLMs. It reached 99.35% of supervised fine-tuning performance while using only 1.57% of the parameters.
  • Black-box LLMs: For black-box LLMs like GPT-3.5-turbo, MedAdapter achieved an average performance improvement of 11.31% for QA tasks, 8.45% for NLI, 2.61% for RQE, and 20.05% for health fact-checking. Crucially, it achieved this at 15.59% of the cost of Azure-SFT and without privacy risks.
  • Efficiency: MedAdapter uses significantly less GPU memory (e.g., 14.75% of LLAMA-2-7B for adaptation) compared to full supervised fine-tuning.
  • Generative Tasks: MedAdapter also showed effectiveness in medical generative tasks like open-ended QA and text summarization.

Limitations and Future Work

  • Access to Label Information: MedAdapter still requires task-specific labeled data to train the small adapter. Scenarios with restricted or unavailable labels remain a challenge.
  • On-Device Inference for Black-Box LLMs: While training is privacy-preserving, handling sensitive patient data during inference with black-box LLMs remains a challenge due to their size and potential for data transmission.
  • Resource Limitations for Experiments: The experiments with black-box fine-tuning were limited to GPT-3.5-Turbo due to API service constraints and costs.
  • Future Work: The authors suggest exploring MedAdapter's potential in more complex, low-resource medical reasoning tasks and investigating its application in on-device inference scenarios. Further research into optimizing the adapter's architecture and training objectives could also be beneficial.

Summary updated

Abstract

Despite their improved capabilities in generation and reasoning, adapting large language models (LLMs) to the biomedical domain remains challenging due to their immense size and corporate privacy. In this work, we propose MedAdapter, a unified post-hoc adapter for test-time adaptation of LLMs towards biomedical applications. Instead of fine-tuning the entire LLM, MedAdapter effectively adapts the original model by fine-tuning only a small BERT-sized adapter to rank candidate solutions generated by LLMs. Experiments demonstrate that MedAdapter effectively adapts both white-box and black-box LLMs in biomedical reasoning, achieving average performance improvements of 25.48% and 11.31%, respectively, without requiring extensive computational resources or sharing data with third parties. MedAdapter also yields superior performance when combined with train-time adaptation, highlighting a flexible and complementary solution to existing adaptation methods. Faced with the challenges of balancing model performance, computational resources, and data privacy, MedAdapter provides an efficient, privacy-preserving, cost-effective, and transparent solution for adapting LLMs to the biomedical domain.
BibTeX
@misc{shi2024medadapter,
  author = {Wenqi Shi and Ran Xu and Yuchen Zhuang and Yue Yu and Hang Wu and Carl Yang and May D. Wang},
  title = {{MedAdapter: Efficient Test-Time Adaptation of Large Language Models towards Medical Reasoning}},
  year = {2024},
  eprint = {2405.03000},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2405.03000},
}
Figure