Federated Learning and Differential Privacy for the Gboard Language ModelFederated Learning of Gboard Language Models with Differential Privacy
Google trained and deployed more than 20 language models in Gboard federated learning using DP-FTRL, obtaining zCDP guarantees with ρ∈(0.2,2); all NWP models have DP.
central DP, honest-but-curious server; zero-one device neighboring (zero-out adjacency definition), device-level DP; the guarantee covers all well-behaved clients in training, and the privacy cost of hyperparameter tuning is not included; the distributed DP setting with client-side local noise addition is not considered.
- Cross-device federated learning cannot uniformly randomly sample clients, so DP-FedAvg is hard-pressed to give formal DP guarantees; previously the Gboard production LM had only empirical audits, not formal DP.
- Deploy DP-FTRL on top of FedAvg (without the uniform sampling assumption), combined with adaptive clipping based on quantile estimation, client timers to control participation intervals, pretraining on public data, and SecAgg on some models.
- Deployed more than 20 DP models, all with zCDP within (0.2, 2); five European NWP tasks improved PRate by 3.26%–8.28% relative to the N-gram baseline; en-US*/es-ES* with SecAgg added had zCDP of 0.25/0.52 respectively.
- The authors state that SecAgg training is noticeably slower and leave it for future work; only a few tasks approach the maximum MinS; the guarantee does not cover hyperparameter tuning and checkpoint selection; the privacy guarantee depends on client timers enforcing participation limits.
- Evaluated models
- de-DE NWPen-GB NWPfr-FR NWPit-IT NWPpt-PT NWPes-ES NWPes-ES* NWPen-US NWPen-US* NWPpt-BR NWPen-IN NWPes-MX NWPes-AR NWPde-DE OTFen-GB OTFes-ES OTFfr-FR OTFit-IT OTFru-RU OTFpt-PT OTF
- Benchmarks
- Gboard 设备群(按语言/地区划分的 NWP 与 OTF 任务,线上 A/B 测试)multi-lingual C4(公开预训练数据)StackOverflow(公开模拟数据集)
- Metrics
- ρ-zCDP(ϵ, δ)-DPPRateAccTrigger RateWMRWPMTop-1 in-vocab accuracy
Google trains language models in Gboard with federated learning and differential privacy, and has deployed more than 20 models with ρ-zCDP privacy guarantees. The paper uses the DP-FTRL algorithm, which makes training not require uniform sampling of client devices, and introduces new client participation criteria; quantile clipping estimation can be combined with DP-FTRL to adaptively select clipping norms during training or reduce hyperparameter tuning. With public-data pretraining, the ρ values of these models fall in the interval (0.2, 2), and two of the models also use secure aggregation. Google states that all Gboard next-word prediction neural network language models now have differential privacy guarantees, and future releases of Gboard neural network language models will also be required to have this guarantee.
Paper analysis
What problem does this paper attempt to solve?
The authors state that in cross-device FL where clients cannot be uniformly sampled, DP-FTRL provides formal DP guarantees for Gboard LM training.
Core question: how to provide formal differential privacy (DP) guarantees for Gboard language model training in a real cross-device federated learning system while maintaining usable model utility.
- Setting and importance: Gboard uses FL to train language models supporting features such as NWP (next word prediction), SC (smart compose), and OTF (candidate reordering). DP can guarantee that the trained model does not memorize specific user data, which the authors consider stronger protection than relying on data minimization principles alone.
- Shortcomings of existing methods: Ramaswamy et al. [2020] trained a production LM with DP-FedAvg, but only performed empirical auditing and did not provide formal DP guarantees; DP-FedAvg requires privacy amplification-by-sampling for strong guarantees, i.e., uniformly randomly sampling clients each round, whereas cross-device FL systems cannot control sampling (devices must meet local conditions such as being charging and connected to a non-metered network to participate).
- Core idea: Deploy DP-FTRL [Kairouz et al., 2021b], which can provide formal guarantees without relying on the uniform sampling assumption; combine it with adaptive clipping, client participation control, and public data pretraining to improve the privacy-utility trade-off.
- Paper outputs: Propose an algorithm embedding adaptive clipping into DP-FTRL (Alg. 1) and an algorithm combined with SecAgg (Alg. 2), train and deploy more than 20 Gboard LMs with ρ-zCDP guarantees (ρ∈(0.2, 2)), and summarize practical recommendations.
- Threat model (defense perspective, terminology copied from the paper):
- Protected object: training data on client devices, preventing the trained model from memorizing specific user data.
- DP setting: central DP, honest-but-curious server; the distributed DP setting with client-side local noise addition is not considered.
- Adjacency definition: zero-one device neighboring (zero-out definition), device-level DP; a single-device user corresponds to user-level DP.
- Coverage: the guarantee covers all well-behaved clients in a single training run; the privacy cost of hyperparameter tuning and final checkpoint selection is not included.
What related research exists?
Related work is divided into four groups: DP-FTRL and DP training algorithms, adaptive clipping, FL systems and SecAgg, and DP pretraining and production deployment.
DP training algorithms and privacy accounting
- DP-SGD [Abadi et al., 2016] and its FL variant DP-FedAvg [Geyer et al., 2017; McMahan et al., 2018]: foundational algorithms for client-level DP; the paper notes that their strong guarantees require the uniform sampling assumption, which cross-device systems cannot satisfy.
- DP-FTRL [Kairouz et al., 2021b]: a DP training algorithm that requires no sampling or shuffling assumption; this paper deploys it directly and reuses its privacy accounting (including the accounting implementation in appendix D).
- zCDP [Bun and Steinke, 2016] and PLD accounting [DP Team, 2022]: this paper reports guarantees in ρ-zCDP and uses PLD to convert to (ϵ, δ)-DP; the US Census Bureau [2021] used zCDP, and all models in this paper are compared with its zCDP > 2.6.
Adaptive clipping
- Andrew et al. [2021]: a method that automatically adjusts the clip norm based on quantile estimation; the paper notes that it cannot be directly used in DP-FTRL (tree-based noise addition assumes a fixed clip norm), and this paper integrates it into DP-FTRL via a restart mechanism and reuses its Thm. 1 noise transformation for accounting.
FL systems, client participation, and secure aggregation
- FedAvg [McMahan et al., 2017] and variants [Wang et al., 2021]: this paper modifies it to obtain federated DP-FTRL.
- Bonawitz et al. [2019], Balle et al. [2020]: background on cross-device FL system design and constrained client sampling (report goal, local participation conditions).
- SecAgg [Bonawitz et al., 2017; Bell et al., 2020]: a secure aggregation protocol, which this paper combines with DP-FTRL as a black box; the random rotation and conditional random rounding techniques of Kairouz et al. [2021a] are used for sensitivity calibration.
- Cho et al. [2023]: the paper cites its conclusion that increasing MinS may benefit utility.
DP pretraining and production deployment
- De et al. [2022], Li et al. [2021], Yu et al. [2021], Xu et al. [2022], Wang et al. [2023]: showed in DP simulations that public data pretraining can improve utility; this paper applies it to production models.
- Ramaswamy et al. [2020]: trained a production LM with DP-FedAvg and used the auditing technique of Carlini et al. [2019]; the paper notes that it has no formal guarantees.
- McMahan and Thakurta [2022]: previously trained es-ES NWP (2000 rounds, no pretraining, zCDP 0.81, 24-hour timer); the es-ES model in this paper is directly compared with it.
Positioning: The authors state that this paper is the first (to the best of our knowledge) to use pretraining for training a DP model directly from user data, and emphasize system-algorithm co-design; for baselines, NWP utility is compared with previously deployed N-gram models or No-DP NN models (es-AR is a mixture of the two), and privacy is compared with the US Census Bureau's zCDP > 2.6.
How does the paper address this problem?
Deploy DP-FTRL on FedAvg, adding quantile-based adaptive clipping, client participation control, public pretraining, and optional SecAgg.
Overall approach: deploy DP-FTRL into Gboard's cross-device FL system—modify FedAvg to clip client model updates and add tree noise when updating the global model on the server, thereby obtaining formal DP guarantees without the uniform sampling assumption; supplement with adaptive clipping, participation control, pretraining and SecAgg.
Federated DP-FTRL and adaptive clipping (Alg. 1)
- Two DP hyperparameters: clip norm C (bounds the norm of client updates ∆) and noise multiplier z (determines the Gaussian noise standard deviation zC).
- Integration of adaptive clipping: DP-FTRL's tree noise addition assumes a fixed clip norm across rounds, so the quantile estimate C t is tracked continuously but only becomes the effective clip norm Cθ at tree restarts; restart rounds R = {128 + 1024i}.
- Key parameters: target quantile γ = 0.5, norm learning rate ηγ = 0.2, clipping estimate noise σb = m/20 (m is the report goal), momentum β = 0.9.
- Privacy accounting: because both the aggregated updates and the quantile estimate use tree noise addition, the accounting of [Kairouz et al., 2021b] can be applied directly, with the noise transformation per Thm. 1 zΔ = (z−2 − (2σb)−2)−1/2, i.e., the model noise is slightly increased from zC to z∆C to cover the cost of the clipping estimate.
Client participation control and system configuration
- MaxP and MinS: MaxP is the maximum number of participations by a single client over the whole training, and MinS is the minimum number of rounds between two participations by the same client; MaxP is upper-bounded by T/MinS. With T fixed, lowering MaxP and increasing MinS strengthens privacy without changing utility.
- report goal assumption: following the assumption of [Kairouz et al., 2021b; McMahan et al., 2018; Xu et al., 2022]—when data is large enough, the noise multiplier increases proportionally with the number of clients per round (lower-bounded by the report goal), and utility is approximately non-decreasing; the authors empirically verify this with two comparison training runs (report goal 500/noise 0.54 vs. 6500/7).
- Timer mechanism: a timer is introduced on the client so that it can participate again only after a certain duration, to control MinS; the timer increments in units of 24 hours (because participation patterns are uneven across day and night).
Pretraining on public data
- Each language task pretrains the model on the multi-lingual C4 dataset (public web pages).
- Three observations: fine-tuning is difficult when input and output share word embeddings; accuracy may drop in the first few rounds of fine-tuning; pretraining gains diminish. Therefore separate input and output embeddings are used, and only half of C4 is used for pretraining.
Combination with SecAgg (Alg. 2)
- Procedure: the client first ℓ2-clips to C and scales up by s, then applies random rotation (random signs + normalized Hadamard matrix) to convert ℓ2 geometry to ℓ∞ geometry, ℓ∞-clips to C∞, then discretizes with conditional random rounding and shifts to {0, …, 2C∞}, and performs secure aggregation modulo M = 2·C∞·m + 1; the server unshifts, unscales, unrotates, and then adds noise with DP-FTRL.
- Sensitivity calibration: the ℓ2 norm upper bound after rounding includes an inflation term, and the inflated Cinflated is used in place of C in accounting; larger s gives smaller inflation, but M grows linearly with s, increasing communication and computation cost. Production training takes α = exp(−0.5).
- Known gap: a paper footnote states that the training version at the time did not explicitly do ℓ∞ clipping, so in theory modulo wraparound could occur and inflate the ℓ2 sensitivity by at most dM, but the authors state that with the chosen M the wraparound probability is less than 2×10⁻²⁷.
Recommended procedure (Sec. 2.5)
The authors give a 7-step strategy: pretrain on public data → simulate with a small report goal to select the largest noise multiplier that meets the utility target → scale report goal and noise multiplier linearly according to the target number of rounds and estimated population → configure timers according to estimated population to approach the maximum MinS → use Alg. 1 directly when hyperparameters are known → when stronger privacy-utility is needed, first tune γ and the server learning rate at a small report goal, fix the estimated clip norm, then train at a large report goal → SecAgg can be used throughout, with exact MaxP/MinS accounted afterward.
What experiments did the paper conduct?
Deployed 13 NWP and 7 OTF models in online A/B tests, all with zCDP less than 2; there are also analyses of clipping, participation control, and pretraining.
Experimental setup
- Trained models: Gboard NWP LM and OTF LM, both one-layer LSTM/CIFG (670 hidden units, embedding dimension 96); NWP vocabulary about 10–20K, OTF about 30K; 10K/20K/30K vocabularies correspond to 2.4M/4.4M/6.4M parameters. SC reuses the NWP model and is not trained further.
- Tasks: device populations partitioned by language/region, with estimated populations from 0.83M (pt-PT) to 16.6M (pt-BR) (Table 1).
- Training configuration: all deployed models use DP-FTRL, report goal 6500, noise multiplier 7 (based on simulation on the public StackOverflow dataset in [Kairouz et al., 2021b]); en-US* and es-ES* additionally use SecAgg.
- Baselines: previously deployed models—N-gram for the five European tasks, No-DP NN for en-US, pt-BR, en-IN, and a mix of the two for es-AR (BaseModel column of Table 1).
- Metrics: top-1 in-vocab accuracy during training; PRate, Acc, Trigger Rate, WMR, WPM in online A/B; ρ-zCDP for privacy, converted to (ϵ, δ)-DP via PLD accounting (δ = 10⁻¹⁰).
- Evaluation method: utility comes from online A/B tests; the paper does not report A/B sample sizes or number of repetitions.
Main results
According to Table 1 (NWP, utility is the improvement relative to previously deployed models, all with report goal 6500, noise multiplier 7):
Swipe horizontally to read the table
Task Rounds PRate(+%) Acc(+%) zCDP Base de-DE 930 8.28 12.49 0.48 N-gram en-GB 980 3.26 7.72 0.48 N-gram fr-FR 1280 3.78 8.50 0.89 N-gram it-IT 1620 3.98 9.86 0.71 N-gram pt-PT 530 3.99 7.82 1.86 N-gram es-ES 1900 0.29 0.48 0.35 zCDP 0.81 old model es-ES* (SecAgg) 1750 0.32 0.56 0.52 same as above en-US 2800 -0.39 0.11 1.31 No-DP NN en-US* (SecAgg) 1360 -0.30 0.15 0.25 No-DP NN pt-BR 3600 0.18 0.29 0.45 No-DP NN en-IN 1290 0.19 0.40 1.14 No-DP NN es-MX 1980 -0.15 0.29 0.64 No-DP NN es-AR 640 0.25 3.50 0.84 mixed - The authors state that the DP NN for the five European NWP tasks (DE, GB, FR, IT, PT) improved utility relative to the previous N-gram models; on en-US, pt-BR, en-IN the DP models have comparable or slightly better utility than the non-private versions.
- Exceptions: PRate is negative for en-US and es-MX (-0.39%, -0.15%); the authors do not explain why.
- The authors state that all models have zCDP less than the zCDP > 2.6 used by the US Census Bureau, and that estimated population is positively correlated with the strength of the privacy guarantee.
OTF model results
According to Table 2 (OTF, likewise report goal 6500, noise multiplier 7): on 7 tasks (de-DE, en-GB, es-ES, fr-FR, it-IT, ru-RU, pt-PT), WMR decreases by 0.72%–1.99% and WPM improves by 0.32%–0.80%; zCDP ranges from 0.32 (ru-RU) to 0.99 (pt-PT), corresponding to DP-ϵ (δ = 10⁻¹⁰) from 5.13 to 9.56.
Adaptive clipping and pretraining (Figure 3)
- Setup: en-GB NWP, report goal 6500, noise multiplier 7. The figure shows that the evaluation accuracy curves for adaptive and fixed clipping are close; adaptive starts from a smaller initial clip norm and eventually catches up; the estimated clip norm (γ = 0.5) stabilizes, and the authors accordingly fix the clip norm at 5.
- Pretraining: the authors state that pretraining reduces the number of rounds needed to reach a given utility threshold by about 1000 under the same noise multiplier (the Pretrain curve in Figure 3a starts higher than the other curves).
- Failure case: de-DE NWP with adaptive clipping makes no progress at all in the first 1000 rounds (catastrophic failure); the authors state that a fixed clip norm has comparable or slightly better utility and is more robust at large report goals.
Privacy parameter analysis (Figure 4)
- report goal and population: scaling report goal and noise multiplier linearly under the assumption that utility is approximately non-decreasing, Figure 4a/4b show that increasing report goal at a fixed number of rounds generally yields smaller zCDP (two panels for populations of 1M and 3M).
- MinS: Figure 4c (report goal 6500) shows that increasing MinS can reduce zCDP; however, MinS is upper-bounded by population/report goal, e.g., with population about 10⁶ and report goal 6500, MinS must be less than 153 rounds, making strong guarantees hard to achieve with 3000 training rounds.
- es-ES case: the old model [McMahan and Thakurta, 2022] used a 24-hour timer and observed MinS 313; this paper's es-ES uses a 144-hour timer, MinS 526, improving zCDP from 0.81 to 0.35, and SC trigger rate improves by 4.23% at round 1240 and by 9.51% at round 1900.
Other ablations and analyses
- report goal comparison: two training runs, report goal 500/noise 0.54 and 6500/7, have similar final utility on more than three Gboard language tasks or slightly better with the large report goal, and the large report goal learns faster in the early stage of training.
- SecAgg: en-US* and es-ES* reach a comparable privacy-utility trade-off in fewer rounds, which the authors suggest may stem from the system configuration bringing more clients per round; however, SecAgg training is noticeably slower.
- Hyperparameter consistency: the authors observe that the learning rate and clip norm are consistent across Gboard LMs, and tuning appears unnecessary.
- (ϵ, δ) conversion (Appendix A): with δ = 10⁻¹⁰, the minimum zCDP ρ = 0.25 corresponds to ϵ = 4.49, and the maximum ρ = 1.86 corresponds to ϵ = 13.69.
What are some points that can be further explored?
The authors list future directions such as SecAgg speedup; the guarantee does not cover tuning and checkpoint selection, and only a few tasks approach the maximum MinS.
Limitations and future directions noted by the authors
- SecAgg is slow (Sec. 2.4 Challenges and future work): a large report goal makes SecAgg challenging in practice, and the observed SecAgg training speed remains markedly slower; the authors leave communication compression [Chen et al., 2022], new DP methods that reduce the report goal [Choquette-Choo et al., 2022], and embedding compression to shorten round time [Shu and Nakayama, 2017] as future work.
- SecAgg sensitivity gap (Sec. 2.4 footnote): the training version at the time did not explicitly perform ℓ∞ clipping, and modulo wraparound could occur, inflating ℓ2 sensitivity by up to dM; the authors state that with the chosen M the wraparound probability is less than 2×10⁻²⁷.
- Difficulty achieving MinS (Sec. 3 Result analysis): only a few tasks approached the maximum possible MinS, which the authors say highlights the challenges of both estimating the population and controlling client participation.
- Difficulty optimizing the timer (Sec. 2.2): many factors affect wall-clock training speed in FL systems, and optimizing the timer period to maximize MinS is challenging.
- Scope of guarantees (Sec. 3 and Appendix A): the DP guarantees do not include hyperparameter tuning, nor the privacy cost of selecting the final checkpoint using evaluation metrics or A/B tests; the guarantees are for well-behaved clients.
- Adaptive clipping failure mode (Sec. 2.1): de-DE NWP showed no progress in the first 1000 rounds before adaptive clipping; the authors state that a fixed clip norm was more robust in large report goal experiments.
Experimental coverage
- Deployed and reported online A/B results for 13 NWP tasks (Table 1) and 7 OTF tasks (Table 2); SC reuses the NWP model, and only the es-ES trigger rate number is reported.
- All deployed models use the same configuration: DP-FTRL, report goal 6500, noise multiplier 7; SecAgg was evaluated only on the two NWP tasks en-US* and es-ES*.
- The model architecture is fixed as a one-layer LSTM/CIFG (670 hidden units), with 2.4M–6.4M parameters.
- Pretraining used only half of multi-lingual C4; the curve analysis of adaptive clipping and pretraining is shown only on en-GB NWP (Figure 3).
- The paper does not report the sample size, number of repetitions, or statistical tests of the A/B tests; it does not report training wall-clock time or the specific slowdown number for SecAgg (only that it is markedly slower).
Summarize the main content of the paper
The authors state that DP-FTRL gives all Gboard NWP neural network LMs formal DP guarantees, with acceptable utility.
A production system paper: Google deploys DP-FTRL in Gboard's cross-device federated learning, providing formal differential privacy guarantees for language model training.
- Problem: the strong guarantees of DP-FedAvg require uniformly random client sampling, but cross-device FL systems cannot control sampling; previously production LMs had only empirical audits, no formal guarantees.
- Method: modified on FedAvg—client updates are clipped to clip norm C, and the server adds noise with a tree mechanism (noise multiplier z); quantile-based adaptive clipping is embedded into DP-FTRL via restarts (Alg. 1); client timers control MinS/MaxP; pretraining uses half of the multi-lingual C4 public data; two models, en-US and es-ES, additionally use SecAgg (Alg. 2, including random rotation and sensitivity calibration with conditional random rounding).
- Deployment results: 20+ LMs launched, all with zCDP within (0.2, 2), which the authors state are all stronger than the US Census Bureau's zCDP > 2.6; all use report goal 6500, noise multiplier 7.
- Utility: the five European NWP tasks improve PRate by 3.26%–8.28% and Acc by 7.72%–12.49% relative to the N-gram baseline (Table 1); on en-US, pt-BR, en-IN they are comparable to or slightly better than the non-private NN, but PRate is negative for en-US and es-MX; on the seven OTF tasks WMR decreases by 0.72%–1.99% (Table 2).
- Key findings: the authors state that pretraining reduces the number of rounds needed to reach the utility threshold by about 1000 under the same noise; es-ES uses a 144-hour timer to improve zCDP from 0.81 to 0.35; adaptive clipping makes no progress in the first 1000 rounds on de-DE, and a fixed clip norm is more robust.
- Authors' conclusion: training practical DP models is possible given large-scale systems and large-scale data; Gboard has stipulated that all future neural network LMs must have DP guarantees before launch.