Auditing AI-Generated Test Data for Leaked Customer PII Before You Ship It

Illustration of a padlock superimposed over a blue circuit board, representing data security and privacy

Most teams that build “synthetic” test data stop at the generation step: a model produces rows that look plausible, nobody recognizes a real name in the output, and the dataset ships to a staging environment or a support ticket gets attached to a bug report. What that skips is the part official guidance treats as the actual point — measuring, not eyeballing, whether the output still carries real customer information or can be used to reconstruct it. A synthetic dataset that was never checked against its source isn’t verified to be safe; it’s just unverified in a new format.

What synthetic data is actually supposed to buy you

NIST Special Publication 800-188, the federal government’s own guidance on de-identifying datasets, places synthetic data on the same spectrum as removing identifiers and releasing summary statistics: a way to publish something that “resemble[s] the original data but… have[s] a lower disclosure risk,” built from “privacy-preserving models” that add noise rather than copy records. That framing matters because it’s explicit about synthetic data being a disclosure-risk reduction, not a disclosure-risk elimination. The same publication notes that fully synthetic data and differential privacy “currently have limited use within the Federal Government due to cost, time constraints, and the sophistication required of practitioners,” and warns that repeated releases of related synthetic datasets “can accumulate information leakage, even when each release leaks little.” Neither caveat disappears because the generator is an LLM instead of a statistical model.

The step most workflows skip: scanning the input before you generate anything

Before any synthetic model sees a dataset, the source still needs a pass for direct identifiers. Gretel’s own Safe Synthetics SDK documentation builds its generation workflow around exactly this order: from_data_source loads the real data and carves out a holdout set (5% by default) for later evaluation, then a recommended transform step redacts and replaces personal identifiers using a built-in template — default, HIPAA, GDPR, or NER-only — or a custom YAML config, and only after that does synthesize train a model that generates records resembling the original without mapping one-to-one to its rows.

Microsoft’s Presidio, the open-source PII detection and anonymization toolkit, is a common tool for that transform step. It combines named entity recognition, regular expressions, rule-based logic, and checksums to flag entities like names, Social Security numbers, credit card numbers, and phone numbers, then hands matches to an anonymizer module that supports redaction, replacement, hashing, encryption, and consistent pseudonymization via mappings. Presidio’s own documentation is direct about its ceiling: it “can help identify sensitive data but cannot guarantee it will find all of it, because detection is automated,” and it recommends layering additional systems and protections rather than treating one pass as sufficient. That line is the reason the audit described below happens on the output, not just the input — a scanner that missed something on the way in won’t catch its own miss on the way out either.

Reading a privacy report instead of eyeballing the output

Gretel’s Synthetic Quality & Privacy Report is a documented example of what an actual measurement looks like, as opposed to a visual scan for recognizable names. Its Data Privacy Score, out of 10, averages two attack-based metrics:

MetricWhat it measuresHow it’s computed
Membership Inference ProtectionHow well the data resists an attacker determining whether a specific record was in the training setA 5% holdout plus 360 simulated attacks, reported as a percentage of attacks at each protection level
Attribute Inference ProtectionHow well sensitive attributes resist being predicted when an attacker already knows other attributesScored against a default quasi-identifier count of 3
PII Replay (Evaluate reports only)How many PII instances from the reference data reappear, exactly, in the synthetic outputCounted per column, both total and unique instances; some replay of common values like first names is expected

A dataset can look nothing like the source to a human reader and still score poorly here — membership inference and attribute inference are statistical attacks, not visual ones, and PII replay specifically catches the case where a generation model reproduces a literal string (an email address, an account number) that happened to appear often enough in training to get memorized.

The mechanisms that actually reduce what gets memorized

Separately from the privacy report, Gretel’s synthesis models expose specific privacy controls, documented on their Privacy Protection page, each aimed at a different failure mode:

MechanismWhat it catchesTrade-off noted in Gretel’s docs
Overfitting prevention (validation_split, early_stopping)The model memorizing training rows outrightNot recommended for time-series, anomaly detection, or very small datasets
Similarity filtering (privacy_filters.similarity)Synthetic records that are near-duplicates of real ones“High” removes records 99%+ similar to a training record; disabled automatically when differential privacy is on
Outlier filtering (privacy_filters.outliers)Rare, distinctive records that are easier to re-identify or exploit in membership/attribute attacksMore aggressive settings remove more legitimate edge-case data too
Differential privacy (Gretel Tabular DP)Formal, mathematically provable privacy guarantees rather than empirical onesGretel recommends epsilon (ε) under 10 for strong guarantees; auto similarity and outlier filters turn off when DP is enabled

