Introduction
Writing emails is a ubiquitous yet time-consuming task, often involving repetitive and idiomatic phrasing. While Google’s "Smart Reply" previously provided quick responses to incoming messages, it did not assist in the active drafting process. Smart Compose addresses this by offering real-time, interactive sentence completions. To be effective, the system must overcome three primary engineering hurdles: maintaining a sub-60ms latency to ensure suggestions feel natural, scaling to serve over 1.5 billion users, and incorporating contextual relevance from subject lines and previous thread history.
System Design and Architectures
The core of Smart Compose is a Neural Language Model (NLM). Researchers evaluated several architectures to balance predictive accuracy with strict latency requirements.
The production choice, LM-A, utilizes a dedicated context encoder to transform metadata (subject line, previous email) into embeddings. These are concatenated with word embeddings at each step of an LSTM. While more complex models like Transformers or Seq2Seq (encoder-decoder with attention) offer higher raw accuracy, their computational cost—particularly the self-attention mechanism's growth with sequence length—made them unsuitable for the 60ms real-time budget.
Personalization Strategy
To capture individual writing styles, the system employs a hybrid approach. Rather than training massive neural models for every user, the global NLM is blended with a lightweight, user-specific n-gram model using Katz-backoff. This personal model is represented as a compact Weighted Finite Automaton (WFA), allowing for efficient interpolation during inference.
Empirical results show that performance peaks when the personal model is given a weight of approximately 0.4. This suggests that the global model provides the structural grammar, while the personal model contributes specific vocabulary and idiosyncratic phrases. This personalization led to a 10% relative gain in "ExactMatch" accuracy and a 6% relative increase in Click-Through Rate (CTR).
Training and Infrastructure
The models were trained on a massive corpus of 8 billion English messages, subjected to rigorous preprocessing to remove personally identifiable information (PII) and boilerplate content. The system has since expanded to include multiple languages using WordPiece tokenization.
A critical component of the deployment was the transition to specialized hardware. Moving inference from CPUs to Cloud TPUs resulted in a 93x increase in throughput and a 10x reduction in latency, enabling the system to meet its demanding real-time performance targets at scale. Currently, Smart Compose saves users over one billion characters of typing per week.
Ethical Considerations and Future Work
The authors acknowledge the risk of algorithmic bias, such as gender-occupation stereotypes. To mitigate this, "blacklists" prevent the model from suggesting gendered pronouns in ambiguous contexts. Future research focuses on optimizing Transformer architectures for lower latency—perhaps through local self-attention—and using Variational Auto-Encoders (VAEs) to enhance the diversity and appropriateness of generated suggestions.
Summary updated