← Snapchat Interview Insights

Snapchat·Machine Learning Engineer·Onsite - System Design / Architecture·Senior

SeniorPrefer not to say
Jul 2026

Summary

Snapchat MLE system design round, heavy on geo and ML pipeline stuff. The question was basically one giant beast that kept spawning sub-problems every time I thought I was done. Walked away feeling okay about the spatial indexing parts but less sure about how I handled the ANN vs. learned ranking discussion.

Questions Asked (5)

Q1

Design a real-time system that surfaces the top-K points of interest within a user's current map viewport as they pan and zoom, with p95 end-to-end latency under 150ms.

System DesignTechnical Trade-offsAlgorithms & Data Structures
Author's notes

This one sprawled in every direction.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and scale, then propose a hybrid architecture combining precomputed spatial indexes (e.g., geohash or H3) with a lightweight ML ranking model that scores candidate POIs based on user context. Emphasize meeting the 150ms p95 latency through caching, parallel processing, and approximate nearest neighbor search, while discussing trade-offs between accuracy and speed.

Pro tip: Quantify the latency budget: break down the 150ms into components (e.g., 20ms for viewport query, 50ms for ML inference, 30ms for network) and show how each is optimized; this demonstrates practical system design maturity.

1. Clarify Requirements and Scale

Ask about user scale, POI density, update frequency, and definition of 'top-K' (e.g., personalized vs. popular). Establish latency and accuracy targets.

2. High-Level Architecture

Propose a client-server design with a spatial index (e.g., geohash) for fast viewport queries, a candidate generation service, and an ML ranking service. Include caching layers for frequent viewports.

3. Data and ML Pipeline

Describe how POI features and user context are used to train a ranking model (e.g., gradient boosted trees or neural network). Discuss offline training and online inference optimizations (e.g., model quantization, feature precomputation).

4. Latency Optimization

Detail techniques to meet 150ms p95: spatial indexing, approximate nearest neighbor search, parallel processing, edge caching, and model serving with low-latency frameworks (e.g., TensorFlow Serving, ONNX Runtime).

5. Trade-offs and Evaluation

Discuss trade-offs between accuracy and latency, consistency vs. freshness, and cost. Propose metrics (p95 latency, recall@K, NDCG) and A/B testing for model improvements.

Key Points to Mention

  • Spatial indexing (geohash, H3, or R-tree) for efficient viewport queries
  • Two-stage ranking: candidate generation (fast, approximate) followed by ML scoring (slower, accurate)
  • Caching strategies (client-side, CDN, in-memory) for frequently accessed viewports
  • Model optimization for low-latency inference (quantization, pruning, distillation)
  • Handling dynamic viewport changes (debouncing, prefetching adjacent tiles)
  • Monitoring and fallback mechanisms to maintain p95 latency under load

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

When would you use approximate nearest neighbor search for candidate retrieval versus a learned ranking model for re-ordering results, and how do you decide which to use?

Technical Trade-offsSystem Design
Author's notes

Honestly the part I was least prepared for.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify that approximate nearest neighbor (ANN) search and learned ranking models serve different stages of a retrieval pipeline: ANN for efficient candidate generation from large corpora, and learned ranking for precise re-ordering of a smaller candidate set. Explain that the decision hinges on scale, latency constraints, and the need for personalization, and that they are often used together in a multi-stage architecture.

Pro tip: Emphasize that ANN and ranking models are complementary, not mutually exclusive; the real trade-off is between recall and precision at different stages, and you should design the system to optimize both. Also, mention that you would monitor online metrics like CTR and engagement to continuously refine the balance.

1. Define the problem and constraints

Identify the scale of the corpus, latency requirements, and computational budget. Determine if the goal is high recall (to not miss relevant items) or high precision (to rank top items accurately).

2. Explain ANN for candidate retrieval

Describe when ANN is appropriate: large-scale retrieval (millions/billions of items), strict latency constraints (e.g., <100ms), and when approximate results are acceptable. Mention techniques like HNSW, IVF, and product quantization.

