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

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

TL;DR

Large language models can show their work step-by-step in math and coding, yet in medicine, they usually jump straight from patient notes to final diagnoses. To bridge this gap, researchers built an automated pipeline that generates and fact-checks synthetic diagnostic reasoning traces against external medical knowledge and real hospital outcomes. Fine-tuning models on these verified steps significantly boosts their ability to predict rare and nuanced diagnoses right when a patient arrives at the hospital.

What Problem Does This Paper Address?

When a doctor diagnoses a patient, they follow a deliberate workflow: spotting symptoms, listing plausible suspects (a differential diagnosis), checking lab results to narrow the list, and finally logging a diagnosis. Yet hospital notes rarely capture this detective work—they mostly record the final conclusion. Because that intermediate supervision is missing from medical records, clinical LLMs tend to rely on superficial text shortcuts rather than inspectable reasoning.

Furthermore, much of medical AI focuses on assigning billing/diagnostic codes (ICD codes) to completed discharge summaries, where the answer is practically written in the narrative. Predicting final discharge diagnoses using only what is known at admission time is much harder—and much closer to useful clinical decision support.

Methods

Instead of checking only the final answer, the authors introduce a four-stage generator–verifier pipeline that mirrors the clinical workflow and grades every intermediate step against external references:

Figure 2: The MERLIN-DDX generator–verifier pipeline. An admission note enters a loop in which a generator LLM samples candidate reasoning traces and a verifier scores each against an external reference target. A trace scoring at or above that stage’s threshold passes on; below it, the stage regenerates, until the round budget is spent and the stage falls back to a label-only target. The loop runs over four stages: symptom extraction (V1), diagnosis ranking (V2), lab-based reranking (V3) and ICD-code prediction (V4). Accepted stage outputs and label-only fallbacks are assembled into the MERLIN-DDX dataset and used to fine-tune a student model. Our contribution is the construction loop rather than any individual stage. Because each accepted trace retains its verifier score, the released dataset can be re-filtered using alternative thresholds (§6.1). Prompts, thresholds and per-stage verifier metrics: §3.2 and Appendix I.
  1. Symptom Extraction ($V_1$): Extracts present or absent symptoms from the admission note, scored against disease-symptom tables in WikiDoc (a peer-edited medical encyclopedia).
  2. Diagnosis Ranking ($V_2$): Forms an initial ranked list of suspect conditions, verified by checking if the true diagnosis ranks near the top of WikiDoc's differential list.
  3. Lab-Based Reranking ($V_3$): Incorporates early lab results (from the first 12 hours) to refine the ranking, requiring the confirmed diagnosis to take the #1 spot. (Used only during dataset creation, since labs aren't ready at the moment of arrival).
  4. ICD-Code Prediction ($V_4$): Predicts final three-character ICD diagnostic categories, verified against actual hospital discharge records.

At each stage, three large generator LLMs (Qwen3-32B, MedGemma-27B, and Llama-3.3-70B) sample candidate reasoning traces. If a trace fails the stage's score threshold, the generator retries up to four times. If it still fails, the pipeline swaps in a clean "label-only" fallback (just the right answer, no flawed reasoning) so difficult patient cases aren't thrown out of the training set. Student models (Qwen3 from 0.6B to 32B) are then fine-tuned on the resulting dataset.

Datasets

  • MIMIC-IV & WikiDoc: Simulated admission notes and outcomes come from MIMIC-IV real hospital stays, paired with structured clinical reference tables from WikiDoc.
  • MERLIN-DDx (New): The authors release this new dataset containing 124,510 stage-level records across 10,400 hospital admissions spanning seven common chief complaints (e.g., chest pain, shortness of breath). Unlike prior physician-annotated reasoning datasets like MIMIC-IV-Ext-DiReCT (which covers ~500 evaluation-only cases) or outcome-only distillation datasets like DeepICD-R1 (which only predicts the primary code), MERLIN-DDx provides step-by-step verified supervision for all discharge codes at training scale.

