KMGen: A Skill-based Approach for Synthetic Individual Patient Data Generation
KMGen is an open-source, end-to-end framework that fully automates the extraction of Kaplan-Meier curves from published plots and generates synthetic individual patient data, including adverse event trajectories, by combining agentic code generation with a mechanistic sampling approach that preserves marginal survival distributions and demographic correlations.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
In the world of medical research, the most valuable resource is often the raw, individual record of a patient's journey through a clinical trial. These records contain the precise timing of when a treatment began, when side effects appeared, and exactly how long a patient lived. Scientists call this individual patient data, and it is the gold standard for understanding how well a new therapy works. However, for reasons of privacy and legal protection, these detailed records are almost never released to the public. Instead, researchers are usually left with only the final summary: a graph showing the percentage of patients who survived over time, and a list of how many people experienced specific side effects. This summary is useful, but it is like trying to understand a complex story by reading only the final chapter; the nuances of how the story unfolded are lost. Without the full data, it is difficult to build better computer models to predict outcomes or to rigorously test new safety monitoring systems.
A team of researchers has developed a new tool called KMGen to bridge this gap. Their work addresses a long-standing limitation in how medical data is shared. While previous methods could sometimes reconstruct the survival graph from a published picture, they could not create the missing half of the patient story: the timeline of side effects. KMGen is the first system designed to do both. It takes a published survival graph and a public trial registry entry, and it automatically generates a complete, synthetic set of individual patient records that look and behave like real data. This allows scientists to test their models and safety algorithms on data that mimics real trials, without ever needing access to the private, protected records of actual patients.
The process begins with a computer program that acts as a digital analyst. Its first job is to look at a published image of a survival curve—a line graph that shows how many patients are still alive at different points in time—and turn that picture back into numbers. This is a difficult task because these graphs often have overlapping lines, different colors, or distracting grid marks that can confuse a computer. The system uses a smart software agent to inspect the image, decide which technique is best for that specific picture, and then write code to extract the data with pixel-perfect precision. The researchers tested this extraction tool on thirty-two different types of graphs, ranging from clean, simple images to messy, distorted ones designed to trick the software. The tool succeeded in almost every case, producing a digital version of the curve that was nearly identical to the original, with errors so small they were barely noticeable.
Once the survival curve is digitized, the system moves to the second, more creative stage: generating the individual patient records. Instead of guessing or randomly inventing patient histories, the system follows a strict, logical recipe. First, a software agent reads the public trial registry to understand the basic facts of the study: the number of patients, their average age, their gender, and the types of side effects that were reported. It organizes this information into a structured plan. Then, a deterministic sampler—a computer program that follows fixed mathematical rules—uses this plan to create thousands of fake patients.
The way this generation works is carefully designed to be both realistic and reliable. The system creates different "archetypes" of patients based on their risk factors, such as age, gender, and overall health. It then assigns each fake patient a survival time that matches the curve extracted from the graph, ensuring that the overall pattern of survival is exactly preserved. For the side effects, the system schedules them based on the typical rhythm of a clinical trial, where patients are checked at regular intervals. It ensures that patients who are sicker or older are more likely to experience side effects, just as they would in a real trial, and that the timing of these events follows the natural patterns of treatment cycles. Crucially, every step of this process is transparent and based on explicit rules rather than hidden guesses, meaning scientists can trace exactly how a specific patient record was created.
The researchers tested this entire pipeline on three real-world cancer trials involving hundreds of patients. They used the system to generate synthetic data and then compared it to the actual, hidden data from those trials. The results were strikingly close. The synthetic survival curves matched the real ones with a high degree of accuracy, and the distribution of side effects in the fake data closely mirrored the real data. For example, the system correctly identified the most common side effects in three out of four cases and reproduced the timing of when those side effects occurred with an average error of less than one month. Even the demographic details, such as the mix of ages and genders, were nearly indistinguishable from the real trials.
This work does not claim to replace real clinical trials or to generate data that can be used to make regulatory decisions about new drugs. The synthetic records are not real people, and they do not capture the full complexity of human biology. However, the study demonstrates that it is possible to create high-quality, realistic data for the specific purpose of testing and improving the tools scientists use to analyze health. By providing a way to generate individual patient data from public summaries, KMGen offers a new resource for researchers to validate their methods and explore safety questions in a setting where real data is unavailable. The system is now available as open-source software, allowing the broader scientific community to use and refine this approach for future studies.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.