Design Query Spelling Correction for Amazon Product Search
Last updated: November 29, 2026
Quick Overview
Design the system that rewrites misspelled search queries such as 'wireles hedphones' to the intended query before retrieval, deciding when to auto-correct and when to show 'Did you mean'.
Amazon
November 29, 20260
0
0 solved
Design the system that rewrites misspelled search queries such as 'wireles hedphones' to the intended query before retrieval, deciding when to auto-correct and when to show 'Did you mean'.
Search science and infrastructure overlap here, and Amazon asks it to see if you can design a low-latency service with offline-built models and safe rollout. Interviewers probe candidate generation, scoring, and the confidence threshold for silent rewrites versus suggestions.
What the Interviewer Expects
- Generate candidates cheaply with edit distance against a query and token dictionary
- Score candidates with language-model and behavioral signals
- Set thresholds separating auto-correct, suggest and leave alone
- Protect brand names, model numbers and rare valid terms
- Evaluate with offline sets and online A/B tests
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- How do you avoid correcting a real brand like 'Crocs' or 'Anker'?
- How would you handle queries in mixed scripts, for example Hinglish on amazon.in?
- What metrics tell you a correction is helping?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Functional: given a query, return a corrected query and a confidence; search uses it as an auto-rewrite (showing 'Showing results for X') or a 'Did you mean' link. Non-functional: added latency under ...
High-Level Design
Offline jobs build a vocabulary of tokens and frequent queries from catalog text and search logs, plus a reformulation table mined from sessions where users typed a query, got poor results, and immedi...