Design Relevance Ranking for Search Within a Gmail Inbox

Last updated: November 29, 2026

Quick Overview

When a user searches their own Gmail, results are sorted by date today. Design a relevance-ranked 'top results' section that finds the email the user is looking for faster.

Google
ML System Design
Software Engineer
Google
November 29, 2026
Software Engineer
Technical Screen
ML System Design
Easy

0

0

0 solved


When a user searches their own Gmail, results are sorted by date today. Design a relevance-ranked 'top results' section that finds the email the user is looking for faster.

Personal search differs from web search because each corpus is private and small, and labels are scarce per user. Interviewers check that you design a global model over per-user features and respect privacy, while keeping it simple enough for a screen.

What the Interviewer Expects
  • Explain why a single global model with per-user features is needed
  • Identify the label: the email the user opens after searching
  • List features such as sender affinity, recency and term match
  • Handle privacy: no human review of email content
  • Define an offline metric like MRR
Key Topics to Cover
Personal search
Learning to rank
Privacy-preserving training
Click labels
Mean reciprocal rank
How to Approach This
  1. Start by mapping the business objective to a concrete ML objective and metric.
  2. Cover the full pipeline: data collection, feature engineering, model selection, training, serving.
  3. Discuss online vs offline evaluation. Plan an A/B test to validate real-world impact.
  4. Address the serving latency budget and whether batch or real-time inference is needed.
  5. Think about the data flywheel: how user feedback improves the model over time.
Possible Follow-up Questions
  • How would you train if you cannot look at any email content?
  • How do you handle queries that are a person's name?
  • How would you measure if top results helped?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice ML System Design Problems
Sample Answer
Requirements

Show up to 3 'top results' above the date-sorted list. Corpus per user: up to hundreds of thousands of messages. Latency under 300 ms. Success: the user opens a top result without reformulating. Const...

High-Level Design
  1. Retrieval: the existing per-user inverted index returns all matching messages (often hundreds).
  2. Feature extraction: per candidate, compute query-independent and query-dependent features....

Submit Your Answer
Markdown supported