Constrained Language Models Using Only Training Data: Generating Auditable Synthetic Clinical Trajectories

A constrained language model pipeline using only training data generates auditable, leak-safe synthetic clinical time series via quantile tokens and Markov transitions.
The study proposes a constrained language model pipeline relying solely on training data for synthetic clinical time series. Its core is factorized generation: a compact GPT-style language model learns cross-biomarker co-occurrence patterns via quantile tokens, while per-biomarker 3×3 Markov transition matrices enforce temporal direction, fitted only on training data for independent auditing. Calibration uses a training-only monotonic quantile mapping (QMap) to avoid test leakage, with Delta W1 quantifying alignment. On a 5,000-patient simulated testbed, the model shows strong distributional fidelity, near-random detectability, and membership inference AUC ~0.5, though differential privacy is not claimed. These are Stage-1 simulator results, with Stage-2 validation on real EHR cohorts planned.
Generating synthetic clinical time series requires balancing temporal realism, protection of model integrity during calibration, and privacy transparency. A recent study on arXiv proposes a constrained language model pipeline that relies solely on training data, using a factorized generation strategy to achieve leak-safe, auditable dynamic characteristics while maintaining fidelity.

Factorized Generation: Combining Language Models with Markov Transitions
The core idea of this pipeline is to decompose the generation task into two parts: learning co-occurrence patterns across biomarkers and constraining the temporal direction. The study employs a compact GPT-style language model that learns co-occurrence relationships between different biomarkers through quantile tokens. Meanwhile, temporal dynamics are enforced by a set of 3x3 Markov transition matrices for each biomarker, fitted exclusively on the training set (TRAIN), making the dynamic characteristics independently auditable.
The cleverness of this design lies in the language model capturing complex cross-sectional associations while the Markov transitions provide explicit temporal directionality. Together, they preserve the expressive power of the language model while ensuring interpretability and auditability of the temporal dimension through explicit transition matrices.
Quantile Tokenization: Before continuous biomarker values can be fed into the language model, they must be discretized into tokens. Quantile tokenization refers to mapping continuous values to a finite set of tokens based on the empirical quantiles (e.g., deciles or percentiles) of that biomarker on the training set, so that each token roughly corresponds to an equal-frequency value interval. The advantages are: greater robustness to skewed or outlier-containing clinical metrics, uniform token distribution that facilitates language model learning, and quantile boundaries that depend only on the training set, making them easy to audit and avoiding test set leakage. Compared to equal-width binning, quantile binning ensures balanced token frequencies and reduces model bias toward high-frequency intervals.
Markov Transition Matrices and Temporal Directionality: A Markov transition matrix describes the probability of a system transitioning from one state to another, with matrix element P(i→j) representing the probability of being in state i at the current time step and state j at the next. This paper fits a separate 3×3 transition matrix for each biomarker, dividing that marker's values into 3 states (e.g., low, medium, high), with each row of the matrix summing to 1. Since the matrices are estimated only on the training set, their transition probabilities can be independently inspected, endowing temporal dynamics with auditability. During generation, the model samples sequentially across time steps, with the next state constrained by the current state and the transition matrix. This structurally guarantees reasonable temporal direction (e.g., avoiding a condition jumping from severe back to mild without cause) while limiting unrealistic abrupt fluctuations in generated trajectories.
Leak-Safe Calibration: Monotonic Quantile Mapping Using Only Training Data
Calibration is an easily overlooked yet critical step in synthetic data generation. The study proposes a monotonic quantile mapping (QMap) fitted using only the training set. Specifically, QMap is fitted on the mapping from SYN(TRAIN) to SIM(TRAIN), using no test set statistics whatsoever. Once fitted, this fixed mapping is applied to the severity values of SYN(TEST).
This design eliminates at the source the possibility of test set information leaking into the generation process, ensuring evaluation fairness. The researchers quantified the severity aligned by QMap using Delta W1 and its confidence intervals, and reported multi-seed experimental results with paired 95% confidence intervals.
Monotonic Quantile Mapping (QMap) and Delta W1: Monotonic quantile mapping is an order-preserving numerical transformation that maps the empirical distribution of synthetic data onto the quantiles of a target distribution, commonly used to correct distributional shifts between synthetic and real data. This paper fits the mapping from SYN(TRAIN) to SIM(TRAIN)—learning how to align the quantiles of the synthetic training set to those of the simulated training set—then applies this fixed mapping to SYN(TEST), thereby avoiding any use of test set statistics. Delta W1 is a metric for alignment quality based on the Wasserstein-1 distance (earth mover's distance), which measures the minimum "transport" cost between two distributions; a smaller Delta W1 indicates that the calibrated severity distribution is closer to the target distribution. Reporting its confidence interval allows assessment of calibration stability.
Distributional Fidelity and Detectability Evaluation
On a simulated testbed comprising 5,000 patients, the constrained language model demonstrated better distributional fidelity and co-occurrence patterns than empirical samplers, with all parameters falling within published clinical ranges. After a small lambda sweep, the synthetic data maintained near-random detectability, meaning classifiers struggle to distinguish real from synthetic samples.
Regarding temporal compliance, thanks to the hard constraints of the Markov transition matrices, the model satisfies temporal direction requirements by construction. For privacy auditing, membership inference attacks based on classifiers yielded an AUC of approximately 0.5, indicating that attackers cannot effectively determine whether a sample belongs to the training set. The researchers explicitly do not claim differential privacy guarantees, but this audit result provides a transparent view of privacy leakage risk.
Membership Inference Attack and AUC: A membership inference attack is a privacy auditing method in which an attacker trains a classifier to determine whether a given sample belongs to the model's training set. A high attack success rate indicates that the model has over-memorized training samples, posing a privacy leakage risk. AUC (area under the ROC curve) is a metric of classifier discriminative ability, where 0.5 indicates performance indistinguishable from random guessing and 1.0 indicates perfect discrimination. In this paper, the attack AUC is approximately 0.5, meaning attackers cannot effectively determine whether a sample comes from the training set, suggesting the synthetic data does not significantly leak training set membership information. Note that this empirical audit is not equivalent to a formal differential privacy guarantee, and the authors explicitly do not claim differential privacy.
Limitations and Outlook: From Simulator to Real EHR
It is important to emphasize that this is a Stage-1 methodological result obtained on a controlled simulator. The research team plans Stage-2 validation to test the method's effectiveness on real EHR cohorts with clinical endpoints. While current results are encouraging, the gap between simulator and real clinical data still requires further evaluation.
The value of this method lies in providing an auditable, leak-safe framework for generating synthetic clinical trajectories, laying the foundation for subsequent application to real healthcare data. Its approach of calibrating solely on training data has implications for any synthetic data generation task requiring rigorous evaluation.
One-line Summary
A constrained language model pipeline using only training data generates auditable, leak-safe synthetic clinical time series through quantile tokens and Markov transitions.
Paragraph Summary
This study proposes a constrained language model pipeline relying solely on training data for synthesizing clinical time series. Its core is factorized generation: a compact GPT-style language model learns cross-biomarker co-occurrence patterns through quantile tokens, while 3×3 Markov transition matrices per biomarker enforce temporal direction, fitted only on the training set to enable independent auditing of dynamics. Calibration uses a monotonic quantile mapping (QMap) fitted exclusively on training data, completely avoiding test set information leakage, with Delta W1 quantifying alignment. On a 5,000-patient simulated testbed, the model outperforms empirical samplers in distributional fidelity and co-occurrence patterns, with near-random detectability and membership inference attack AUC of approximately 0.5, though the authors do not claim differential privacy. These are Stage-1 simulator results, with Stage-2 validation planned on real EHR cohorts.
Related articles

Michael Nielsen Takes Down His Classic Neural Network Textbook, Sparking Community Discussion
Michael Nielsen's classic free textbook Neural Networks and Deep Learning has been taken offline, sparking discussion on Hacker News about the reasons and impact.

Inside the AI Training Data Market: The Trade-off Between Exclusivity and Discounts
G2i founder Gabe Greenberg reveals the dual-track pricing of the AI training data market: labs pay a premium for exclusive data or accept discounts that allow others to buy it.

SessionGraph: Unifying All Coding Agent Sessions in One Interactive Graph
SessionGraph aggregates coding agent sessions into an interactive graph, helping developers review, debug, and manage AI coding workflows across sessions. This article examines its positioning, value, and open questions.