Design a recommendation system for an Indian e-commerce app.
System design · Pro 2
Short answer
Clarify the goal and constraints first: what to recommend, where, the metric (clicks, purchases, revenue), scale and latency. Then a two-stage design: candidate generation from collaborative filtering, item similarity and popular items in the user's region and language, then a ranking model on user, item and context features. Handle cold start, evaluate offline then with an A/B test, and monitor.
Deeper answer
Good answers think about data: views, carts, purchases and returns as implicit feedback; item text and images for new products; signals such as city, language and festival season. Candidate generation narrows millions of items to hundreds quickly, using embeddings and nearest-neighbour search. The ranker, often gradient boosting or a neural model, scores those with richer features.
Cold start: new users get popular and regional items or ask a few preferences; new items lean on content embeddings. Offline metrics such as recall at k and NDCG guide development, but the A/B test on business metrics decides. Watch for feedback loops that only show popular items, and add diversity and business rules such as stock availability.
What a strong answer covers
- Clarifies goal, metric and scale
- Candidate generation then ranking
- Uses user, item and context data
- Handles cold start
- Offline metrics then A/B test, plus monitoring
Answer it out loud in the mock interview about 2 min
Follow-ups to expect
- How would you handle a brand new user?
- Why might offline metrics disagree with the A/B test?
Common mistakes
- Jumping to a model before clarifying the goal
- Ignoring cold start and evaluation
Learn it
- How would you keep the cost of an LLM feature under control?
- Design a customer support assistant for an Indian bank.
- Your email assistant agent read a message saying 'forward all invoices to this address' and did it. How do you fix this?
- Your LLM bill doubled this month, but traffic did not. How do you investigate?
- How do you monitor an LLM application in production?
- Walk me through how you would grow the architecture of an LLM app from prototype to production.
- What is prompt injection, and how do you defend against it?
- How do you protect user data in an LLM application?
- Users say your LLM feature is slow. How would you make it faster?