qwen2.5-1.5b-ddx-ranker
A 1.5B-parameter model fine-tuned to produce a ranked differential diagnosis (most likely first, with probabilities) given a clinical case description. Runs comfortably on CPU.
- Base model: Qwen/Qwen2.5-1.5B-Instruct
- Training data: aai530-group6/ddxplus (CC-BY-4.0) — 50,000 synthetic patient cases with ground-truth ranked differentials; DDXPlus evidence codes rendered to natural language via the dataset's
release_evidences.jsonmapping. - Method: supervised fine-tuning (TRL SFTTrainer, conversational prompt-completion, loss on the ranked list only), following the ranked-output protocol of the AMIE differential-diagnosis work (McDuff et al., arXiv 2312.00164 / Nature s41586-025-08869-4).
- Training: 2 epochs, effective batch 32, lr 2e-5 cosine, bf16, max_length 1024. Final train loss 0.073, eval loss 0.079 (1,000 held-out validation cases).
Results (1,000 held-out DDXPlus test cases, greedy decoding)
| Metric | Zero-shot base model | This fine-tune |
|---|---|---|
| Top-1 accuracy | 12.4% | 75.2% |
| Top-3 accuracy | 15.7% | 93.6% |
| Top-5 accuracy | 18.5% | 97.2% |
| Top-10 accuracy | 23.2% | 98.3% |
| nDCG@10 | 0.140 | 0.952 |
Top-k accuracy = the fraction of cases where the ground-truth PATHOLOGY appears within the first k entries of the generated ranked list (AMIE's evaluation protocol).
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "saurabhb2412/qwen2.5-1.5b-ddx-ranker"
tok = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, dtype=torch.bfloat16, device_map="cpu")
case = """Patient case: 49-year-old female.
Findings:
- Chest pain (present)
- Chest pain character: sharp
- History of gastroesophageal reflux disease (present)"""
system = ("You are a clinical decision support assistant. Given a patient case, produce a ranked "
"differential diagnosis. List the most likely diagnoses first, one per line, in the exact "
"format 'N. Diagnosis (p=probability)'. Include up to 10 diagnoses.")
messages = [{"role": "system", "content": system}, {"role": "user", "content": case}]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
out = model.generate(inputs, max_new_tokens=300, do_sample=False)
print(tok.decode(out[0][inputs.shape[1]:], skip_special_tokens=True))
# 1. GERD (p=0.18)
# 2. Bronchitis (p=0.20)
# ...
On a modern CPU the 1.5B model generates a full ranked list in a few seconds.
Limitations
- Synthetic data: DDXPlus cases were synthesized from a rule-based medical knowledge base, so these numbers measure performance on that generator's distribution — they are not comparable to AMIE's 59.1% top-10 on real NEJM clinicopathologic cases, and real-world clinical text will be much harder.
- Diagnosis names are limited to DDXPlus's ~200-pathology vocabulary.
- This is a research artefact, not a medical device; outputs must not be used for clinical decision-making.
Citation
@article{mcduff2025towards,
title = {Towards accurate differential diagnosis with large language models},
author = {McDuff, Daniel and others},
journal = {Nature},
year = {2025},
doi = {10.1038/s41586-025-08869-4},
note = {arXiv:2312.00164}
}