TL;DR
Differential privacy is a promise about a randomised release of information. If someone's record is added to or removed from a dataset, the chance of any particular output changes by at most a fixed factor, controlled by a number called epsilon. The mechanism that makes this true adds random noise to the answer, scaled to how much one record can move that answer.
Builds on: Randomized Algorithms, Laplace Distribution, Global Sensitivity · Leads to: Gaussian Mechanism, Differentially Private SGD
Where it's used
Training neural networks on private data. Abadi and colleagues showed how to train a deep network with stochastic gradient descent while limiting what the trained weights reveal about any one training example. Their method, DP-SGD, clips each example's gradient and adds noise to the sum, as described in their paper.
A hospital counting patients. Imagine a hospital that wants to publish how many patients in a year had a certain condition, without making it possible to tell from the published number whether a specific person was among them. This is a scenario used to explain the idea, not a reported deployment.
How it works
We use a tiny dataset. Five people each have a yes or no answer to one question, and the query is the number of yeses. In this dataset the true answer is 3. We want to release a noisy version of the answer with a privacy level epsilon equal to 1.
flowchart LR D[Dataset D with 5 rows] --> Q[Query: count of yeses = 3] Q --> S[Sensitivity: largest change from one row] S --> B[Noise scale b = sensitivity / epsilon] B --> R[Release 3 plus Laplace noise]
- Start with the true answer. The dataset D has five rows and the count of yeses is 3. Check: the released number should be near 3, but not exactly 3.
- Find the sensitivity. Look at every neighbouring dataset, one with a row added or removed. Removing one row gives a count of 2 or 3. Adding one gives 3 or 4. The largest change is 1, so the sensitivity is 1. Check: no single row can move the count by 2.
- Pick the noise scale. Use scale . Check: a smaller epsilon would give a bigger scale, so more noise.
- Draw the noise. Draw one number from a Laplace distribution with centre 0 and scale 1. Suppose the draw is 0.6. Check: the noise can be positive or negative.
- Release the noisy answer. Publish 3 + 0.6 = 3.6. Check: an analyst sees 3.6 and cannot tell the true count is 3.
- Compare with the neighbour. Suppose the dataset D' has one extra yes, so its true count is 4. The chance of releasing 3.6 from D is set by a Laplace density centred at 3. From D' it is set by a density centred at 4. The density from D divided by the density from D' at 3.6 is , and the reverse ratio is . Check: both ratios lie between and , so the two datasets give nearly the same output chances.
- Read the guarantee. Because the ratio is bounded for every output and every neighbour, one person's row changes what an outside observer can infer by at most a factor .
The math
A randomised mechanism is -differentially private if, for every pair of neighbouring datasets and and every set of outputs ,
Here is the privacy parameter: a smaller value means a stronger guarantee. The neighbours are defined in Global Sensitivity.
A query is the function being released, and is the mechanism that releases with noise. The factor comes from the Exponential Function, so .
Step 1 in symbols: the true answer and its sensitivity
Write the true answer as . The sensitivity is the largest change in between neighbours. In the norm, written with a Supremum over neighbouring pairs,
In the walkthrough, is the count, so .
Step 2 in symbols: the Laplace noise
The Laplace mechanism releases
Here has density , as defined in the Laplace distribution lesson. The walkthrough uses .
Step 3 in symbols: why the guarantee holds
Take neighbours with and differing by at most . For a single output , the density of the release is under . Divide the density under by the density under :
The first inequality is the triangle inequality. Summing over outputs in a set gives the definition.
Check with the walkthrough: , , , . The ratio is in one direction, and in the other, which is below .
Step 4 in symbols: properties that matter in practice
Two properties are used all the time. Post-processing: any function applied to an -private output is still -private, because the function cannot see the data again. Composition: answering queries with budgets on the same data is at most -private under basic composition, so each release spends part of a fixed total.
Step 5 in symbols: the approximate version
The Gaussian mechanism, in Gaussian Mechanism, relaxes the guarantee to : the inequality above may fail with a small extra probability , added to the right-hand side. It uses Gaussian noise, whose tails are lighter than Laplace noise, and it is often used when many queries are answered.
Worked examples
A dataset has 5 rows, and the count of yeses is 3.
- Remove one yes row: the count becomes 2. The change is 1.
- Remove one no row: the count stays 3. The change is 0.
- Add one yes row: the count becomes 4. The change is 1.
- Add one no row: the count stays 3. The change is 0.
- The largest change over all neighbours is 1, so the sensitivity is .
Interpretation: a count changes by at most 1 when one person is added or removed, so the noise only needs to be scaled to 1.
The same count query, with sensitivity 1, is released with two privacy levels.
- With , the scale is .
- The chance that the noise is bigger than 1 in size is .
- With , the scale is .
- The same chance is .
- Check: the first chance is larger, as it should be, because the first release is noisier.
Interpretation: a smaller epsilon buys stronger privacy at the price of noisier answers. Choosing epsilon is a policy decision about how much accuracy is worth giving up.
A survey of 1,000 people is split into 10 age bins. Releasing all 10 counts is a Histogram query. Adding or removing one person changes exactly one bin by 1, so the sensitivity of the whole histogram is 1. Take .
- The scale is , and each bin gets its own independent Laplace noise with scale 2.
- Releasing all 10 bins together costs once, because the whole histogram has sensitivity 1.
- For a bin whose true count is 120, the released value is 120 plus noise, so it will usually lie within a few units of 120.
- The probability that one bin's noise is larger than 4 in size is .
- Check: , so about one bin in seven moves by more than 4.
Interpretation: the noise is small compared with a count of hundreds, so the histogram stays useful for broad patterns, while no single person's row can be read from it. Try it: with instead, what is the scale per bin, and what is the probability that one bin's noise exceeds 4 in size? Answer: the scale is 4, and the probability is .
Common mistakes and tradeoffs
It is tempting to think differential privacy hides everything about a dataset. In fact it protects one person's contribution: it bounds how much that person's presence can change the output's chances. Aggregate facts about the population can still be learned, and they are the point of the release.
It is tempting to think any random noise gives privacy. In fact the noise must be scaled to the sensitivity, and the sensitivity is a worst case over all neighbouring datasets. Noise that is too small for the worst case gives no guarantee, however random it looks.
It is tempting to think answering more questions is free. In fact each release uses part of the privacy budget, and under basic composition the costs add up. A budget used up on many questions leaves little for later ones.
Differential privacy suits statistics over many people, where each person's effect is small and the noise is small too. It is the wrong tool for an exact answer about one named person, because the noise is large relative to a single record's effect and the guarantee is about inference, not secrecy. Alternatives include access controls, k-anonymity style generalisation, and synthetic data, though each has weaker or different guarantees.
History
In 2006, Cynthia Dwork and colleagues introduced the guarantee in the form used here, and showed that noise scaled to the sensitivity can achieve it. The definition gave a precise guarantee that could be reasoned about across many releases.
In 2016, Abadi and colleagues showed how to train deep networks with differential privacy, using gradient clipping and noise. That work brought the guarantee to machine learning.
Recap
- A mechanism is -differentially private if one record changes each output's chance by at most a factor .
- The Laplace mechanism adds noise with scale equal to the sensitivity divided by .
- Sensitivity is the largest change in the answer from one added or removed row, taken over all neighbouring datasets.
- Post-processing keeps the guarantee, and composition makes privacy budgets add up.
- Read next: Gaussian Mechanism for the approximate version, and Differentially Private SGD for training with it.
Check yourself
QuestionRecall: what does the sensitivity of a query measure?Show answer
QuestionComputation: a count query has sensitivity 1. What is the Laplace scale for epsilon equal to 0.2, and what is the chance that the noise is larger than 5 in size?Show answer
QuestionWhy: why does a smaller epsilon give a stronger guarantee?Show answer
QuestionApplied: a team releases 20 separate counts from the same data, each with epsilon equal to 0.5. What total privacy cost should it expect, and what would it change?Show answer
Sources
- Abadi et al. (2016), "Deep Learning with Differential Privacy": https://arxiv.org/abs/1607.00133
- "Differential privacy" (Wikipedia): https://en.wikipedia.org/wiki/Differential_privacy