KatInterview

Priority Inbox and Thread Digests for a Large Webmail Product

Machine LearningModel answer
MediumModel answerMachine Learningml-system-designlearning-to-rankllm-summarization

Last updated

Design a low-latency, privacy-preserving system that reorders a user's inbox by importance and attaches faithful LLM-written digests to the most important threads.

Problem

You are designing two connected features for a large consumer and enterprise webmail product:

  1. Priority ordering. When a user opens their mailbox, the messages are arranged so the ones that matter most appear first, tailored to that user.
  2. Thread digests. For threads judged important (or simply long), the system shows a short, abstractive summary that reflects the conversation context.

Constraints

  • Scale and speed. Hundreds of millions of users, with millions active every day. Both ordering and digest display must finish in under 500 ms at the user-facing edge.
  • Privacy. Mail is personal data. Processing must respect regional data residency rules and strict privacy expectations.
  • Learning from behavior. The ranker should improve from signals such as opens, replies and deletions, without creating a feedback loop that buries important mail.
  • Safety. Digests must stay faithful to the source thread, must not invent or expose sensitive details, and must not produce biased text.

What to cover

  1. Architecture. Outline data ingestion, the inference pipelines and the serving approach. Explain how the ranker and the generative component fit together.
  2. Features. Which signals matter most for priority? How do you treat long, multi-reply threads differently from short standalone messages?
  3. Models. Choose and justify a ranking approach (for example a two-tower retrieval-style model versus gradient-boosted trees) and a summarization approach (for example a small distilled model you host versus an external API model).
  4. Feedback and safety. How do you prevent a filter-bubble effect where the system only reinforces what the user already clicks? What guardrails stop personal information from leaking into generated digests?

State your scale assumptions with numbers, and discuss trade-offs and failure modes.

Hints

Hint 1

Work out the numbers first: emails per day, inbox opens per day, and the share of threads that need a digest. Use them to decide what must happen at delivery time versus at read time.

Hint 2

Keep generation off the read path: precompute a base priority score when mail arrives, use it to decide which threads get a digest, cache digests, and only do a light re-rank on inbox open.

Hint 3

Clicks are biased by display position, so log position and propensity, correct for them in training, reserve exploration slots, and pin certain categories (security alerts, manager mail) regardless of model score.

Hint 4

Treat email text as untrusted input to the summarizer: guard against prompt injection, check that each claim in the digest is supported by the source, and scan outputs for sensitive data.