MedProQA
Fine-tuned Phi-3 for medical question answering
- Role
- Solo Developer
- Timeline
- Jul 2025
- Context
- Personal project
- Links
- Resume ↗
The outcome
- 82.6% accuracy on MedMCQA.
- Hallucination rate down 28% on out-of-distribution queries.
- 38% less GPU memory and 24% lower training cost vs full fine-tuning.
The challenge
A fine-tuned LLM for medical question answering, built to learn the full training loop end to end — data curation, quantised fine-tuning, and honest evaluation including out-of-distribution behaviour.
Medical QA punishes hallucination more than most domains, and full fine-tuning of a capable base model was out of reach on available hardware.
The system
250K+ QA pairs curated from MedQA, MedMCQA and PubMedQA through schema normalisation and dedup pipelines, then used to fine-tune Phi-3 with QLoRA 4-bit quantisation. Evaluation covered both in-distribution accuracy and out-of-distribution hallucination rate.
The hard parts
Training within a memory budget
QLoRA 4-bit quantisation cut GPU memory by 38% and training cost by 24% against full fine-tuning — the difference between the project being possible and not.
Curating three inconsistent corpora
MedQA, MedMCQA and PubMedQA don't share a schema. Normalisation and dedup pipelines were needed before any of it could be trained on.
What I took from it
- Deduplicate before you benchmark. MedQA, MedMCQA and PubMedQA overlap, and any leakage between the training mix and the eval set would have inflated the 82.6% into a number that meant nothing.
- One accuracy figure on a benchmark that resembles your training data doesn't describe the model. Tracking hallucination rate on out-of-distribution queries as a separate metric is what showed whether anything had actually generalised.
- Quantisation decided whether the project existed. 38% less memory and 24% lower cost wasn't an optimisation pass — it was the difference between training this and not.
Stack
- Model
- Phi-3, QLoRA, PyTorch
- Data
- MedQA, MedMCQA, PubMedQA, Dedup pipelines
Timeline
- Jul 2025
Built and evaluated.