The Critical Batch Size as a Privacy Scale

When many machines train one model together, each sends back a gradient. A gradient is the direction in which the model's weights should move, averaged over a batch of that machine's examples. Two research communities study this averaged gradient for opposite reasons. Optimization researchers ask how large the batch can grow before averaging more examples stops speeding up training. That threshold is called the critical batch size. Privacy researchers ask how much of each individual example can be recovered from the average, which is called gradient inversion.

This note proposes that both communities are measuring one quantity. The critical batch size is roughly the batch size at which the part of the averaged gradient specific to the examples in the batch becomes as large as the part shared with the whole data distribution. Below that point, the averaged gradient is dominated by what is particular to the batch. Above it, the gradient is dominated by the shared signal. If this is right, privacy leakage should be indexed by the ratio of the batch size to the critical batch size at that moment in training, not by the raw batch size.

The idea makes sharp, checkable predictions. Leakage curves from different models and training stages should fall onto one curve when plotted against this ratio. Training schedules that grow the batch as the critical batch size grows should keep leakage roughly flat over training. An attacker who subtracts an estimate of the shared gradient should gain most exactly where the batch exceeds the critical batch size.

Core Claim

Write the batch gradient as $G_B = G + \xi_B$. Here $G$ is the gradient over the whole data distribution and $\xi_B$ is the batch-specific deviation. For independently drawn examples, $\mathbb{E}\|\xi_B\|^2 = \mathrm{tr}(\Sigma)/B$, where $\Sigma$ is the covariance of single-example gradients. The relative size of the batch-specific part is therefore

$$\rho(B) = \frac{\mathbb{E}\|\xi_B\|^2}{\|G\|^2} = \frac{B_{\text{noise}}}{B}, \qquad B_{\text{noise}} = \frac{\mathrm{tr}(\Sigma)}{\|G\|^2}.$$

Here $B_{\text{noise}}$ is the classical gradient noise scale, the standard proxy for the critical batch size. The same ratio governs both effects:

  • Optimization. Saturation sets in once $\rho$ falls well below one, because extra examples no longer reduce noise that matters.
  • Privacy. Everything an attacker learns about specific examples, beyond what any public data would reveal, lives in $\xi_B$.

Our claim is empirical and falsifiable. Inversion quality, measured by PSNR, LPIPS, or ROUGE-L, is predicted much better by $B/B^*(t)$ than by $B$. Here $B^*(t)$ is the critical batch size at training step $t$. The claim is not that leakage vanishes above $B^*$. High-dimensional gradients are heavily overdetermined, and Inverting Gradients recovers recognizable images at $B=100$. The claim is that $B/B^*$ is the right axis on which to place leakage.

The framing also explains a known puzzle. Inverting Gradients reports that trained networks leak more than untrained ones. Critical Batch Size Revisited shows that the critical batch size starts near zero and grows over training. Growth in $B^*$ means $\|G\|$ shrinks relative to per-example variation, so at a fixed $B$ the batch-specific share rises. Under our hypothesis, the rising leakage over training and the rising $B^*$ are the same phenomenon.

Relation to Prior Work

Three papers motivate the gap.

The critical-batch literature supplies the method.

One constraint comes from the same source. Critical Batch Size Revisited argues that the noise-scale proxy is unreliable for Adam. We therefore use $B_{\text{noise}}$ only for SGD vision workloads. Under Adam we use the branched empirical $B^*$, and we report any gap between the two as a result.

Understanding Deep Gradient Leakage via Inversion Influence Functions (I²F) is the closest competing tool. It predicts single-example reconstruction error in closed form from the network Jacobian. It does not model how averaging over a batch mixes examples together. We treat it as a rival predictor, not as a component.

Research Program

Measuring the axis. We first build a cheap estimator of $B_{\text{noise}}(t)$ at every saved checkpoint. It uses the standard two-batch-size estimate of $\mathrm{tr}(\Sigma)$ and $\|G\|^2$. At a subset of checkpoints we validate it against the branched $B^*$ of Critical Batch Size Revisited, defined as the batch size at which steps-to-target exceed perfect linear scaling by 20%. This is the operational definition used in How Does Critical Batch Size Scale in Pre-training?.

Sweeping attacks. At each checkpoint we run passive, honest-but-curious inversion attacks across a grid of batch sizes from $B^*/8$ to $8B^*$. Early checkpoints have small $B^*$. This lets us probe the regime above $B^*$ while keeping batches small enough for attacks to be informative.

Population-subtraction attack. We derive one consequence and test it directly. In federated learning, the server sees updates from many clients. Their mean is an estimate $\hat G$ of the population gradient. Before running the inversion, the attacker can match against $G_B - \hat G$ instead of $G_B$, which removes the shared component that dominates cosine matching above $B^*$.

Subtraction cannot add information. It can only reshape the attacker's optimization landscape. Its gain therefore separates two explanations for attack failure that the research file notes are currently hard to tell apart: missing information versus the attacker getting stuck. If subtraction gains grow sharply with $B/B^*$, then failures above $B^*$ were partly optimization failures. If gains stay flat, those failures reflect information loss.

Baselines

