Design a traffic forecasting system
I was asked this
No reports yet. Sign in to say where you were asked it.
An AI/ML design interview question asked at Uber. It tests time series, graph ml and geospatial.
Design a system that forecasts travel speed on every road segment for the next hour, from live GPS traces sent by drivers' phones. Routing and arrival-time estimates use the forecasts, so they must be accurate, fresh and available for every segment in every city served.
Requirements
- Functional: estimate current speed per road segment from GPS traces; forecast speed per segment for several horizons (for example 5, 15, 30 and 60 minutes); fall back sensibly on segments with little or no live data; react to incidents, closures and events.
- Non-functional: forecasts refreshed every minute or so for millions of segments; served to routing with very low latency; accuracy measured per city and road type.
Clarifying questions
- How many segments, and how many GPS points per second arrive?
- How dense is live data: many vehicles on highways, few on side streets?
- Which horizons matter most to routing?
- Are incident and event feeds available?
- Is the forecast a single number or a distribution (uncertainty)?
What a strong answer covers
- Map matching: snapping noisy GPS points to road segments and turning them into segment travel times, filtering stopped or parked vehicles.
- Features: current and recent speeds on the segment and its upstream and downstream neighbors, historical speed for the same time of day and day of week, weather, events, incidents.
- Models: a historical-average baseline, gradient-boosted trees per horizon, and graph neural networks or sequence models that use the road network's structure; when the extra complexity pays off.
- Sparse segments: blending live data with historical profiles weighted by how much live data there is, and borrowing from neighboring segments.
- Pipeline: a streaming job that aggregates speeds per segment per minute, a model that scores all segments on a schedule, and a store that routing reads from.
- Evaluation: error by horizon, city, road type and time of day, with special attention to sudden slowdowns; monitoring for drops in GPS data volume.
Follow-ups
- A crash closes a highway lane. How quickly does the forecast react, and from which signal?
- How do you forecast for a new city with no history?
- How would you turn segment forecasts into an arrival-time estimate for a whole route, and is summing them right?
Where it's asked
What it tests
time series · graph ml · geospatial
Sign in to see the worked answer
The full answer, chapter by chapter, with what interviewers expect at each level. New accounts get 5 credits: each one unlocks a question for good.
What the labs asked this week
A weekly email of what OpenAI, Anthropic and the other top AI labs asked engineers, round by round.
