research27 min studyLesson 923 in Engineering

Distinguish a noisy sum from its publicly normalized mean

Keep clipping, noise units and denominators aligned with the accountant’s mechanism.

On this page

What you’ll understand

  • Compute the standard deviation before and after a fixed public division.
  • State which adjacency makes sigma a sensitivity-relative noise multiplier.
  • Avoid treating a private or random denominator as harmless public scaling.

The phrase “add noise to gradients” leaves several mechanisms possible. Noise calibrated to a clipped sum and noise calibrated directly to a mean have different units unless the divisor is handled consistently. A reproducible mechanism names the protected contribution, sensitivity, Gaussian standard deviation and the public normalization applied afterward. Learning rate and optimizer updates are subsequent operations; they cannot repair a mismatch between those quantities.

Noise is calibrated to a bounded sum

Assume add/remove record adjacency, separable per-record gradients and a fixed public clipping threshold C. A sum of clipped gradients changes by at most C when one record is added or removed, at a fixed model state. Add a Gaussian vector with independent coordinates of standard deviation sigma times C. Sigma is dimensionless in this convention. For replacement adjacency, the same sum can have sensitivity 2C; using the same noise without changing the analysis does not retain the add/remove guarantee.

The Gaussian distribution is part of a complete mechanism, not merely a measured empirical standard deviation. Reusing or exposing its random seed can reveal noise and invalidate the intended protection. Numerical generation and implementation assumptions matter, which is one reason frameworks expose specific secure-randomness modes. A hand-picked noise vector in a worked arithmetic example is not a private randomizer. The accountant must correspond to the actual protected transcript, including any additional measurements or logs released alongside the final model.

S=∑i∈Bg‾i,Z∼N(0,σ2C2I),S~=S+Z,σ>0S=\sum_{i\in B}\overline g_i,\qquad Z\sim\mathcal N(0,\sigma^2 C^2I),\qquad\widetilde S=S+Z,\quad\sigma>0
C has gradient units, sigma is dimensionless, and each coordinate of Z has standard deviation sigma C. The stated sensitivity-relative interpretation assumes add/remove adjacency and separately bounded unaffected contributions; the sampled mechanism still needs an appropriate sampling analysis.↔ Scroll wide equations horizontally.

A public divisor scales signal and noise together

Dividing the entire noisy sum by a fixed public positive B₀ is postprocessing. Both its sensitivity and its Gaussian standard deviation divide by B₀, so their ratio remains unchanged. It is not equivalent to averaging the signal and then adding the original sum-scale noise unless that larger-noise mechanism is intentional. Conversely, adding noise that is too small because the signal was divided twice can invalidate the intended guarantee. Track units at every conversion rather than relying on the variable name gradient.

For Poisson sampling the realized batch size varies and can be zero. Opacus v1.5.4 DPOptimizer uses expected_batch_size for mean scaling rather than inferring the divisor from the realized batch. The public-status assumptions behind any population count or expected size still need to be stated by the application. A private count or a data-dependent divisor is not automatically free postprocessing of the noisy sum. It needs its own joint analysis or a different construction, especially if an empty batch changes observable behavior.

g~=S+ZB0,Δ2≤CB0,SD⁡(g~j)=σCB0,B0>0\widetilde g=\frac{S+Z}{B_0},\qquad \Delta_2\le\frac{C}{B_0},\qquad \operatorname{SD}(\widetilde g_j)=\frac{\sigma C}{B_0},\quad B_0>0
B₀ is fixed, public and identical across neighboring datasets. The SD refers only to the added Gaussian component conditional on the sampled signal, not to total gradient variability. The sensitivity bound is for the underlying clipped-sum query before sampling amplification.↔ Scroll wide equations horizontally.

Keep logical updates and normalization in the ledger

