MERLIN-DDxLearning Clinical Diagnostic Reasoning from Reference-Filtered Traces

Findings of EACL 2027

Jan Frick1,*,† Dennis Fast1,* Conor Fallon1,* Konstantin Schlüter2 Roseli Neuschäfer3 Jonas Antonio Cittadino1 Felix Gers1 Alexander Löser1

1Berliner Hochschule für Technik   2Charité – Universitätsmedizin Berlin   3Justus Liebig Universität Gießen

*Equal contribution   †Project lead

The four MERLIN-DDx stages on one case: symptoms (epigastric pain radiating to the back, nausea, fever), a ranked differential with cholecystitis first, lab reranking with elevated lipase moving pancreatitis to first, and discharge ICD codes K85.90, E86.0, E87.6, I10.

Illustrative textbook case, not a MIMIC-IV admission.

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 κ = 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.

The pipeline

Pipeline: an admission note enters a loop where a generator LLM samples candidate reasoning traces and a verifier scores them against reference targets; traces at or above threshold go into the MERLIN-DDx dataset, which fine-tunes a student LLM.
A generator samples candidate traces, a verifier scores each against a reference target, and traces at or above the stage threshold are kept. Below it, the stage regenerates until the round budget is spent, then falls back to a label-only target. Every accepted trace keeps its score, so the dataset can be re-filtered at other thresholds.
StageTaskReference targetVerifierAccept at
V1Symptom extractionWikiDoc symptom list for the confirmed diseaseNormDot≥ 0.60
V2Diagnosis rankingWikiDoc differential for the chief complaintReciprocal rank≥ 0.50
V3Lab-informed reranking (labs ≤ 12 h)as V2Reciprocal rank≥ 0.80
V4Discharge ICD-code predictionMIMIC-IV discharge codesmicro-F1≥ 0.55

Generators: Qwen3-32B, MedGemma-27B and Llama-3.3-70B-Instruct, 30 candidates per round, up to 4 rounds per stage.

10,400MIMIC-IV admissions
124,510stage records
117,580with a verifier score
7chief complaints

What the verifier checks. The verifiers measure agreement with a reference target, not whether the reasoning is correct. A blinded clinician audit finds that the verifier loop does not improve clinician-rated rationale validity. Read "accepted trace" as "reference-filtered", not "verified".

Results

Bar chart of ICD macro-F1 on the test split for Qwen3 0.6B, 8B, 14B and 32B: the MERLIN-fine-tuned model is highest at every size, above the label-only control and the untuned base.
Fine-tuning on MERLIN-DDx improves ICD macro-F1 at every scale, beyond a label-only control (same cases and codes, no traces). Test split, means over three evaluation repeats (8B fine-tuned: three training seeds), whiskers std.
Diagnosis rankingICD codes
ModelR@1R@3F1micF1macRmacPmac
Untuned baselines
MedGemma-27B51.8±0.274.5±0.329.4±0.27.6±0.19.1±0.311.8±0.3
Llama-3.3-70B-Instruct51.1±0.572.5±0.629.7±0.611.8±0.714.4±0.518.0±0.4
Baichuan-M2-32B49.6±0.371.8±0.732.4±1.111.1±0.914.8±1.113.2±1.0
Qwen3 base and fine-tuned
Qwen3-0.6B34.2±0.352.9±0.41.2±0.10.1±0.00.1±0.00.4±0.0
+ label-only†11.4±2.913.5±3.333.4±0.33.5±0.03.6±0.14.7±0.4
+ MERLIN51.0±0.573.1±0.743.6±0.710.4±0.410.4±0.412.5±0.6
Qwen3-8B45.5±0.566.6±0.519.7±0.15.0±0.14.9±0.29.1±0.2
+ label-only†*51.2±1.468.7±1.344.1±0.611.3±0.110.9±0.114.6±0.1
+ MERLIN*53.9±0.576.3±0.439.8±4.213.0±1.313.3±0.917.8±0.9
Qwen3-14B49.0±0.168.9±0.330.7±0.311.2±0.214.0±0.314.6±0.3
+ label-only†50.5±2.265.3±2.447.0±0.314.5±0.114.9±0.217.6±0.4
+ MERLIN46.6±1.368.7±4.748.8±0.518.2±0.617.9±0.821.5±0.7
Qwen3-32B50.5±0.770.3±0.233.6±0.113.1±0.416.2±0.615.9±0.6
+ label-only†27.9±5.640.4±8.247.3±0.516.6±0.517.1±0.319.7±0.8
+ MERLIN36.0±1.576.8±1.550.7±0.220.9±0.320.9±0.523.6±0.1
Encoder classifier
BioClinical ModernBERT‡––26.4±0.88.2±0.113.8±2.37.0±0.7

Held-out test split (n = 2,184), admission-time protocol: no lab values, no reranking, dev-selected best epoch. F1mac over three-character ICD codes is the primary metric. Bold best, underline second best. ± is std over three evaluation repeats of one checkpoint; * rows are over three training seeds. †Label-only control: same cases, instructions, gold outputs and ICD-row oversampling, traces removed; at 0.6B and 32B it produces valid diagnosis-stage JSON for only about 21% and 46% of cases, which lowers its R@1/R@3. ‡Strongest of three encoder classifiers retrained on our MIMIC-IV subset; ± over three training seeds.

Two line plots for Qwen3-8B on the dev split: macro-F1 rises from unfiltered traces to half to full verifier thresholds, with and without duplicated ICD rows; micro-F1 is matched by oversampling alone.
Stricter verifier filtering raises macro-F1. Qwen3-8B, full fine-tuning, dev split. Macro-F1 (left) rises with filter strictness with and without duplicated ICD-coding rows; micro-F1 (right) is matched by oversampling alone.

Release

MERLIN-DDx is a research resource, not a diagnostic tool. It must not inform clinical decisions without prospective validation and regulatory review.

Citation

@misc{frick2026merlinddx,
  title         = {{MERLIN-DDx}: Learning Clinical Diagnostic Reasoning from Reference-Filtered Traces},
  author        = {Frick, Jan and Fast, Dennis and Fallon, Conor and Schl{\"u}ter, Konstantin and Neusch{\"a}fer, Roseli and Cittadino, Jonas Antonio and Gers, Felix and L{\"o}ser, Alexander},
  year          = {2026},
  eprint        = {2611.37309},
  archivePrefix = {arXiv},
  primaryClass  = {cs.CL},
  note          = {Findings of EACL 2027}
}