The practical implication for anyone generating test data with a general-purpose chat model rather than a purpose-built synthesizer: none of these four controls exist by default in a plain prompt-and-paste workflow, and a prompt can’t configure early stopping or an epsilon value. If the plan is to turn real production rows into test fixtures with an LLM, the safer sequence is Presidio-style de-identification on the input first, synthesis second, and a Gretel-style measurement pass on the output — not a single prompt that claims to do all three at once.

A ready-to-copy audit checklist

SYNTHETIC TEST DATA PRIVACY AUDIT

Source data:
  Contains real customer records? {yes/no}
  Direct identifiers present (name, email, SSN, card number, phone): {list}
  Quasi-identifiers present (zip, birth date, job title, rare combinations): {list}

Pre-generation scan:
  Tool used: {Presidio / other} 
  Entities detected: {count by type}
  Manual spot-check of a 50-row sample: {pass/fail}
  Note: automated detection is not guaranteed complete — treat a clean
  scan as a floor, not a certificate.

Generation method:
  Tool: {LLM prompt / Gretel / SDV / other}
  Privacy controls enabled: {early stopping, similarity filter, outlier
  filter, differential privacy — note epsilon if used}

Post-generation measurement (do not skip even if the scan above was clean):
  Membership inference check run? {yes/no, protection level}
  Attribute inference check run? {yes/no, protection level}
  PII replay count: {total instances, unique instances, which columns}
  Manual re-read of 20 synthetic rows against 20 real rows side by side:
  {pass/fail, what if anything matched}

Disposal of intermediate files:
  Original source file deleted from the generation environment? {yes/no}
  Holdout set used only for evaluation, not shared downstream? {yes/no}

The ordering matters: the pre-generation scan and the post-generation measurement are not redundant with each other. One checks whether real identifiers made it into the model’s input; the other checks whether the model’s output can still be traced back to that input statistically, which a clean input scan does not rule out.

A worked example

A support team wants to turn six months of real customer tickets into a fixture set for load-testing a new ticket-routing model, without handing contractors an export of actual customer emails and order numbers. The tickets go through Presidio first, configured for emails, names, phone numbers, and order-ID patterns specific to the company’s format (since Presidio’s built-in recognizers won’t know a custom order-ID scheme without a custom recognizer). The scrubbed tickets then go into Gretel’s Safe Synthetics SDK using the default Tabular Fine-Tuning model with similarity filtering set to high. The resulting Quality & Privacy Report shows a Membership Inference Protection score in the “good” band and a PII Replay count of zero for emails and order IDs, but a nonzero replay count for city names — expected, since city names are common values that legitimately recur across both real and synthetic data and aren’t on their own identifying.

Common pitfalls

The most common mistake is treating “the output doesn’t contain any names I recognize” as equivalent to “this passed a privacy check.” Recognizability and statistical leakage are different properties; a dataset can pass the first test and fail the second if a generation model overfit to a small or unusually structured source table, which is exactly the scenario Generating Test Fixtures That Cover the Edge Cases You’d Miss covers from the opposite angle — fixtures that are realistic enough to be useful are also the ones most worth auditing before they leave a secure environment.

The second is skipping differential privacy or similarity filtering on the assumption that a general-purpose LLM prompt is “basically” doing the same thing. A chat model asked to “generate similar but fake records” has no holdout set, no similarity threshold, and no epsilon — it has no privacy mechanism at all, just an instruction it may or may not follow consistently across a large batch. The grading-order discipline covered in A Pre-Ship Checklist for Testing an AI Agent’s Tool Calls applies here too: a programmatic check (did the membership inference score clear a threshold) beats a judgment call (does this look fake enough) for exactly the same reason it beats it when grading a tool call.

The third is running the audit once and treating the result as permanent. NIST’s own caution about repeated releases accumulating leakage applies directly to a test dataset that gets regenerated every sprint from an updated production snapshot — each regeneration is a new release, and the rubric discipline for grading any AI output consistently is the same reason a one-time audit doesn’t cover a dataset that keeps changing.

A related point worth closing on: Is data “synthetic” just because an AI generated it instead of a human? No. NIST’s definition ties synthetic data to privacy-preserving models that add noise during generation, not to the generating tool. A chat model asked to paraphrase or lightly alter real rows produces altered real data, not synthetic data, and carries a correspondingly higher disclosure risk.

This is worth being explicit about: Does running source data through Presidio before generation make the output safe on its own? Presidio’s own documentation says no — it states plainly that automated detection isn’t guaranteed to find everything, which is why a post-generation measurement pass (membership inference, attribute inference, PII replay) is a separate, necessary step rather than a formality.

One more practical point: What’s a reasonable epsilon value if using differential privacy? Gretel’s documentation recommends epsilon under 10 for strong guarantees with its Tabular DP model; the appropriate value ultimately depends on the sensitivity of the source data and should be set deliberately rather than left at a tool’s default without review.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top