As asked
Design the end-to-end architecture for a recommendation system that must surface the best 20 items from a catalog of 50 million, with sub-100ms total latency.
Sample answer outline
Stage 1 retrieval uses approximate nearest neighbor search with FAISS or ScaNN over user and item embeddings, returning 1,000 candidates in under 10ms. Stage 2 ranking uses a deeper model with interaction features computed on the 1,000 candidates, running in under 50ms on GPU. The retrieval index is rebuilt nightly and served from memory. User embeddings are precomputed and stored in a feature store. The serving graph materializes fresh context features per request and feeds them to both stages.
Expect these follow-ups
- How do you ensure fresh embeddings for a new user who signed up 10 minutes ago?
- What would you change in this design to support diversity constraints in the final 20 results?