IvyGPT: InteractiVe Chinese pathwaY language model in medical domain

Rongsheng Wang, Yaofei Duan, Chan-Tong Lam, Jiexi Chen, Jiangsheng Xu, Haoming Chen, Xiaohong Liu, Patrick Cheong-Iao Pang, Tao Tan

Abstract

General large language models (LLMs) such as ChatGPT have demonstrated remarkable success across diverse tasks. However, their adoption in the medical sector remains limited due to concerns regarding factual accuracy and the inability to provide nuanced clinical advice. We introduce IvyGPT, a 33-billion parameter LLM based on the LLaMA architecture, specifically tailored for the Chinese medical domain. IvyGPT is trained using a combination of high-quality medical question-answer (QA) instances and Reinforcement Learning from Human Feedback (RLHF). By utilizing the memory-efficient QLoRA method, we successfully fine-tuned the model on a limited hardware setup. Our experimental results indicate that IvyGPT significantly outperforms existing medical GPT models, providing richer, more professional diagnostic and treatment suggestions that closely align with human medical expertise.

Introduction

While general-purpose LLMs have transformed natural language processing, the medical field requires a level of precision and domain-specific reasoning that these models often lack. In the Chinese medical context, existing specialized models frequently suffer from limited parameter sizes (typically 6B or 7B), which restricts their complex reasoning capabilities. Furthermore, general models are prone to "hallucinations"—generating factually incorrect information—and often lack the specific communicative nuances required for doctor-patient interactions.

IvyGPT was developed to bridge this gap. By scaling the model to 33 billion parameters and implementing a rigorous multi-stage training pipeline, the researchers aimed to create a system capable of mimicking professional medical reasoning and providing comprehensive, actionable advice.

Methodology: Efficiency and Scale

The development of IvyGPT involved a three-stage strategy designed to transform a general-purpose base model into a specialized medical assistant.

1. Base Model and QLoRA

The researchers utilized LLaMA-33B as the foundation. To overcome the hardware constraints of training a 33B parameter model, they employed QLoRA (Quantized Low-Rank Adaptation). This technique uses 4-bit quantization to reduce memory overhead, allowing the model to be trained on just four NVIDIA A100 (80GB) GPUs. This approach not only saved memory but also improved training speed; for instance, PPO training time was reduced from 47 hours to 23 hours compared to standard LoRA.

2. Supervised Fine-Tuning (SFT)

The model underwent initial Supervised Fine-Tuning on a curated dataset of medical Q&A pairs. This stage established the model's baseline medical knowledge and its ability to engage in multi-turn conversations.

3. Reinforcement Learning from Human Feedback (RLHF)

The "secret sauce" of IvyGPT is the RLHF stage. The team trained a Reward Model to evaluate responses based on coherence, informativeness, and factual accuracy. By further fine-tuning the model using these scores, the researchers shifted IvyGPT’s output from simple factual retrieval to a more professional, "doctor-like" diagnostic style.

Data Curation

The performance of IvyGPT is rooted in a high-quality dataset of 307,038 Q&A sets, derived from two primary sources:

  • Refined Public Data: The team utilized the HuaTuoGPT dataset, using ChatGPT to identify and correct grammatical errors and remove common-sense inaccuracies.
  • Real-World Consultations: To capture the flow of authentic medical dialogue, the researchers scraped a large volume of doctor-patient conversations from public medical platforms, ensuring the model understands the nuances of clinical inquiry.

Key Insights and Results

The "Doctor-Like" Shift

A primary finding of the study is that while SFT provides the model with knowledge, RLHF provides it with professionalism. Post-RLHF, IvyGPT’s responses became significantly more comprehensive, moving beyond brief answers to provide detailed diagnostic reasoning and treatment pathways.

Quantitative Performance

IvyGPT was evaluated against other models using a word2vec-based semantic similarity metric to compare its outputs with real doctor responses:

  • IvyGPT: 93.58
  • ChatGPT: 89.13
  • ChatMed: 84.51
  • HuaTuo: 71.20

Information Density

In the medical domain, verbosity—when paired with accuracy—is often a proxy for quality. IvyGPT generates significantly more detailed responses than its competitors, with an average word count of 271.05 per response, compared to 157.98 for ChatMed. This allows the model to provide necessary context and depth for patient queries.

Discussion and Future Work

IvyGPT demonstrates that high-performing, domain-specific models can be developed even with limited compute resources. However, several challenges remain. The researchers noted that obtaining diverse data for rare medical conditions is difficult, and the model still faces hurdles in fully personalizing advice based on a patient’s unique medical history.

Ethical considerations regarding safety and accountability remain paramount. Future iterations of IvyGPT will focus on integrating the model with established medical expert systems and knowledge bases, as well as exploring further compression techniques like pruning and distillation to facilitate broader deployment in clinical settings.

Summary updated

BibTeX
@inproceedings{wang2023ivygpt,
  author = {Rongsheng Wang and Yaofei Duan and Chan-Tong Lam and Jiexi Chen and Jiangsheng Xu and Haoming Chen and Xiaohong Liu and Patrick Cheong-Iao Pang and Tao Tan},
  title = {{IvyGPT: InteractiVe Chinese pathwaY language model in medical domain}},
  booktitle = {CICAI},
  year = {2023},
  url = {https://openreview.net/forum?id=nogubJH2nm},
}
Figure