Papers
Topics
Authors
Recent
Search
2000 character limit reached

RawMed: Synthetic Multi-Table EHR Generation

Updated 6 July 2026
  • 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

Sp=[e1p,e2p,,enpp],S^p = [e_1^p, e_2^p, \dots, e_{n^p}^p],

where npn^p is the number of events for patient pp. Each event consists of a timestamp tipt_i^p, an event type or table name ϵip\epsilon_i^p, and a set of column-value pairs

aip={(cj,vj)j=1,,mϵip}.a_i^p = \{(c_j, v_j)\mid j = 1,\dots,m^{\epsilon_i^p}\}.

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

eip=(tip,xip),e_i^p = (t_i^p, x_i^p),

where xipx_i^p 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 L=128L=128. The embedded event tensor is defined as

xipRL×F,xip=xtext,ip+xtype,ip+xdpe,ip,\mathbf{x}_i^p \in \mathbb{R}^{L\times F}, \qquad \mathbf{x}_i^p = \mathbf{x}_{\text{text},i}^p + \mathbf{x}_{\text{type},i}^p + \mathbf{x}_{\text{dpe},i}^p,

with npn^p0. Here, npn^p1 is the token embedding, npn^p2 is a type embedding distinguishing table names, column names, and values, and npn^p3 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:

npn^p4

with npn^p5 and npn^p6. Each latent vector is quantized against a codebook

npn^p7

where npn^p8 and npn^p9. Basic vector quantization is defined as

pp0

RawMed then extends this with residual quantization. For each latent vector, residual quantization of depth pp1 produces indices pp2 and reconstructs

pp3

The residual procedure initializes pp4 and iteratively selects

pp5

Each event is therefore represented by pp6 discrete indices. The decoder reconstructs the event embedding, and training uses a reconstruction loss

pp7

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

pp8

where each pp9 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

tipt_i^p0

Each event block is then interleaved as time tokens followed by latent event tokens, and the full patient sequence is flattened as

tipt_i^p1

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

tipt_i^p2

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; tipt_i^p3, tipt_i^p4, tipt_i^p5, tipt_i^p6, codebook size tipt_i^p7, and residual depth tipt_i^p8. Optimization uses AdamW with learning rate tipt_i^p9, weight decay ϵip\epsilon_i^p0, dropout ϵip\epsilon_i^p1, batch size 4096 events, and up to 200 epochs with early stopping. TempoTransformer uses AdamW with learning rate ϵip\epsilon_i^p2, weight decay ϵip\epsilon_i^p3, 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

ϵip\epsilon_i^p4

while categorical CDE uses Jensen–Shannon divergence

ϵip\epsilon_i^p5

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 ϵip\epsilon_i^p6, I-CDE ϵip\epsilon_i^p7, and ER ϵip\epsilon_i^p8, compared with SDV at CDE ϵip\epsilon_i^p9 and ER aip={(cj,vj)j=1,,mϵip}.a_i^p = \{(c_j, v_j)\mid j = 1,\dots,m^{\epsilon_i^p}\}.0, RC-TGAN at CDE aip={(cj,vj)j=1,,mϵip}.a_i^p = \{(c_j, v_j)\mid j = 1,\dots,m^{\epsilon_i^p}\}.1 and ER aip={(cj,vj)j=1,,mϵip}.a_i^p = \{(c_j, v_j)\mid j = 1,\dots,m^{\epsilon_i^p}\}.2, and ClavaDDPM at CDE aip={(cj,vj)j=1,,mϵip}.a_i^p = \{(c_j, v_j)\mid j = 1,\dots,m^{\epsilon_i^p}\}.3 and ER aip={(cj,vj)j=1,,mϵip}.a_i^p = \{(c_j, v_j)\mid j = 1,\dots,m^{\epsilon_i^p}\}.4. For SMAPE, the real-data reference is aip={(cj,vj)j=1,,mϵip}.a_i^p = \{(c_j, v_j)\mid j = 1,\dots,m^{\epsilon_i^p}\}.5 and RawMed obtains aip={(cj,vj)j=1,,mϵip}.a_i^p = \{(c_j, v_j)\mid j = 1,\dots,m^{\epsilon_i^p}\}.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 aip={(cj,vj)j=1,,mϵip}.a_i^p = \{(c_j, v_j)\mid j = 1,\dots,m^{\epsilon_i^p}\}.7 for real data with MEDS-TAB and aip={(cj,vj)j=1,,mϵip}.a_i^p = \{(c_j, v_j)\mid j = 1,\dots,m^{\epsilon_i^p}\}.8 with GenHPF, while RawMed reaches aip={(cj,vj)j=1,,mϵip}.a_i^p = \{(c_j, v_j)\mid j = 1,\dots,m^{\epsilon_i^p}\}.9 and eip=(tip,xip),e_i^p = (t_i^p, x_i^p),0 respectively. On eICU, the corresponding values are eip=(tip,xip),e_i^p = (t_i^p, x_i^p),1 and eip=(tip,xip),e_i^p = (t_i^p, x_i^p),2 for real data versus eip=(tip,xip),e_i^p = (t_i^p, x_i^p),3 and eip=(tip,xip),e_i^p = (t_i^p, x_i^p),4 for RawMed. The best baseline is substantially lower, at eip=(tip,xip),e_i^p = (t_i^p, x_i^p),5 on MIMIC-IV and eip=(tip,xip),e_i^p = (t_i^p, x_i^p),6 on eICU (Cho et al., 9 Jul 2025).

