Privacy attacks and differential privacy: test it, then bound it
Read the scorecard's privacy attacks (membership inference, attribute disclosure, nearest-neighbor distance ratio), then train with DP-SGD for a guarantee you can state — and say exactly what it covers.
What runs in CodeSplash
- Deep neural network (torch MLP) Verified in Python and R
- Synthetic data — tabular GAN (WGAN-GP) Experimental
You will be able to
- Read a membership attack AUC and an attribute-disclosure excess against unseen rows
- Explain what DP-SGD's clipping, noise and privacy budget ε do
- State what a differential-privacy guarantee covers and what it doesn't
Distances are not attacks
ReadThe scorecard's privacy checks so far ask how close synthetic rows come to training rows, compared with rows the generator never saw. An attacker asks sharper questions, and the scorecard now runs three of them, each against the same unseen-row yardstick.
Membership inference
Read- A membership inferenceMembership inferenceGuessing whether a row was in a model's training data, here from how low the model's loss on it is. attack holds a real person's row and guesses "this row trained the generator" when some synthetic row sits very close to it. The attack AUC is the chance a training row is closer to the synthetic data than an unseen row is: 0.5 means the synthetic rows give membership away no better than a coin.
Disclosure and near copies
Read- An attribute disclosureAttribute disclosureGuessing a person's hidden column from their other columns via the closest synthetic row; the risk is the excess over unseen rows. attack knows a person's other columns, finds the closest synthetic row on them, and reads off one column. What matters is the excess: how much better the guess works for people in the training data than for people who weren't.
- The nearest-neighbor distance ratioNearest-neighbor distance ratioA row's distance to its closest real row divided by the distance to the second closest; near 0 = sits on one record. divides a synthetic row's distance to its closest real row by the distance to the second closest. A ratio near 0 means the row sits on one real record rather than among several.
Predict the attack
PredictPredict first
A careless generator returns its training rows with a little rounding. The holdout is 20% of the table. What attack AUC do you expect?
Reveal
Close to 1. Every training row has a synthetic row right on top of it, while unseen rows don't, so closeness separates them almost perfectly. The same table would also show an NNDR share far above 5% and a large attribute-disclosure excess.
A low reading is not a guarantee: these are three particular attacks, and a stronger attacker might do better. To promise something about every attack you need differential privacy.
Differential privacy in one paragraph
ReadDifferential privacyDifferential privacyA promise that a result looks almost the same whether or not any one person's row was used; ε says how close. promises that the trained model would look almost the same whether or not any one person's row was in the training data. "Almost" is the privacy budget εPrivacy budget (ε)How much one person's row may change what a private computation shows; smaller is more private.: smaller is more private. A small chance δ that the bound fails comes with it, set below one over the number of rows.
How DP-SGD gets there
ReadDP-SGDDP-SGDTraining that clips each row's gradient and adds Gaussian noise to every step, so the model is differentially private. gets there by changing every training step: each row's gradient is clipped to a fixed size (the clipping norm C), so no single row can move the weights much; Gaussian noise with standard deviation σ·C is added to the sum (σ is the noise multiplierNoise multiplier (σ)In DP-SGD, the noise's standard deviation divided by the clipping norm; more noise, smaller ε.); and each batch is drawn by Poisson samplingPoisson samplingEach row joins each batch independently with chance batch size ÷ rows, so batch sizes vary.. A Rényi-DP accountantRényi-DP accountantAdds up the privacy cost of every DP-SGD step in Rényi divergence, then converts the total to (ε, δ). adds up the privacy cost of every step into one ε.
Pick the budget
ReflectOn the Learners step, open a neural network's Advanced options and set Privacy budget ε. CodeSplash finds the smallest noise that reaches that ε for the planned number of steps, trains, and shows the ε it reached on the run's Training tab, computed again by the app's own accountant. More epochs or larger batches use more budget, so the same ε needs more noise. Write down the ε you would accept for this table and the accuracy you would give up for it.
What the guarantee covers
ReflectThe guarantee covers the trained network, and anything computed only from it (predictions, generated rows), for the training rows of that fit. It does not cover what was read from the data without noise: the column scaling, the list of categories, or rows used for early stopping. A rare category that appears in the output reveals that someone had it. Report ε with δ and that sentence, never "the data is anonymous".
With Shuffled batches the reported ε is labeled approximate, because the accountant's analysis assumes Poisson sampling.
Check your understanding
CheckpointCheck yourself
You train the same network twice with DP-SGD, once for 10 epochs and once for 40, with the same noise multiplier. Which run has the smaller ε?
Show the answer
Answer: a
Every step spends privacy, and the accountant adds up all of them. Four times as many steps at the same noise give a larger ε. To keep ε fixed for longer training you need more noise.
Check yourself
A generator trained with ε = 1 outputs a category that only one person in the data has. Is that covered by the guarantee?
Show the answer
Answer: b
Generated rows are covered as far as they depend on the network's weights, but the category list was taken from the data as it is. Merge or drop rare categories before training when that matters.
Check yourself
Guessing plan from the other columns works for 62% of training rows and 60% of unseen rows. What does this tell you?
Show the answer
Answer: a
Most of the 62% comes from how predictable plan is from the other columns, which the attacker would get from any good model of the population. The risk owed to the synthetic data is the excess over unseen rows.
Do it on your own data
In the appScore a generator with a holdout and read Privacy attacks under Privacy. For a guarantee, pick Tabular GAN and set Privacy budget ε under Advanced: the critic, the only part that sees real rows, trains with DP-SGD, and the scorecard shows the ε it reached. A neural network on the Learners step takes the same options and shows its ε on the Training tab.