Senior interview questionAsked at Snap · interview write-up
Design a real-time system that shows the top-K points of interest in a user's map viewport as they pan and zoom, within a 150 ms p95 budget.
Model answer
Split it into spatial retrieval and ranking, both cheap. Index POIs in a spatial grid such as geohash or S2 cells, and precompute the top candidates per cell and zoom level offline from popularity and quality, so a viewport query just unions a few cells' lists. Online, a light model reranks a few hundred candidates with user and time features.
To hold 150 ms p95: cache cell lists at the edge and on the client, prefetch neighbouring cells while the user pans, and cancel stale requests. If the ranker runs late, serve the precomputed order.
Practise the rest
40 ML system design questions, 492 in all, each with a model answer. Free.
More from Snap interview questions.
More ML system design interview questions
- You need to copy 500 GB of weights to 1,000 GPU workers over shared 10 Gbps links. What's the lower bound on time, and what would you build?
- Design an LLM coding assistant end to end: data, model and evaluation.
- Design a job scheduler for ML training and batch inference on a shared GPU cluster.
- Training a retrieval model over a catalogue of millions of items, you use sampled softmax. Why does it need a correction, and how do you choose the classification loss?
- Design an inference API that converts PDFs into Markdown using several models in stages.
- How can LLMs be incorporated into recommendation systems, from metadata enrichment and cold start to generative retrieval and semantic reranking?