Large Language Model Distilling Medication Recommendation Model

Qidong Liu, Xian Wu, Yuanshao Zhu, Zijian Zhang, Feng Tian, Yefeng Zheng · DOI

Introduction

Automated medication recommendation systems are critical for assisting clinicians in prescribing optimal drug combinations. However, existing models often struggle with two primary challenges: a lack of deep semantic understanding of medical codes and the "single-visit" problem, where models fail to provide accurate recommendations for patients without historical data. While Large Language Models (LLMs) offer superior reasoning capabilities, their computational overhead and tendency for hallucinations make them impractical for direct clinical deployment.

The LEADER Framework

To address these issues, we introduce LEADER (LargE languAge moDel distilling mEdication Recommendation). This framework leverages the semantic power of LLMs while maintaining the efficiency of compact models through a teacher-student distillation approach.

Overview of the LEADER teacher-student distillation architecture.

Stage 1: The Teacher Model

The teacher model is based on LLaMA-7B, fine-tuned using Low-Rank Adaptation (LoRA). To prevent hallucinations, the standard generative head is replaced with a classification layer (Linear + Sigmoid), restricting outputs to a predefined set of valid medications. Medical records are converted into natural language prompts, allowing the model to utilize its pre-trained medical knowledge to understand the nuances behind medical codes rather than treating them as simple identifiers.

Stage 2: The Student Model

The student is a lightweight transformer-based architecture. It is trained via feature-level distillation, learning to replicate the internal hidden states of the teacher LLM. This process transfers the "reasoning" capabilities of the large model into a much smaller footprint. Additionally, a profile alignment technique is used to map patient demographics to medication needs, mitigating the cold-start problem for first-time visitors by using demographic profiles as a proxy for medical history.

Experimental Setup

The LEADER framework was evaluated on two benchmark datasets:

  • MIMIC-III: Data from over 7,000 visits (2001–2012).
  • MIMIC-IV: A larger dataset with nearly 9,000 visits (2008–2019).

Performance was measured using PRAUC, Jaccard similarity, and F1 score, focusing on both multi-visit and single-visit scenarios to ensure robustness across different clinical contexts.

Key Results

LEADER consistently outperformed state-of-the-art baselines such as GAMENet and SafeDrug. The student model achieved a significant 25x to 30x speedup in inference time compared to the teacher LLM, while requiring only 1/15th of the GPU memory, making it feasible for deployment on standard medical facility hardware.

Sensitivity analysis of the alpha hyperparameter across MIMIC datasets.

Sensitivity analysis (Figure 5) demonstrates the impact of the $\alpha$ hyperparameter, which balances the distillation loss. The results show optimal performance peaks across both MIMIC-III and MIMIC-IV, indicating the effectiveness of the knowledge transfer process and the model's stability across different data distributions.

Conclusion and Future Work

LEADER demonstrates that LLMs can be effectively distilled into compact models for specialized clinical tasks. By combining semantic reasoning with efficient deployment, the framework provides a viable path for real-world AI-assisted prescribing. Future work will focus on deeper integration of Drug-Drug Interaction (DDI) constraints and enhancing the interpretability of the student model's decision-making process to match the transparency of the teacher's prompts.

Summary updated

BibTeX
@misc{liu2024large,
  author = {Qidong Liu and Xian Wu and Xiangyu Zhao and Yuanshao Zhu and Zijian Zhang and Feng Tian and Yefeng Zheng},
  title = {{Large Language Model Distilling Medication Recommendation Model}},
  year = {2024},
  eprint = {2402.02803},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.02803},
}
Figure