KatInterview

ML System Design: Intersection Maneuver Intent Prediction

Machine LearningModel answer
HardModel answerMachine Learningautonomous-drivingsequence-modelingsystem-design

Last updated

Design an ML pipeline that classifies each vehicle at an intersection as turning left, going straight, or turning right, given a short trajectory history and optional map context.

Intersection Maneuver Intent Prediction

You are building a real-time intent recognition system for an autonomous vehicle. At any intersection, there are n vehicles (typically 5–50) either waiting or approaching. For each vehicle you have a rolling history covering the last 3–10 seconds at 10 Hz, containing:

  • Position (x, y) in a map-aligned world frame
  • Velocity (vx, vy) and, optionally, acceleration (ax, ay)
  • Optionally: lane centerlines, stop-line positions, and allowed maneuvers from an HD map

Your goal is to output, for each vehicle, a probability distribution over three maneuver classes:

ClassDescription
Left turnVehicle will turn left through the intersection
Go straightVehicle will continue without turning
Right turnVehicle will turn right through the intersection

These predictions feed directly into the ego vehicle's motion planner, so latency, calibration, and failure modes all matter.

Your task: describe how you would design, train, and evaluate this system end-to-end.

Structure your answer around these six areas:

  1. Labeling strategy and time horizon — how do you define and extract ground-truth intent from logged data?
  2. Feature engineering vs. learned sequence models — when would you use each, and how do you incorporate map/lane geometry?
  3. Multi-agent interactions — how do the behaviors of surrounding vehicles affect each agent's predicted intent?
  4. Evaluation metrics — what do you measure beyond accuracy, and how do you connect metrics to planner safety?
  5. Data challenges — class imbalance, distribution shift across different intersections and cities, and vehicles that change their mind at the last moment.
  6. Uncertainty estimation — how do you produce well-calibrated probabilities and use them responsibly in downstream planning?

Hints

Hint 1

Start by asking what the consuming system actually needs. A planner that reacts to intent 3 seconds early has very different requirements than one that acts 0.5 seconds early — this shapes your label definition, your time-horizon evaluation, and your cost matrix before you write a single line of model code.

Hint 2

Labels are free from hindsight: you already know where each logged vehicle went. Think carefully about *when* during the approach you snapshot the input features for a training example — the anchor time index-ed to time-before-entry prevents the model from trivially reading the answer from within-turn heading. Then think about what makes a label ambiguous or invalid (tracking loss, out-of-log vehi…

Hint 3

A lane-conditioned, target-based formulation — scoring each *candidate exit lane* rather than predicting left/straight/right as a fixed 3-way softmax — handles arbitrary intersection geometries and lets the map topology zero out physically impossible classes automatically. This is both a modeling win and a generalization win across cities.