Large language models learn clinical diagnostic reasoning from verified traces

MERLIN-DDx: Learning Clinical Diagnostic Reasoning from Reference-Filtered Traces

Computation and LanguageArtificial IntelligenceMachine Learning

Summary

Medical notes usually record the final diagnoses but not the reasoning doctors use to get there, which makes it hard to teach AI to think like a doctor. The authors created a method that generates step-by-step reasoning from real patient data and checks each step against reliable medical knowledge and outcomes. This produced a large dataset of reasoning traces that improve AI models' ability to diagnose diseases based on initial patient information. Their experiments showed better accuracy, especially for rare conditions, when models learned from the reasoning steps rather than just diagnoses.

What this means in practice

  • For clinical decision support developers: Enhance early diagnostic AI tools by training models on stepwise reasoning traces verified with clinical knowledge and patient outcomes.
  • For medical coding teams: Improve accuracy in assigning diagnosis codes at admission using models trained on verified diagnostic reasoning, aiding billing and patient records.

Authors

Jan Frick, Dennis Fast, Conor Fallon, Konstantin Schlüter, Roseli Neuschäfer, Jonas Antonio Cittadino, Felix Gers, Alexander Löser

Abstract

Large language models reason step by step in mathematics and code, but in clinical differential diagnosis (DDx) they still map notes straight to answers. One reason is that the supervision needed to teach clinical reasoning is largely missing, because clinical notes record conclusions rather than the reasoning traces behind them. We present a four-stage generator-verifier pipeline that builds this supervision. It generates diagnostic reasoning traces over real hospital admissions and checks the structured answer of every intermediate step against an external clinical reference (WikiDoc) and the recorded patient outcome (MIMIC-IV). The result is MERLIN-DDx, a dataset of 124,510 stage records over 10,400 admissions whose discharge diagnosis WikiDoc covers, of which 117,580 carry a verifier score; clinicians confirm the reference diagnosis in 77% of reviewed cases (inter-rater kappa = 0.91). We evaluate two admission-time tasks, differential diagnosis and ICD coding, predicting discharge codes from what was known on arrival. This is harder than coding finished discharge summaries, and closer to real decision support. Fine-tuning Qwen3 models (0.6B-32B) on MERLIN-DDx improves long-tail ICD performance (macro-F1) over the untuned base at every scale. Case-matched label-only controls, trained on the same cases and gold codes without traces, isolate what the traces add: 1.7 to 6.9 macro-F1 points at every scale, though not consistently on micro-F1. A data ablation at 8B shows macro-F1 rising with verifier-filter strictness, although stricter filtering retains fewer traces. An error analysis shows the gain reaches every frequency stratum and is especially large on low-frequency codes, which are improved but not solved. We release the dataset, pipeline, and prompts.