RawMed: Synthetic Multi-Table EHR Generation
- RawMed is a generative framework that synthesizes raw multi-table, time-series electronic health records by preserving the original structured format with minimal preprocessing.
- It converts each clinical event into text and applies residual quantization to compress event-level content into discrete latent sequences for efficient modeling.
- The framework employs an autoregressive TempoTransformer with explicit temporal tokenization, outperforming baselines in fidelity and utility while ensuring privacy.
Searching arXiv for RawMed and closely related synthetic EHR generation work to ground the article in current literature. {"query": "\"RawMed\" synthetic EHR arXiv", "max_results": 10, "sort_by": "relevance"} Searching for the specific RawMed paper and adjacent work on synthetic EHR generation. RawMed is a generative framework for synthesizing multi-table, time-series electronic health records (EHR) that are intended to remain close to raw EHR structure rather than to heavily curated feature matrices. It represents each clinical event as text, compresses event-level content into a short discrete latent sequence by residual quantization, and then models patient trajectories autoregressively in latent space while preserving explicit temporal structure. In the formulation introduced by Cho et al., RawMed is presented as the first framework to synthesize multi-table, time-series EHR data that closely resembles raw EHRs, with minimal preprocessing, and is validated on two open-source ICU datasets where it outperforms baseline models in fidelity and utility (Cho et al., 9 Jul 2025).
1. Scope and problem setting
RawMed is motivated by the observation that real EHR are not single flat tables but time-series relational databases composed of multiple linked tables, heterogeneous column types, and event-level timestamps. In this view, an EHR contains tables such as labs, medications, and input events; categorical fields such as drug names, item identifiers, routes, and units; numerical fields such as laboratory values, doses, and infusion rates; and sparse, irregularly sampled events that share a patient-level time axis. The framework therefore treats “raw” EHR as the original time-stamped rows from these tables, with all columns and original values retained except for a small set of uninformative identifiers or leakage-prone fields (Cho et al., 9 Jul 2025).
The central motivation is synthetic data generation under privacy and governance constraints. The paper argues that real EHR are difficult to share because they are sensitive, highly regulated, and high-dimensional enough that de-identification remains brittle. Synthetic EHR are therefore intended to offer privacy preservation and research utility without exposing true patient trajectories (Cho et al., 9 Jul 2025).
RawMed is positioned against earlier EHR generators that usually simplify the problem by selecting only a few expert-chosen variables, flattening multiple tables into a single representation, or imposing heavy preprocessing such as binning, one-hot encoding, normalization, grouping, or temporal aggregation. The paper identifies these design choices as distortive because they can hide subtle trends, discard columns required by downstream tasks, and hard-code schema-specific assumptions. RawMed instead aims to generate “raw-like” EHR with minimal preprocessing, explicit temporal modeling, and enough scalability to handle on the order of 333,524 features and up to 243 time steps per patient while preserving original values (Cho et al., 9 Jul 2025).
2. Event representation and minimal preprocessing
RawMed formalizes a patient trajectory as an ordered event sequence
where is the number of events for patient . Each event consists of a timestamp , an event type or table name , and a set of column-value pairs
The timestamp is treated separately from the remaining attributes in order to preserve its role in temporal ordering (Cho et al., 9 Jul 2025).
The framework converts each event into a textual serialization that begins with the table name and then lists non-null columns and values. A lab event with item, value, and unit, for example, is serialized as a string such as lab item Glucose value 95 uom mg/dL. This yields an event representation
where is raw event text (Cho et al., 9 Jul 2025).
Tokenization uses the Bio+Clinical BERT tokenizer, with each event padded or truncated to a fixed length . The embedded event tensor is defined as
with 0. Here, 1 is the token embedding, 2 is a type embedding distinguishing table names, column names, and values, and 3 is a digit-place embedding. Numeric strings are split into digits, so a value such as 123.45 becomes 1 2 3 . 4 5, allowing the model to preserve decimal structure without converting values into normalized floating-point features (Cho et al., 9 Jul 2025).
“Minimal preprocessing” in RawMed is therefore substantive rather than rhetorical. The framework explicitly avoids manual feature selection, numeric binning, one-hot encoding, grouping, normalization, or time-window aggregation. It drops only a small set of columns that are pure identifiers or leak future information, such as subject_id, orderid, canceled flags, and some secondary timestamps. This suggests that RawMed is designed to be schema-preserving and task-agnostic, in contrast to prior approaches that depend on extensive domain engineering (Cho et al., 9 Jul 2025).
3. Latent compression and temporal generative model
RawMed uses a two-stage architecture. The first stage compresses each event independently; the second stage models the temporal sequence of compressed events for each patient (Cho et al., 9 Jul 2025).
For event compression, a convolutional encoder maps each embedded event into a shorter latent sequence:
4
with 5 and 6. Each latent vector is quantized against a codebook
7
where 8 and 9. Basic vector quantization is defined as
0
RawMed then extends this with residual quantization. For each latent vector, residual quantization of depth 1 produces indices 2 and reconstructs
3
The residual procedure initializes 4 and iteratively selects
5
Each event is therefore represented by 6 discrete indices. The decoder reconstructs the event embedding, and training uses a reconstruction loss
7
together with a commitment term, with codebook updates performed by exponential moving average (Cho et al., 9 Jul 2025).
After compression, a patient sequence becomes
8
where each 9 is the event’s grid of code indices. Time is tokenized separately: timestamps are discretized at 10-minute resolution, converted to base-10 digits, and stored as
0
Each event block is then interleaved as time tokens followed by latent event tokens, and the full patient sequence is flattened as
1
This explicit separation of time tokens from event-code tokens is a defining design choice; the ablation study shows that removing time separation sharply degrades temporal fidelity (Cho et al., 9 Jul 2025).
The temporal model, called TempoTransformer, is a 12-layer autoregressive Transformer with 8 attention heads, hidden size 512, and feed-forward dimension 2048. It models the flattened quantized sequence with causal self-attention and optimizes
2
Generation proceeds by sampling token blocks under vocabulary constraints: time positions can emit only decimal digits, and event positions can emit only latent code indices. The sampled event codes are decoded through the codebook and decoder back into text, then parsed into relational tables. Post-processing enforces valid table names, col val col val structure, numeric cleaning, categorical value correction by Levenshtein distance, temporal monotonicity, and range-based semantic constraints for numeric columns (Cho et al., 9 Jul 2025).
4. Datasets, training configuration, and evaluation framework
RawMed is evaluated primarily on two open-source ICU datasets and additionally on an emergency department dataset in appendix experiments. The main settings are summarized below (Cho et al., 9 Jul 2025).
| Dataset | Tables | Scale |
|---|---|---|
| MIMIC-IV (ICU subset) | labevents, prescriptions, inputevents |
62,704 patients, about 6.8M rows, up to 243 events per patient |
| eICU | lab, medication, infusiondrug |
143,812 patients, about 6.8M rows, max 114 events per patient |
The main experiments use adult patients with ICU stays longer than 12 hours and a 90% train / 10% test split. The framework keeps 9–15 columns per table in MIMIC-IV and includes most original columns except identifiers, some local codes, secondary times, and future-leaking attributes such as drugordercancelled (Cho et al., 9 Jul 2025).
Event compression uses a 5-layer CNN encoder with kernel size 5, stride 2, and padding 2; 3, 4, 5, 6, codebook size 7, and residual depth 8. Optimization uses AdamW with learning rate 9, weight decay 0, dropout 1, batch size 4096 events, and up to 200 epochs with early stopping. TempoTransformer uses AdamW with learning rate 2, weight decay 3, batch size 32 patient sequences, and up to 200 epochs. Training takes less than 24 hours for event compression on a single A6000 GPU and less than 48 hours for temporal modeling, using three A6000 GPUs for MIMIC-IV and one for eICU (Cho et al., 9 Jul 2025).
The evaluation framework is unusually broad because it is designed specifically for multi-table time-series synthetic EHR. For single-table fidelity, RawMed reports column-wise density estimation (CDE), item-specific CDE (I-CDE), pairwise column correlation (PCC), item-specific PCC (I-PCC), and predictive similarity. Numeric CDE uses the Kolmogorov–Smirnov statistic
4
while categorical CDE uses Jensen–Shannon divergence
5
Predictive similarity is measured by training XGBoost models on real or synthetic tables and testing on real data, using SMAPE for numeric targets and classification error rate for categorical targets (Cho et al., 9 Jul 2025).
For multi-table temporal utility, the framework defines 11 downstream tasks over a 12-hour observation horizon, using the first 6 hours as input and the second 6 hours for prediction. Six tasks predict laboratory outcomes and five predict medication or input occurrence. Utility is measured by AUROC using two patient representations, GenHPF and MEDS-TAB. Temporal fidelity is assessed with Time Gap KS, Event Count KS, and Next Event Prediction F1. Privacy is evaluated with a membership inference attack (MIA), where accuracy near 0.5 indicates low leakage (Cho et al., 9 Jul 2025).
5. Empirical performance and comparative position
Across both MIMIC-IV and eICU, RawMed achieves the best performance among the generative baselines reported in the paper, including SDV, RC-TGAN, ClavaDDPM, and RealTabFormer. On MIMIC-IV single-table fidelity, RawMed records CDE 6, I-CDE 7, and ER 8, compared with SDV at CDE 9 and ER 0, RC-TGAN at CDE 1 and ER 2, and ClavaDDPM at CDE 3 and ER 4. For SMAPE, the real-data reference is 5 and RawMed obtains 6, which is closer than the baselines and slightly lower than the real-trained reference value itself (Cho et al., 9 Jul 2025).
Clinical utility results show similarly strong preservation of downstream signal. On the 11-task benchmark, micro-averaged AUROC on MIMIC-IV is 7 for real data with MEDS-TAB and 8 with GenHPF, while RawMed reaches 9 and 0 respectively. On eICU, the corresponding values are 1 and 2 for real data versus 3 and 4 for RawMed. The best baseline is substantially lower, at 5 on MIMIC-IV and 6 on eICU (Cho et al., 9 Jul 2025).
Temporal fidelity is a central empirical result. RawMed’s Time Gap KS is 7 on MIMIC-IV and 8 on eICU, compared with 9 for SDV and roughly 0–1 for the other baselines. Event Count KS is 2 on MIMIC-IV and 3 on eICU. Next Event Prediction F1 reaches 4 and 5, compared with real-data references of 6 and 7 and baseline ranges of 8–9 and 0–1 (Cho et al., 9 Jul 2025).
The comparison with RealTabFormer is especially important because both methods are text-based. Under a 6-hour observation window, RawMed reduces maximum sequence length by 84% on MIMIC-IV and 74% on eICU, yielding approximately 1.8k and 0.8k latent tokens per patient instead of direct text sequences of 11.2k and 3.1k tokens. In the same setting, RawMed improves MIMIC-IV CDE from 2 to 3 and Time Gap KS from 4 to 5, and improves eICU CDE from 6 to 7 and Time Gap KS from 8 to 9. The paper also reports that RealTabFormer requires 10–20 days of training, whereas RawMed trains in less than 2 days (Cho et al., 9 Jul 2025).
Ablation studies identify three decisive components. First, residual quantization improves over ordinary vector quantization; for example, the KS statistic for patientweight on MIMIC-IV falls from 0 with VQ to 1 with RQ. Second, removing time tokenization worsens temporal fidelity, increasing Time Gap KS from 2 to 3. Third, removing time separation produces a much larger degradation, with CDE 4, Time Gap KS 5, and Event Count KS 6. These results suggest that RawMed’s gains derive not only from compression but from the specific factorization of event content and explicit temporal tokens (Cho et al., 9 Jul 2025).
6. Privacy, limitations, and broader significance
RawMed’s privacy analysis is empirical rather than formal. Membership inference attack accuracy is 7 on MIMIC-IV and 8 on eICU, essentially random guessing and comparable to the other methods. The authors interpret this as evidence that RawMed captures near-real fidelity without increasing attackability. At the same time, the paper explicitly notes that RawMed provides no formal differential privacy guarantees and that synthetic data should still be treated as risk-reduced rather than risk-free, especially for rare patterns or outliers (Cho et al., 9 Jul 2025).
Several limitations are acknowledged. The main experiments use only three time-series tables, so scaling to dozens of tables may require additional architectural or representational changes. The principal time horizon is 12 hours, with 24-hour experiments reported as promising but not fully extending to much longer trajectories. The current model is unconditional, so it cannot directly generate cohorts conditioned on diagnoses, demographics, or outcomes. Static patient attributes and unstructured clinical notes are out of scope. Generalization beyond MIMIC-IV, eICU, and the appendix experiment on MIMIC-IV-ED remains an open question (Cho et al., 9 Jul 2025).
Within the literature, RawMed is positioned as the first method to address raw multi-table time-series EHR at this level of fidelity and scale, and as a bridge between text-based generative modeling and EHR-specific structure. Its practical significance lies in making it possible to share or benchmark on raw-like synthetic relational EHR without collapsing them into narrow feature sets. A plausible implication is that RawMed shifts synthetic EHR generation from feature-engineered panel synthesis toward schema-preserving event synthesis, where utility is assessed not only by marginal distributions but also by inter-table relationships, temporal dynamics, and downstream clinical prediction (Cho et al., 9 Jul 2025).