Design ETA Prediction
Understanding the Problem
⏱️ What is ETA prediction? An ETA (estimated time of arrival) model predicts how long something will take to get somewhere: a driver to reach a rider, a rider to reach their destination, or a food order to reach a customer's door. In ride-hailing and delivery apps the ETA is one of the most visible numbers in the product, and one of the most used internally: dispatch, pricing and the restaurant list all depend on it.
You'll hear this asked as "design ETA for Uber," "design the delivery time estimate for DoorDash," or "predict when my food will arrive." They are one problem with two shapes. A ride ETA is mostly a driving-time question. A delivery ETA is a chain of stages (the kitchen cooks, a courier is assigned and drives over, waits, then drives to the customer), and only some of them involve driving. We'll design one ETA platform that serves both, and point out where they differ.
The routing side, building the road graph, live traffic from GPS probes and shortest paths, is covered in Design Google Maps. Matching riders to drivers is in Design Uber, and the order flow is in Design a Food Delivery App. Here we go deep on the model: what it predicts, what it learns from, and how it stays accurate when it starts raining at 6 pm on a Friday.
Functional Requirements
Core Requirements
- The system should predict a pickup ETA (driver to rider) and a trip ETA (pickup to drop-off) for ride requests, before and during the trip.
- The system should predict a delivery ETA for food orders at three moments: on the restaurant list (for every restaurant shown), at checkout (the promised time), and continuously after the order is placed.
- ETAs should reflect real-time conditions: traffic, weather, incidents, events ending, and how busy each kitchen is right now.
- The system should serve ETAs to internal consumers like dispatch and pricing, which ask for many origin-destination pairs at once.
Below the line (out of scope)
- Computing the route itself and the live segment speeds (we consume both from the routing engine).
- The dispatch optimizer that uses our ETAs to assign drivers and couriers.
- Turn-by-turn navigation and rerouting.
Non-Functional Requirements
Ask your interviewer how many trips and orders there are, but more importantly, ask who calls the ETA service, because the internal callers dominate the traffic. We'll assume a company running 25 million rides and 10 million food orders a day.
Core Requirements
- Throughput: on the order of 600,000 predictions per second at peak, most of them in batches from internal callers.
- Latency: a single consumer-facing ETA in under 100 ms at p99, including the route lookup. A batch of 20 to 50 pairs for dispatch in under 50 ms. The model's own share should be a few milliseconds.
- Accuracy: low absolute error, and just as important, low bias. An ETA that's always two minutes optimistic is worse than one that's randomly off by two minutes, because users learn the first one is a lie.
- Freshness: traffic signals no more than a minute or two old, kitchen backlog within seconds, and a model that adapts to a sudden rainstorm without a retrain.
- Stability: an ETA shown during a trip or order shouldn't bounce around. 18 min, 25 min, 17 min in one minute reads as broken.
Below the line (out of scope)
- Multi-region consistency. Each region serves its own cities.
Now the arithmetic, because it decides the architecture.
- Restaurant list: say 100 million list loads a day, each showing ETAs for about 30 restaurants. That's 3 billion ETAs a day, ~35,000 per second on average and around 100,000 per second at the dinner peak.
- Ride quotes and app opens: a few hundred million a day, each needing a pickup ETA and often a trip ETA. That's single-digit thousands per second, small by comparison.
- Dispatch: the matcher in each city re-evaluates open requests against nearby drivers every couple of seconds. With 50,000 open requests at peak, 20 candidate drivers each, every 2 seconds, that's 500,000 pickup ETAs per second.
So most of our load is short pickup ETAs requested in bulk by a machine, and the next biggest is restaurant-list ETAs that can tolerate being a minute stale. Only a small slice is a person waiting on one specific number. That tells us two things: the model must be cheap enough to run hundreds of thousands of times a second on CPUs, and caching will carry the restaurant list.
Many candidates design for "the rider opens the app." The sharper observation is that ETA is an internal platform first. Dispatch and pricing call it far more than humans do, and they care about different things: dispatch wants an unbiased mean to compare drivers fairly, while a customer-facing promise wants a number they'll rarely beat.
Framing It as an ML Problem
ML Objective
The business metrics differ by product:
- Rides: fewer rider cancellations while waiting, higher conversion from quote to request, and better dispatch decisions (which depend on comparing pickup ETAs across drivers).
- Delivery: a high on-time rate (delivered before the promised time), high checkout conversion (an honest but not inflated ETA), and fewer late-order refunds and support contacts.
None of these is a training target. What we can label for every completed trip or order is the actual duration. So the model is a regression on duration, and the business trade-offs show up in which statistic of the distribution we predict and show:
- Dispatch and pricing want the expected value (the mean), so comparisons and costs are unbiased.
- A delivery promise wants a high quantile (say the 80th percentile), so most orders arrive on time.
- The restaurant list wants something in between and sometimes a range ("25-35 min").
That's a design decision worth saying out loud: one model that predicts a distribution, several consumers that read different points of it.
Inputs and Outputs
- Input: an origin and a destination (or, for delivery, a restaurant, an order and a customer address), a request time, and optionally the route already chosen by the routing engine. For in-progress requests, the current state: where the driver is, whether the food is ready.
- Output: predicted duration in seconds as a mean plus a few quantiles (p50, p80, p90), and for delivery a breakdown by stage. Each prediction carries an ID so the actual outcome can be joined back to it.
Choosing the ML Approach
The key choice is what to predict.
- Predicting total duration from scratch throws away the routing engine, which already knows the road graph, speed limits and live segment speeds.
- Predicting the residual on top of the routing engine's ETA keeps everything the routing engine knows and lets the model learn what it gets systematically wrong: intersections, left turns, how long airport pickups take, how traffic will change over the next 30 minutes, how long it takes to find parking at a hospital.
We go with the residual. The routing engine's ETA becomes the single most important feature, and the model predicts a correction (in practice, often the log of the ratio actual / routing_eta, which keeps short and long trips on the same scale). Uber has written publicly about doing exactly this with a transformer-based model it calls DeepETA, and it's a well-known pattern.
For delivery, we also decompose by stage. The kitchen and the road are different processes with different signals, so we model them separately and combine them (more in Modeling).
Data and Labels
Sources
- Trip logs: request time, assignment, driver arrival, pickup, drop-off, plus the full GPS trace for each trip.
- Order logs: placed, accepted by restaurant, marked ready, courier assigned, courier arrived at restaurant, picked up, arrived at customer, delivered.
- Prediction logs: every ETA we served, with the exact features the model saw. This is how we train without skew and measure accuracy online.
- Routing engine outputs: the route, its segments and its base ETA at prediction time.
- External: weather feeds, event calendars (stadiums, concerts), incident reports, holidays.
How labels are produced
The label is simply actual_end − prediction_time for each stage we model. It's implicit and free: 35 million examples a day. But it's noisier than it looks.
- Human timestamps lie. Drivers tap "arrived" a block early; couriers tap "delivered" in the elevator. Use the GPS trace where we can: arrival is when the device stopped within some radius of the pickup point, not when the button was pressed.
- Outliers are real behaviour, not noise to drop blindly. A driver who stops for gas mid-trip, or a rider who asks to stop at an ATM, produces a trip that's 15 minutes long for a 5-minute route. Filter trips whose traces show stops that the product doesn't account for, but keep the ordinary ones like waiting at a pickup, because the model must learn those.
- Food "ready" is unreliable. Many restaurants tap "ready" only when the courier walks in, or never. So the prep-time label is partly missing and partly biased.
Censored labels. That last point needs a closer look. When the courier arrives and waits for the food, we learn the true ready time (roughly when they picked up). When the courier arrives late and the food is already sitting there, we only learn that the food was ready some time before the courier arrived. The label is right-censored: we know an upper bound, not the value.
If you treat the upper bound as the label, you'll overestimate prep time for restaurants that are usually fast. If you drop censored rows, you keep only the orders where the kitchen was slower than the courier, and overestimate prep time across the board. The right tool is a censored regression loss (a survival-style likelihood where a censored row contributes P(prep ≤ bound) instead of a density at a point). The simpler interview answer: use the courier-waited orders as exact labels, use the others as upper bounds, and say that the loss has to treat them differently.
Selection bias. We only get labels for trips that happened. A rider shown a 14-minute pickup ETA who cancels produces no pickup label. Since long ETAs cause cancellations, the trips with long ETAs that we do observe are the ones where the rider was patient, not a random sample. It's a real bias but small next to the others; mention it and move on.
Label leakage. The traffic during the trip is the best predictor of trip duration, and it's not available at prediction time. If the training pipeline joins traffic by trip time instead of prediction time, offline error looks wonderful and online error doesn't move. Always train from the prediction log or with features rebuilt as of the prediction timestamp (point-in-time joins in the feature store).
Sampling. We don't need every trip. Downsample the extremely common cases (short city trips at off-peak hours) and keep all of the rare ones (airports, long trips, bad weather, new cities), with weights so the overall error metric isn't distorted.
Interviewers who have built this will almost always ask about the food-ready signal. Saying "the prep label is censored when the courier is late, so we can't just regress on it" is one of the strongest single sentences you can say in this question.
Feature Engineering
Route features (from the routing engine)
- Routing ETA and route distance, the two strongest features.
- Route composition: fraction on highways vs local roads, number of turns (left turns separately), traffic signals, toll roads, bridges.
- Live vs historical: the routing ETA with live speeds and the routing ETA with historical speeds for the same hour of the week. A big gap between them means unusual traffic right now, and the model learns how quickly such gaps tend to close.
Spatial features
- Origin and destination cells at several resolutions (H3 or geohash, for example a city-block cell and a neighbourhood cell), as learned embeddings. Hash them into a fixed-size table so new cells don't need a schema change.
- Place type: airport, train station, stadium, hospital, mall, gated community, high-rise. Pickups at airports and drop-offs at large apartment complexes have their own delays.
Temporal features
- Hour of week, minutes since midnight, holiday flags, school calendar.
- Minutes until or since a known event (a concert ending in 10 minutes floods nearby roads).
Real-time features (streaming)
- Recent residual in the area: the routing engine's error over the last 15 to 30 minutes on trips that started near this origin. This is one of the most useful real-time features in the whole system, because it captures anything the routing engine is missing right now, whatever the cause.
- Weather: current precipitation intensity, visibility, temperature, from a weather feed keyed by cell.
- Incident count on the route from user reports or road authorities.
Delivery features
- Restaurant: historical prep time by hour of week, item count and item types (a pizza takes longer than a salad), order subtotal, cuisine.
- Kitchen load right now: orders placed at this restaurant in the last 15 minutes, orders currently in progress, recent prep times. A restaurant that normally takes 12 minutes takes 25 when 15 orders landed in 10 minutes.
- Courier supply: available couriers near the restaurant, the expected assignment delay for this zone right now.
- Last mile: historical handoff time at this address or building (a house is 1 minute, a 30-floor tower with a security desk is 6), parking difficulty near the drop-off.
Cross features. Deep models learn most interactions, but a few explicit ones are worth computing: restaurant × hour of week prep time, and origin cell × hour of week residual.
Batch vs real-time. Batch features (Spark, daily): historical prep times, cell embeddings' training data, per-address handoff times. Streaming features (Flink over Kafka, seconds to a minute): kitchen load, recent residuals, courier supply, weather. Both live in a feature store with an online copy (Redis or a similar key-value store) and an offline copy with point-in-time history for training. See Feature Store.
Modeling
Driving time (pickup and trip ETAs)
Bad Solution: Routing Engine ETA, or Historical Averages
Approach
Return the routing engine's ETA as is: the sum of segment travel times along the best route, using live speeds. Or look up the average duration of past trips between the same two cells at the same hour of the week.
Challenges
The routing engine sums segment times but doesn't model what happens between segments: waiting at signals, left turns across traffic, the driver finding the rider at a busy pickup. It also assumes today's traffic stays as it is for the whole trip. Both are systematic errors, and on an average city trip they add up to minutes. Historical averages ignore today entirely. Both make good fallbacks if the model is down, and the routing ETA is the right baseline to beat.
Good Solution: Gradient-Boosted Trees on the Residual
Approach
Train a GBDT (LightGBM or XGBoost) to predict log(actual / routing_eta) from a few hundred features: route composition, cell IDs bucketed into categories, hour of week, weather, and the streaming features like recent residual. Multiply the routing ETA by the exponentiated prediction to get the final ETA.
Challenges
This is a strong baseline and fast enough to run on CPU at our volume. Its limits show up with high-cardinality inputs. There are millions of cells, and GBDTs handle them poorly; you end up with target-encoded features per cell and per cell × hour, which is a lot of pipelines to maintain. It also needs one model per product (pickup, trip, delivery travel) or a lot of hand-built interactions to share across them. Many teams run this in production for years; it's a perfectly good answer for mid-level.
Great Solution: A Deep Residual Model With Embeddings and Multiple Heads
Approach
A neural network that treats every input as a token:
- Each categorical feature (origin cell at three resolutions, destination cell, hour of week, place type, city) gets a learned embedding.
- Each continuous feature (routing ETA, distance, weather) is bucketized into quantile bins and embedded too, which turns out to work better than feeding raw floats.
- A small transformer encoder over these tokens lets the model learn interactions between features, for example that rain matters more on highway-heavy routes. To keep inference cheap, use a linear-attention variant or a shallow stack: there are only a few dozen tokens, and this is a CPU model.
- Heads: one per product (pickup, trip, delivery travel leg), sharing the encoder, each predicting a residual mean and several quantiles. A shared encoder means the rare products benefit from the common ones.
Challenges
Embedding tables for millions of cells dominate the model's size, so hash them and keep the dimension modest (16 to 64). Latency needs care: the model should run in well under a millisecond per pair when batched, which rules out anything large. And a deep model is harder to debug than trees, so keep the GBDT as a shadow model and a fallback for a while after launch.
Predicting the residual rather than the raw duration has a second benefit: if the routing team ships a better traffic model, our predictions improve immediately, and our model only has to learn the smaller remaining error.
Delivery time (stages)
A delivery ETA is a sum of stages that run partly in parallel: the kitchen cooks while a courier is assigned and drives over.
delivery_eta = max(prep_time, assign_delay + courier_to_restaurant)
+ pickup_wait
+ restaurant_to_customer
+ last_mile_handoff
Bad Solution: One End-to-End Model on Total Delivery Time
Approach
Regress total minutes from order to door on all the features at once.
Challenges
It works, and it's a fine first version. But it can't tell a slow kitchen from a slow courier, so it can't be updated as stages complete, it can't tell dispatch when to send the courier, and when it's wrong nobody can say why.
Good Solution: A Model per Stage, Combined by Formula
Approach
Train separate models for prep time (with the censored loss), courier assignment delay, travel legs (the driving-time model above), and handoff time. Combine them with the formula, taking the max where stages run in parallel.
Challenges
Each stage is explainable and can be re-predicted on its own. But the formula treats the stages as independent, and they aren't: on a stormy Friday night, prep, assignment and travel are all slow together. Adding means ignores that correlation, and the sum's quantiles are not the sum of the quantiles. A p80 for each stage, added up, gives something much more pessimistic than the p80 of the total.
Great Solution: Stage Models Feeding a Final Model That Predicts the Distribution
Approach
Keep the stage models, and feed their predictions (means and quantiles) as features into a final model that predicts the total delivery time's distribution directly, trained on actual totals. The final model learns the correlations and how the stages combine, and it outputs quantiles of the total that are actually calibrated. The stage predictions are still exposed separately: dispatch uses predicted prep time to decide when to send a courier (arriving exactly as the food is ready means no courier idling and no food going cold).
Challenges
Two layers of models means two layers to train in order and to keep consistent: the final model must be trained on stage predictions from the same version of the stage models it'll see in production, ideally out-of-fold predictions so it doesn't learn from overfit inputs. That's more pipeline, but it's the pattern delivery companies tend to converge on.
Training
Loss. Plain squared error is dominated by a few very late trips. Absolute error is robust but gives up on the mean. A good default for the mean head is Huber loss (squared near zero, absolute in the tails). An asymmetric version that penalizes underestimates more than overestimates bakes in the product's preference against late ETAs. For the quantile heads, use pinball (quantile) loss:
pinball(y, ŷ, τ) = τ · (y − ŷ) if y ≥ ŷ
(1 − τ) · (ŷ − y) otherwise
Minimizing it makes ŷ the τ-th quantile of the conditional distribution. Train τ = 0.5, 0.8 and 0.9 as separate heads, and either add a penalty when a lower quantile exceeds a higher one or predict non-negative gaps between quantiles so they can't cross.
Target. Predict log(actual / routing_eta) for driving legs and log(actual) for non-driving stages. Logs make errors relative, so a 2-minute miss on a 5-minute trip counts more than on a 60-minute one, which matches how users feel it.
Weights. Weight examples by how much they matter: dispatch's pickup ETAs at peak hours, delivery orders in big markets. Upweight rare but important slices (airports, new cities) so they aren't drowned out.
Retraining cadence. Retrain weekly or daily on a rolling window of recent months, with a time-based validation split. We don't need minute-level online training, unlike a feed recommender: the world changes fast, but those changes reach the model as real-time features (live speeds, recent residuals, kitchen load). The model learns how to use a sudden rise in the recent residual; it doesn't need to relearn the roads every hour.
Retrain more often (daily) when a city's road network changes a lot, and run a quick fine-tune when a new city launches.
Scale. A few hundred million examples per training run and a model of a few hundred MB, mostly embeddings, fits on a handful of GPUs, or even CPUs for the GBDT. Distributed training isn't the hard part here.
Evaluation
Offline Metrics
- MAE and MAPE for the mean head, overall and sliced by city, distance bucket, hour of week and product. MAPE shows the error users feel on short trips; MAE shows what dispatch sees.
- Mean signed error (bias) by slice. A model can have good MAE and still be three minutes optimistic for airport pickups.
- Tail error: the 90th and 95th percentile absolute error. One 20-minute miss costs more trust than ten 1-minute misses.
- Quantile calibration (coverage): for the p80 head, the fraction of actuals below the prediction should be close to 80%, in every slice. Plot coverage by city and hour; a dinner-peak coverage of 65% means late orders.
- Pinball loss for each quantile head, to compare models.
Always split by time (train on earlier weeks, test on the most recent), and always compare against the routing-engine baseline and the current production model on the same held-out set.
Online Metrics and A/B Testing
- Rides: online ETA error (predicted vs actual, from the prediction log), rider cancellations while waiting, quote-to-request conversion.
- Delivery: on-time rate against the promised time, average lateness of late orders, checkout conversion, refunds and support contacts for late orders.
- Guardrails: p99 latency, fallback rate, ETA stability during trips.
Interference is the trap. If dispatch uses the ETA, a new model changes which driver gets which rider, and that changes outcomes for riders in the control group too (they compete for the same drivers). User-level randomization gives biased results. Use switchback experiments: randomize by city and time window (say 30-minute blocks), so in any given block one model drives the whole city. For purely display changes (how we show the ETA to the user), user-level A/B tests are fine.
There's also a subtle effect on the product: a more honest (longer) delivery ETA can reduce conversion even while it improves on-time rate. Decide with the business which trade-off you're making, and make both metrics primary.
Serving
A request flows like this:
- The ETA service gets one pair or a batch of pairs. For a batch, it asks the routing engine for a one-to-many query (one rider, 20 drivers), which is much cheaper than 20 separate routes.
- The routing engine returns route features and the base ETA for each pair.
- The service fetches features from the online store in one multi-get: cell features, recent residuals, weather, and for delivery the restaurant's kitchen load and courier supply.
- The model runs on the whole batch at once on CPU. Hundreds of pairs take a few milliseconds.
- Post-processing: clamp to sane bounds, apply smoothing for in-progress predictions, choose the quantile each consumer asked for, round for display.
- The prediction and its features are written to the prediction log (async, through Kafka) for training and online accuracy tracking.
A latency budget for a consumer-facing ETA at 100 ms p99:
| Step | Budget |
|---|---|
| Routing engine (route + base ETA) | ~30 ms |
| Feature fetch (one multi-get) | ~10 ms |
| Model inference | ~2-5 ms |
| Post-processing, logging hand-off | ~2 ms |
| Network and slack | the rest |
Caching does a lot of the work. The restaurant list asks for ETAs from 30 restaurants to one customer location. The answer for (restaurant, customer's small cell, 2-minute time bucket) is the same for everyone in that cell, so cache it. Hit rates are high in dense areas, which is where the traffic is. A cache on (origin cell, destination cell, minute) with a short TTL also absorbs repeated pickup ETAs for the same driver during dispatch.
Batch vs online. Most ETAs are online predictions, because they depend on live state. A batch job still helps: every few minutes, precompute the restaurant-side part of the delivery ETA (prep time and courier assignment delay for each open restaurant), so the restaurant list only needs to add the travel leg per customer cell. That turns a model call per restaurant into a lookup plus a cheap travel estimate.
Fallbacks. If the model times out, return the routing engine ETA multiplied by a per-city correction factor. If the routing engine is down, use historical cell-to-cell durations. If the kitchen-load features are stale (the stream is lagging), the model was trained with a "feature missing" token and falls back to the historical prep time. The ETA service should never return nothing.
Potential Deep Dives
1) How do we react to sudden changes like a storm or a big event?
At 6:05 pm a downpour starts. Roads slow down, everyone orders food, and kitchens back up.
Bad Solution: Retrain More Often
Approach
Retrain the model every hour so it learns from the latest data.
Challenges
An hourly model is still an hour behind a storm that started five minutes ago, and it learns from only a few minutes of storm data, mixed with a full day of normal data. Retraining is the wrong lever for changes that happen in minutes.
Good Solution: Live Traffic and Weather as Features
Approach
Feed live segment speeds (through the routing ETA), live precipitation and the live-vs-historical gap into the model. The model has seen thousands of past rainstorms and knows how much rain adds on top of the routing ETA.
Challenges
This covers causes we've named. It doesn't cover causes we haven't (a protest, a stadium letting out, a closed bridge that the map doesn't know about yet), and live speeds lag reality by a minute or two in areas with few probes.
Great Solution: Recent-Error Features and an Online Bias Correction
Approach
Add features that measure the model's own recent mistakes. Flink tracks, per area and product, the error of trips and orders that finished in the last 15 to 30 minutes, and how in-progress trips are tracking against their predictions (a trip that's 70% done in 90% of its predicted time is running late). These go into the model as features, so it learns to trust them more when they're based on many trips.
On top of that, a small online correction layer adjusts the model's output per area using an exponentially weighted average of recent residuals, bounded so it can't run away:
bias[area] = 0.9 · bias[area] + 0.1 · mean_recent_log_error[area]
final_eta = model_eta · exp(clamp(bias[area], −0.3, 0.3))
Challenges
Recent errors are a lagging signal for the start of a disruption and a misleading one at the end, when the storm has passed but the correction is still adding minutes. Use short windows, weight by trip count, and decay the correction when the area's error returns to normal. The bound matters: a broken GPS feed that makes every trip look late shouldn't add 30 minutes to every ETA in the city.
2) How do we update the ETA during a trip or order without it jumping around?
Once a ride or order is in progress, we know more: where the driver is, whether the restaurant has marked the food ready, whether the courier has picked up. We re-predict the remaining time from the current state, using the same models with "elapsed" features (time since order, current stage, distance remaining).
The raw predictions will wobble. A courier stopping at a red light makes the remaining time jump up for 30 seconds. Users hate that. Apply display rules on top of the model:
- Smooth: exponential smoothing on the displayed ETA, with a faster response when the change is consistent for several updates.
- Be asymmetric: move the displayed time later promptly when we're confident it's slipping (bad news early is better than bad news at the door), but move it earlier slowly.
- Hysteresis: only change the displayed minute when the new prediction differs by more than a threshold, like 2 minutes.
- Tell the user why when we push the time back by a lot: "the restaurant is running behind."
For delivery, there's also the promise: the time shown at checkout. It shouldn't change silently afterwards. If it's going to be missed, we notify the customer and possibly compensate them. That's a policy decision, but the ETA system should expose a "probability of missing the promise" signal for it, which comes straight from the quantile heads.
3) How do we choose the number we show when costs are asymmetric?
A late food order costs a refund and a churned customer. An early arrival costs almost nothing, but an inflated ETA on the restaurant list costs orders. Different consumers want different numbers.
Bad Solution: Show the Mean
Approach
Use the mean prediction everywhere.
Challenges
If the error is symmetric, roughly half the orders arrive later than promised. A 50% on-time rate is a product disaster even when MAE is excellent.
Good Solution: Pad the Mean by a Constant
Approach
Show the mean plus 5 minutes, tuned until the on-time rate hits the target.
Challenges
Uncertainty isn't constant. A 2 km delivery at 3 pm from a fast restaurant is very predictable; a 9 km delivery at 7 pm from a slammed kitchen in the rain is not. A constant pad is too much for the first (it costs conversion) and too little for the second (it still arrives late).
Great Solution: Quantile Heads, Chosen per Consumer
Approach
Each consumer picks the point of the distribution that matches its cost. Dispatch and pricing read the mean. The checkout promise reads the p80 (or whatever the on-time target implies). The restaurant list shows a range, p50 to p85, rounded to 5 minutes. Because the quantile heads are calibrated per slice, the padding automatically grows when uncertainty does.
Challenges
Calibration has to be monitored continuously, by city and hour, because quantile heads drift faster than means do. Also watch the incentive loop: if the promise is the p80, operations teams may start judging couriers against it, which is unfair at the p80's tail. Keep the internal plan (mean) and the external promise (quantile) as separate fields.
4) How do we handle new cities, new restaurants and sparse areas?
A new city has no trips. A new restaurant has no prep history. A rural cell sees one trip a week.
- Hierarchy of embeddings. Cell embeddings at several resolutions mean a sparse fine cell still has a well-trained coarse parent. Hashing gives every new cell an embedding slot from day one, and the coarse ones carry the signal until the fine one learns.
- Priors for restaurants. A new restaurant's prep time starts from restaurants with the same cuisine, price level and item types in the same area, then shrinks toward its own observed prep times as orders arrive (a Bayesian average weighted by order count).
- New cities start on the routing engine baseline with a global correction model (trained across all cities, with city-level features like road density and congestion index rather than city ID), then get their own fine-tuned heads after a few weeks of trips.
Monitor these slices separately; they're where the bias hides.
5) How do we monitor accuracy and catch drift?
Every prediction is logged, and every outcome is joined back to it within minutes of the trip or order finishing. That gives us live accuracy dashboards:
- Bias and MAE by city, product and hour, with alerts when bias in any big slice drifts past a threshold (say 10% relative error for an hour).
- Quantile coverage for the promise, by city: the on-time rate is the business metric and our calibration metric at the same time.
- Feature health: the freshness of streaming features (kitchen load more than a minute old means the stream is behind), null rates, and drift in feature distributions.
- Map changes: a new road or a closed bridge shows up as a sudden localized bias. Feed localized bias alerts to the routing team, because often the fix belongs in the map, not the model.
A dashboard isn't enough when the ETA also drives dispatch. Changes to the ETA model, and to the routing engine underneath it, go through shadow mode first: the new model scores live traffic, and we compare its predictions against actuals for a few days before it's allowed to influence anything.
What is Expected at Each Level?
Mid-level
You should frame ETA as regression on duration, propose the routing engine ETA as a baseline and a GBDT on top of it, and list sensible features (distance, time of day, traffic, weather, restaurant prep history). You should use a time-based split and MAE, and recognise that features must be computed as of prediction time. With prompting, you should break a delivery ETA into prep and travel.
Senior
You should predict the residual over the routing engine and explain why, decompose delivery into stages with parallel prep and courier travel, and catch the censored prep-time label. Expect to discuss bias as a metric separate from MAE, quantile outputs for customer promises vs means for dispatch, streaming features like kitchen load and recent residuals, caching for the restaurant list, and a latency budget for batch requests from dispatch.
Staff+
You should treat ETA as a platform with several consumers and design the contract: which quantile each consumer gets, how promises are separated from internal plans, and how changes are rolled out safely when dispatch and pricing depend on them. Expect to discuss switchback experiments because of marketplace interference, the feedback loop between displayed ETAs and conversion, online bias correction and its failure modes, and where the fix belongs when the model is consistently wrong (often the map or the timestamps, not the model).