Design Personalized Private Email Search
Retrieve and rank relevant emails for a query, personalize with the owner’s profile, and keep learning and serving private, fresh and measurable.
Problem statement
Design a machine-learning search system that retrieves relevant emails for a query and ranks the results, including the follow-up of personalizing those results with a user profile.
The report discusses dual Transformer encoders for query and email representations with cosine similarity as one possible approach, not a mandatory model. For this exercise, assume each authenticated user searches only their own private mailbox of English email subject and body text.
Return up to 20 email summaries, with personalization based on permitted profile preferences and prior search interactions; relevance to the current query remains essential. Newly arrived email should become searchable within five minutes.
An acknowledged deletion must hide that email immediately from subsequent search results, while all serving-index copies are purged within 24 hours. Training uses only explicitly consented examples and feedback. Design data collection, retrieval, ranking, evaluation, serving and safe model changes.
Sending mail, attachments, shared mailboxes and generated answers are outside scope.
What to build
- Return up to 20 relevant ranked email summaries for a query, restricted to the authenticated owner’s mailbox.
- Use permitted profile preferences and search history to improve ranking while retaining query relevance and a useful cold-start path.
- Make new email searchable within five minutes; immediately hide acknowledged deletions and purge serving-index copies within 24 hours.
- Collect consented learning examples and feedback, evaluate retrieval and ranking, and safely release or roll back compatible models and indexes.
At scale
- For this exercise, assume one million active users averaging 10,000 emails each and 20 million newly ingested emails per day.
- For this exercise, assume a peak of 5,000 search requests per second and a 500 ms p95 end-to-end search target.
- For this exercise, queries contain at most 200 characters and email text contains at most 20 KB; attachment search is excluded.
- For this exercise, an embedding or personalization outage may degrade relevance, but search must still enforce mailbox ownership and acknowledged deletion.