Topic 3 of 5 · 5 min read
Differential privacy and synthetic data
Goal: Choose between differential privacy, synthetic data and plain redaction for a given training task and justify the trade-off.
Redaction removes known identifiers, differential privacy limits what any one record can change in the model, and synthetic data replaces real records with generated ones; each protects against a different problem and each has a cost.
Check yourself · 1 of 3
What does differential privacy bound?
Why it matters
Scrubbing cannot catch what you cannot detect. Rare diagnoses, quirky phrasing and unusual combinations identify people without any name. When the data is very sensitive, you need a guarantee that does not depend on spotting every identifier.
The three options
- Redaction. Cheap and readable. It protects only against identifiers you found. It gives no formal guarantee.
- Differential privacy (DP). In DP-SGD, training clips the influence of each example and adds noise to the gradients. The result carries a number, epsilon, that bounds how much any single record could change the outcome. Smaller epsilon means stronger privacy. The cost is lower accuracy, slower training and more tuning, and the cost is larger for small datasets and for rare facts. Libraries such as Opacus handle the mechanics for PyTorch. NIST warns that an epsilon is only meaningful when you know the unit of privacy (one record? one user?) and the assumptions behind it.
- Synthetic data. A model generates fake records that mimic the real ones, and you train on those. It is not private by default. A generator trained on real data can memorize and copy real records into the synthetic set. Synthetic data is private only if the generator was trained with DP, or if you test the output for copies.
How to choose
- List what an attacker could learn and who would be harmed.
- If the harm is high and records are individually sensitive, such as health or finance, use DP, usually together with scrubbing.
- If you need to share a dataset outside the team, prefer DP-trained synthetic data over raw rows.
- If the data is low risk and already scrubbed, redaction plus leak testing is usually enough.
Before and after
Weak: "We generated synthetic patient notes with a base model, so there is no privacy issue." The generator saw real notes and was never tested for copies.
Better: "We trained the generator with DP at a stated epsilon, scrubbed the output and searched it for exact matches to real notes."
What goes wrong
- Calling synthetic data anonymous without testing.
- Quoting epsilon with no context. A large epsilon gives little protection.
- Expecting DP to be free. Plan for an accuracy drop and measure it.
Examples
Choosing for three projects
| Project | Data | Choice |
|---|---|---|
| Tone tuning of a help bot | Public docs, scrubbed chats | Redaction plus leak test |
| Model on clinic notes | Health records | DP training plus scrubbing |
| Sharing a test set with a vendor | Customer orders | DP-trained synthetic data, checked for copies |
Synthetic data that copied
A team generates 10,000 fake loan records. A search finds 31 that match a real applicant's name, amount and date exactly. The generator had memorized them. Fix: retrain with DP or filter near-matches, then re-test.
Key points
- Redaction protects only against identifiers you detect; DP bounds the influence of any single record.
- DP-SGD clips per-example gradients and adds noise, which costs accuracy and speed.
- Epsilon is only meaningful with a stated unit of privacy and assumptions; smaller means stronger.
- Synthetic data can copy real records unless the generator is trained with DP or the output is tested.
- Match the method to the harm: DP for highly sensitive records, redaction plus testing for low-risk scrubbed data.
Common mistakes
- Treating synthetic data as automatically anonymous.
- Reporting an epsilon without saying what a unit of privacy is.
- Choosing DP for low-risk data and losing accuracy for no reason.
- Using DP as a substitute for scrubbing and consent.
Check yourself · 2 of 3
Why can synthetic data still leak personal data?
Check yourself · 3 of 3
Which cost is typical of DP-SGD training?
Practice items, not counted towards your mastery.
Start here
- Extracting Training Data from Large Language Models (Carlini et al.) (opens in a new tab)PaperFree
Shows that a language model can emit verbatim training sequences, including personal details, to a plain attacker.
- The Secret Sharer: measuring unintended memorization (Carlini et al.) (opens in a new tab)PaperFree
Introduces canary insertion and the exposure metric used to test whether a model memorized a planted secret.
- Quantifying Memorization Across Neural Language Models (opens in a new tab)PaperFree
Measures how memorization grows with model size, repeated data and prompt length.
More for this topic
- Deep Learning with Differential Privacy (Abadi et al.) (opens in a new tab)PaperFree
The paper that defined DP-SGD: clip each example's gradient, add noise, track the privacy budget.
- Opacus: differential privacy for PyTorch (opens in a new tab)ToolFree
A library for training PyTorch models with DP-SGD, with tutorials and a privacy accountant.
- NIST SP 800-226: Guidelines for Evaluating Differential Privacy Guarantees (opens in a new tab)StandardFree
How to read an epsilon value and the pitfalls of claiming a privacy guarantee.
Where to go in your country
- EDPB Opinion 28/2024 on data protection aspects of AI models (opens in a new tab)DocsFreeEU
The EU regulators' view on when a trained model counts as anonymous and what that means for erasure.