Design Hybrid Semantic Retrieval for Long-Tail Product Search Queries
Last updated: November 29, 2026
Quick Overview
Long-tail Amazon search queries such as "something to keep my dog from scratching the leather couch" often return poor results with lexical matching alone. Design a retrieval system that combines lexical and embedding-based retrieval at catalog scale.
Amazon
November 29, 20260
0
0 solved
Long-tail Amazon search queries such as "something to keep my dog from scratching the leather couch" often return poor results with lexical matching alone. Design a retrieval system that combines lexical and embedding-based retrieval at catalog scale.
A hard ML system design round in the style of Amazon Search relevance teams. The interviewer is probing two-tower training details, ANN indexing over hundreds of millions of products, merging lexical and semantic candidates, and how to keep semantic matches from returning plausible but wrong products.
What the Interviewer Expects
- Explains why lexical retrieval fails on descriptive tail queries
- Designs a two-tower model with suitable negatives
- Covers ANN index choice, sharding and refresh
- Merges candidate sets and calibrates for the ranker
- Guards against semantic drift and irrelevant matches
- Evaluates on tail-specific slices
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 do you choose hard negatives without picking false negatives?
- How do you keep the index fresh for new listings?
- What is your recall versus latency trade-off for the ANN index?
- How would you handle exact part number queries?
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
M
- Catalog of hundreds of millions of products across marketplaces.
- Retrieve about 1,000 candidates per query in under 30 ms p99 for the retrieval stage.
- Improve relevance and conversion on tail qu...
L
- Lexical retrieval: existing inverted index with BM25 and field boosts, fast and precise for exact terms.
- Semantic retrieval: query tower encodes the query; product tower encodes title, b...