[KongchangAI]
· 2 min read· 1,264 words

MERLIN-DDx: Teaching AI Clinical Reasoning with Reference-Filtered Trajectories

MERLIN-DDx: Teaching AI Clinical Reasoning with Reference-Filtered Trajectories

MERLIN-DDx builds a clinical reasoning dataset that boosts long-tail ICD coding performance after fine-tuning.

Large language models often skip reasoning in clinical differential diagnosis because medical records lack reasoning chains. MERLIN-DDx uses a four-stage generator-verifier pipeline with WikiDoc and MIMIC-IV cross-validation to build a 124,510-record dataset covering 10,400 admissions. Clinicians confirmed 77% reference diagnosis accuracy (kappa=0.91). Fine-tuning Qwen3 models improved long-tail ICD macro-F1 across all scales, with reasoning trajectories adding 1.7–6.9 macro-F1 points. Stricter verifier filtering yields higher macro-F1. Gains span all frequency strata, though low-frequency code issues persist.

Title

MERLIN-DDx: Teaching AI Clinical Reasoning with Reference-Filtered Trajectories

Meta Description

MERLIN-DDx builds clinical diagnostic reasoning trajectories via a generator-verifier pipeline, validated against WikiDoc and MIMIC-IV, significantly improving long-tail ICD coding performance and releasing data and code.

Article Content

Large language models can reason step by step in math and coding tasks, but in clinical differential diagnosis (DDx), they often map medical records directly to answers. The key obstacle is the lack of supervision signals: clinical notes typically store only conclusions, not the reasoning process. To address this, researchers propose MERLIN-DDx, a clinical diagnostic reasoning dataset built through a four-stage generator-verifier pipeline, designed to teach models to think like doctors.

MERLIN-DDx research overview

The Missing Supervision for Clinical Reasoning and Its Construction

Clinical differential diagnosis requires models not only to give a diagnosis but also to demonstrate the reasoning chain. However, real hospital records rarely document how doctors step by step ruled out other possibilities and finally locked in a diagnosis. This "conclusions-only" status quo makes it difficult to directly train models to learn the reasoning process.

MERLIN-DDx's solution is to build a four-stage generator-verifier pipeline. It generates diagnostic reasoning trajectories for real hospital admission records and verifies the structured answers at each intermediate step. Verification relies on two external sources: the clinical reference WikiDoc and the recorded patient outcomes in MIMIC-IV. This cross-validation mechanism ensures the reliability of the reasoning trajectories.

Differential diagnosis (DDx) is a core part of clinical thinking: based on symptoms, signs, and initial test results, doctors list a set of possible diseases, then rule them out one by one through further tests or observation, and finally determine the diagnosis. This process is inherently multi-step reasoning, not simple pattern matching. In machine learning contexts, DDx is usually modeled as multi-class classification or sequence generation, but real clinical decisions also involve uncertainty management, risk trade-offs, and the time dimension. MERLIN-DDx attempts to approximate this process with explicit reasoning trajectories, so that the model outputs not just a diagnostic label but also the intermediate evidence supporting that judgment.

Missing supervision signals refers to the lack of "process annotations" in training data—medical records only record the final diagnosis, but rarely document how doctors ruled out other possibilities. Unlike math problems that have standard solution steps, clinical reasoning is often implicit in doctors' experience and conversations. Therefore, building a reasoning dataset requires additionally generating and verifying intermediate steps, which is exactly the core problem that MERLIN-DDx's four-stage pipeline aims to solve.

Dataset Scale and Quality Verification

The final MERLIN-DDx dataset contains 124,510 stage records covering 10,400 admissions, all of whose discharge diagnoses are covered in WikiDoc. Of these, 117,580 records carry verifier scores. To assess data quality, clinicians reviewed some cases and confirmed that the reference diagnosis accuracy reached 77%, with an inter-rater agreement kappa value of 0.91, indicating highly reliable annotation.

Cohen's kappa is a statistic measuring the degree of agreement between two annotators, which subtracts the probability of chance agreement. Kappa values typically range from 0 to 1, with 0.61–0.80 considered high agreement and above 0.81 considered almost perfect agreement. The reported kappa=0.91 indicates that clinicians' reviews of the reference diagnoses were highly consistent, showing that the annotation criteria are clear and reproducible. Note that a high kappa does not directly equal absolute diagnostic correctness; it only reflects the degree of agreement among annotators, which is why the authors also report a 77% reference diagnosis accuracy.

