Design real-time top-K POI retrieval on maps

Quick Overview

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 real-time top-K POI retrieval on maps

Company: Snapchat

Role: Machine Learning Engineer

Category: ML System Design

Difficulty: hard

Interview Round: Onsite

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.

Quick Answer: 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.

|Home/ML System Design/Snapchat
Snapchat logo
Snapchat
Sep 6, 2025, 12:00 AM
hardMachine Learning EngineerOnsiteML System Design
7
0

Real-Time Top-K POIs in Viewport: System Design

Context

Design a real-time system for a mobile map that continuously shows the top-K points of interest (POIs) within the user’s current viewport as they pan and zoom. The system must feel instant, remain stable while the viewport moves, and support personalization.

Requirements

Functional

  1. Return top-K POIs for the current viewport rectangle and zoom level, with stable ordering during small pans/zooms.
  2. Support filters (e.g., category, open-now), and pagination/infinite scroll for lists.
  3. Deduplicate POIs across tiles and avoid flicker when moving.
  4. Personalize ordering per user when available; provide sensible defaults for cold start.

Latency/SLOs

  • End-to-end p95 latency < 150 ms (from gesture end to POIs rendered), p99 < 250 ms.
  • Freshness: most POI attribute updates visible within 1–5 minutes; critical updates (closures) < 30 seconds.
  • Availability ≥ 99.9%.

Specify

  • Architecture across client, edge, and backend services.
  • Spatial indexing and tiling strategy (e.g., quadtree/S2, R-tree), cell covering, and range queries.
  • Candidate generation and cell unions.
  • Retrieval vs. re-ranking pipeline.
  • Caching (client/edge): tile-level and viewport-level.
  • Freshness and incremental updates.
  • Metrics (latency, quality, stability, freshness, cost).
  • When to use approximate nearest neighbor (ANN) for retrieval vs. learned models for ranking; decision criteria and hybrid approach.
  • Load shedding, pagination while panning, dedup across tiles, cold start, offline vs. online evaluation, and cost considerations.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...