3. Explain learned ranking for re-ordering

Describe when a learned ranking model is used: after ANN retrieves a few hundred candidates, to precisely order them using rich features (user, item, context). Highlight models like GBDT, DNN, or transformers, and the need for training data and feature engineering.

4. Discuss the trade-offs and decision criteria

Compare ANN vs. ranking on dimensions: latency, accuracy, scalability, and complexity. Explain that ANN is fast but less accurate, while ranking is accurate but slower and requires more resources. The decision depends on the stage in the pipeline and business metrics.

5. Propose a hybrid multi-stage architecture

Recommend using ANN for candidate generation followed by a learned ranking model for re-ordering. This balances efficiency and accuracy. Mention the importance of tuning the number of candidates to balance recall and latency.

Key Points to Mention

  • Two-stage retrieval: candidate generation (ANN) + re-ranking (learned model)
  • ANN techniques: HNSW, IVF, PQ, and their trade-offs (speed vs. recall)
  • Learned ranking models: GBDT, DNN, transformers; feature engineering and training data
  • Latency and scalability constraints: ANN for low latency at scale, ranking for precision on smaller sets
  • Evaluation metrics: recall@k for retrieval, NDCG or CTR for ranking
  • Online experimentation (A/B testing) to decide the optimal balance and number of candidates

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

How would you handle load shedding, deduplication across tile boundaries, and pagination while the user is actively panning?

System DesignTechnical Trade-offs
Author's notes

Surprised me as a follow-up because I hadn't thought much about dedup across tiles.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by framing the problem as a real-time tile-based map system with ML-driven content, then discuss each challenge (load shedding, deduplication, pagination) in the context of user panning. Emphasize trade-offs between latency, accuracy, and resource usage, and propose a cohesive architecture that balances these concerns.

Pro tip: Mention that you would instrument the system to measure pan velocity and user engagement, using that data to dynamically adjust load shedding and prefetching strategies. This shows you think about optimizing for real-world usage patterns, not just theoretical correctness.

1. Clarify requirements and constraints

Ask about expected pan speed, tile size, ML model inference latency, and acceptable staleness. This ensures your solution aligns with Snapchat's scale and real-time expectations.

2. Design a tile-based architecture with caching

Propose a hierarchical tile system with a cache (e.g., LRU) for rendered tiles and ML predictions. Discuss how to prioritize tiles based on viewport and pan direction.

3. Implement load shedding and deduplication

For load shedding, drop low-priority tiles or use lower-fidelity ML models when under load. For deduplication, use spatial hashing or geohashing to identify overlapping content across tile boundaries and merge results.

4. Handle pagination and prefetching during panning

Use a sliding window of tiles around the viewport, prefetching in the direction of pan. For pagination, maintain a cursor or offset per tile and fetch incrementally as the user pans, avoiding redundant requests.

5. Discuss trade-offs and monitoring

Highlight trade-offs: e.g., aggressive load shedding reduces latency but may degrade ML accuracy; deduplication adds compute but saves bandwidth. Propose metrics (latency, cache hit rate, dedup ratio) to monitor and tune.

Key Points to Mention

  • Tile-based rendering and caching strategies (e.g., LRU, quadtree)
  • Load shedding techniques: dropping requests, using approximate models, or degrading quality
  • Deduplication methods: spatial hashing, geohashing, or content-based hashing across tile boundaries
  • Pagination with cursors or offsets, and prefetching based on pan velocity
  • Trade-offs between latency, accuracy, and resource consumption
  • Monitoring and dynamic adjustment using real-time metrics

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q4

How would you evaluate this system both offline and online, and what metrics would you track?

A/B Testing & ExperimentationProduct Analytics & Metrics
Author's notes

Pretty standard but I tied it back to the latency SLA which I think landed well.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the system and its objectives, then structure your answer into offline evaluation (using historical data and proxy metrics) and online evaluation (via A/B tests and real-time metrics). Emphasize the importance of aligning offline metrics with online business goals and iterating based on results.

