← Questions
Design an email spam detection system
0
I was asked this
No reports yet. Sign in to say where you were asked it.
An AI/ML design interview question asked in Amazon's technical phone screen, last asked Aug 2025. It tests classification, nlp and trust and safety.
Design an end-to-end system that decides whether an incoming email is spam before it reaches the inbox, for a large mail provider. Cover the problem definition and labels, the data, features, models, serving at delivery time, evaluation, adversaries and how the system keeps learning.
Requirements
- Functional: score every incoming message and route it to the inbox or the spam folder (optionally quarantine or reject); learn from user actions such as "Report spam" and "Not spam"; explain or log why a message was flagged.
- Non-functional: very high throughput and a tight latency budget at delivery time; a very low false-positive rate, since losing a real email is worse than letting some spam through; privacy and compliance for message content.
Clarifying questions
- How many messages per second, and what latency can the delivery path afford?
- What is the cost of a false positive compared with a missed spam message? Are there different classes (phishing, malware, marketing)?
- Which labels exist today: user reports, honeypot accounts, manual review?
- Can the model read message bodies, or only metadata, for privacy reasons?
- Is the decision per user (personalized) or global?
What a strong answer covers
- Labels and their noise: user reports, honeypot traps, reviewed samples; delayed and biased labels and how to correct for them.
- Features: content (text, URLs, attachments), headers and authentication (SPF, DKIM, DMARC), sender and domain reputation, network signals (IP, sending volume and bursts), and recipient behavior.
- Models: rules and blocklists as the first stage, then a fast model (logistic regression or gradient-boosted trees), and a heavier text model for uncertain cases; when online learning helps.
- Serving: a staged pipeline that keeps cheap checks first, feature lookups from a low-latency store, and the latency and throughput budget.
- Thresholds and calibration chosen from the cost of each error type; evaluation with precision and recall, PR curves and cost-weighted metrics, measured on recent data.
- Adversaries and drift: spammers probing the filter, fast-changing campaigns, retraining cadence, cold start for new senders and domains.
- Rollout and operations: shadow mode, A/B ramps with guardrails on false positives, monitoring, logging and rollback.
Follow-ups
- A new phishing campaign gets through: how fast can you react, and with what?
- Personalize the filter for each user without overfitting to one person's clicks.
- Users rarely press "Not spam": how do you measure false positives at all?
- Detect spam that is generated by large language models.
Where it's asked
- Amazon · Technical phone screen · Last asked Aug 202560 min · Live coding in a shared editor that does not run code, plus Leadership Principles questions · No AI
What it tests
classification · nlp · trust and safety
No official answer yet. Draw yours on the right; publish it and it shows under Community.
Nothing published yet. Publish your canvas and it shows here for others to open and remix.
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing
