← Waymo Interview Insights

Waymo·Data Scientist·Technical Phone Screen·Senior

Senior
Jul 2026

Summary

Waymo data scientist interview with two pretty distinct sections: one on K-means from scratch and one on multi-agent trajectory prediction that got pretty deep into transformer architectures and training-inference mismatch. The ML modeling half felt more like a research discussion than a standard DS interview.

Questions Asked (6)

Q1

Explain what objective K-means optimizes and walk through how the alternating optimization procedure works.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

Pretty standard setup question but I fumbled the formal objective a bit.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by stating the objective function that K-means minimizes: the sum of squared distances between each point and its assigned cluster centroid. Then explain the alternating optimization procedure: first assign each point to the nearest centroid, then update each centroid to the mean of its assigned points, and repeat until convergence. Emphasize that this is a coordinate descent algorithm that monotonically decreases the objective and converges to a local minimum.

Pro tip: Mention that K-means assumes spherical clusters of similar size and is sensitive to initialization, so in practice you'd use K-means++ or multiple restarts; this shows awareness of practical limitations beyond the basic algorithm.

1. Define the objective

State that K-means minimizes the within-cluster sum of squares (WCSS), i.e., the sum over all clusters of the squared Euclidean distances between points and their cluster centroid.

2. Describe the assignment step

Explain that given current centroids, each data point is assigned to the cluster whose centroid is closest (typically Euclidean distance), which minimizes the objective with respect to assignments.

3. Describe the update step

Explain that given current assignments, each centroid is recomputed as the mean of all points assigned to it, which minimizes the objective with respect to centroids.

4. Explain the alternation and convergence

Highlight that these two steps are repeated alternately until assignments no longer change or a maximum number of iterations is reached; each step decreases or maintains the objective, guaranteeing convergence to a local minimum.

5. Discuss properties and caveats

Mention that the algorithm is sensitive to initialization and may converge to different local minima; techniques like K-means++ or multiple restarts help mitigate this.

Key Points to Mention

  • Objective: minimize sum of squared Euclidean distances between points and their assigned centroids (WCSS).
  • Alternating optimization: assignment step (E-step) and update step (M-step) akin to EM for Gaussian mixtures with fixed spherical covariance.
  • Convergence: monotonic decrease of objective, but only to a local minimum; no guarantee of global optimum.
  • Complexity: O(n * k * d * t) where n is number of points, k clusters, d dimensions, t iterations.
  • Initialization sensitivity: random initialization can lead to poor clusters; K-means++ improves seeding.
  • Assumptions: clusters are roughly spherical, similar size, and well-separated; not suitable for arbitrary shapes.

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

Q2

Implement K-means (Lloyd's algorithm) from scratch, including centroid initialization, the assignment and update steps, and a stopping condition.

Algorithms & Data Structures
Author's notes

Got through it but my empty cluster handling was hand-wavy.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem and assumptions, then outline the algorithm's steps: initialization, assignment, update, and convergence check. Write clean, modular code with clear variable names and discuss time complexity and potential pitfalls.

Pro tip: Mention that K-means is sensitive to initialization and suggest K-means++ as a robust alternative, showing awareness of practical improvements. Also, discuss how to handle empty clusters and choose k, demonstrating real-world experience.

1. Clarify requirements and assumptions

Ask about input format, distance metric (usually Euclidean), stopping criteria (e.g., max iterations, tolerance), and whether to implement K-means++ or random initialization.

2. Initialize centroids

Randomly select k data points as initial centroids, or implement K-means++ for better initialization. Explain the chosen method and its impact.

3. Assignment step

For each data point, compute distance to each centroid and assign it to the nearest one. Efficiently vectorize if using NumPy.

4. Update step

Recompute each centroid as the mean of all points assigned to it. Handle empty clusters by reassigning or reinitializing.

5. Check stopping condition

Repeat assignment and update until centroids change less than a tolerance or a maximum number of iterations is reached. Return final centroids and labels.

Key Points to Mention

  • Distance metric: Euclidean distance is standard; mention other metrics if relevant.
  • Convergence: K-means always converges, but may converge to local optimum.
  • Time complexity: O(n * k * d * i) where n is number of points, k clusters, d dimensions, i iterations.
  • Initialization methods: random vs. K-means++; discuss trade-offs.
  • Handling empty clusters: strategies like reassigning to farthest point or reinitializing.
  • Choosing k: elbow method, silhouette score, or domain knowledge.

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

Q3

Describe and implement a better centroid initialization strategy than random initialization.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

K-means++ was clearly what they wanted and I knew it.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by explaining the limitations of random initialization (e.g., poor convergence, empty clusters) and then introduce k-means++ as a superior strategy. Describe the algorithm step-by-step, emphasizing the probabilistic selection of centroids based on distance. Finally, implement it in code (e.g., Python) and discuss trade-offs like computational overhead and improved clustering quality.

Pro tip: Mention that k-means++ is the default in scikit-learn and is widely used in industry, but also note that for very large datasets, approximate variants or sampling can be used to reduce overhead. This shows awareness of practical constraints.

1. Explain the problem with random initialization

Discuss how random initialization can lead to suboptimal clustering, slow convergence, and empty clusters. Highlight that it's sensitive to initial seed.

2. Introduce k-means++ as a better strategy

Describe k-means++: it selects initial centroids sequentially, each with probability proportional to its squared distance from the nearest existing centroid. This spreads centroids out.

3. Detail the algorithm steps

Walk through: 1) Choose first centroid uniformly at random. 2) For each subsequent centroid, compute D(x)^2 for each point (distance to nearest centroid) and select with probability proportional to D(x)^2. 3) Repeat until k centroids chosen. 4) Proceed with standard k-means.

