← Google Interview Insights

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

SeniorPrefer not to say
Jul 2026

Summary

Machine learning system design round at Google for an MLE role. The whole thing was one big open-ended design question about building a real-time recommendation system, and they expected you to drive the conversation across a lot of different dimensions.

Questions Asked (7)

Q1

Design a real-time recommendation system for a large-scale mobile app that serves personalized results to millions of daily active users with sub-100ms P95 latency.

System DesignTechnical Trade-offs
Author's notes

This was the entire interview, basically.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Begin by clarifying requirements and constraints (scale, latency budget, freshness needs), then architect the system in layers: offline model training, near-line feature computation, and online serving with pre-computed candidates. Explicitly discuss trade-offs at each layer to demonstrate engineering maturity rather than just listing components.

Pro tip: Google interviewers reward candidates who proactively identify the tension between model complexity and serving latency — show you understand that a two-tower retrieval model with ANN search plus a lightweight ranking model is often superior to a single heavy model, and explain why.

1. Clarify Requirements & Define Constraints

Pin down scale (DAU, QPS, catalog size), latency budget breakdown (retrieval vs. ranking), acceptable staleness of recommendations, and personalization depth. This signals structured thinking and prevents designing the wrong system.

2. Design the Offline Training Pipeline

Describe batch model training using distributed frameworks (e.g., TensorFlow/JAX on TPUs), covering candidate generation models (two-tower, matrix factorization) and ranking models (gradient boosted trees or deep neural nets). Discuss feature engineering, training data pipelines, and model versioning.

3. Build the Near-Line Feature & Embedding Store

Explain how user and item embeddings are pre-computed and stored in a low-latency vector store (e.g., ScaNN, Vertex AI Matching Engine) and how real-time user signals (clicks, dwell time) are streamed via Pub/Sub into a feature store (e.g., Redis, Bigtable) to keep context fresh without blocking serving.

4. Design the Online Serving Architecture

Walk through the request path: ANN retrieval (~10ms) → lightweight re-ranking model (~20ms) → business logic filters → response, all within the 100ms P95 budget. Highlight the use of model quantization, request batching, and co-locating the serving binary with the feature store to minimize network hops.

5. Address Reliability, Monitoring & Iteration

Discuss fallback strategies (popularity-based defaults if personalization fails), A/B testing infrastructure for model rollouts, and key metrics to monitor (CTR, NDCG, latency percentiles, feature freshness lag). Mention canary deployments and shadow scoring to safely ship model updates.

Key Points to Mention

  • Two-stage retrieval + ranking architecture: ANN-based candidate retrieval (two-tower model) followed by a more expensive pointwise or listwise ranking model to balance quality and latency
  • Latency budget decomposition: explicitly allocate the 100ms across retrieval, feature fetch, ranking, and network overhead to show you reason about end-to-end latency holistically
  • Approximate Nearest Neighbor (ANN) search: tools like ScaNN or FAISS with quantized embeddings to achieve sub-10ms retrieval over billions of items
  • Real-time feature freshness vs. consistency trade-off: streaming pipelines (Pub/Sub + Dataflow) for session-level signals vs. batch pipelines for stable user history features
  • Model serving optimizations: quantization (INT8), TensorRT/XLA compilation, request batching, and hardware accelerators (GPUs/TPUs) to meet strict latency SLAs at scale
  • Feedback loops and training data quality: handling position bias, exposure bias, and delayed reward signals (e.g., watch time) when constructing training labels from logged user interactions

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

Q2

How would you design the feature store to ensure consistency between offline training and online inference?

System DesignData Modeling
Author's notes

This tripped me up more than it should have.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Frame your answer around the core training-serving skew problem, then systematically walk through architectural decisions that enforce consistency at the data, compute, and serving layers. Demonstrate awareness of both the technical tradeoffs (latency vs. consistency, batch vs. streaming) and operational concerns like monitoring and versioning that Google-scale systems demand.

Pro tip: Mention point-in-time correctness (also called 'time travel' queries) explicitly — this is a subtle but critical concept that separates senior candidates from junior ones, as it prevents label leakage during training while ensuring the offline feature values match what would have been served online at that exact timestamp.