Temporal fidelity is a central empirical result. RawMed’s Time Gap KS is eip=(tip,xip),e_i^p = (t_i^p, x_i^p),7 on MIMIC-IV and eip=(tip,xip),e_i^p = (t_i^p, x_i^p),8 on eICU, compared with eip=(tip,xip),e_i^p = (t_i^p, x_i^p),9 for SDV and roughly xipx_i^p0–xipx_i^p1 for the other baselines. Event Count KS is xipx_i^p2 on MIMIC-IV and xipx_i^p3 on eICU. Next Event Prediction F1 reaches xipx_i^p4 and xipx_i^p5, compared with real-data references of xipx_i^p6 and xipx_i^p7 and baseline ranges of xipx_i^p8–xipx_i^p9 and L=128L=1280–L=128L=1281 (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 L=128L=1282 to L=128L=1283 and Time Gap KS from L=128L=1284 to L=128L=1285, and improves eICU CDE from L=128L=1286 to L=128L=1287 and Time Gap KS from L=128L=1288 to L=128L=1289. 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 xipRL×F,xip=xtext,ip+xtype,ip+xdpe,ip,\mathbf{x}_i^p \in \mathbb{R}^{L\times F}, \qquad \mathbf{x}_i^p = \mathbf{x}_{\text{text},i}^p + \mathbf{x}_{\text{type},i}^p + \mathbf{x}_{\text{dpe},i}^p,0 with VQ to xipRL×F,xip=xtext,ip+xtype,ip+xdpe,ip,\mathbf{x}_i^p \in \mathbb{R}^{L\times F}, \qquad \mathbf{x}_i^p = \mathbf{x}_{\text{text},i}^p + \mathbf{x}_{\text{type},i}^p + \mathbf{x}_{\text{dpe},i}^p,1 with RQ. Second, removing time tokenization worsens temporal fidelity, increasing Time Gap KS from xipRL×F,xip=xtext,ip+xtype,ip+xdpe,ip,\mathbf{x}_i^p \in \mathbb{R}^{L\times F}, \qquad \mathbf{x}_i^p = \mathbf{x}_{\text{text},i}^p + \mathbf{x}_{\text{type},i}^p + \mathbf{x}_{\text{dpe},i}^p,2 to xipRL×F,xip=xtext,ip+xtype,ip+xdpe,ip,\mathbf{x}_i^p \in \mathbb{R}^{L\times F}, \qquad \mathbf{x}_i^p = \mathbf{x}_{\text{text},i}^p + \mathbf{x}_{\text{type},i}^p + \mathbf{x}_{\text{dpe},i}^p,3. Third, removing time separation produces a much larger degradation, with CDE xipRL×F,xip=xtext,ip+xtype,ip+xdpe,ip,\mathbf{x}_i^p \in \mathbb{R}^{L\times F}, \qquad \mathbf{x}_i^p = \mathbf{x}_{\text{text},i}^p + \mathbf{x}_{\text{type},i}^p + \mathbf{x}_{\text{dpe},i}^p,4, Time Gap KS xipRL×F,xip=xtext,ip+xtype,ip+xdpe,ip,\mathbf{x}_i^p \in \mathbb{R}^{L\times F}, \qquad \mathbf{x}_i^p = \mathbf{x}_{\text{text},i}^p + \mathbf{x}_{\text{type},i}^p + \mathbf{x}_{\text{dpe},i}^p,5, and Event Count KS xipRL×F,xip=xtext,ip+xtype,ip+xdpe,ip,\mathbf{x}_i^p \in \mathbb{R}^{L\times F}, \qquad \mathbf{x}_i^p = \mathbf{x}_{\text{text},i}^p + \mathbf{x}_{\text{type},i}^p + \mathbf{x}_{\text{dpe},i}^p,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 xipRL×F,xip=xtext,ip+xtype,ip+xdpe,ip,\mathbf{x}_i^p \in \mathbb{R}^{L\times F}, \qquad \mathbf{x}_i^p = \mathbf{x}_{\text{text},i}^p + \mathbf{x}_{\text{type},i}^p + \mathbf{x}_{\text{dpe},i}^p,7 on MIMIC-IV and xipRL×F,xip=xtext,ip+xtype,ip+xdpe,ip,\mathbf{x}_i^p \in \mathbb{R}^{L\times F}, \qquad \mathbf{x}_i^p = \mathbf{x}_{\text{text},i}^p + \mathbf{x}_{\text{type},i}^p + \mathbf{x}_{\text{dpe},i}^p,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).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to RawMed.