macro-F1 and micro-F1 are two commonly used aggregate metrics in multi-class tasks. macro-F1 first computes F1 for each class separately and then takes the arithmetic mean, so each class has equal weight and it is sensitive to low-frequency classes; micro-F1 aggregates true positives, false positives, and false negatives across all classes before computing, and is more easily dominated by high-frequency classes. In tasks like ICD coding with an obvious long-tail distribution, macro-F1 better reflects the model's ability to recognize rare codes, which is why this paper focuses on reporting macro-F1 improvements.

Evaluation Tasks: Admission-Time Differential Diagnosis and ICD Coding

The researchers set up two tasks close to real decision support: differential diagnosis and ICD coding. The key difference is that the model can only use information known at the time of admission to predict discharge diagnosis codes, rather than relying on completed discharge summaries. This is harder than traditional coding tasks but also closer to real clinical scenarios.

Experiments fine-tuned the Qwen3 series models (0.6B to 32B). Results show that after fine-tuning on MERLIN-DDx, models of all sizes outperform non-fine-tuned baselines on long-tail ICD performance (macro-F1). To isolate the contribution of reasoning trajectories, the researchers designed a case-matched label-only control group: using the same cases and gold codes for training, but without providing reasoning trajectories. Comparison found that reasoning trajectories bring 1.7 to 6.9 macro-F1 point improvements at each scale, although the gains on micro-F1 are inconsistent.

ICD coding is the process of converting clinical diagnoses and procedures into International Classification of Diseases standard codes, commonly used for insurance billing, statistics, and research. The number of ICD codes is huge and highly imbalanced, with a few common codes accounting for most samples and a large number of rare codes having few samples, forming a long-tail distribution. Traditional automated coding models are mostly based on complete discharge summaries, whereas this paper requires the model to predict discharge diagnosis codes using only information known at admission, which is closer to early-admission decision support scenarios but also significantly increases difficulty due to incomplete information.

Long-tail ICD performance refers to the model's performance on low-frequency codes. Because low-frequency classes have few samples, models tend to favor high-frequency classes, resulting in lower macro-F1. This paper isolates the contribution of reasoning trajectories through a case-matched label-only control group: both groups use the same admission cases and gold codes, with the only difference being whether reasoning trajectories are provided. This design controls for case difficulty and label distribution, making the observed macro-F1 improvements more likely attributable to reasoning supervision itself.

Data Ablation and Error Analysis

Data ablation experiments on the 8B model show that as verifier filtering strictness increases, macro-F1 rises, although stricter filtering retains fewer trajectories. Error analysis further shows that performance improvements cover all frequency strata, especially on low-frequency codes, but problems with low-frequency codes are improved, not fully solved.

Significance and Outlook

MERLIN-DDx's contribution lies not only in the dataset itself but also in providing a reusable supervision construction approach: using external references and real outcomes to filter and verify reasoning trajectories. The researchers have released the dataset, pipeline, and prompts, providing infrastructure for clinical reasoning research. Although the challenge of low-frequency codes remains, this work takes an important step toward more interpretable and reliable clinical decision support.

One-line Summary

MERLIN-DDx builds a clinical reasoning dataset that improves long-tail ICD coding performance after fine-tuning.

Paragraph Summary

Large language models often output conclusions directly in clinical differential diagnosis without reasoning, rooted in the fact that medical records only record diagnostic results and do not preserve reasoning chains. To address this, researchers propose MERLIN-DDx, which uses a four-stage generator-verifier pipeline combined with WikiDoc and MIMIC-IV to cross-validate reasoning trajectories, building a dataset of 124,510 stage records covering 10,400 admissions. Clinician review confirmed 77% reference diagnosis accuracy with kappa=0.91. After fine-tuning Qwen3 series models, long-tail ICD coding macro-F1 improved over baselines at all scales; a case-matched label-only control shows that reasoning trajectories bring 1.7 to 6.9 macro-F1 point improvements. Ablation experiments show that stricter verifier filtering yields higher macro-F1. Performance improvements cover all frequency strata, but low-frequency code issues remain not fully resolved.

#MERLIN-DDx#clinical reasoning#differential diagnosis#ICD coding#long-tail#generator-verifier pipeline#LLM fine-tuning#MIMIC-IV#WikiDoc#clinical decision support
Share:

Related articles