Abstract
Diagnosis based on Electronic Health Records (EHRs) often struggles with data scarcity and privacy concerns. To address these issues, we introduce RareSyn, an innovative data synthesis approach designed to augment and de-identify EHRs, with a focus on rare diseases. The core insight of RareSyn involves using seed EHRs of rare diseases to recall similar records from both common and rare diseases, and then leveraging Large Language Models to substitute the key medical information (e.g., symptoms or examination details) in these records with information from the knowledge graph, thereby generating new EHRs. We first train a transformer Encoder with contrastive learning to integrate various types of medical knowledge. Then, RareSyn engages in iterative processes of recalling similar EHRs, structuring EHRs, revising EHRs, and generating new EHRs until the produced EHRs achieve extensive coverage of the rare disease knowledge. We assess RareSyn based on its utility for diagnosis modeling, the diversity of medical knowledge it incorporates, and the privacy of the synthesized EHRs. Extensive experiments demonstrate its effectiveness in improving disease diagnosis, enhancing diversity, and maintaining privacy.
Introduction
Training AI models for rare disease diagnosis presents a significant challenge due to the inherent scarcity of clinical data. Rare diseases, by definition, affect a small percentage of the population, leading to a "long tail" distribution where many conditions have insufficient data for robust machine learning. Furthermore, strict privacy regulations often restrict the sharing of existing clinical records.
RareSyn addresses these hurdles by synthesizing high-fidelity, privacy-preserving Electronic Health Records (EHRs). By integrating structured medical knowledge from Knowledge Graphs (KGs) with the generative capabilities of Large Language Models (LLMs), RareSyn creates diverse training data that significantly enhances diagnostic accuracy while ensuring patient privacy.
The RareSyn Framework
The RareSyn pipeline consists of an initial pretraining phase followed by a four-step iterative synthesis process.
1. Encoder Pretraining and Layered Recalling
The process begins by training a Transformer encoder (E) using contrastive learning on diverse medical data, including medical exams, knowledge graphs, and existing EHRs. This encoder learns to map different medical entities and records into a shared embedding space.
In the Layered Recalling step, a "seed" EHR of a rare disease is used to retrieve similar records. Crucially, the system recalls records from both rare diseases and common diseases. These common disease records serve as structural "templates," providing realistic clinical note skeletons.
2. EHR Structuring and imap Replacement
The recalled template records are parsed into a structured format called an imap, which consists of term-value pairs for symptoms (S), examinations (E), and treatments (T).
The core innovation lies in the Weighted imap Replacement. RareSyn samples new medical entities from a Medical Knowledge Graph to replace values in the template. A distance-based weighting mechanism prioritizes entities that are characteristic of the target rare disease, ensuring the synthetic record is medically relevant.
3. EHR Generation and Stopping Mechanism
Finally, an LLM (such as GPT-4) is prompted to transform the modified imap back into a natural language clinical note, using the original template's style. This ensures the output is a professional-grade medical record. The process iterates, generating multiple records until the set of synthetic EHRs achieves sufficient coverage of the rare disease's characteristics as defined in the Knowledge Graph.
Experimental Evaluation
RareSyn was evaluated on two primary datasets: JARVIS-D (193 diseases) and JarvisD2 (diagnosis QA). The study focused on the rarest diseases in these sets.
Diagnostic Performance
The impact of RareSyn-generated data was substantial. For embedding-based models like BERT and MedBERT, Micro-F1 scores for rare disease diagnosis improved from approximately 21% to over 92% on the JARVIS-D dataset. This demonstrates that synthetic data can effectively bridge the gap caused by data scarcity.
Medical Fidelity and Privacy
Medical experts reviewed the synthetic records, finding them to be 97% medically accurate. In a "Turing test" style evaluation, experts could only distinguish real from synthetic records about 50% of the time.
From a privacy perspective, the synthetic records were found to be "untraceable." In the embedding space, synthetic records were further from their "seed" records than typical real records are from each other, indicating a low risk of re-identification.
Conclusion
RareSyn provides a robust solution for the data scarcity problem in rare disease AI. By leveraging common diseases as structural scaffolding and Knowledge Graphs for factual grounding, it generates high-quality, diverse, and private EHRs. Future work includes expanding the framework to multi-lingual contexts and exploring the impact of larger-scale LLMs on the generation quality.
Citation: Wang, H., Zhao, Y., Zheng, Y., & Wu, X. (2025). RareSyn: Health Record Synthesis for Rare Disease Diagnosis. Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing (EMNLP), 12311–12327.
Summary updated