1. Define the Core Problem

Articulate training-serving skew clearly: offline training uses historical batch data while online inference uses real-time data, and any divergence in feature computation logic or data distributions causes model degradation. Establish that the goal is a single source of truth for feature definitions and values.

2. Unified Feature Computation Layer

Propose a shared feature transformation pipeline (e.g., using Apache Beam or Spark) that runs both in batch mode for offline training and in streaming mode for online serving, ensuring the same business logic is applied in both paths. Discuss using a feature registry to version and govern feature definitions centrally.

3. Dual Storage Architecture

Design an offline store (e.g., BigQuery, Parquet on GCS) for historical feature retrieval during training and an online store (e.g., Bigtable, Redis) for low-latency serving during inference. Explain how writes to both stores are coordinated — typically via a materialization job — to keep them in sync.

4. Point-in-Time Correctness & Versioning

Implement time-travel queries in the offline store so training datasets retrieve feature values as they existed at the label timestamp, preventing data leakage. Version features and models together so a deployed model always references the exact feature schema it was trained on.

5. Monitoring & Drift Detection

Build observability into both stores by logging online feature distributions and comparing them against offline training distributions using statistical tests (e.g., KL divergence, PSI). Set up automated alerts for schema mismatches, null rate changes, or distribution drift to catch skew before it impacts model performance.

Key Points to Mention

  • Training-serving skew and its root causes (logic divergence, data pipeline differences, temporal leakage)
  • Point-in-time correctness / time-travel queries to prevent label leakage during training dataset generation
  • Unified transformation logic shared between batch and streaming pipelines (e.g., Apache Beam for portability)
  • Feature registry for centralized versioning, lineage tracking, and governance of feature definitions
  • Dual-store architecture: offline store for training (BigQuery/Parquet) and online store for serving (Bigtable/Redis) with coordinated materialization
  • Continuous monitoring for feature drift, schema validation, and statistical distribution comparison between offline and online feature values

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

Q3

Walk me through how you'd handle cold start for both new users and new items.

System DesignTechnical Trade-offs
Author's notes

Felt okay here.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Frame your answer by clearly distinguishing the two cold start scenarios (new users vs. new items) and then systematically walk through both short-term fallback strategies and long-term learning mechanisms for each. Ground your discussion in real system constraints like latency, data sparsity, and exploration-exploitation trade-offs. Conclude by mentioning how you'd measure success and iterate on the solution.

Pro tip: Interviewers at Google love when candidates acknowledge that cold start is not a one-time fix but an ongoing system design challenge — mention how you'd instrument the system to detect cold start degradation and set up feedback loops to accelerate warm-up, which signals production-level thinking.

1. Define the Problem Scope

Clarify what 'cold start' means in the specific system context — new users with no interaction history and new items with no engagement signals. Briefly state why this is hard: collaborative filtering breaks down without historical data, and content-based signals alone are often insufficient.

2. New User Cold Start Strategies

Discuss layered approaches: start with non-personalized popularity-based or trending recommendations, then leverage onboarding signals (explicit preferences, demographics, referral source) to bootstrap a user profile. Mention using transfer learning or cross-domain signals if available (e.g., Google account activity).

3. New Item Cold Start Strategies

Explain how to represent new items using content-based features (text embeddings, metadata, category tags) to place them in the existing embedding space without interaction data. Discuss item-side exploration strategies like forced exposure, publisher-boosted slots, or bandit-based injection to rapidly collect feedback signals.

4. Exploration-Exploitation Trade-offs

Introduce bandit algorithms (e.g., Thompson Sampling, UCB) as a principled way to balance showing new users/items to gather signal while minimizing user experience degradation. Highlight how the exploration budget can be tuned based on business constraints and confidence thresholds.

5. Measurement and Graduation Criteria

Define how you'd know when a user or item has 'graduated' from cold start — e.g., a minimum number of interactions or a confidence threshold on embeddings. Describe the metrics you'd track: CTR lift, engagement rate for new items, and retention or satisfaction scores for new users.

