In federated learning, hospitals and phones train a shared model without sending out their raw data. They send only model updates (gradients). Recent attacks show those updates are anything but anonymous. For language models, an attacker can test each vocabulary word and ask whether it lies in the low-dimensional space spanned by the first layer's gradient, and in this way recover whole batches of text almost exactly. Differential privacy (DP), which clips each example's contribution and adds calibrated random noise, is the standard answer. DP also has a well-known weakness in sparse data, where most categories are empty or nearly empty: noise sized for the worst case drowns the rare signals. This proposal argues that these two facts are the same fact seen from two sides. For every token, one number sets both whether the DP-trained model can learn it and whether an attacker can detect it in a single client's update. That number is the token's signal-to-noise ratio in the shared gradient.
The consequence is sharp and testable. Under ordinary per-example DP, a rare clinical term that occurs once in a client's batch is hidden. The same rare term repeated across many notes about one patient builds up signal linearly in its repeat count, while the noise stays fixed, so it becomes detectable. Terms that are rare in the population but concentrated in one person are exactly the sensitive ones in clinical text. We propose to measure this with a noise-aware version of the span-check attack. We also derive the detection threshold it should follow. Finally, we test a cheap fix borrowed from private histograms: bound how much any one token type can contribute from one client, instead of bounding only each example.
Core Claim
Consider a token type $t$ that appears in $m_t$ distinct examples of one client's batch. Take the gradient of a first-layer projection matrix with $d_{out}$ output rows, under per-example clipping to norm $C$ and Gaussian noise of standard deviation $\sigma C$ per entry. The gradient energy along $t$'s embedding direction is at most $(m_t \rho_t C)^2$, where $\rho_t \in [0,1]$ is the fraction of each clipped example gradient that falls on this layer and this direction. Along any fixed direction, the noise energy has mean $\sigma^2 C^2 d_{out}$ and standard deviation $\sigma^2 C^2\sqrt{2 d_{out}}$. An attacker who scans a vocabulary of $V$ candidates pays roughly a $\sqrt{2\log V}$ factor for taking the maximum of that many noise draws. This gives a predicted detection condition:
$$ m_t\,\rho_t \;\gtrsim\; \sigma\,(4\, d_{out} \log V)^{1/4}. $$
The quartic root comes from comparing squared signal against the fluctuation of a chi-squared noise energy with $d_{out}$ degrees of freedom, plus the multiple-testing penalty. With $\sigma \approx 1$, $d_{out}=768$ and $V \approx 30{,}000$, the right side is about 13. Singletons are therefore safe, but a term repeated a few dozen times in one client's batch is not.
The formula makes three further predictions. An attacker who averages $R$ rounds from the same client divides $\sigma$ by $\sqrt{R}$. Sparse fine-tuning that shrinks $d_{out}$ lowers the threshold. The model learns token $t$ from its total multiplicity $M_t$ across all clients and rounds, whereas the per-round attacker sees only $m_t$.
This is consistent with DP rather than a refutation of it: repeated tokens span several examples, and DP's guarantee for a group of $m$ examples degrades roughly as $m\varepsilon$. What is new is the frequency-resolved measurement and the quantitative threshold. The fix follows from the gap between $M_t$ and $m_t$: cap each token type's per-client contribution so that detection depends on a constant rather than on $m_t$. Tokens that are common across clients can still be learned from $M_t$. Tokens that exist in only one patient's records cannot be learned without leaking them, and we will report that honestly as the long-tail limit already familiar from private histograms.
Relation to Prior Work
Three attack papers show that discrete text gradients are highly invertible and motivate the work. DAGER exploits the low rank of first-layer attention gradients to do exact span checks on candidate tokens, reaching ROUGE-1/2 above 0.99 at batch size 128. FET searches over token sequences guided by fully connected layer gradients. The radiology tokenizer study shows that domain tokenizers, which turn rare clinical concepts into single tokens, raise clinical entity recall. All three run without any defense. We keep DAGER's span check as the attack core, replace its exact rank test with a likelihood-ratio test that knows the noise level, and ask what survives DP.
On the defense side, Fed-CDP shows that client-side per-example DP renders image reconstructions pure noise. Its tests cover dense images and small tabular data, not long-tailed vocabularies with repetition inside a client. LMO-DP replaces Gaussian noise with a randomized-scale Laplace mechanism for language model fine-tuning. It reports accuracy only and runs no attack. Scalable DP with sparse network fine-tuning shrinks the trained parameter set to cut total noise. Our formula predicts that the same shrinkage lowers the attacker's threshold, which that paper leaves untested.
From the sparse-DP line we borrow the method rather than the setting. Private histogram work bounds each user's contribution per bin and uses public structure to avoid drowning sparse regions (Bagdasaryan et al.; Cunningham et al.). We apply per-bin bounding with token types as bins inside the gradient.
Data Reconstruction Attacks and Defenses argues that DP noise is "overkill" compared with pruning. That constrains us: we must show a leakage mode that matters in practice under formal DP, not simply rerun DP against a weak attack. SoK: Gradient Leakage warns that attacks tuned to toy settings fail in production. We therefore test multi-step local updates and realistic batch sizes.
Research Program
We will build three components.
The first is the noise-aware span attack. For each candidate token, it computes the gradient energy along the token's embedding direction. It compares that energy against the chi-squared null implied by the known $\sigma$ and $C$, which are public parameters of the mechanism. It then extends sequences greedily as DAGER does. A multi-round variant averages the same client's updates across rounds.
The second is a frequency-resolved audit. It reports token detection rate at a fixed false-positive rate, stratified by within-client multiplicity $m_t$ and by global frequency. It checks whether the measured curve collapses onto the predicted threshold when plotted against $m_t\rho_t / \sigma(4 d_{out}\log V)^{1/4}$, with $\rho_t$ estimated from the clean gradients.
The third is per-token-type contribution clipping. In the embedding layer and the first attention projections, the gradient factorizes as a sum of outer products of per-position error signals and input embeddings. The client groups these outer products by token type and clips each group's sum to $C_{tok}$ before adding noise. This bounds the influence of all occurrences of one token type. For the treated layers, it adds a token-type-level guarantee on top of the example-level DP used everywhere else. Here neighboring datasets differ in every occurrence of one token type within a client. Writing down the combined accounting precisely is part of the work. We will report it separately from the example-level $\varepsilon$ rather than folding it in.
Baselines
The naive reference point is undefended federated fine-tuning. There DAGER reports ROUGE-1/2 above 0.99 on SST-2, CoLA and ECHR at batch sizes up to 128 (DAGER). The radiology study reports 42.3% exact sentence recovery at batch 64 and 18.1% clinical entity recall for RadBERT (radiology study). We will reproduce both numbers first to validate our pipeline.
The strongest existing defense is client-side per-example DP-SGD in the Fed-CDP style (Fed-CDP). We will also run LMO-DP's noise (LMO-DP), which reports 92.20% SST-2 accuracy for RoBERTa-large at $\varepsilon=0.3$ against about 50.92% for Gaussian DP-SGD. We found no reported result on Lacuna for DAGER, FET or the imprint attack against any DP-trained model, nor for any attack on DP-trained models on MIMIC-CXR. Those numbers are what this work produces.
User-level clipping, which clips a client's whole update, is the principled competitor for repeated tokens. Freezing the embedding and first layers is the common practical one. Standalone gradient pruning at 90% and 99% represents the "overkill" position of Liu et al..
All methods share the same models (BERT-base, GPT-2, RadBERT), the same client partitions, the same local steps, the same number of rounds and the same hyperparameter search budget. DP methods are compared at matched example-level $\varepsilon \in \{1, 3, 8\}$.
Our method beats per-example DP if, at matched $\varepsilon$ and within one point of task accuracy, it drives detection of within-client-repeated rare tokens to the singleton level. It beats user-level clipping if, at matched repeated-token detection, it keeps rare-entity utility higher on tokens with large $M_t$. Two ablations isolate the key ingredients. The first applies identical noise with per-token-type clipping switched off, which isolates the clipping. The second runs the exact-rank DAGER test against our likelihood-ratio test, which isolates the attack's noise awareness.
Why not just…?
Why not just freeze the embeddings and first layers? The attacker knows the frozen weights. It can therefore push candidate prefixes through them and span-check the first trainable layer, as DAGER does when it extends to deeper layers. Freezing also removes the model's main capacity to learn rare vocabulary. This alternative is a genuine threat, so we include it as a baseline and report both leakage and rare-entity utility. If freezing matches our method on both, we will say so.
Why not just use user-level DP? It covers repetition by construction. However, it calibrates noise to an entire client's update, which is the uniform-noise-over-a-sparse-domain regime where rare-item utility collapses (Fienberg et al.). The matched-detection utility comparison settles whether a token-type-level bound buys anything. If it does not, the audit and threshold remain the contribution.
Why not just rely on large batches or secure aggregation? The radiology study finds that growing the batch from 64 to 256 only lowers RadBERT's exact recovery from 42.3% to 37.2%. Its active server inserts a linear probe that secure aggregation does not stop. Our multiplicity analysis predicts that larger batches help singletons but not a patient's repeated terms, and we test this directly.
Why not just use a generic tokenizer? Generic tokenizers split rare terms into subword pieces and lower entity recall, from 18.1% to 12.5% for GPT-2 (radiology study). Our analysis applies at the subword level all the same. We run GPT-2 alongside RadBERT to see whether splitting shifts the detection curve or only relabels it.
Why not just prune gradients? Pruning gives no formal guarantee, which regulated settings require. Its standalone effectiveness needs more than 99% sparsity at about a 10% accuracy cost (Huang et al.). We include it as a baseline and also as a stress test. Pruning keeps the largest coordinates, and our prediction is that those are where repeated rare tokens concentrate.
Proposed Experiments
MIMIC-CXR radiology reports, partitioned by patient, form the core testbed, because rare findings recur naturally within a patient's notes. ECHR legal documents provide a second setting with names repeated inside documents. SST-2, CoLA and Rotten Tomatoes serve as low-repetition controls, following the DAGER and FET evaluations.
The decisive checks come in three parts. The first is whether detection under per-example DP stays near the false-positive floor for singletons but rises with $m_t$, following the predicted fourth-root dependence on layer width. We will vary width through sparse fine-tuning masks and averaging over rounds $R$ through the multi-round attacker. If detection stays flat in $m_t$, the core claim is wrong. The second is whether per-token-type clipping flattens that curve at matched $\varepsilon$ and accuracy. The third is whether rare-entity recall is preserved for tokens with large global multiplicity $M_t$ and lost only for tokens confined to a single patient. That split is the predicted and unavoidable limit.
References
- DAGER: Exact Gradient Inversion for Large Language Models
- Gradient Inversion Attack in Federated Learning: Exposing Text Data through Discrete Optimization
- Privacy Leakage in Federated Learning in Radiology Reports: A Comparative Evaluation of Tokenizer-Driven Privacy Risks
- Gradient-Leakage Resilient Federated Learning
- LMO-DP: Optimizing the Randomization Mechanism for Differentially Private Fine-Tuning (Large) Language Models
- Scalable Differential Privacy With Sparse Network Finetuning
- Towards Sparse Federated Analytics: Location Heatmaps under Distributed Differential Privacy with Secure Aggregation
- Privacy-Preserving Synthetic Location Data in the Real World
- Data Reconstruction Attacks and Defenses: A Systematic Evaluation
- SoK: Gradient Leakage in Federated Learning
- Differential Privacy for Protecting Multi-dimensional Contingency Table Data: Extensions and Applications
- Evaluating Gradient Inversion Attacks and Defenses in Federated Learning