Preparing your design workspace

Loading the problem and your latest saved attempt…

Design Road-Segment Travel-Time Prediction

Turn aggregate road observations into fresh travel-time forecasts while preserving temporal training correctness and honest fallback behavior.

Problem statement

An ML interview report describes a system-design round dealing with traffic data and explicitly does not disclose its exact questions. For this exercise, assume road traffic: a client requests the expected travel time in seconds for a known road segment five minutes from now.

Authorized input observations contain a stable event ID, segment ID, event time and measured segment travel time; the road-segment catalog is supplied. Design observation ingestion, recent features, a supervised predictor, evaluation and online delivery.

Return the prediction time, forecast horizon, model version and input freshness. A historical time-of-day estimate is a permitted fallback when disclosed as such; if neither current inference nor a usable fallback exists, return unavailable.

For this exercise, use aggregate segment data without driver identifiers or raw location traces. Routing, personalized destinations, traffic-light control and raw GPS map matching are outside scope.

The road interpretation, forecast objective and all numeric targets below are authored practice assumptions, not reported company requirements.

What to build

  1. Accept authorized aggregate segment observations with retry-safe identities and preserve enough history to learn and correct late data.
  2. Return a five-minute-ahead travel-time forecast for a known segment with its time, model version and freshness, or a disclosed historical fallback or unavailable outcome.
  3. Train and evaluate against future observed travel time using time-consistent features, then release compatible model and feature versions without interrupting prediction reads.

At scale

  • For this exercise, assume 10000 known road segments, 1000 observations per second at peak and 1000 prediction requests per second at peak; each request names one segment.
  • For this exercise, target 200ms p95 prediction latency and current features no more than 60 seconds behind accepted on-time observations during healthy operation. Do not label a stale historical fallback as a current forecast.
  • For this exercise, retain aggregate observations for seven days, build one training snapshot per day and publish at most one model release per day. Compare temporal-holdout error against a segment/time-of-day baseline.
  • For this exercise, valid observations may arrive up to one day late. Accept them for historical correction; define bounded serving and training policies for late or temporarily missing data.