Key Points to Mention

  • Content-based and metadata-driven feature representations as a fallback when collaborative signals are absent
  • Onboarding flows and explicit preference elicitation to accelerate new user profiling
  • Bandit algorithms (Thompson Sampling, UCB) for principled exploration of new users and items
  • Hybrid models that blend collaborative filtering with content-based signals, weighted by data availability
  • Embedding initialization strategies for new items — e.g., averaging similar item embeddings or using a side-information encoder
  • Monitoring and feedback loops to detect cold start degradation and measure warm-up velocity

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

Q4

Given a strict latency budget, where would you use caching in the serving path and what TTL and consistency strategies would you apply?

System DesignTechnical Trade-offs
Author's notes

Talked through result-level caching for non-personalized surfaces, user embedding caching with short TTLs, and pre-computed candidate sets refreshed nearline.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by mapping the ML serving path end-to-end (feature retrieval, model inference, post-processing, response assembly) and identify latency hotspots at each layer before proposing targeted caching strategies. For each cache placement, explicitly justify the TTL and consistency trade-off in terms of staleness tolerance, cache hit rate, and the business/model accuracy impact of serving stale data.

Pro tip: Google interviewers reward candidates who quantify trade-offs — mention concrete numbers like p99 latency targets, expected cache hit rates, and staleness windows (e.g., 'user embeddings can tolerate 5-minute staleness with a 95% hit rate, saving ~40ms per request'), which signals production-level thinking rather than theoretical knowledge.

1. Decompose the Serving Path

Walk through each stage of the ML pipeline: feature retrieval (online store lookups), model inference (forward pass), post-processing (ranking, filtering), and response serialization. Identify which stages are the latency bottlenecks and which have cacheable outputs.

2. Identify Cache Placement Opportunities

Propose caching at multiple layers: feature caches (e.g., user/item embeddings in Redis), inference result caches (for repeated or near-duplicate inputs), and response-level caches (for popular or deterministic queries). Justify each placement by its expected hit rate and latency savings.

3. Define TTL Strategy per Layer

Assign TTLs based on data volatility and staleness tolerance — short TTLs (seconds to minutes) for rapidly changing features like real-time signals, longer TTLs (hours) for slowly changing embeddings or item metadata. Discuss how TTL interacts with model retraining cadence.

4. Address Consistency and Invalidation

Discuss consistency strategies such as write-through vs. write-behind, event-driven invalidation (e.g., Pub/Sub on feature updates), and versioned cache keys tied to model versions to prevent serving stale predictions after a model rollout.

5. Quantify Trade-offs and Failure Modes

Explicitly state the trade-off between latency gains and model quality degradation from stale data, and address failure scenarios like cache stampedes (use probabilistic early expiration or request coalescing) and cold-start misses (pre-warming strategies).

Key Points to Mention

  • Multi-layer caching: feature store cache (e.g., Redis/Memcached), inference result cache, and CDN/response-level cache for deterministic outputs
  • TTL calibration tied to data volatility — distinguish between real-time signals (low TTL), user embeddings (medium TTL), and static item metadata (high TTL)
  • Cache invalidation strategies: event-driven invalidation via Pub/Sub, versioned cache keys for model version alignment, and write-through vs. lazy expiration trade-offs
  • Cache stampede prevention using techniques like probabilistic early expiration (PER), request coalescing/mutex locks, or background refresh
  • Cold-start and pre-warming strategies to ensure cache readiness at model deployment or traffic spikes
  • Monitoring and observability: tracking cache hit rate, latency percentiles (p50/p99), and staleness impact on downstream metrics like CTR or ranking quality

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

Q5

What offline and online metrics would you track, and how would you set up experiments to evaluate the recommender?

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

Standard territory.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Structure your answer by first separating offline metrics (used during model development) from online metrics (used in live experiments), then explain how they connect to business goals. Demonstrate that you understand the limitations of each metric type and why both are necessary for a robust evaluation pipeline.

Pro tip: Impress interviewers by acknowledging the 'proxy metric trap' — offline metrics like NDCG or precision@k often don't correlate perfectly with online business metrics like revenue or retention, and mentioning this gap shows senior-level thinking about real-world ML deployment.

1. Define Offline Metrics