Key Insights and Ideas

  • Quality beats trace quantity: Tightening the verifier thresholds forces more traces to revert to plain label-only fallbacks—meaning fewer reasoning examples overall—yet long-tail diagnostic accuracy climbs monotonically. Filtering out noisy alignment matters more than sheer reasoning volume.
  • Keep hard cases, drop bad traces: Completely removing cases that failed verification hurt performance by 2.5 macro-F1 points compared to keeping those cases with a no-reasoning fallback.
  • Traces specifically unlock the "long tail": Medical coding is wildly imbalanced—153 common "head" codes make up ~83% of occurrences, leaving hundreds of rarer "body" and "tail" codes. Compared to models trained on the exact same cases without reasoning traces, MERLIN's intermediate supervision adds very little to common codes, but drives substantial gains on rarer conditions.
  • Better predictions don't mean better prose: Here is a great scientific plot twist. In a blinded clinician audit, the written rationales that passed the verifier loop were no more clinically valid than zero-shot rationales or rejected ones. The verifiers work by enforcing structural alignment with true outcomes, not by teaching the model to write more convincing medical essays.

Key Results

Because medical codes have a massive long tail, the authors use macro-F1 (which weights rare and common ICD categories equally) as their primary metric:

Figure 1: Fine-tuning on MERLIN-DDX improves ICD macro-F1 at every scale, beyond a label-only control. Untuned Qwen3 bases compared with the same models fine-tuned on MERLIN-DDX traces or on a case-matched label-only control (same cases and codes, no traces), evaluated on the test split using our primary metric. Means over three evaluation repeats (8B fine- tuned bars: three training seeds), whiskers std. The 0.6B base bar is 0.1.
  • Consistent gains across scales: Fine-tuning on MERLIN-DDx improves Qwen3 macro-F1 over untuned bases at every size—from 0.1% to 10.4% at 0.6B, and 13.1% to 20.9% at 32B.
  • Isolating the reasoning boost: Compared against strict "label-only" controls (trained on the exact same cases and gold codes without traces), the reasoning traces add +1.7 to +6.9 macro-F1 points across all scales (though micro-F1, which favors frequent codes, is mixed at 8B).
  • Punching above its weight: The fine-tuned Qwen3-8B model (13.0% macro-F1, 53.9% Recall@1 on differential diagnosis) outperforms untuned 27B–70B baselines, including Llama-3.3-70B-Instruct (11.8% macro-F1) and Baichuan-M2-32B (11.1% macro-F1).
  • Clinical target validation: Reviewing 350 cases, clinicians confirmed the pipeline's ICD-to-WikiDoc reference diagnosis was clinically plausible 77.1% of the time (with high inter-rater agreement, $\kappa = 0.913$).

Limitations and Future Work

  • Reference bottlenecks: Requiring a valid WikiDoc match excluded 60.7% of candidate admissions, and WikiDoc's static candidate lists omit the true diagnosis in 11.4% of reviewed cases. Testing formal ontologies like SNOMED CT or curated references like UpToDate is an open next step.
  • Prototypical bias & simplified codes: The symptom verifier checks notes against textbook disease prototypes, meaning an accurate extraction of an atypical patient presentation gets penalized. Additionally, ICD codes are truncated to three-character categories rather than full granular billing codes, and ultra-rare codes (<10 training examples) remain below 10% F1.
  • Closing the rationale gap: Because verifier filtering improved diagnostic accuracy without measurably improving the clinical quality of the written rationales, future work needs to untangle exactly which properties of intermediate supervision drive learning—and how to improve prediction and explanation quality together.

Summary updated

BibTeX
@misc{frick2026merlin,
  author = {Jan Frick and Dennis Fast and Conor Fallon and Konstantin Schlüter and Roseli Neuschäfer and Jonas Antonio Cittadino and Felix Gers and Alexander Löser},
  title = {{MERLIN-DDx: Learning Clinical Diagnostic Reasoning from Reference-Filtered Traces}},
  year = {2026},
  eprint = {2611.37309},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.37309},
}
Figure