Abstract
One of the big challenges in machine learning applications is that training data can be different from the real-world data faced by the algorithm. In language modeling, users' language (e.g. in private messaging) could change in a year and be completely different from what we observe in publicly available data. At the same time, public data can be used for obtaining general knowledge (i.e. general model of English). We study approaches to distributed fine-tuning of a general model on user private data with the additional requirements of maintaining the quality on the general data and minimization of communication costs. We propose a novel technique that significantly improves prediction quality on users' language compared to a general model and outperforms gradient compression methods in terms of communication efficiency. The proposed procedure is fast and leads to an almost 70% perplexity reduction and 8.7 percentage point improvement in keystroke saving rate on informal English texts. We also show that the range of tasks our approach is applicable to is not limited by language modeling only. Finally, we propose an experimental framework for evaluating differential privacy of distributed training of language models and show that our approach has good privacy guarantees.
Introduction
Machine learning models deployed in real-world applications, particularly language models for software keyboards, frequently encounter a "data gap." While these models are typically pre-trained on large, publicly available datasets like Wikipedia or news articles, the actual language used by consumers—such as in private messaging or social media—is often informal, idiosyncratic, and rapidly evolving. Bridging this gap through fine-tuning on user data is essential for high-quality predictions but presents significant hurdles: catastrophic forgetting, where the model loses its general linguistic capabilities, and the dual constraints of user privacy and communication bandwidth.
Methods
The researchers propose a "federated fine-tuning" approach designed to personalize models on-device while maintaining global performance and privacy.
Random Rehearsal
To mitigate catastrophic forgetting, the training process on the user's device does not rely solely on private messages. Instead, it "rehearses" by mixing a small portion of the original general training data (e.g., Wikipedia snippets) provided by the server with the local user data. This ensures the model remains anchored to standard English structures while adapting to personal styles.
Distributed Model Averaging
The system employs a communication-efficient architecture where the server averages the weights of models updated by $K$ different users. The authors found that performing more local computation (e.g., training for a full epoch) before transmitting updates was more effective than complex gradient compression techniques like Deep Gradient Compression (DGC).
Empirical Differential Privacy (DP)
To protect user privacy without the accuracy trade-offs often seen with standard DP noise injection, the authors developed an empirical framework. They observed that privacy leakage in language models follows a power-law (Pareto) distribution, allowing them to calculate a "Privacy Budget" ($\epsilon$) based on how much a single user's data influences the final global model.
Datasets and Evaluation
The approach was validated across multiple domains:
- Language Modeling: Using Wikipedia as the general source and Twitter as a proxy for informal user data.
- Benchmarks: Penn Treebank (PTB) was used to assess communication efficiency.
- Generalization: The method was also applied to image classification tasks using MNIST and CIFAR-10, where "shuffled" images simulated a shift in data distribution.
Key Results
The implementation of Random Rehearsal proved superior to alternative methods like "Learning without Forgetting" (LwF), which uses soft labels. Rehearsal provides a more accurate representation of the underlying language distribution.
As shown in the figure above, standard fine-tuning leads to a sharp increase in Wikipedia perplexity as the model adapts to Twitter data. In contrast, rehearsal mode maintains stable performance on the general dataset while still achieving significant gains on the user-specific data.
Quantitatively, the approach achieved:
- A 70% reduction in perplexity on informal English texts.
- An 8.7 percentage point improvement in the Keystroke Saving Rate (KSS).
- Strong privacy guarantees, with a calculated $\epsilon = 0.67$ for a 3,000-user cohort.
- High efficiency, with on-device training taking less than 3 minutes on standard mobile hardware.
Discussion and Limitations
While the results are promising, the authors note that their privacy analysis is empirical rather than a formal mathematical proof. Additionally, the rehearsal method requires some general data to be sent to the device, which consumes user bandwidth. Future work may explore applying these techniques to modern Transformer architectures beyond the LSTMs and ResNets tested here.
Conclusion
This work demonstrates that distributed fine-tuning with Random Rehearsal is a viable and efficient path toward personalizing language models. It successfully balances the need for domain adaptation with the preservation of general knowledge and user privacy.
Summary updated