Pro tip: At Snapchat, where engagement and virality are key, highlight metrics like Daily Active Users (DAU), time spent, and retention, and discuss how you'd handle network effects and novelty effects in A/B tests.

1. Clarify the System and Goals

Ask clarifying questions to understand the system's purpose, constraints, and what success looks like. This ensures your evaluation plan is tailored to the specific ML application.

2. Offline Evaluation

Describe how you would use historical data, cross-validation, and proxy metrics (e.g., precision, recall, AUC) to assess model performance before deployment. Mention the importance of avoiding data leakage and ensuring offline metrics correlate with online goals.

3. Online Evaluation

Explain how you would design A/B tests or interleaving experiments to measure the model's impact in production. Discuss metrics like click-through rate, conversion rate, and engagement, and how to ensure statistical significance.

4. Metrics to Track

List both offline and online metrics, including business metrics (e.g., revenue, DAU), model metrics (e.g., latency, accuracy), and guardrail metrics (e.g., crash rates, user reports). Explain how you'd prioritize them.

5. Iterate and Monitor

Emphasize continuous monitoring, detecting drift, and iterating based on feedback. Mention the importance of long-term holdout groups to measure lasting impact.

Key Points to Mention

  • Offline metrics: precision, recall, F1, AUC, RMSE, and how they relate to business KPIs.
  • Online metrics: CTR, conversion rate, DAU, time spent, retention, and engagement metrics.
  • A/B testing best practices: randomization, sample size, statistical power, and avoiding peeking.
  • Guardrail metrics: latency, error rates, user complaints, and system health.
  • Novelty and primacy effects in online experiments and how to mitigate them.
  • Long-term impact measurement using holdout groups and cohort analysis.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q5

How do you handle cold start for new POIs or new users in this system?

Technical Trade-offsSystem Design
Author's notes

Short answer: I said fallback to geo-popularity signals and region-level priors.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by acknowledging that cold start is a fundamental challenge in recommendation systems, especially for a platform like Snapchat with diverse and rapidly changing content. Then, outline a multi-pronged strategy that leverages content-based features, contextual information, and exploration techniques to provide reasonable recommendations until sufficient interaction data is collected. Emphasize the importance of balancing exploration and exploitation, and how you would measure success and iterate.

Pro tip: Show that you understand Snapchat's unique context: ephemeral content, strong social graph, and multimodal signals (images, videos, text). Mention how you could use these signals to bootstrap recommendations, e.g., using visual embeddings or social connections to infer user preferences.

1. Define the cold start problem

Clarify what constitutes a cold start for new POIs (points of interest) and new users in the system, and why it's challenging (lack of interaction data, sparsity, etc.).

2. Leverage content and context

For new POIs, use content-based features (e.g., location, category, visual features) to match with user preferences. For new users, use contextual signals (e.g., device, location, time, demographics) and onboarding information.

3. Employ exploration strategies

Use multi-armed bandits or other exploration techniques to gather feedback on new POIs and for new users, balancing exploration with exploitation to learn quickly.

4. Utilize transfer learning and meta-learning

Leverage knowledge from similar users or POIs (e.g., collaborative filtering with side information, meta-learning) to make initial predictions.

5. Monitor and iterate

Set up metrics to evaluate cold start performance (e.g., click-through rate, engagement) and continuously refine the approach based on feedback.

Key Points to Mention

  • Content-based filtering using POI attributes (location, category, visual features) and user profiles.
  • Contextual bandits for exploration-exploitation trade-off.
  • Transfer learning from similar users or POIs (e.g., using social graph or geographical proximity).
  • Hybrid models that combine collaborative filtering with side information.
  • Evaluation metrics and A/B testing to measure cold start effectiveness.
  • Snapchat-specific signals: ephemeral content, social connections, multimodal data (images, videos).

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.