research35 min studyLesson 87 in Engineering

Differential privacy and accounting

Reason from neighboring datasets to sensitivity, randomized release, and cumulative privacy loss without confusing epsilon with an attack probability.

On this page

What you’ll understand

  • Interpret an epsilon-delta guarantee through neighboring datasets and measurable events.
  • Calculate sensitivity and Laplace scale for a bounded sum.
  • Explain clipping, noise, and composition without inventing DP-SGD accounting results.

Removing names does not prevent a model or statistic from revealing information about a contributor. Differential privacy instead constrains how much the distribution of released outputs can change when one protected contribution changes. The guarantee is about a randomized mechanism, a neighboring-dataset definition, and all relevant output events. It is neither a promise that no inference is possible nor a probability that an individual will suffer a privacy breach.

Define the protected contribution

Choose adjacency first: adding or removing one record, replacing one record, or adding or removing all records belonging to one person. These are different guarantees. A person with many records may receive weak protection if the accounting only treats each record as a separate participant. Specify the unit, contribution bounds, public information, and which outputs are released, including model checkpoints, evaluation reports, and intermediate statistics.

For neighboring datasets, differential privacy bounds event probabilities across the mechanism's randomness. Epsilon controls a multiplicative comparison and delta an additive relaxation. Delta is not generally the chance that a particular person is exposed, and epsilon is not a percentage of privacy lost. A useful policy interprets these parameters with the protected population, use case, and cumulative release process rather than relying on a universal safe threshold.

P(M(D)∈S)≤eεP(M(D′)∈S)+δP(\mathcal{M}(D)\in S)\le e^{\varepsilon}P(\mathcal{M}(D')\in S)+\delta
The inequality must hold for every neighboring pair D,D′ and measurable event S. The probability is over mechanism randomness; the definition depends on the declared adjacency relation.↔ Scroll wide equations horizontally.

Bound influence before adding noise

Sensitivity measures the largest change in a query across neighboring datasets. For an add-or-remove neighboring relation and a sum of contributions clipped into zero through one, absolute sensitivity is one. Adding Laplace noise with scale sensitivity divided by epsilon gives pure differential privacy for that scalar release. This statement assumes correct clipping, independent appropriate randomness, and the exact query; it does not automatically cover an unbounded mean with a private denominator.

DP-SGD follows the same influence-control principle with per-example or per-user gradient clipping and calibrated random noise. Sampling scheme, clipping unit, noise multiplier, number of steps, and accountant all matter. Clipping only the already-averaged gradient is a different operation and generally does not bound each person's influence as required. Use a validated implementation and accountant, then test that logging and checkpoint publication do not bypass the intended mechanism.

Δ1f=sup⁡D∼D′∣f(D)−f(D′)∣,M(D)=f(D)+Lap ⁣(Δ1fε)\Delta_1 f=\sup_{D\sim D'}|f(D)-f(D')|,\qquad \mathcal{M}(D)=f(D)+\mathrm{Lap}\!\left(\frac{\Delta_1 f}{\varepsilon}\right)
For a scalar query and ε>0, the Laplace mechanism provides (ε,0)-DP when Δ1f is a valid global sensitivity under the chosen adjacency. The noise scale has the same units as the query.↔ Scroll wide equations horizontally.

Account for every release

Basic sequential composition adds epsilon and delta across mechanisms applied to overlapping protected data, including adaptively chosen mechanisms satisfying their conditional guarantees. Stronger accounting can provide tighter bounds for specific mechanisms. Do not add per-step values from incompatible accountants or claim privacy amplification without the required sampling assumptions. Independent datasets may support a parallel-composition argument only when the protected individuals are disjoint in the relevant sense.

Hyperparameter searches and decisions based on private validation can consume privacy too. Releasing a postprocessed function of an already private output does not add privacy loss by itself, provided it uses no additional private data. Maintain a release ledger and establish a stopping policy before experiments. Utility testing remains necessary: a formally private mechanism can still produce inaccurate or unfair results, and formal privacy cannot remedy data collection that was inappropriate in the first place.

Release a bounded sum

Each participant contributes a value clipped into [0,1]. Under add-or-remove-one-participant adjacency, release the sum with epsilon 0.5 using Laplace noise. Then release a second separately randomized sum on the same people with epsilon 0.3.

  1. Adding or removing one clipped contribution changes the sum by at most one, so scalar L1 sensitivity is one.

  2. The first noise scale is 1/0.5 = 2 in sum units. Laplace variance is twice the scale squared, giving 2 × 4 = 8.

  3. The second release uses scale 1/0.3 ≈ 3.33. Basic sequential composition gives total epsilon 0.5 + 0.3 = 0.8 and delta zero.

  4. This is a valid basic upper bound, not a DP-SGD training accountant. Protecting a person contributing several unbounded records would require a different sensitivity argument.

The result

The privacy calculation starts with contribution bounds and adjacency, then follows the complete randomized release process.

Explore the model

Interactive lab

Interactive lab · probability

Contrast randomized outcomes with privacy guarantees

The lab computes an exact binomial distribution for n independent Bernoulli trials at probability p. It illustrates output randomness only. It does not generate Laplace noise, compare neighboring datasets, clip gradients, or calculate epsilon, delta, or a DP-SGD privacy budget.

Contrast randomized outcomes with privacy guaranteesThese are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Current readings: Mean · np: 5; Variance · np(1−p): 2.5; Total probability: 1. All parameters are adjustable with the labeled controls below.03581000.070.150.220.3Successes kP(X = k)k = 0 · P = 9.77e-4
Exact probabilityHighlighted outcomeMean np
Mean · np
5
Variance · np(1−p)
2.5
Total probability
1
t = 0 s

These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forRandomness alone is insufficient for differential privacy; the guarantee compares complete output distributions under neighboring inputs.

Check your understanding

A system adds arbitrary noise to a model's outputs. What is needed before claiming differential privacy?

Try it yourself

A scalar sum has sensitivity two under the declared adjacency. Find Laplace scale at epsilon 0.4. Three overlapping-data releases use epsilon 0.4 each and delta zero; give the basic composed guarantee. Does publishing a deterministic chart of those released values add loss?

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Divide sensitivity by epsilon, add sequential budgets, and distinguish postprocessing from another private-data access.

Compare with the solution

The scale is 2/0.4 = 5. Basic sequential composition gives (1.2,0)-DP for the three releases. A deterministic chart using only those released values is postprocessing and adds no privacy loss by itself. Consulting additional private data to select or annotate the chart can change that conclusion.

Take it with you

  • Define neighboring datasets and bound each protected contribution before calibrating noise.
  • Epsilon and delta describe a mechanism guarantee, not individual breach probabilities.
  • Track composition and private-data access across training, tuning, and publication.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.