Start by listing ranking and relevance metrics such as NDCG, MAP, Precision@k, Recall@k, and MRR that can be computed on held-out datasets. Explain that these enable fast, cheap iteration during model development before any user exposure.

2. Define Online Metrics

Identify user-behavior and business metrics like CTR, conversion rate, session length, revenue per user, and long-term retention that reflect real user satisfaction. Distinguish between guardrail metrics (e.g., latency, diversity) and primary success metrics.

3. Design the A/B Experiment

Describe the experiment setup: randomized user-level or query-level splitting, control vs. treatment assignment, and the need for a holdout group. Address statistical considerations like sample size calculation, power analysis, and minimum detectable effect.

4. Address Experimentation Challenges

Highlight pitfalls specific to recommender systems such as novelty bias, network effects, and position bias that can confound results. Mention techniques like interleaving experiments or counterfactual evaluation to complement standard A/B tests.

5. Connect Metrics to Business Goals

Tie the evaluation framework back to the product objective — for example, balancing short-term engagement (CTR) against long-term user satisfaction (retention, diversity). Explain how you would use a metric hierarchy to make launch decisions.

Key Points to Mention

  • Offline ranking metrics: NDCG, MAP, Precision@k, Recall@k, and MRR — and their limitations as proxies for real user behavior
  • Online metrics hierarchy: primary metrics (CTR, conversion, revenue), secondary metrics (session depth, return rate), and guardrail metrics (latency, diversity, fairness)
  • Statistical rigor: power analysis, sample size estimation, significance thresholds, and runtime to avoid peeking problems
  • Recommender-specific experiment challenges: position bias, popularity bias, novelty effects, and cold-start users skewing results
  • Advanced evaluation techniques: interleaving (team-draft or balanced), counterfactual/off-policy evaluation using logged data, and holdout-based long-term measurement
  • Long-term vs. short-term metric trade-offs: optimizing CTR can hurt retention if recommendations feel clickbaity, so monitoring ecosystem health metrics is critical

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

Q6

How would you design the system to degrade gracefully if the model server is slow or unavailable?

System DesignTechnical Trade-offs
Author's notes

Answered this quickly: fallback to cached results, then popularity-based recommendations, then a lightweight rule-based system.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Frame your answer around the principle of graceful degradation by layering fallback strategies from fastest to slowest, ensuring the system remains functional even under partial failure. Start by identifying the failure modes (latency spikes vs. full unavailability), then walk through a tiered defense strategy that balances user experience, data freshness, and system complexity. Demonstrate awareness of real-world trade-offs between consistency, availability, and performance.

Pro tip: Google interviewers value candidates who think in terms of SLOs and SLAs — explicitly mention how you'd define acceptable degradation thresholds (e.g., p99 latency budgets, error budgets) and how observability/alerting ties into your design, as this shows production-grade thinking beyond just the happy path.

1. Define Failure Modes & SLOs

Distinguish between slow responses (high latency) and full unavailability, and establish clear SLO thresholds (e.g., timeout after 200ms) that trigger fallback behavior. This scopes the problem and shows structured thinking before jumping to solutions.

2. Implement Circuit Breakers & Timeouts

Wrap all model server calls with strict timeouts and a circuit breaker pattern that opens after a configurable failure rate, preventing cascading failures and fast-failing requests instead of queuing them indefinitely. Mention libraries or patterns like Hystrix or Google's own internal equivalents.

3. Design a Fallback Hierarchy

Define a tiered fallback strategy: first try a cached prediction (Redis/Memcached), then fall back to a lightweight local model or heuristic rule, and finally serve a safe default response. Each tier trades freshness/accuracy for availability and latency.

4. Add Caching & Precomputation

Cache recent or high-frequency predictions at the serving layer so that a model outage doesn't immediately impact users with common inputs. For batch-friendly use cases, precompute and store predictions asynchronously to decouple serving from inference.

5. Observability, Alerting & Recovery

Instrument the system with metrics (error rate, latency percentiles, fallback trigger rate) and set up alerts so on-call engineers are notified immediately. Include a strategy for graceful recovery — e.g., gradually re-routing traffic back to the model server once it stabilizes (canary re-enablement).