4. Implement in code

Provide a concise Python implementation using NumPy, showing the selection loop and distance calculations. Optionally, mention using scikit-learn's KMeans with init='k-means++'.

5. Discuss trade-offs and alternatives

Compare k-means++ to random: better quality but O(k) extra passes over data. Mention other strategies like k-means|| (parallel) or hierarchical initialization for large-scale data.

Key Points to Mention

  • Random initialization can lead to poor local minima and empty clusters.
  • k-means++ selects centroids far apart, improving convergence and cluster quality.
  • The algorithm is probabilistic and requires computing distances to nearest centroid for each point.
  • Implementation complexity is O(k * n * d) per iteration, but often worth it.
  • k-means++ is the default in scikit-learn and widely adopted.
  • For big data, approximate methods like k-means|| or sampling can be used.

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

Q4

Propose an ML approach to predict the next 2 positions of a target vehicle given its past trajectory, nearby agent trajectories, and map context. Cover input representation, architecture, output parameterization, and loss/metrics.

System DesignTechnical Trade-offsData Modeling
Author's notes

This is where the interview shifted gears completely.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Structure your answer around a multimodal trajectory prediction pipeline: encode scene elements (target, agents, map) with a graph or transformer, fuse them into a shared representation, and decode a distribution over future trajectories. Emphasize how each design choice (input representation, architecture, output parameterization, loss) addresses multimodality, social interaction, and map constraints.

Pro tip: Anchor your answer in Waymo's real-world constraints: latency, safety, and interpretability. Mention that you'd start with a strong baseline (e.g., constant velocity) and iterate, and that you'd evaluate with both minADE/minFDE and miss rate to capture multimodality.

1. Clarify scope and assumptions

Confirm the prediction horizon (2 positions, e.g., 1s and 2s ahead), coordinate frame (agent-centric vs. global), and available inputs (past trajectories, map, agent types). State that you'll assume a fixed time step and that the target's past is observed.

2. Design input representation

Represent each agent's past as a sequence of positions/velocities; encode map as polylines or raster; include agent attributes (type, size). Use a graph or set-based representation to handle variable numbers of agents and map elements.

3. Choose architecture and fusion

Propose an encoder-decoder architecture: e.g., a transformer or graph neural network to encode agents and map, with attention-based fusion to model social interactions and map compliance. The decoder outputs a set of future trajectories with probabilities.

4. Define output parameterization

Output a multimodal distribution: K trajectory hypotheses, each with a probability and a sequence of 2 future positions (or parameters of a distribution per step). This captures uncertainty and multiple possible futures.

5. Specify loss and metrics

Use a multi-task loss: classification (probability of each mode) + regression (e.g., negative log-likelihood or Huber loss on positions). Evaluate with minADE/minFDE over K modes, miss rate, and probability-weighted metrics to assess calibration.

Key Points to Mention

  • Multimodality: predicting a distribution over futures, not a single trajectory, using K modes with probabilities.
  • Social interaction modeling: attention or graph networks to capture agent-agent interactions and right-of-way.
  • Map context: encoding lane geometry, traffic controls, and drivable area to constrain predictions.
  • Output parameterization: mixture of Gaussians or direct trajectory regression with mode probabilities.
  • Loss functions: winner-takes-all or negative log-likelihood for multimodal outputs, plus auxiliary losses.
  • Evaluation metrics: minADE/minFDE, miss rate, and calibration (e.g., probability-weighted metrics) to measure both accuracy and uncertainty.

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

