Abstract
Objective: The primary aim of this research was to address the limitations observed in the medical knowledge of prevalent large language models (LLMs) such as ChatGPT, by creating a specialized language model with enhanced accuracy in medical advice. Methods: We achieved this by adapting and refining the large language model meta-AI (LLaMA) using a large dataset of 100,000 patient-doctor dialogues sourced from a widely used online medical consultation platform. These conversations were cleaned and anonymized to respect privacy concerns. In addition to the model refinement, we incorporated a self-directed information retrieval mechanism, allowing the model to access and utilize real-time information from online sources like Wikipedia and data from curated offline medical databases. Results: The fine-tuning of the model with real-world patient-doctor interactions significantly improved the model's ability to understand patient needs and provide informed advice. By equipping the model with self-directed information retrieval from reliable online and offline sources, we observed substantial improvements in the accuracy of its responses. Conclusion: Our proposed ChatDoctor represents a significant advancement in medical LLMs, demonstrating a significant improvement in understanding patient inquiries and providing accurate advice. Given the high stakes and low error tolerance in the medical field, such enhancements in providing accurate and reliable information are not only beneficial but essential.
Introduction
While general-purpose Large Language Models (LLMs) like ChatGPT are impressive conversationalists, they often stumble in specialized fields. In medicine, these models frequently "hallucinate" (generate plausible-sounding but incorrect information) or lack the depth of knowledge required for clinical accuracy. Furthermore, because LLMs are frozen in time after training, they cannot account for new diseases (like Mpox) or recently approved medications. In a high-stakes environment where a wrong answer can be life-threatening, "mostly right" is not good enough. The authors sought to bridge this gap by creating a model specifically tailored for the nuances of medical consultation.
Methods
The researchers developed ChatDoctor using a multi-stage approach:
- Base Model: They utilized LLaMA-7B, a relatively compact but powerful open-source model.
- General Instruction Tuning: The model was first trained on 52,000 general instructions from Stanford’s Alpaca project to establish basic conversational competence.
- Medical Fine-Tuning: The core of the project involved fine-tuning the model on 100,000 authentic, anonymized patient-doctor dialogues from the HealthCareMagic-100k dataset. This allowed the model to learn the "language" of patients—which is often casual and superficial—and the structured, expert reasoning of physicians.
- Autonomous Knowledge Retrieval (RAG): To combat hallucinations and the knowledge cutoff problem, they implemented a Retrieval-Augmented Generation (RAG) framework. When a query is received, ChatDoctor extracts key medical terms and searches external sources, including Wikipedia and a curated MedlinePlus disease database, to ground its final response in verified data.
Key Results
ChatDoctor's performance was evaluated against ChatGPT using both quantitative metrics and qualitative case studies.
- Quantitative Performance: Using BERTScore (a metric that evaluates semantic similarity to human physician responses), ChatDoctor outperformed ChatGPT across Precision, Recall, and F1 scores. While the numerical difference was small (F1 of 0.8446 vs 0.8406), the p-value ($2.14 \times 10^{-111}$) indicates the improvement is highly statistically significant.
- Qualitative Superiority: In case studies, ChatDoctor correctly identified the purpose of "Daybue" (a drug approved in early 2023) and provided specific testing protocols for Mpox—topics where ChatGPT failed or gave generic refusals because the information was not in its original training data.
- Clinical Mirroring: In a test case involving a unilateral headache, ChatDoctor correctly mirrored a human physician's diagnosis of sinusitis, whereas ChatGPT failed to provide a congruent interpretation.
Conclusion
ChatDoctor represents a significant advancement in medical LLMs, demonstrating a significant improvement in understanding patient inquiries and providing accurate advice. By combining domain-specific fine-tuning with an autonomous "knowledge brain" for real-time information retrieval, it significantly reduces the risk of hallucinations. While currently a research tool and not a replacement for professional medical advice, such enhancements in providing accurate and reliable information are essential for the future of AI in healthcare.
Summary updated