Abstract: This paper presents the first consumer-scale next-word prediction (NWP) model trained with Federated Learning (FL) while leveraging the Differentially Private Federated Averaging (DP-FedAvg) technique. There has been prior work on building practical FL infrastructure, including work demonstrating the feasibility of training language models on mobile devices using such infrastructure. It has also been shown (in simulations on a public corpus) that it is possible to train NWP models with user-level differential privacy using the DP-FedAvg algorithm. Nevertheless, training production-quality NWP models with DP-FedAvg in a real-world production environment on a heterogeneous fleet of mobile phones requires addressing numerous challenges. For instance, the coordinating central server has to keep track of the devices available at the start of each round and sample devices uniformly at random from them, while ensuring secrecy of the sample, etc. Unlike all prior privacy-focused FL work of which we are aware, for the first time we demonstrate the deployment of a differentially private mechanism for the training of a production neural network in FL, as well as the instrumentation of the production training infrastructure to perform an end-to-end empirical measurement of unintended memorization.
Introduction
Modern mobile features like next-word prediction (NWP) rely on Large Language Models (LLMs) trained on user-generated text. However, this text often contains highly sensitive information—passwords, social security numbers, or private conversations. While Federated Learning (FL) helps by keeping raw data on the user's device, it is not a complete privacy solution. Research has shown that an adversary could potentially "invert" model updates or query the final model to extract specific training examples—a phenomenon known as unintended memorization. This paper addresses the challenge of training a high-performing model on millions of devices without accidentally memorizing a specific user's private secrets.
Methodology
DP-FedAvg Algorithm
The researchers employed DP-FedAvg (Differentially Private Federated Averaging), which incorporates two primary privacy-preserving steps:
- Clipping: Each user’s model update is "clipped" to a maximum $L_2$ norm. This ensures that no single user's data can have an outsized influence on the global model.
- Noising: The server adds Gaussian noise to the sum of the clipped updates before updating the global model.
The "Secret Sharer" Validation
To move beyond theoretical guarantees, the authors used an empirical framework called "Secret Sharer." They inserted "canaries"—unique, random, out-of-distribution phrases—into the training process via synthetic devices. They then tested whether the final model could "remember" these phrases using techniques like Beam Search and Random Sampling. This allowed for a direct measurement of how many repetitions ($n_e$) across how many users ($n_u$) were required for a secret to be leaked.
Datasets and Tuning
- Stack Overflow Corpus: A public dataset used for hyperparameter tuning. The team found that settings (learning rates, clipping norms) optimized here transferred effectively to the private production environment.
- Production Gboard Data: Real-world, on-device data from a fleet of mobile phones (specifically targeting Spanish language users).
- Synthetic Canary Data: Custom-built sequences used to measure the limits of memorization.
Experimental Results
Model Utility
Despite the added noise and clipping required for differential privacy, the new NWP model significantly outperformed the existing n-gram baseline. In live experiments, the model demonstrated a +7.77% relative increase in Top-1 Recall and a +4.31% increase in Click-Through Rate (CTR).
Privacy Robustness
The Secret Sharer tests revealed that memorization is a threshold-based phenomenon. The model only began to "memorize" canaries when they were repeated tens of thousands of times across multiple users. Crucially, for a single user ($n_u=1$), even if they repeated a secret phrase 200 times, the model showed virtually no signs of memorization.
Discussion and Future Work
The Production Reality Gap
In theory, DP requires "uniform sampling" of users. In reality, production systems use "Pace Steering" to avoid overwhelming servers and depend on devices being plugged in and on Wi-Fi. While these real-world constraints make formal $(\epsilon, \delta)$ proofs difficult, the empirical privacy remains robust. The system successfully scaled to 20,000 clients per round, completing 2,000 rounds of training over approximately three weeks.
Limitations
This work assumes a "trusted server" for aggregation. It does not protect against a malicious server operator, though techniques like Secure Aggregation could be added. Furthermore, the authors refrain from claiming a specific, certified $(\epsilon, \delta)$ privacy budget due to the dynamic nature of mobile fleets, instead providing hypothetical upper bounds (e.g., $\epsilon \approx 5.36$ for a 4-million user population).
Future directions include exploring "random check-ins" to better align production infrastructure with the requirements of formal DP proofs and expanding the framework to other languages and model architectures.
Summary updated