Design real-time top-K POI retrieval on maps
SnapchatMachine Learning Engineer · OnsiteLast updated
This question evaluates a candidate's ability to design scalable, low-latency real-time retrieval and personalized ranking systems for geospatial data, testing competencies in spatial indexing and tiling, candidate generation versus re-ranking pipelines, caching and freshness strategies, latency and availability SLOs, deduplication and pagination, and model/ANN decision-making; the domain is ML system design for map-based POI retrieval and it assesses both high-level architectural reasoning and practical engineering trade-offs. Such problems are commonly asked to assess how an engineer balances consistency, stability and freshness under strict latency and availability targets while reasoning about operational concerns like load shedding, offline versus online evaluation, instrumentation and cost.
Design a real-time system to show the top-K points of interest (POIs) within a user’s current map viewport as they freely pan and zoom. Specify: functional and latency requirements (e.g., p95 <150 ms end-to-end), architecture (client, edge, and backend services), spatial indexing and tiling strategy (e.g., geohash, quadtrees, R-trees), candidate generation (range queries, cell unions), retrieval vs. re-ranking pipeline, caching at client/edge (tile- or viewport-level), freshness and incremental updates, and metrics. Discuss when to use approximate nearest neighbor search for candidate retrieval versus a learned ranking model for ordering; outline decision criteria (latency, recall, data sparsity, personalization) and how to combine ANN prefiltering with model-based re-ranking. Cover load shedding, pagination while panning, deduplication across tiles, cold start, evaluation (offline vs. online), and cost considerations.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.