arXiv:2608.22618cs.LGAug 2026

Manuscript Offprint

arXiv:2608.22618

KMGen: A Skill-based Approach for Synthetic Individual Patient Data Generation

Jalen Jiang, Chufan Gao, Ethan Rasmussen, Stephen Z. Xie, Jimeng Sun

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Jalen Jiang

Siebel School of Computing and Data Science

University of Illinois Urbana-Champaign

JALENJ4@ILLINOIS.EDU

Chufan Gao

Siebel School of Computing and Data Science

University of Illinois Urbana-Champaign

CHUFAN2@ILLINOIS.EDU

Ethan Rasmussen

Siebel School of Computing and Data Science

University of Illinois Urbana-Champaign

ETHANMR3@ILLINOIS.EDU

Stephen Z. Xie

Mayo Clinic Alix School of Medicine

XIE.STEPHEN@MAYO.EDU

Jimeng Sun

Siebel School of Computing and Data Science

University of Illinois Urbana-Champaign

JIMENG@ILLINOIS.EDU

Abstract

Individual patient data (IPD) from clinical trials is the substrate for survival modeling, meta-analysis, and safety research, yet IPD is rarely released. Prior work has addressed only half of this gap: reconstructing Kaplan–Meier (KM) curves from published plots — typically requiring manual digitization or human-in-the-loop correction — while offering no mechanism for generating the adverse-event (AE) streams that constitute the other half of a patient record. We introduce KMGen, the first end-to-end framework that (i) fully automates KM curve extraction at accuracy competitive with human-guided tools, and (ii) generates synthetic per-patient AE trajectories from public trial registry records. The extraction stage is a fully automated agentic pipeline — an agent generates code to extract each step in the km curve — achieving a mean Integrated Absolute Error (IAE) of 0.0151 on a 32-plot benchmark spanning clean, edge-case, and adversarial conditions. The IPD generation stage decouples patient archetype extraction from statistical sampling: an LLM distills the trial record into arm-specific statistics, adverse events, patient demographics, and risk multipliers. A mechanistic sampler generates patient events via clinical archetypes, bootstrap rank-correlation coupling to the empirical KM curve (preserving the marginal survival distribution exactly), and cycle-based AE scheduling with an induction/maintenance split. Across three held-out oncology trials spanning an order of magnitude in cohort size and 30 independent regenerations per trial, KMGen achieves mean integrated KM absolute difference ΔKM≤0.051\Delta_{KM} \leq 0.051, sex/ECOG JSD ≤0.013\leq 0.013 on 5 of 6 demographic slots, and recovers ≥71%\geq 71\% of the top-15 AEs by exact MedDRA term under

© 2026 J. Jiang, C. Gao, E. Rasmussen, S.Z. Xie & J. Sun.

a single fixed parameter set. The pipeline is interpretable end-to-end and released as open source at https://github.com/chufangao/kmgen.

1. Introduction

Individual patient data (IPD) represents the gold standard for clinical research, enabling precise modeling of time-to-event outcomes, subgroup identification, and rigorous validation of statistical assumptions. However, access to IPD from Randomized Controlled Trials (RCTs) is often restricted due to privacy regulations, proprietary interests, and data governance constraints. Consequently, secondary analyses frequently rely on aggregated summary statistics, such as hazard ratios (HR) and median survival times. These summary statistics impose limitations on downstream applications that require granular event timing or censoring patterns, particularly in the development of machine learning models and meta-analyses.

Recent methodological advances have sought to mitigate these limitations by reconstructing IPD from published survival data. Guyot et al. (2012) introduced an iterative numerical algorithm to invert Kaplan–Meier Kaplan and Meier (1958) equations, allowing for the recovery of sufficient statistics from published curves. Subsequent developments, such as IPD from KM Liu et al. (2021), enhanced the stability of this reconstruction process through modified iterative algorithms and improved user interfaces. Most recently, KM-GPT Zhao et al. (2025) demonstrated the application of multi-modal LLMs to automate the extraction process, significantly reducing manual digitization requirements. While these reconstruction methods have substantially advanced the accessibility of historical trial data, their utility is inherently bounded by the existence of published figures.

To address these complementary constraints, we introduce KMGen, a unified framework for both the extraction and generation of synthetic IPD from clinical trial reports and KM curves. KMGen operates through a dual-purpose architecture that addresses the full spectrum of IPD accessibility needs: (1) an adaptive hybrid pipeline for extracting patient-level survival data from published KM plots, and (2) a semi-deterministic agentic harness for generating high-fidelity synthetic IPD when reconstruction is not feasible. This comprehensive approach builds upon the foundational work of prior reconstruction methods while extending their utility to scenarios where trial data must be simulated for methods development or secondary analyses.

The extraction component of KMGen employs a two-stage pipeline that combines computer vision with multimodal LLM reasoning. An LLM agent, using an adaptive markdown skill, analyzes the input image to select from a technique toolbox (color-based extraction, spatial cluster separation, tick-mark bounding box detection), while deterministic computer vision code handles pixel-level precision. This architecture addresses three core challenges in KM plot extraction: (1) axis calibration despite matplotlib rendering artifacts, (2) curve separation under visual anti-patterns including overlapping curves and black-and-white figures, and (3) validation against ground-truth synthetic benchmarks.

The generation component shifts the problem from reconstruction to creation. End-to-end LLM samplers can hallucinate clinically implausible event sequences and tend toward mode collapse on the long tail of rare Davidson et al. (2026). KMGen instead splits the work: an LLM agent maps the trial record into a structured, MedDRA-compliant configuration, and a deterministic sampler then realizes per-patient event streams from that configuration — using bootstrap rank-correlation coupling to the empirical KM curve (preserving the marginal survival distribution by construction), patient archetypes with per-organ-system risk multipliers, and cycle-based AE scheduling with an induction–maintenance phase split. Every clinical prior is an explicit, citable parameter rather than a latent weight, which makes the resulting synthetic IPD auditable for downstream methods development and safety-monitoring work in settings where access to real IPD is restricted.

This paper contributes to the ecosystem of IPD tools by unifying extraction and generation capabilities within a single framework. Our primary contributions are:

  1. The development of KMGen, a dual-purpose framework that combines adaptive hybrid extraction with deterministic synthetic generation for comprehensive IPD accessibility.

  2. An evaluation of extraction performance on a 32-plot synthetic benchmark spanning clean plots, edge cases, and adversarial stress tests, demonstrating a mean IAE of 0.0151—comparable to methods that require much more human guidance Zhao et al. (2025).

  3. An end-to-end evaluation of the generation pipeline on three real oncology trials with held-out IPD, reporting mean ± std over 30 independent regenerations: mean integrated KM absolute difference ΔKM≤0.051\Delta_{KM} \leq 0.051, top-15 AE overlap ≥71%\geq 71\%, and faithful early-phase AE timing under a single fixed parameter set.

  4. The release of an open-source implementation to facilitate reproducibility and further development within the research community.

The remainder of this paper is organized as follows: Section 2.1 presents the KM plot extraction pipeline and our synthetic benchmark setup. Section 2.2 details the mechanistic synthetic IPD generation methodology. Section 3 evaluates the KM plot extraction and the generation pipeline against ground-truth IPD from three complex oncology trials, highlighting fidelity metrics for survival and safety profiles. Finally, Section 4 discusses the implications for healthcare machine learning and future directions in synthetic clinical data generation.

References (31)