Raw batch size (naive reference). We regress reconstruction quality on $\log B$ alone, pooled over all checkpoints and architectures. This is exactly how prior attack papers report results.

  • Fair comparison: it is fit on the same attack runs as our predictor, with the same functional form, a monotone spline.
  • What beats it: our axis wins if $\log(B/B^*)$ explains substantially more variance across held-out checkpoints, which we expect because raw $B$ ignores training stage.

Gradient norm. We also include the gradient norm as a simple predictor, since attackers sometimes use it as a convergence signal. Inverting Gradients argues that gradient magnitude mostly reflects how far training has converged. The norm captures the denominator of $\rho$ but not the variance in the numerator.

Strongest attacks. These fix the leakage we measure.

  • CIFAR-10 and CIFAR-100: the cosine-matching attack of Inverting Gradients. On trained ResNet-20 for CIFAR-100 it reports roughly 14 dB PSNR, versus roughly 7 dB for Euclidean matching.
  • ImageNet: GradInversion from See Through Gradients. On ResNet-50 at batch sizes 8 to 48 it reports LPIPS 0.484, and about 28% image identifiability precision at $B=48$.
  • Text: FILM (code), which reports ROUGE-L approaching 1.0 at $B=1$ on WikiText-103.

Each attack is run with its published hyperparameters and an identical iteration budget at every grid point. We first reproduce the reported numbers at their native batch sizes.

Strongest rival predictor. This is the I²F lower bound of Understanding Deep Gradient Leakage via Inversion Influence Functions, computed with the authors' public code. We extend it to batches by averaging per-example scores. It receives the same checkpoints and the same compute budget as our estimator.

No reported result was found on Lacuna for any predictor of leakage across training checkpoints and batch sizes. The comparison will therefore be established here. Beating I²F means higher held-out rank correlation with measured PSNR or LPIPS across both batch size and training stage.

Subtraction ablation. This isolates the key ingredient by comparing four variants of the inversion target:

  • no subtraction;
  • subtraction of the true full-data gradient;
  • subtraction of an estimate $\hat G$ from 16 to 64 simulated clients;
  • a control that subtracts a random vector of matched norm.

Why not just…?

Why not just plot leakage against batch size, as the obvious study would? That is our naive baseline, and it is a real threat. If raw $B$ predicts leakage as well as $B/B^*$ across checkpoints, our claim is false. The collapse test below settles it. The prior evidence that training stage matters (Inverting Gradients shows trained models leak more) is why we expect raw $B$ to fail. It is not yet proof.

Why not just use I²F, which already predicts leakage in closed form? I²F is the strongest competitor. It may well win on per-example vulnerability, for example why some MNIST digits are easier to recover. It does not model how batching dilutes each example's signal, which is the variable at issue. We also test whether combining the two improves on either alone. If I²F alone matches our predictor across batch sizes, we will report that the noise scale adds nothing.

Why not just use DP-SGD and stop caring about batch size? Differential privacy bounds worst-case leakage, but at a utility cost. Data Reconstruction Attacks and Defenses finds Gaussian gradient noise worse than pruning on the privacy-utility trade-off. FILM reports severe perplexity damage from DP-SGD. Our work is about describing leakage, not defending against it. Practitioners who do not run DP still need to know what their batch-size and schedule choices expose, and this note answers that question.

Why not just use very large batches as a shield? Recovery at $B=100$ to 256 in Inverting Gradients, FILM, and Fishing for User Data already refutes the shield. Batches beyond $B^*$ also buy no training speedup, so they cost memory without benefit. Our framing makes this precise: the batch only helps privacy in proportion to $B/B^*$, a quantity that the model's own growing $B^*$ erodes over training.

Proposed Experiments

Vision. We train ResNet-18 on CIFAR-10 and ResNet-20 on CIFAR-100 with SGD and save 10 checkpoints from initialization to convergence. For each checkpoint we:

  • measure $B_{\text{noise}}$, plus the branched $B^*$ at three of the checkpoints;
  • run the cosine attack over the batch-size grid;
  • record PSNR, SSIM, and LPIPS.

We repeat a reduced version on ImageNet with ResNet-50 and GradInversion, recording LPIPS and image identifiability precision.

Text. We fine-tune GPT-2 on WikiText-103 and Enron Email, tracking the empirical $B^*$. We compare fixed batch sizes against the batch-warmup schedule of Critical Batch Size Revisited and measure FILM's ROUGE-L and named-entity recovery over training. One honest caveat: FILM's bag-of-words step reads which embedding rows have non-zero gradients, which does not depend on $\rho$. We expect the hypothesis to govern only the stage that reorders tokens into sentences. We will report the two stages separately.

Decisive checks. There are four.

  1. Collapse. Measured on held-out checkpoints and architectures, curves of leakage against $\log(B/B^*)$ must explain clearly more variance than curves against $\log B$.
  2. Schedule. Under batch warmup, leakage per round should stay roughly flat over training. Under a fixed batch size it should rise as $B^*$ grows.
  3. Subtraction. The gain from population subtraction should be near zero below $B^*$ and should grow above it. True and estimated $\hat G$ should behave similarly, and the random-vector control should show no gain.
  4. Optimizer. Repeating the CIFAR collapse test with Adam, using the branched $B^*$, checks whether the axis survives the optimizer shift that Which Algorithmic Choices Matter at Which Batch Sizes? shows moves $B^*$ outward.

If the collapse fails, the critical batch size is not a privacy scale, and that negative result would itself correct a common assumption about large-batch privacy.