Inspiration
Software and AI teams constantly hit a compliance wall when building realistic staging environments, CI test suites, or fine-tuning datasets: production databases contain rich relational edge cases and messy real-world distributions, yet strict privacy laws (GDPR, HIPAA, and internal security policies) prohibit copying raw customer records into non-production environments. Meanwhile, naive fake-data generators (Faker) produce statistically unrealistic records that break referential integrity across foreign keys and fail to expose subtle edge cases during testing. We built DataSynth to synthesize high-fidelity, multi-table relational datasets with formal Differential Privacy guarantees and deterministic business-rule compliance.
What it does
DataSynth inspects existing database schemas and statistical profiles to generate safe, production-representative synthetic datasets for testing, benchmarking, and model training:
Multi-Table Referential & Temporal Synthesis: Learns conditional probability distributions across parent-child table hierarchies, preserving foreign-key cardinality, realistic timestamp sequences (e.g., signup_at < first_order_at < refund_at), and skewed long-tail distributions without copying real rows.
Formal (epsilon, delta) -Differential Privacy Engine: Injects calibrated mathematical noise into learned statistical histograms and generative tabular models so individual user records cannot be reconstructed or inferred—even under membership-inference attacks.
LLM-Powered Semantic Text & Edge-Case Fuzzing: Synthesizes realistic unstructured fields (support tickets, transaction descriptions, medical notes) conditioned on structured row attributes, while optionally oversampling rare boundary conditions for stress-testing downstream pipelines.
How we built it
Statistical & Generative Core: Built in Python using PyTorch, SDV (Synthetic Data Vault) conditional tabular transformers, and Google Differential Privacy accounting libraries to track cumulative privacy loss (epsilon) strictly.
Schema & Constraint Solver: Engineered a topological schema graph builder using SQLAlchemy and NetworkX to resolve foreign-key insertion order and enforce custom SQL check constraints automatically.
High-Throughput Parquet & Database Loader: Built a parallel data writer in Rust (Apache Arrow and Polars bindings) capable of streaming millions of validated synthetic rows directly into PostgreSQL, DuckDB, or cloud object storage.
Privacy & Fidelity Audit Studio: Created an interactive web report in React, TypeScript, and Observable Plot comparing real vs. synthetic marginal distributions, correlation matrices, and Nearest-Neighbor Distance Ratio (NNDR) privacy leakage scores.
Challenges we ran into
Maintaining realistic correlations across 15+ interconnected tables while keeping cumulative Differential Privacy budget (epsilon < 1.0$) tight initially degraded multi-hop join accuracy. We solved this by decomposing the schema into weakly coupled star-schema subgraphs and allocating privacy budget proportionally based on mutual-information sensitivity—preserving critical cross-table relationships with 40% less noise overhead.
Accomplishments that we're proud of
Achieved 94.6% downstream ML model parity (models trained solely on DataSynth output performed within 5.4% of models trained on real production data) while passing strict membership-inference privacy audits at $\epsilon = 0.8$.
Generated 1 million schema-valid relational rows across 12 tables in under 42 seconds on a single developer workstation.
What's next for DataSynth
Adding a GitHub Actions CLI plugin that automatically seeds ephemeral pull-request preview databases with fresh, privacy-safe synthetic edge cases on every commit.Supporting multimodal document synthesis (generating matching synthetic PDF invoices and receipts linked to structured database rows).
Top comments (0)