How does DP-SGD (differentially private stochastic gradient descent) bound per-example influence and add noise during training? In a batch of size B=100 with clipping threshold C=1 and noise multiplier σ=1.2, two per-example gradients have ℓ2 norms 5 and 0.5: what are their clipping scale factors, what is the per-coordinate noise standard deviation on the averaged gradient, and why do per-example clipping, subsampling, and larger batches matter?

ML systems and evaluation, Privacy
Level L4 Advanced. Length Medium. Nature Th+Mat Both.

What's being asked

Whether you know the exact DP-SGD (differentially private stochastic gradient descent) update, why clipping must happen per example, and how privacy accounting and batch size govern utility.

Key idea

DP-SGD bounds every training example's influence by clipping each per-example gradient gi to ℓ2 norm at most C before summing, adding isotropic Gaussian noise N(0,σ2C2I) (where I is the identity matrix), and dividing by the batch size B. Because sensitivity is capped at C per example regardless of parameter count, modern privacy accountants can track cumulative (ε,δ) privacy loss across thousands of updates.

Steps

  1. Write one DP-SGD step on a mini-batch Bt of expected size B: compute per-example gradients gi=∇θℓ(θt,xi); clip each vector as gˉi=gi⋅min⁡ ⁣(1,C∥gi∥2); sum and noise as g~=∑i∈Btgˉi+N(0,σ2C2I); and divide by B to update θt+1=θt−ηg~/B with learning rate η.
  2. Apply the clipping numbers (C=1): for ∥g1∥2=5>C, the scale factor is min⁡(1,1/5)=0.2, shrinking its norm to 5×0.2=1. For ∥g2∥2=0.5≤C, the scale factor is min⁡(1,1/0.5)=1, leaving the gradient unchanged at norm 0.5.
  3. Compute the per-coordinate noise standard deviation on the averaged gradient g~/B: each coordinate of the summed noise has standard deviation σC, so dividing by B=100 at σ=1.2 and C=1 yields zero-mean Gaussian noise with standard deviation σCB=1.2×1100=0.012.
  4. Explain why clipping must be per example: clipping only the batch-averaged gradient lets a single extreme example (say norm 10,000) hijack the batch direction before clipping, so the sensitivity of the update with respect to one record would remain unbounded.
  5. Explain subsampling amplification and privacy accounting: when each record from a dataset of size N is included independently with probability q=B/N (Poisson subsampling), any single person affects a step only with probability q, amplifying privacy. Across many steps, naive sequential composition is far too loose, so DP-SGD uses tighter tools—such as the moments accountant or Rényi DP (Rényi differential privacy) accountants—to accumulate (ε,δ) over training, where δ is the small failure probability.
  6. Note the accuracy cost and why bigger batches help: clipping biases gradients when C is small, while Gaussian noise adds per-coordinate variance (σC/B)2. Larger batches B shrink the noise standard deviation on the averaged update as 1/B at fixed σ, which typically improves the privacy–accuracy trade-off despite slightly higher sampling rate q.

Common mistakes

How long your answer should be

3–4 minutes: update equations, worked clipping and noise numbers, per-example rationale, and accounting plus batch-size trade-off.

Read this

Previous in ML systems and evaluation: What is ε-differential privacy, and why does the Laplace mechanism satisfy it? For a counting query (sensitivity Δf=1) released with the Laplace mechanism at ε=0.5, what are the noise scale b, variance, standard deviation, and tail probability P(∣noise∣>5), and how do privacy and accuracy change across repeated queries?
Next in ML systems and evaluation: For a probabilistic binary classifier issuing discrete forecast values f1,…,fK with bin sizes n1,…,nK (summing to N), bin observed frequencies oˉk=1nk∑i∈Bkyi and overall base rate oˉ=1N∑i=1Nyi, how do you derive Murphy’s three-term decomposition of the Brier score into reliability, resolution and uncertainty, and what does each term measure?