Skip to main content
QUICK REVIEW

[Paper Review] Federated Learning of N-gram Language Models

Mingqing Chen, Ananda Theertha Suresh|arXiv (Cornell University)|Oct 8, 2019
Privacy-Preserving Technologies in DataComputer Science29 references18 citations
TL;DR

This paper proposes a federated learning framework to train high-quality n-gram language models for virtual keyboards without ever collecting user data on central servers. By first training a recurrent neural network (RNN) via federated averaging on-device, then approximating it into an n-gram model using neural-inferred and external corpus topologies, the method achieves superior next-word prediction accuracy over traditional server-based training, with A/B tests showing up to 10.53% top-1 accuracy on English and 9.65% on Brazilian Portuguese.

ABSTRACT

We propose algorithms to train production-quality n-gram language models using federated learning. Federated learning is a distributed computation platform that can be used to train global models for portable devices such as smart phones. Federated learning is especially relevant for applications handling privacy-sensitive data, such as virtual keyboards, because training is performed without the users' data ever leaving their devices. While the principles of federated learning are fairly generic, its methodology assumes that the underlying models are neural networks. However, virtual keyboards are typically powered by n-gram language models for latency reasons. We propose to train a recurrent neural network language model using the decentralized FederatedAveraging algorithm and to approximate this federated model server-side with an n-gram model that can be deployed to devices for fast inference. Our technical contributions include ways of handling large vocabularies, algorithms to correct capitalization errors in user data, and efficient finite state transducer algorithms to convert word language models to word-piece language models and vice versa. The n-gram language models trained with federated learning are compared to n-grams trained with traditional server-based algorithms using A/B tests on tens of millions of users of virtual keyboard. Results are presented for two languages, American English and Brazilian Portuguese. This work demonstrates that high-quality n-gram language models can be trained directly on client mobile devices without sensitive training data ever leaving the devices.

Motivation & Objective

  • To enable training of production-quality n-gram language models for mobile virtual keyboards without ever transmitting raw user-typed data to central servers.
  • To overcome the limitations of direct federated training of n-grams, which is infeasible due to large vocabularies and data sparsity in morphologically rich languages.
  • To develop a method that leverages federated RNN training to produce high-quality n-gram approximations suitable for low-latency inference on mobile devices.
  • To address data quality issues such as inconsistent capitalization and out-of-vocabulary (OOV) words in user-generated training data.
  • To evaluate the resulting n-gram models in real-world A/B tests on tens of millions of users across two languages, demonstrating improved prediction accuracy.

Proposed method

  • Train a recurrent neural network language model (RNN LM) using FederatedAveraging on client devices, ensuring user data never leaves the device.
  • Use the SampleApprox algorithm to approximate the trained RNN LM into a finite-state transducer-based n-gram model for efficient on-device inference.
  • Combine neural-inferred n-gram topology with an external large corpus topology (A_W) to improve coverage and reduce data sparsity, especially for rare or OOV words.
  • Apply a capitalization normalization FST to correct inconsistent capitalization in user-typed text before model training.
  • Use a modified SLL^e metric (excluding OOV words) to guide model selection, focusing on in-vocabulary performance.
  • Deploy and evaluate the resulting n-gram models in A/B tests on live production traffic of a virtual keyboard application.

Experimental results

Research questions

  • RQ1Can high-quality n-gram language models be trained directly on mobile devices using federated learning without exposing raw user data?
  • RQ2Does approximating a federated RNN LM into an n-gram model yield better performance than training n-grams directly from centralized logs?
  • RQ3How effective is combining neural-inferred n-gram topology with an external corpus topology in improving model quality and coverage?
  • RQ4To what extent do capitalization normalization and word-piece modeling mitigate data quality issues in federated n-gram training?
  • RQ5Can the resulting n-gram models outperform traditional server-based training in real-world user prediction accuracy?

Key findings

  • The federated RNN-based n-gram model (A_P_r) achieved a top-1 prediction accuracy of 10.53% on English (en_US), significantly outperforming the baseline model at 10.03%.
  • For Brazilian Portuguese (pt_BR), the best federated model (A_P_r) achieved 9.65% top-1 accuracy, compared to 8.55% for the baseline model.
  • The word-piece model (P_4K-L) achieved a SLL^e of 10.49 on en_US, outperforming the 10.46 SLL^e of the word model (W_30K) in the same language.
  • The model using interpolated topology (A_r) consistently outperformed models trained on purely neural-inferred or external-only topologies.
  • The SLL^e metric showed that 4K word-piece models with GLSTM architecture performed better than 16K and 30K word-piece models, suggesting optimal vocabulary size for this setup.
  • All federated models significantly outperformed the baseline model in A/B tests, demonstrating the feasibility and superiority of federated training for n-gram models.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.