Maintenance Notice

Due to necessary scheduled maintenance, the JMIR Publications website will be unavailable from Wednesday, July 01, 2020 at 8:00 PM to 10:00 PM EST. We apologize in advance for any inconvenience this may cause you.

Who will be affected?

Accepted for/Published in: JMIR AI

Date Submitted: Dec 30, 2025
Date Accepted: Jun 22, 2026

The final, peer-reviewed published version of this preprint can be found here:

Improving Clinical Validity in Synthetic Electronic Health Record Generation Using Best-of-N Sampling: Comparative Evaluation Study

Masud MA, Hasan M

Improving Clinical Validity in Synthetic Electronic Health Record Generation Using Best-of-N Sampling: Comparative Evaluation Study

JMIR AI 2026;5:e90590

DOI: 10.2196/90590

PMID: 42531495

PMCID: 13422743

Warning: This is an author submission that is not peer-reviewed or edited. Preprints - unless they show as "accepted" - should not be relied on to guide clinical practice or health-related behavior and should not be reported in news media as established information.

Constraint-Aware GAN for Clinical Tabular Data Synthesis: Improving GAN Outputs via Best-of-N Latent Space Sampling

  • Md Akmol Masud; 
  • Mahmud Hasan

ABSTRACT

Background:

The digitization of healthcare has generated vast electronic health records (EHRs) with immense potential for research, yet privacy regulations like HIPAA and GDPR severely limit data sharing. Generative Adversarial Networks (GANs) enable the creation of privacy-preserving synthetic datasets that mimic real distributions. However, standard GANs frequently produce clinically invalid samples, violating biological or logical constraints (e.g., impossible age-diagnosis combinations or invalid physiological correlations), creating a "validity gap" despite strong statistical fidelity.

Objective:

This study aims to bridge the validity gap in GAN-based clinical tabular data synthesis by introducing an inference-time strategy that enforces clinical constraints without retraining models, applying destructive post-processing, or compromising statistical fidelity, privacy, or downstream utility.

Methods:

We trained Wasserstein GAN with Gradient Penalty (WGAN-GP) models, enhanced with spectral normalization and soft constraint penalties, on three public clinical datasets representing varying constraint complexity: Stroke Prediction (N=5,110; simple bounds), Diabetes Health Indicators (N=100,000; intermediate implications), and Cardiovascular Disease (N=68,599; complex multi-variable correlations). At inference, we applied Constraint-Aware Best-of-N Sampling: generating N latent vectors, producing candidate samples via the generator, scoring each for constraint violations (sum across sex-specific, gender encoding, physiological range, correlation, and logical categories), and selecting the lowest-scoring (most valid) sample. Performance was evaluated on validity (violation reduction), fidelity (Kolmogorov-Smirnov statistics, correlations), utility (train-on-synthetic-test-on-real AUC), and privacy (membership inference attack AUC).

Results:

Best-of-N sampling yielded substantial validity improvements with minimal fidelity loss. For simple and intermediate constraints, Best-of-16 achieved 100% violation reduction at ~56ms per sample. For complex constraints (e.g., blood pressure relationships), Best-of-32 reduced violations by 92.4% (Cohen’s d=2.98). A non-linear scaling law emerged, with Best-of-16 as an efficiency sweet spot and a "complexity wall" requiring N=128 for near-perfect validity in structural dependencies. Fidelity remained high (ΔKS<0.03), privacy was preserved (MIA AUC≈0.50), and utility improved (+0.8% to +18.6% TSTR AUC).

Conclusions:

Constraint-Aware Best-of-N Sampling provides a practical, efficient inference-time solution for generating clinically valid synthetic tabular data using GANs. It offers a deployable playbook balancing computational cost and rigor, outperforming soft training penalties while avoiding distributional distortions from post-processing. This approach facilitates safer sharing of synthetic EHRs for medical research and AI development.


 Citation

Please cite as:

Masud MA, Hasan M

Improving Clinical Validity in Synthetic Electronic Health Record Generation Using Best-of-N Sampling: Comparative Evaluation Study

JMIR AI 2026;5:e90590

DOI: 10.2196/90590

PMID: 42531495

PMCID: 13422743

Download PDF


Request queued. Please wait while the file is being generated. It may take some time.

© The authors. All rights reserved. This is a privileged document currently under peer-review/community review (or an accepted/rejected manuscript). Authors have provided JMIR Publications with an exclusive license to publish this preprint on it's website for review and ahead-of-print citation purposes only. While the final peer-reviewed paper may be licensed under a cc-by license on publication, at this stage authors and publisher expressively prohibit redistribution of this draft paper other than for review purposes.