explaingit

kent0n-li/chatdoctor

Analysis updated 2026-05-18

3,631PythonAudience · researcherComplexity · 4/5Setup · hard

TLDR

A research project that fine-tunes Meta's LLaMA language model on real patient-doctor conversations so it can answer medical questions in a doctor-like style, for research use only.

Mindmap

mindmap
  root((ChatDoctor))
    What it does
      Fine-tunes LLaMA
      Medical Q&A style
      Not clinically approved
    Tech stack
      Python
      LoRA fine-tuning
      Alpaca base data
    Training data
      HealthCareMagic
      iCliniq
      Synthetic ChatGPT set
    Extensions
      Disease database lookup
      Live Wikipedia search
    Use cases
      Medical NLP research
      Chatbot prototyping
    Audience
      Researchers
      ML students

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Study how a general language model can be adapted to medical conversation style.

USE CASE 2

Prototype a research chatbot that answers health questions like a doctor would phrase them.

USE CASE 3

Fine-tune the model on your own medical dataset using the provided LoRA scripts.

USE CASE 4

Experiment with grounding answers in a disease database or live Wikipedia lookups.

What is it built with?

PythonLLaMALoRAAlpaca

How does it compare?

kent0n-li/chatdoctorrlcode/reinforcement-learningpallets/quart
Stars3,6313,6313,632
LanguagePythonPythonPython
Setup difficultyhardmoderateeasy
Complexity4/53/52/5
Audienceresearcherresearcherdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1day+

Fine-tuning requires GPU hardware and multiple conversation datasets, not validated for real medical use.

In plain English

ChatDoctor is a research project from a team of medical and computer science researchers at several universities. It takes an existing general-purpose AI language model called LLaMA, developed by Meta, and further trains it on medical conversation data so it can respond to patient questions in the style of a doctor. The training data comes from three sources: 100,000 real patient-doctor conversations scraped from HealthCareMagic.com, 10,000 conversations from iCliniq.com, and a smaller synthetic set of 5,000 conversations generated with ChatGPT. Before training on any medical data, the model was first trained on a general conversational dataset from Stanford (called Alpaca) to give it basic language skills. The combination is meant to produce a model that knows how to hold a conversation and also has exposure to how doctors actually phrase diagnoses and recommendations. The project includes two extended variants: one that can look up a structured disease database to ground its answers, and one that can search Wikipedia in real time before responding. These are meant to reduce the chance of the model making things up. The repository provides scripts for fine-tuning the model on your own hardware using either full training or a lighter method called LoRA, which adjusts only a small fraction of the model's parameters and requires less computing power. Inference scripts let you run a local chat session once a model is set up. The authors are clear that the model has not reached reliable clinical accuracy and should not be used in real medical settings. It is presented as a research prototype to study how language models can be adapted for medical question answering, not as a replacement for professional medical advice.

Copy-paste prompts

Prompt 1
Explain how ChatDoctor was fine-tuned from LLaMA using patient-doctor conversation data.
Prompt 2
Walk me through setting up the LoRA fine-tuning scripts in this repo on my own machine.
Prompt 3
Show me how to run the local inference chat session once the model is trained.
Prompt 4
Compare the disease-database variant and the Wikipedia-search variant of ChatDoctor described here.

Frequently asked questions

What is chatdoctor?

A research project that fine-tunes Meta's LLaMA language model on real patient-doctor conversations so it can answer medical questions in a doctor-like style, for research use only.

What language is chatdoctor written in?

Mainly Python. The stack also includes Python, LLaMA, LoRA.

How hard is chatdoctor to set up?

Setup difficulty is rated hard, with roughly 1day+ to a first successful run.

Who is chatdoctor for?

Mainly researcher.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.