Attacks

Federated learning leaks other clients' exact sentences

Reviewing Stealing Exact Training Data from Other Clients during Federated Learning · Omkar Shrikanth, Soham Dambalkar, Parag Jyoti Pal et al.

Federated learning leaks other clients' exact sentences

Researchers show that one ordinary participant in federated fine-tuning can recover other participants' training sentences word for word from the averaged update alone. The attack verifies each guess and subtracts it, so the averaging meant to hide individual contributions comes apart one sentence at a time.

One participant in a federated training run takes the averaged update the whole group produced and pulls out other participants' training sentences, word for word. These are not approximations or keywords. They are the exact text, and one of the datasets tested was a corpus of email bodies.

Federated learning is meant to prevent exactly that. Each client fine-tunes the shared model on its own data and sends back an update rather than the data. The server averages the updates and pushes out the new model. The privacy argument rests on that averaging: one sentence's signal is mixed with everyone else's, so no single contribution should stand out.

For text, that argument mostly held. Earlier attacks needed an individual client's gradient, or they failed once the aggregate held more tokens than the model's hidden dimension, the width of its internal representation. Past that point the contributions overlap too much to separate. Existing attacks recovered nothing exactly.

This attack works from the aggregate alone, and it works by subtraction. Gradients on the embedding layer reveal which tokens appeared somewhere in the round. A beam search assembles candidate sentences from those tokens, guided by how well each partial sentence matches signals in the gradient. Then comes the step I find cleverest. Each candidate's own gradient is computed and tested against the aggregate. If it does not fit at a consistent scale, it is discarded.

Verified sentences are then subtracted from the aggregate. What remains is cleaner, with fewer sentences competing, so ones that were buried become recoverable on the next pass. The loop repeats until nothing new verifies. Averaging entangles everyone; this unwinds it one sentence at a time.

The verification step is why precision reaches 100%: whatever it outputs is exact. On aggregates holding up to four times more tokens than the hidden dimension, it recovered up to 80.2% of client sentences exactly. The attacker needs nothing special. They follow the protocol and look at what every participant already receives.

There are preconditions. The full pipeline is built for transformers with a parallel residual layout, such as the Pythia and GPT-J models tested, and transfers less effectively to other designs. It needs some sentences to verify early, or the loop stalls. Recovery also falls as the aggregate grows very large, and precision can drop on long sequences or heavily repeated tokens.

The defences were mixed. Adding Gaussian noise to the shared gradient eliminated exact recovery at the levels tested. Gradient clipping, the cheap option, did not stop it. An Adam-style server optimiser also produced no exact recoveries in the configuration evaluated. That is a side effect of how it rescales the update, not a designed defence, and I would not rely on it against an attacker who adapts.

If you fine-tune on sensitive text alongside partners, calibrated noise is the protection with evidence behind it. Averaging is not hiding.

Further analysis

Problem

This paper studies whether a participating client in federated learning can recover exact training text belonging to other clients from the aggregated model update. This matters because federated learning is commonly pitched as a privacy-preserving way to fine-tune language models on sensitive corpora, yet gradients can leak information. Prior text-reconstruction attacks required access to individual client gradients or failed once the number of aggregated tokens approached the model hidden dimension, leaving a practical privacy gap for realistic federated deployments.

Approach

The authors present an iterative client-side gradient inversion pipeline that progressively denoises an aggregated gradient by identifying and subtracting the gradient contribution of already-recovered sentences. Key components are: extraction of a bag of tokens from embedding gradients (or a top-K solve for tied embeddings); computation of per-token "token directions" from first-MLP gradients in parallel-residual architectures; a gradient-guided beam search that scores prefix continuations using a whitened cosine signal between prefix hidden states and unembedding residual rows plus a small language-model fluency weight; candidate verification by comparing per-token summed gradients (anchors) to the residual under a consistent positive scaling factor fit by least squares; and peeling, which subtracts the scaled gradients of verified sentences from the original aggregate to produce a cleaner residual for the next iteration. The loop repeats until no new sentences are verified.

Key Findings

  • The method achieves exact sentence recovery with 100% precision for verified outputs in many settings and, according to the abstract, recovers up to 80.2% of client sentences exactly in regimes where existing attacks recover none.
  • The pipeline extends recoverability beyond the previous "hidden-dimension wall" (aggregated tokens exceeding the model hidden dimension); it outperforms prior baselines (including methods that rely on low-rank attention gradients) both below and above that threshold.
  • The attack was evaluated on Pythia-160M, Pythia-410M and GPT-J-6B and on datasets including Enron email bodies, SST-2 and PubMed; results show recovery degrades as aggregation grows very large, and precision can fall when sequence lengths are long or token multiplicity is high.
  • Defences were mixed: adding Gaussian noise to the shared gradient (differential-privacy style) eliminated exact recovery at tested noise levels, while simple gradient clipping did not prevent recovery. Using a server optimizer akin to Adam (FedAdam) in the evaluated configuration yielded no exact recoveries due to coordinatewise scaling effects.

Limitations

The full pipeline is tailored to parallel-residual transformer architectures and leverages first-MLP features; transfer to sequential-residual or tied-embedding models is possible but less effective. Recovery depends on being able to identify token directions, which requires the number of distinct tokens and their activation matrix to be well conditioned relative to the MLP width. Peeling requires some sentences to be verified initially; if none are found the process stalls. Recovery also declines when the aggregate contains very many tokens relative to model capacities.

Implications

From an offensive-security viewpoint, an honest-but-curious client that observes only the aggregated FedAvg update can reconstruct other clients' exact training sentences and thereby exfiltrate sensitive information even when many clients contribute. The attack scales beyond previously assumed safe regimes and is robust to common federated configurations and gradient clipping, meaning aggregation alone is not a sufficient privacy guarantee. Defenders should therefore treat participation in federated fine-tuning as a concrete risk and consider stronger protections such as calibrated noise, secure aggregation that prevents observing the aggregate in a usable form, or server-side optimisers and protocols that alter gradient geometry.

The paper title, authors and abstract

Stealing Exact Training Data from Other Clients during Federated Learning

Omkar Shrikanth, Soham Dambalkar, Parag Jyoti Pal, Advik Raj Basani, Arnab K. Paul

Malicious adversaries can employ gradient inversion attacks to reverse-engineer private data using the model updates of a round in Federated Learning. While there have been developments in gradient inversion for text, exact text recovery by a malicious client has so far remained infeasible, as FedAvg entangles the gradient contributions of many clients and obscures the signal of any individual sentence. We introduce a novel attack pipeline that unwinds this entanglement progressively through an iterative loop, in which the gradient contributions of sentences recovered exactly in one round are subtracted from the aggregate, exposing the remaining sentences for recovery in the next iteration. We show, for the first time, exact sentence recovery, with 100% precision, and on aggregates containing up to $4\times$ more tokens than the model's hidden dimension, we recover up to 80.2% of client sentences exactly, a regime where existing attacks recover none exactly.