Design Query Spelling Correction for Facebook Search
Last updated: November 29, 2026
Quick Overview
Design a system that detects and corrects misspelled queries in Facebook search, including names, which are often unusual. Explain candidate corrections, the scoring model, and when to auto-correct versus suggest.
Meta
November 29, 20260
0
0 solved
Design a system that detects and corrects misspelled queries in Facebook search, including names, which are often unusual. Explain candidate corrections, the scoring model, and when to auto-correct versus suggest.
Query understanding is a core part of search loops at Meta, and names make spelling correction harder than in web search. Interviewers check that you avoid over-correcting real names, mine training data from reformulations, and pick between silent rewrite and suggestion based on confidence.
What the Interviewer Expects
- Generates corrections via edit distance, phonetic matching and query logs
- Mines labeled pairs from user reformulations
- Scores candidates with a model using frequency, context and personalization
- Uses confidence thresholds to choose auto-correct, suggest, or leave alone
- Protects rare but valid names, especially names in the user's network
Key Topics to Cover
How to Approach This
- Start by mapping the business objective to a concrete ML objective and metric.
- Cover the full pipeline: data collection, feature engineering, model selection, training, serving.
- Discuss online vs offline evaluation. Plan an A/B test to validate real-world impact.
- Address the serving latency budget and whether batch or real-time inference is needed.
- Think about the data flywheel: how user feedback improves the model over time.
Possible Follow-up Questions
- How would you handle transliterated names typed in Latin script?
- What if the misspelling is a valid username of some other person?
- How do you evaluate the precision of auto-corrections offline?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice ML System Design ProblemsSample Answer
Requirements
- Input: a raw query; output: either the original query, a suggested correction ("Did you mean"), or a silent rewrite.
- Must work across many languages and scripts.
- Latency budget around 20 ms sinc...
High-Level Design
- Candidate generation: for each token, candidates within edit distance 2 from a vocabulary of names, pages and common terms (using a symmetric delete index), phonetic neighbors (Double Metaphone...