A Modular Approach for Clinical SLMs Driven by Synthetic Data with Pre-Instruction Tuning, Model Merging, and Clinical-Tasks Alignment

Jean-Philippe Corbeil, Amin Dada, Jean-Michel Attendu, Asma Ben Abacha, Alessandro Sordoni, Lucas Caccia, François Beaulieu, Thomas Lin, Jens Kleesiek, Paul Vozila · DOI

TL;DR

This paper introduces MediPhi, a collection of 3.8-billion-parameter Small Language Models (SLMs) tailored for clinical environments. By combining pre-instruction tuning, domain-specific model merging, and alignment via a massive new synthetic dataset (MediFlow), the authors create an SLM that achieves near-parity with models twice its size and even outperforms GPT-4 on complex medical coding tasks.

What Problem Does This Paper Address?

Deploying Large Language Models (LLMs) like GPT-4 in real-world clinical settings is highly challenging due to steep computational costs, high latency, and strict data privacy regulations (such as HIPAA) that restrict access to real patient data.

While Small Language Models (SLMs) offer a faster, cheaper alternative, they suffer from limited capacity. When researchers try to adapt them to the medical domain using standard continual pre-training, the models often experience "catastrophic forgetting"—losing their basic abilities to follow instructions or handle long contexts. Furthermore, existing medical AI benchmarks focus heavily on multiple-choice medical exams rather than the messy, unstructured tasks clinicians face daily, such as parsing radiology reports or extracting social determinants of health (SDoH).

Methods

To overcome these limitations, the authors propose a three-step modular framework to efficiently inject clinical knowledge into an SLM (specifically, Phi-3.5 mini) without breaking its general capabilities.

Figure 1: Our approach in two steps: 1) continual pre- training; 2) alignment. 1) Starting from Phi3.5 mini: 1.a) We leverage knowledge acquisition methods such as pre-instruction tuning on diverse medical and clini- cal corpora to obtain domain-specific experts. 1.b) We recur to model merging to merge experts first with the base model to combine new knowledge as well as re- cover skills degraded by the previous step, then together to form an unified model, MediPhi. 2) We generate MediFlow, a synthetic instruction dataset MediFlow for clinical tasks. We align our model on MediFlow using Supervised Fine-Tuning (SFT) and Direct Preference Optimization (DPO) and obtain MediPhi-Instruct. Seg- mentation of model parameters as equal block size are only for illustrative purposes.
  1. Pre-Instruction Tuning (PIT): Instead of standard Domain Adaptation Pre-Training (DAPT)—which simply feeds raw text to the model for next-token prediction—the authors use PIT. They leverage GPT-4o to generate diverse task data (summaries, named entity recognition, and relation extraction) directly from raw medical text, training the model on a blend of these tasks and the original documents. Five distinct expert models were trained across different medical text categories.
  2. Domain-Specific Model Merging: To counteract catastrophic forgetting, each expert model is first merged back with the original base model using Spherical Linear Interpolation (SLERP). This acts as a regularizer, restoring general instruction-following skills. Next, all five specialized experts are combined into a single unified model (MediPhi) using the BreadCrumbs merging operator, optimized via an evolutionary algorithm.
  3. Clinical Alignment (SFT + DPO): Finally, the unified model undergoes Supervised Fine-Tuning (SFT) and Direct Preference Optimization (DPO) using a newly generated synthetic instruction dataset to refine its conversational and formatting capabilities.
Comparison of single-expert SLERP merging versus multi-expert merging operators.

Datasets

The project relies on a mix of existing corpora, a massive new synthetic dataset, and an expanded evaluation benchmark:

  • Training Corpora: A diverse mix of public and permissively licensed medical text, including PubMed articles, clinical cases (PMC-Patients, Asclepius), doctor-patient dialogues (NoteChat), and medical coding webpages.
  • MediFlow (New Dataset): A synthetic dataset containing 2.5 million high-quality instructions spanning 14 medical NLP tasks, 98 fine-grained document types (e.g., discharge summaries, operative notes), and 6 difficulty levels. It includes robust support for structured JSON outputs.
  • CLUE+ (New Benchmark): The authors doubled the size of the existing Clinical Language Understanding Evaluation (CLUE) benchmark from 6 to 12 datasets. The new additions incorporate complex clinical tasks like medical error detection (MEDEC), doctor-patient dialogue summarization (ACI-Bench), and radiology report QA (MEDIQA-RRS QA).

Key Insights and Ideas

  • Vanilla DAPT Fails on Structured Web Data: The authors found that standard pre-training on raw medical coding webpages actually degraded model performance to near-random guessing. Transforming the dense webpages into textbook-like "explainers" or applying PIT with summaries completely reversed this trend, unlocking massive performance gains.
  • Merging as a Regularizer: Merging the specialized clinical experts back into the base model using SLERP didn't just preserve general capabilities; it actively boosted domain-specific accuracy.
  • Quality Over Quantity for Alignment: When aligning the model on the new MediFlow dataset, filtering the data down to the top 800,000 highest-quality instructions yielded noticeably better results than training on the full 2.5 million sample set.

Key Results

  • Beating GPT-4 on Medical Coding: The specialized medical coding expert achieved a 44% relative improvement over the base model on the ICD10CM benchmark, outperforming GPT-4-0125 by 14% (65% vs 57% accuracy).
  • Punching Above Its Weight Class: The final aligned model, MediPhi-Instruct (3.8B), achieved near-parity with Meta-Llama-3-8B-Instruct on the CLUE+ benchmark, despite being less than half its size.
  • Targeted Outperformance: MediPhi-Instruct outperformed the larger LLaMA3-8B model on several critical clinical subsets, including ICD10CM (+29.2%), radiology report QA (+5.8%), and medical question summarization (+3.3%).

Limitations and Future Work

Despite its strong performance, the authors note several limitations:

  • Resource Intensity: Generating the synthetic data and training the models required substantial compute resources (~12,000 GPU hours on A100s) and significant API costs for processing close to 25 billion tokens.
  • Scope Constraints: The MediFlow dataset is currently English-only and restricted to single-turn instructions rather than multi-turn conversations. It also features a limited number of highly complex, multi-step reasoning tasks.
  • Evaluation Gaps: The impact of the clinical tuning on non-medical capabilities (like safety alignment or multilingualism) was not fully explored. As a result, the authors recommend using MediPhi strictly for clinical NLP tasks and advise that human experts verify all model outputs.

Summary updated

BibTeX
@inproceedings{corbeil2025modular,
  author = {Jean-Philippe Corbeil and Amin Dada and Jean-Michel Attendu and Asma Ben Abacha and Alessandro Sordoni and Lucas Caccia and François Beaulieu and Thomas Lin and Jens Kleesiek and Paul Vozila},
  title = {{A Modular Approach for Clinical SLMs Driven by Synthetic Data with Pre-Instruction Tuning, Model Merging, and Clinical-Tasks Alignment}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure