DrugRAG: Enhancing Pharmacy LLM Performance Through A Novel Retrieval-Augmented Generation Pipeline

Houman Kazemzadeh, Kiarash Mokhtari Dizaji, Seyed Reza Tavakoli, Farbod Davoodi, MohammadReza KarimiNejad, Parham AbedAzad, Ali Sabzi, Armin Khosravi, Siavash Ahmadi, Mohammad Hossein Rohban, Glolamali Aminian, Tahereh JavaheriarXiv 2025 · DOI

Introduction

While Large Language Models (LLMs) have demonstrated remarkable proficiency in general medical examinations like the USMLE, the specialized field of pharmacy presents unique challenges. Pharmacists must navigate a landscape of precise drug selections, complex dosage calculations, and nuanced contraindications. General-purpose models often falter in these areas, exhibiting "hallucinations" or logical lapses when tasked with technical pharmacotherapy requirements. Smaller, open-source models are particularly vulnerable, frequently failing to recall specific equations or confusing medications with similar nomenclature.

To address these reasoning gaps, we present DrugRAG, a modular, three-step retrieval-augmented generation pipeline. DrugRAG acts as an external "knowledge bridge," injecting validated drug data into the reasoning process without requiring the prohibitive costs of model retraining or fine-tuning.

Methodology: The DrugRAG Pipeline

The DrugRAG system is designed to be model-agnostic, allowing it to enhance any existing LLM architecture through a structured three-stage process:

  1. Reasoning Extraction: The initial clinical query (q) is processed by a high-reasoning model (OpenAI o3). This step extracts 3–6 core medical concepts, creating a "reasoning trace" (z) that filters out linguistic noise and focuses on the technical core of the question.
  2. Medical Evidence Retrieval: The extracted terms are used to query the Medical Chat API, which aggregates data from trusted sources such as OpenFDA and DrugBank. The system retrieves a concise, structured evidence snippet (E) containing relevant dosages, indications, and contraindications.
  3. Synthesis & Answering: The original query and the retrieved evidence are synthesized into a final prompt (q + E). The target LLM (e.g., Llama or Gemma) is then instructed to generate a trustworthy clinical answer grounded in the provided evidence.
Figure 1: The three-stage DrugRAG pipeline architecture, illustrating the flow from clinical query to trustworthy answer.

Experimental Setup

The pipeline was evaluated using a benchmark of 141 multiple-choice questions from PharmacyExam, a resource for the North American Pharmacist Licensure Examination (NAPLEX). The dataset covers five critical domains: Person-Centered Assessment and Treatment Planning (40%), Foundational Knowledge (25%), Medication Use Process (25%), Professional Practice (5%), and Pharmacy Management (5%).

Key Results

The implementation of DrugRAG resulted in performance gains across all 11 tested models, ranging from 8-billion parameter open-source models to top-tier proprietary systems.

Figure 3: Comparison of baseline accuracy versus accuracy with DrugRAG across five prominent LLMs, highlighting significant point improvements.

The "RAG Equalizer" Effect

The most significant finding was the disproportionate benefit provided to smaller models. While massive models like GPT-5 (92% baseline) and o3 (89% baseline) maintain high internal knowledge bases, smaller models lack the parameter density to store exhaustive drug interaction data.

  • Llama 3.1 (8B): Experienced the largest boost, jumping from a baseline of 46% to 67% (+21 points).
  • Gemma 3 (27B): Improved from 61% to 71% (+10 points).
  • Gemini 3 Pro: Rose from 75% to 84% (+9 points).

Notably, domain-specific pre-training (Bio-Medical Llama 3 8B) did not provide a baseline advantage over general-purpose models of the same size, both starting at 46%. This suggests that for technical fields, real-time access to validated information is more critical than the memorization achieved during initial training.

Discussion and Error Analysis

Baseline models typically failed due to "formula-related errors" (mathematical misapplications) and "medication-identification errors" (e.g., confusing similar drug names like Tavist and Tavist ND). DrugRAG effectively mitigated these issues by providing the exact formulas and drug identities within the prompt context. Statistical analysis confirmed that with DrugRAG, models like Claude Opus 4.5 and Medical Chat achieved performance levels that were not statistically different from the baseline of GPT-5.

Limitations and Future Work

Despite these gains, several constraints remain. The 141-question benchmark is relatively small and limited to multiple-choice formats, which may not fully reflect real-world clinical complexity. Additionally, the multi-step API process introduces increased latency and cost per query. Future research will focus on scaling the pipeline for open-ended clinical scenarios and optimizing the retrieval speed for real-time medical decision support.

Summary updated

BibTeX
@misc{kazemzadeh2025drugrag,
  author = {Houman Kazemzadeh and Kiarash Mokhtari Dizaji and Seyed Reza Tavakoli and Farbod Davoodi and MohammadReza KarimiNejad and Parham AbedAzad and Ali Sabzi and Armin Khosravi and Siavash Ahmadi and Mohammad Hossein Rohban and Glolamali Aminian and Tahereh Javaheri},
  title = {{DrugRAG: Enhancing Pharmacy LLM Performance Through A Novel Retrieval-Augmented Generation Pipeline}},
  year = {2025},
  eprint = {2512.14896},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2512.14896},
}
Figure