Q5

Explain what multi-head attention is doing in the context of multi-agent trajectory prediction and why it's useful there.

Technical Trade-offsSystem Design
Author's notes

Explained it as learning multiple different 'relationship types' between agents simultaneously, so one head might capture following behavior, another lane-sharing dynamics, etc.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining multi-head attention as a mechanism that allows the model to jointly attend to information from different representation subspaces at different positions. Then explain how in multi-agent trajectory prediction, it enables each agent to selectively focus on relevant other agents and past timesteps, capturing complex social interactions. Conclude by highlighting why this is useful: it improves accuracy by modeling diverse interaction types and scales to many agents.

Pro tip: Emphasize that multi-head attention is not just about performance but also about interpretability—you can visualize attention heads to understand which agents influence each other, which is crucial for safety-critical systems like autonomous driving.

1. Define multi-head attention

Explain that it runs multiple attention mechanisms in parallel, each with its own learned query, key, and value projections, allowing the model to capture different types of relationships.

2. Contextualize in multi-agent trajectory prediction

Describe how each agent's future trajectory depends on its own history and the behavior of other agents; multi-head attention lets the model weigh these dependencies dynamically.

3. Explain the benefits

Discuss how multiple heads capture diverse interaction patterns (e.g., yielding, overtaking, following) and how attention handles variable numbers of agents without fixed adjacency matrices.

4. Connect to system design and trade-offs

Mention computational complexity (quadratic in number of agents) and how techniques like sparse attention or clustering can mitigate it, balancing accuracy and efficiency.

Key Points to Mention

  • Multi-head attention allows parallel processing of different relationship types (e.g., spatial, temporal, social).
  • It dynamically weights the influence of other agents based on context, unlike fixed graph structures.
  • Attention scores provide interpretability by showing which agents are attended to.
  • It handles variable numbers of agents and missing data gracefully.
  • Trade-off: quadratic complexity with number of agents, requiring optimization for real-time systems.
  • Multi-head attention is a core component of transformer-based models for trajectory prediction.

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

Q6

During autoregressive decoding, the model sees ground-truth previous steps at training time but its own (potentially wrong) predictions at inference time. How would you fix this mismatch, and what are the tradeoffs of different approaches?

Technical Trade-offsAlgorithms & Data StructuresSystem Design
Author's notes

This was the hardest question in the whole interview.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clearly defining the exposure bias problem in autoregressive models, then present a structured overview of mitigation strategies ranging from data augmentation to architectural changes. For each approach, discuss tradeoffs in terms of training complexity, inference cost, and performance gains, and conclude with a recommendation tailored to the constraints of the role (e.g., real-time systems at Waymo).

Pro tip: Emphasize that the best solution depends on the specific application: for safety-critical systems like autonomous driving, robustness to errors is paramount, so methods like scheduled sampling or reinforcement learning may be preferred despite their complexity. Also, mention that sometimes a simple fix like teacher forcing with dropout can be surprisingly effective.

1. Define the Problem

Explain exposure bias: the discrepancy between training (ground-truth inputs) and inference (model's own predictions) in autoregressive models, and its consequences like error accumulation.

2. Categorize Solutions

Group approaches into data-level (e.g., data augmentation, noise injection), training-level (e.g., scheduled sampling, professor forcing), and inference-level (e.g., beam search, re-ranking).

3. Analyze Tradeoffs

For each category, discuss tradeoffs: training stability, computational cost, ease of implementation, and impact on final performance. Highlight that some methods trade training complexity for inference robustness.

4. Recommend and Justify

Choose a recommended approach based on the context (e.g., Waymo's need for safety and real-time inference) and justify why it balances the tradeoffs effectively.

Key Points to Mention

  • Exposure bias and error accumulation in autoregressive decoding
  • Scheduled sampling: gradually transitioning from ground-truth to model predictions during training
  • Professor forcing: using adversarial training to make hidden states indistinguishable between training and inference
  • Data augmentation techniques: injecting noise into ground-truth sequences to simulate prediction errors
  • Reinforcement learning (e.g., policy gradient) to directly optimize sequence-level metrics
  • Tradeoffs: increased training time, potential instability, and inference latency; simpler methods like dropout may suffice

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