Design a search ranking system
PremiumML systemMedium
- Learning to rank
- NDCG
- Position bias
Quick answer
This ML system interview question asks you to design a search ranking system. Aim for a design that turns data into useful predictions in production, then explain the data, training, serving and monitoring. Interviewers want to see how you frame the problem, measure success and keep the model healthy after launch.
The problem
Design a search ranking system for a large online marketplace like Amazon or eBay: for each query, find and order the products a shopper is most likely to buy. The hard parts are ranking millions of matches in a few hundred milliseconds and learning from clicks that are biased by the order you showed.
Shoppers type short queries such as "running shoes men" or "usb c cable 2m". The system retrieves matching products, ranks them and shows 48 results per page. Most revenue comes from the first page, and many queries are rare ones that have never been seen before.
What must a search ranking system do?
- Ranked results: Return the top 48 products for a query, with filters such as price and brand applied.
- Rare queries: Return relevant results for queries never seen before, including synonyms ("sneakers" for "trainers").
How well must it do it?
- Latency: 300 ms p99 from query to ranked results.
- Relevance: NDCG@10 on human-judged queries must not drop for any release.
What scale should you design for?
Use these numbers in your estimates.
The scale numbers unlock with this questionUnlock
Key concepts
- Learning to rank
- NDCG
- Position bias
- Multi stage ranking
- Semantic retrieval
- BM25
How you’ll practise
- Problem framing
- Data and labels
- Features and model
- Training and evaluation
- Serving and monitoring
- Wrap-up
Lala, personalized to you, gives a hint when you ask and reviews your design when you are ready.
What do interviewers look for?
In any ML system design round.
- Frames the product goal as a clear ML problem
- Defines offline and online success metrics
- Explains where the data and labels come from
- Separates training from serving and keeps features consistent
- Plans for drift, retraining and rollbacks
- Weighs model quality against latency and cost
Questions people ask about this interview question
- Which design type is this question?
- It is an ML system question. You design a search ranking system and explain your choices the way you would in an interview.
- Is this question asked at entry level?
- It is marked Medium. Entry-level engineers can practise it, but it expects you to reason about requirements and trade-offs, not only list components.
- What should I cover first?
- Start with the product goal, how success is measured and what data is available. Agree on scope with the interviewer before you design anything.
- Can I practise it for free?
- It is a premium question. Sign up and unlock it once for 10 credits; it then stays unlocked. When you finish, Lala, your personalized AI mentor, can review your design for 30 credits.
Related questions
Updated · Written by the SevyDevy team