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
ML System Design
Machine Learning Engineer
Meta
November 29, 2026
Machine Learning Engineer
Onsite
ML System Design
Medium

0

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
query understanding
spelling correction
query reformulation mining
phonetic matching
confidence thresholds
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 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 Problems
Sample 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
  1. 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...

Submit Your Answer
Markdown supported