Key Points to Mention

  • Circuit breaker pattern with configurable thresholds to prevent cascading failures
  • Tiered fallback strategy: cached predictions → lightweight/local model → rule-based heuristics → safe defaults
  • Timeout budgets aligned with overall request SLOs (e.g., model call capped at a fraction of total latency budget)
  • Prediction caching (in-memory or distributed cache like Redis) for high-frequency or repeated inputs
  • Observability: tracking fallback rate as a key metric to detect and alert on model server degradation
  • Trade-off transparency: explicitly acknowledging that fallbacks sacrifice accuracy/freshness for availability, and how to communicate this to stakeholders

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

Q7

Propose a baseline model and then a more advanced ranking model, and explain why you'd structure it as candidate generation followed by ranking.

System DesignAlgorithms & Data Structures
Author's notes

Started with collaborative filtering as a baseline, then two-tower neural retrieval for candidate generation, then a cross-feature deep ranking model.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Structure your answer by first grounding the two-stage architecture in real-world scalability constraints, then walk through a concrete baseline model (e.g., collaborative filtering or BM25) before proposing an advanced ranker (e.g., a neural pointwise/pairwise/listwise model). Tie every design decision back to the trade-off between computational cost and ranking quality to show engineering maturity.

Pro tip: Explicitly quantify the scale problem upfront — e.g., 'ranking 1 billion items in under 100ms is infeasible, so candidate generation reduces the pool to ~1,000 items' — this signals you understand why the two-stage paradigm exists at Google-scale, not just that it exists.

1. Motivate the Two-Stage Architecture

Explain the core tension: exhaustive ranking over millions of items is computationally prohibitive at inference time. Candidate generation (retrieval) narrows the corpus to a manageable set so the ranker can apply expensive, high-quality features only where it matters.

2. Propose a Baseline Model

Describe a simple, interpretable retrieval + ranking baseline — for example, ANN search over user/item embeddings from matrix factorization (e.g., SVD or implicit ALS) for retrieval, followed by a logistic regression ranker using hand-crafted features like CTR, recency, and popularity. Highlight why this is a strong starting point: fast to train, easy to debug, and provides a clear performance floor.

3. Propose an Advanced Model

Upgrade retrieval to a dual-encoder (two-tower) neural network trained with in-batch negatives, enabling semantic matching beyond keyword overlap. Upgrade the ranker to a deep neural network (e.g., DCN-v2 or a transformer-based model) that ingests dense embeddings, sparse features, and cross-feature interactions, trained with a listwise loss like LambdaRank or softmax cross-entropy.

4. Explain Feature and Training Differences Between Stages

Clarify that the retrieval stage must use only features computable offline or via fast ANN lookup, while the ranker can afford expensive real-time features (user context, query-item interaction signals, freshness). Discuss how training objectives differ: retrieval optimizes recall@K, while ranking optimizes NDCG or MAP.

5. Address Trade-offs, Failure Modes, and Iteration Path

Acknowledge key risks such as retrieval recall ceiling (items not retrieved can never be ranked), training-serving skew, and feedback loops from logged data. Propose mitigations like hard negative mining, exploration strategies (epsilon-greedy or contextual bandits), and offline/online evaluation metrics (NDCG offline, A/B CTR/engagement online).

Key Points to Mention

  • Two-tower / dual-encoder architecture for scalable retrieval with approximate nearest neighbor (ANN) search (e.g., ScaNN, FAISS)
  • Distinction between retrieval objective (recall@K) and ranking objective (NDCG, MAP, or pairwise AUC) and how they require different loss functions
  • Feature asymmetry: lightweight features at retrieval vs. rich, expensive cross-features (e.g., feature crosses, attention over history) at ranking
  • Hard negative mining and in-batch negatives to improve embedding quality in the two-tower model
  • Listwise ranking losses (LambdaRank, softmax cross-entropy) vs. pointwise (binary cross-entropy) and their impact on ranking quality
  • Online evaluation strategy: shadow mode testing, A/B experiments, and guardrail metrics (latency, diversity, fairness) alongside engagement metrics

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