Differential Privacy
A mathematical definition of privacy, and its cost.
Differential privacy is a security definition with a calculus: guarantees that compose, survive any post-processing and can be tracked across thousands of training steps. This lesson makes the definition precise through the privacy-loss random variable and hypothesis testing, builds the exponential and Gaussian mechanisms, derives advanced and Rényi composition, and ends with the accounting behind DP-SGD and the 2020 US Census.
What you’ll learn
- Characterize -DP by the privacy-loss random variable, the hockey-stick divergence and hypothesis-testing trade-offs.
- Prove the privacy and utility guarantees of the exponential mechanism, and calibrate the Gaussian mechanism exactly.
- Derive advanced composition and Rényi accounting, including the growth of for repeated Gaussian mechanisms.
- Analyze DP-SGD (clipping, amplification by subsampling, accounting, utility bounds) and assess the 2020 Census deployment.
What the definition says
Let the test answer "" on the set , so and . The DP inequality from to on gives the first condition:
The inequality from to on the complement gives the second:
Conversely, the two conditions for every (and both orders of every pair) are the DP inequalities themselves. So no attacker, whatever it knows, can beat the two lines in the plane; Attacks on Models turns this into a bound on membership inference.
Recording the whole trade-off curve, rather than two lines, gives -DP (Dong, Roth & Su, 2022). Its central case, -Gaussian DP, says that telling from is at least as hard as telling from . The Gaussian mechanism with sensitivity and noise is exactly -GDP, and GDP composes by .
Three modeling choices sit inside every guarantee. Neighbors: under add/remove a histogram has sensitivity 1; under replace-one it has 2. The unit of privacy: a guarantee per record says little about a user with a thousand records, so training on user data needs user-level clipping or group privacy. : a mechanism that publishes each record with probability is -DP, so must be far below .
A mechanism over a database of 100,000 people is certified -DP. What is the main weakness of this guarantee?
- is too large to mean anything
- Nothing: is a small probability
- is 100 times larger than , so the definition permits releasing about 100 people's records in the clear
- -DP does not compose
Show the answer
C. is 100 times larger than , so the definition permits releasing about 100 people's records in the clear
Publishing each record independently with probability satisfies -DP, and hence -DP, while exposing about 100 people completely. Meaningful guarantees use , such as or here.
Mechanisms beyond Laplace
Privacy. Between neighbors, the weight of each outcome changes by at most , and so does their sum :
Utility. The bad set has at most members, each of weight at most , while the optimal outcome alone makes :
Setting makes the right side . The error grows only logarithmically with the number of outcomes. Selecting the most common of 1,000 diagnoses ( = count, ) at returns, with probability 95% (), one whose count is within of the top.
The Gaussian mechanism uses the sensitivity . The classical calibration holds only for and is loose; Balle & Wang (2018) gave the exact condition:
Why Gaussian noise for learning? A clipped gradient with in dimensions can have as large as , so Laplace noise would need about times more noise per coordinate than Gaussian noise, which pays only . And Gaussian releases compose cleanly: of them with sensitivity are a single Gaussian release of the stacked vector, whose sensitivity is .
Composition: advanced and Rényi
The privacy loss of an adaptive composition is the sum of the per-step losses, each bounded by given the past:
Each step's expected loss is a KL divergence, which is small for an -DP pair:
The centered losses form a martingale with increments in intervals of length , so the Azuma–Hoeffding inequality bounds the upper tail:
Choose . The loss exceeds with probability at most , which gives -DP (add for steps).
For queries at with , basic composition gives 100 and advanced composition 5.8. For at it gives 5.9, worse than basic composition's 5: the law pays off only for many small steps. The optimal composition bound can be computed exactly, but doing so is #P-hard in general (Murtagh & Vadhan, 2016). Rényi accounting is the practical middle ground.
Compose Gaussian releases, order by order:
Convert to and optimize over the order, writing , and :
At the optimum, the dominant term grows like and falls like :
A system makes Gaussian releases, each with noise . What does the Rényi bound give at ?
Show the answer
5.3
and , so . Each release alone costs about 0.48 (the classical calibration agrees), so basic composition would charge 48, and advanced composition 53, worse still because each step's is not small.
DP-SGD and the 2020 Census
DP-SGD (Privacy & Security) clips each example's gradient to norm , adds to the sum, and samples each batch by including every example independently with probability . Sampling helps because an example that is not in the batch cannot leak in that step:
The Rényi divergence of the sampled Gaussian mechanism has no closed form, but for integer orders it is a finite binomial sum (Mironov, Talwar & Zhang, 2019). To leading order in small , with unit sensitivity and noise multiplier , it is : sampling at rate acts like shrinking the sensitivity by a factor . Over steps the law then gives , the scaling of Abadi et al.'s moments accountant.
A worked case: batches with (600 of 60,000 examples), , steps (100 epochs) and . Summing the exact Rényi divergences over integer orders gives (best order ), and the leading-order formula gives 6.1. With the same run costs , at the price of much noisier gradients.
Utility. For convex, Lipschitz losses on a bounded domain, the best achievable excess empirical risk under -DP is , and noisy SGD attains it (Bassily, Smith & Thakurta, 2014): privacy costs more in high dimension and less with more data. In practice, clipping biases the gradients (so is set near typical gradient norms), per-example gradients cost memory and time, tuning hyperparameters on private data leaks privacy unless it is accounted for (Papernot & Steinke, 2022), and privately fine-tuning publicly pretrained models narrows the accuracy gap substantially (De et al., 2022, for images; Li et al., 2022, for language).
The 2020 US Census. The TopDown algorithm (Abowd et al., 2022) adds discrete Gaussian noise (Canonne, Kamath & Steinke, 2020) to many tables at each level of the geographic hierarchy, from nation down to census block, then solves constrained optimization problems that return consistent, nonnegative integer tables. That second phase is post-processing and costs no privacy. The budget was set in zero-concentrated DP (Bun & Steinke, 2016): for the person-level redistricting data, roughly at . State population totals were held invariant, published exactly and outside the formal guarantee. Demographers and some states objected to the noise in small areas and small groups; the Bureau pointed to its 2010 reconstruction experiment.
Key takeaways
- -DP means the hockey-stick divergence between neighbors' outputs is at most ; equivalently, every test satisfies and ; must be far below .
- The exponential mechanism selects privately with error ; the Gaussian mechanism is calibrated exactly by the Balle–Wang condition and suits -bounded vectors.
- Basic composition adds 's; advanced composition grows like for small steps; Rényi DP adds order by order, and Gaussian releases cost .
- DP-SGD combines clipping, Gaussian noise and Poisson sampling (amplification ; to leading order, sensitivity scaled by ) with numerical Rényi accounting; convex utility is .
- The 2020 Census used TopDown with zero-concentrated DP ( for persons, roughly at ) plus exact invariants: DP at national scale, with real trade-offs.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
Why does the exponential mechanism weight outcomes by rather than ?
- To make the probabilities sum to one
- Because the utility of the best outcome counts twice
- To improve accuracy
- Because both an outcome's weight and the normalizing sum can change by between neighbors, and the two factors multiply
Show the answer
D. Because both an outcome's weight and the normalizing sum can change by between neighbors, and the two factors multiply
The probability is a ratio of the outcome's weight to the total weight, and a neighboring dataset can move the numerator up while moving the denominator down, each by at most ; together they stay within .
A system makes many Gaussian releases with . Holding and fixed, roughly how does change if you double ?
- It falls by a factor of about 4
- It falls by a factor of about 2
- It falls by a factor of about
- It does not change
Show the answer
B. It falls by a factor of about 2
For the dominant term is , linear in . The quadratic term does fall by 4, but it is the smaller one.
A mechanism is -DP. You run it on a Poisson subsample that includes each record with probability . What privacy guarantee results?
- : subsampling changes nothing
Show the answer
C.
Amplification by subsampling gives , close to because is moderate. A record that is probably not sampled can rarely affect the output.
The Census TopDown algorithm turns noisy counts into consistent, nonnegative integer tables. How much of the privacy budget does that step consume?
- None: it is post-processing of noisy measurements and never touches the confidential data
- Half the budget, because it runs on every level of geography
- An amount equal to the number of constraints
- It makes the release non-private, because rounding removes noise
Show the answer
A. None: it is post-processing of noisy measurements and never touches the confidential data
The optimization uses only the noisy measurements, so post-processing preserves the guarantee. The exceptions are the invariants, such as state population totals, which were published exactly and lie outside the formal guarantee.
Further reading
- C. Dwork & A. Roth, The Algorithmic Foundations of Differential Privacy (Foundations and Trends in Theoretical Computer Science, 2014).
- F. McSherry & K. Talwar, "Mechanism design via differential privacy," FOCS (2007).
- C. Dwork, G. N. Rothblum & S. Vadhan, "Boosting and differential privacy," FOCS (2010).
- I. Mironov, "Rényi differential privacy," IEEE Computer Security Foundations Symposium (2017).
- J. M. Abowd et al., "The 2020 Census Disclosure Avoidance System TopDown Algorithm," Harvard Data Science Review (2022).