Medical LLM fine-tuning & preference alignment
A bilingual medical language model, fine-tuned and then aligned, to compare the two methods.
The problem
General language models answer medical questions fluently without always being right, and fluent mistakes are the dangerous ones.
The aim was to compare supervised fine-tuning (SFT) with preference alignment (DPO) on a small model, in French and in English, across the whole cycle from data to API.
The approach
French and English medical data was normalised and anonymised with Presidio, then versioned on Hugging Face with the models.
Starting from Qwen3-1.7B, I trained an SFT model with LoRA adapters, then aligned it with Direct Preference Optimization.
Both models answered the same prompts on symptoms, differential diagnosis and triage, with the same settings, so their answers can be compared line by line. A FastAPI service exposes the model.
The results
SFT gave a solid baseline. On the test prompts, DPO answers were more structured and more cautious, for instance sending parents to a doctor first in the triage case.
The models, the datasets and the full set of answers are published, so the comparison can be checked.
The limits
This is a research project and must not be used for medical decisions. Both models still make clinical mistakes, and the test set is small.
Serving the model needs a dedicated GPU, so there is no permanent public demo.
The stack
- Python
- Presidio
- Datasets (HF Hub)
- SFT / LoRA
- DPO
- Eval (CSV/JSON)
- FastAPI
Contact
If you'd like to discuss a role, request a demo, or ask about my projects, feel free to reach out.
I'm looking for a hands-on senior AI/ML engineer or AI tech lead role, in Lyon or remote. I'm also happy to talk about AI projects, consulting, or leading an AI team.