A memory-limited implementation can accumulate clipped contributions across physical microbatches before one noise addition and optimizer update. That differs from independently noising and updating after every microbatch. Record which event advances the accountant and how accumulation changes the logical sampling mechanism. Do not log raw per-example gradients, raw sums or private batch statistics merely because the final update is sanitized. Those outputs lie outside the postprocessing protection of the noisy aggregate and require separate treatment.

The function lab provides a deterministic scaling analogy. Reset and set both coefficient a=1 and position x=2; predict y=4 and slope 4. Separately Reset and set both a=0.5 and x=2; predict y=2 and slope 2. Scaling this public function halves both displayed quantities. It does not draw Gaussian noise, average private records or estimate epsilon. Use the analogy only to check consistent units when the noisy sum is divided, and use a real accountant for the actual mechanism.

Normalize the signal and noise exactly once

Two selected clipped contributions are (1,0) and (0,1), with C=1, sigma=2 and public divisor B₀=4. The divisor is fixed independently of the selected count. For arithmetic only, use the illustrative rounded noise vector Z=(2,-2).

  1. The clipped sum is S=(1,1). The Gaussian mechanism’s coordinate standard deviation is sigma C=2, regardless of the two selected records in this illustrative batch. The displayed noise vector is supplied for arithmetic, not generated by a private implementation.

  2. Adding that vector gives the noisy sum (3,-1). Dividing the entire result by the public four yields the noisy mean-like update (0.75,-0.25). The noiseless normalized signal would have been (0.25,0.25).

  3. The added-noise standard deviation after division is 2/4=0.5 per coordinate, and the add/remove query sensitivity bound is 1/4=0.25. Their ratio remains two. This calculation establishes units and ratio, not a complete sampled or composed epsilon bound.

The result

The update is (0.75,-0.25) for the supplied arithmetic vector. Public division scales both signal and noise; the actual sampling and full release history remain necessary for privacy accounting.

Explore the model

Interactive lab

Interactive lab · function

A public scaling changes both displayed quantities

Reset → set a=1 and x=2 → predict y=4, slope 4. Separate Reset → set a=0.5 and x=2 → predict y=2, slope 2 for y=ax².

A public scaling changes both displayed quantitiesThis lab uses only y = ax². Playback traces the curve within the fixed integration interval from 0 to x; it does not estimate numerical error or change the chosen point. Current readings: y at chosen x: 0.608; Tangent slope · 2ax: 1.35; Signed area · ax³/3: 0.182. All parameters are adjustable with the labeled controls below.−2.4−1.201.22.4−9−4.504.59xy(x, ax²)
y = ax²TangentSigned integral
y at chosen x
0.608
Tangent slope · 2ax
1.35
Signed area · ax³/3
0.182
t = 0 s

This lab uses only y = ax². Playback traces the curve within the fixed integration interval from 0 to x; it does not estimate numerical error or change the chosen point. 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 forThis public quadratic is a units analogy. It contains no dataset, Gaussian randomizer, noisy mean or privacy accountant.

Check your understanding

A noisy clipped sum is divided by a fixed public B₀. What happens to its added Gaussian standard deviation?

Try it yourself

Use C=2, sigma=1.5, public divisor B₀=6 and clipped sum S=(3,0). For arithmetic only let Z=(-3,3). Find the noisy sum, normalized update, coordinate noise SD and add/remove sensitivity bound after division.

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

Give me a hint

Noise SD is sigma C before division. Do not substitute the supplied vector’s norm for the distribution’s coordinate standard deviation.

Compare with the solution

The noisy sum is (0,3), and the normalized update is (0,0.5). Coordinate noise SD is 1.5×2=3 before division and 0.5 afterward. Query sensitivity is at most 2/6=1/3 under the stated add/remove assumptions. The noise-to-sensitivity ratio is 1.5; no sampled-composition budget follows from this arithmetic alone.

Take it with you

  • Noise multipliers require an explicit sensitivity and adjacency convention.
  • A fixed public divisor scales the whole noisy result.
  • Private counts, raw logs and logical update boundaries need their own accounting scope.

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.