Farah is standing outside Indiranagar metro station in Bengaluru at twenty to seven on a Friday evening, with rain starting to darken the pavement. She opens a ride-hailing app, enters the airport as her destination and taps Request. Two numbers appear almost at once. Her car will arrive in 7 minutes, and the trip will take about 58, so she'll land at the airport at 7:45. She decides on the spot: wait here, don't bother with the metro, tell her friend to expect her. Eleven minutes later the car pulls up, four minutes after the app said it would.
Those two numbers weren't read from anywhere. Nobody knew them. They were predictions, made in a few milliseconds, one of billions made every week, and each had to be a single figure for something that has a spread. A trip that might take 50 minutes on a good evening and 75 on a bad one gets one number on the screen. That number is also used by the system itself: it helps choose which driver Farah is matched with, it goes into the fare she was quoted, and it feeds the plans a delivery platform makes for a courier. A prediction of this kind is an estimated time of arrival, or ETA, and the real duration it is later compared with is the actual time of arrival, or ATA. That gap is the error, and it's easy to see why not every error costs the same: four minutes of lateness ruins Farah's evening in a way that four minutes of earliness doesn't.
So the question this chapter answers is: how does a ride-hailing app turn a road map and a pile of past trips into one trustworthy number of minutes, in a few milliseconds, for billions of requests a week?
We'll build the design the way an engineer would, starting with the obvious version, a road graph and a shortest-path sum, and fixing each failure in turn. That leads to a model that learns only the routing engine's mistakes, to the lopsided loss function that makes lateness cost more than earliness, to the way features are turned into table lookups so the model stays fast, and to a transformer layer that is cheaper than the usual one. After that comes the Google Maps answer, a graph neural network that lets traffic on one road reach its neighbours. Then we look at serving, training data, how the estimates are judged and what went wrong. We rely on two sets of primary sources, Uber's DeepETA blog post (February 2022) and its DeeprETA paper (June 2022), and Google and DeepMind's blog post (September 2020) and CIKM 2021 paper, and we say plainly where internals are unpublished. How drivers are matched and how the map is cut into cells are different questions, and we leave them out. Here we care only about the estimate itself.
01What we're building, and how big
1.1 What it has to do
Given a start, an end and a moment in time, the system returns how long the trip will take. That one job gets called from many places, and the callers don't want the same thing. Uber's 2022 paper lists them: fares, pickup estimates, matching riders to drivers, and delivery planning. A fare needs the average, because the company wants to charge a fair price over many trips. A figure shown to a rider on a screen may be better as a number she can rely on, meaning a late-ish estimate. A courier's plan cares about the tail, because a few very late deliveries do the most damage. Uber's paper makes exactly this point: a single point estimate isn't ideal when consumers need different things, such as the mean for fares and the 95th-percentile error for delivery.
Alongside that, the system has some firm properties to meet.
- Accurate where it counts. Accuracy means the typical error, but also the bad errors in the tail, and it has to hold in every city and for every kind of trip.
- Fast. Uber's 2022 post says the model must answer "within a few milliseconds at most", because it sits inside other requests.
- General. One model for rides and deliveries, pickups and drop-offs, in every country. Uber's 2022 post names this as one of its three adoption challenges.
- Fresh. Traffic changes by the minute, and the estimate must follow it.
- Stable. Run the same trip twice and you shouldn't get answers that wander. Google's CIKM 2021 paper points out that models saved at different points in training give "different end user experiences", and treats that variance as a first-class problem.
1.2 How big is it?
Both companies publish scale figures, from different years. Uber's 2022 paper says its post-processing system handles "billion-level requests" per week, and its 2022 blog post calls this the highest-QPS model at Uber, where QPS means queries per second. That paper also puts a price on accuracy: reducing ETA error "by even low single digit percentages unlocks tens of millions of dollars in value per year". An earlier post, from November 2015, said Uber's routing engine handled "hundreds of thousands of ETA requests per second", answering in single-digit milliseconds. Google's September 2020 blog post says more than a billion people use Google Maps, and that its predictive ETAs were already "consistently accurate for over 97% of trips" before the work we'll describe.
Suppose a model sees 3 billion ETA requests a week (an illustrative figure, since Uber says only "billion-level"). What is the average number of requests per second? Take peak traffic as three times the average, and a model that takes 3 milliseconds of one CPU core per request. How many cores does the peak need? Then try 300,000 requests per second, the order of magnitude Uber's 2015 post gave for its routing engine.
Show the answer
A week has 604,800 seconds, so 3 billion requests is about 5,000 a second on average and about 15,000 at the assumed peak. One core serving a 3 ms request handles roughly 330 requests a second, so the peak needs about 45 cores before any headroom. At 300,000 a second the same arithmetic gives about 900 cores. Uber's two figures probably count different things, and the sources don't reconcile them, so don't read either as the other's growth.
What matters is how sensitive the bill is to per-request cost. A model that took 30 ms instead of 3 would need ten times the fleet, and every other step in the chain that wants an ETA, such as a matching step scoring a few dozen candidate drivers, multiplies the count again. That's why the published designs are so keen on lookups and one shallow layer.
One more pair of numbers shows the scale of the model itself. Its training set held about 1.4 billion ETA requests from 14 days of trips in September and October 2021. A model trained on them has about 141 million parameters, and the paper says more than 99% of those sit in lookup tables called embeddings, which section 05 explains. We'll see in section 05 why that's a deliberate choice.
02Version 1: the road graph and a sum
Our first design needs no machine learning. A map company already has a digital copy of the road network, so we can treat it as a graph: every intersection is a node and every stretch of road between two intersections is an edge, with a weight that says how long the stretch takes to drive. A routing engine is software that finds the cheapest path through such a graph from the start to the end, using a shortest-path algorithm, and the cost of the path is the ETA. Uber's 2022 paper describes it in these terms: routing engines "divide up the road network into small road segments represented by weighted edges", find the best path and add up the weights.
Where do the edge weights come from? Two sources, both measured from the phones of drivers who passed through earlier. One is the speed right now. Google's CIKM paper builds a baseline from it that averages each segment's speed over the last two minutes and sums the resulting times along the route. Another is history: the typical speed on this segment at this hour of this day of the week, averaged over the last 17 weeks in the same paper. Uber's 2015 routing engine, Gurafu, launched globally in April 2015 together with a historical traffic system built from GPS data collected from partner phones.
Neither source is right everywhere, and Google's paper shows the trade-off in numbers. Its offline tables report the root mean squared error (RMSE) of the two baselines over a single supersegment (a route piece we'll define in section 07). In New York, with a prediction made for the present moment, the real-time sum scored 42.3 seconds and the historical sum 48.0, so live speeds win when you're predicting now. For a prediction an hour into the future, the real-time sum degrades to 69.6 and the historical one to 51.8, so history wins. Farah's trip to the airport lasts nearly an hour, and the road ahead of her will be in a different state when she reaches it. A system that only looks at where the cars are now describes the road she's leaving. This is the first break in version 1.
| Edge weights come from | Plus | Minus |
|---|---|---|
| Live speeds | Sees an accident or a closure as soon as phones report it | Describes now, so it's weak when the trip runs 30 or 60 minutes ahead |
| Historical speeds for this hour and weekday | Knows rush hours before they start | Blind to today's accident, weather, or an event that just ended |
| A hand-tuned blend of the two | Uses both | The blend has to be set by someone, per region and horizon, and it's still a sum of road pieces |
A second break is more basic, and it holds even with perfect speeds. A routing engine returns the time of one best path from a point to a point. Uber's 2022 paper lists four ways that falls short of what the apps need.
- Route uncertainty. Nobody knows in advance which route a driver will take. A driver may know a shortcut, or may follow the phone's turn-by-turn advice and then take a different turn.
- Human error. Drivers miss turns, especially in hard parts of the network, and a shortest-path algorithm can't model that.
- Distribution shift. Arrival times for driving to a restaurant differ markedly from those for driving to pick up a rider, "even when the shortest path is the same". Here distribution means the spread of actual times for a given routing estimate.
- Uncertainty estimation. Different callers want different summaries of that spread. A graph search returns one number and gives no hint about the spread.
Uber's paper also notes that the beginning and end of a trip account for much of the noise. A driver arriving to pick Farah up may have to find a gap by the kerb in a street full of parked scooters, and the routing engine doesn't try to predict that, so it estimates the time between the neighbourhoods of the start and the end instead of between the exact points.
Uber had been through this before. Its first ETA system, Goldeta (in service from roughly 2011 to 2014, according to the 2015 post), sat on top of open-source routing engines such as OSRM and corrected their estimates using "hundreds of thousands of Uber trips" on similar routes. Its trouble was cold start: a new city had no history, so ETAs there were worse than in established cities. By 2022 the production ETA model was, in the paper's words, "a group of XGBoosts with each trained on one mega-region". XGBoost is a widely used library for gradient-boosted trees, ensembles of many small decision trees added one after another, each correcting the errors of those before it. All of these systems share one idea, that the routing engine's answer is a good start and its errors can be learned from data. Making that the explicit design is the next step.
03Fix 1: learn the routing engine's mistakes
We now have a log of past trips, and for each one two numbers: what the routing engine predicted and how long the trip took. With such a log, the simplest thing to do is to look at the errors. Uber's paper plots them and finds that both the routing ETAs and the gaps between routing ETA and ATA are skewed, with a long tail on the late side, and that the gaps for rides and for food deliveries have different shapes. Errors have structure. They depend on the hour, the place, the kind of trip and the traffic, and anything that depends on features can be learned.
There are two ways to set up the learning. One predicts the ATA directly from the features, and treats the routing ETA as one feature among many. Another predicts the residual, the amount by which the routing ETA is off, and adds it back. Uber's paper calls the second ETA post-processing and writes it as
Here is the routing engine's ETA for request , holds the request's features (time, route and other inputs), is the learned model, is its predicted residual and is the final ETA. For Farah, the routing engine might say 9.0 minutes to her pickup, the model says the gap is +2.5 minutes at this hour on a rainy Friday evening, and the app shows 11.5.
Why should predicting the gap beat predicting the whole answer? Most of the information is already in the routing ETA. It ranges over a hundred-fold, from a one-minute hop to an hour-long drive, and the structure of the road graph is what makes it so. If the model predicts from scratch, it has to rebuild that arithmetic from features, to within a few percent, using a finite number of table cells or parameters. If it predicts the gap, the routing engine does the arithmetic and the model only handles what the graph misses. An experiment below shows the effect in a deliberately small world. Trips have a routing ETA, a congestion effect that the graph misses during rush hours, a different handover time for pickups and drop-offs, and multiplicative noise. Two models share exactly the same grid of cells over hour, request type and the routing ETA cut into eight bins. One fills each cell with the average ATA, and the other fills each cell with the average gap and adds it to the exact routing ETA.
Try it Predict the ATA from scratch, or predict the routing engine's gap
import numpy as np
rng = np.random.default_rng(7)
NB, NC = 8, 24 * 2 * 8 # routing-ETA bins, total cells
def trips(n):
hour = rng.integers(0, 24, n)
kind = rng.integers(0, 2, n) # 0 pickup, 1 drop-off
y0 = rng.lognormal(np.log(600), 0.7, n) # routing ETA, seconds
rush = np.isin(hour, [8, 9, 18, 19, 20])
y = y0 * (1 + np.where(rush, 0.20, 0.0)) # congestion graph misses
y = y + np.where(kind == 0, 45, 120) # kerb and handover time
return hour, kind, y0, y * rng.lognormal(0, 0.12, n)
def cell(hour, kind, y0, edges):
return (hour * 2 + kind) * NB + np.searchsorted(edges, y0)
def fit(c, target):
s = np.bincount(c, target, NC)
k = np.bincount(c, minlength=NC)
return np.where(k > 0, s / np.maximum(k, 1), target.mean())
hT, kT, y0T, yT = trips(50_000)
print("train trips routing scratch residual")
for n in (1_000, 5_000, 50_000):
h, k, y0, y = trips(n)
edges = np.quantile(y0, np.linspace(0, 1, NB + 1)[1:-1])
c, cT = cell(h, k, y0, edges), cell(hT, kT, y0T, edges)
scratch = fit(c, y)[cT] # cell mean of the ATA
resid = y0T + fit(c, y - y0)[cT] # exact ETA + cell mean gap
mae = lambda p: np.abs(yT - p).mean()
print(f"{n:>11,} {mae(y0T):>7.0f}s {mae(scratch):>7.0f}s"
f" {mae(resid):>8.0f}s")
145s on average. The from-scratch table, which must store the whole answer in 384 cells, is at 190s with 1,000 trips, worse than having no model, and only reaches 145s at 50,000 trips. The residual table, with the same cells and the same data, is at 105s with 1,000 trips, 90s with 5,000 and 87s with 50,000.On average the routing ETA alone is off by 145 seconds. A from-scratch table, which has to store the whole answer in 384 cells, only reaches 145 at 50,000 training trips, and it's worse than not having a model at all when data is scarce (190 seconds with 1,000 trips), because each cell is a coarse average over trips whose routing ETAs differ by hundreds of seconds. A residual table starts at 105 seconds with 1,000 trips and settles at 87, about as low as this toy's noise allows. Cells and data are identical, so the only difference is what each cell had to remember. Real systems use far richer models than a table, but the same asymmetry of effort applies to them.
Uber's features for the residual model are the ones in Table 1 of the paper: temporal ones (minute of day, day of week), the latitude and longitude of the start and end, trip type, route type and request type, the routing ETA and estimated distances, real-time and historical speeds, and context such as country, region and city IDs. It says the spatial and temporal features matter most. Its label is the ATA, and its definition depends on the request. For a pickup it is the time from the driver accepting the request to starting the ride or delivery trip, and for a drop-off it is the time from the start of the trip to its end.
| Design | Plus | Minus |
|---|---|---|
| Routing engine only | Explainable, no training data, works in a new city on day one | Systematic errors it can't see: route choice, handover time, per-task bias |
| Learn the ATA from scratch | One model, no routing engine in the loop at serving time | Has to relearn road geometry; needs far more data to reach the same accuracy |
| Learn the residual on top of the routing ETA | Small, focused target; decoupled from the routing engine; the model can be updated without touching the router | Two systems to run, and the model inherits the router's blind spots |
Uber's published path runs through all three rows. Goldeta, in roughly 2011 to 2014, corrected open-source routing with historical trips. Then came the per-region XGBoost ensembles, and Uber's 2022 blog post says they grew into "one of the largest and deepest XGBoost ensembles in the world at that time" after the company's engineers contributed improvements to the open-source library. Scaling that approach further became "untenable", in the post's word, and the team moved to deep learning on the argument that neural networks scale with data through data-parallel stochastic gradient descent. Decoupling matters too. Uber's paper says the approach can be placed on top of any routing engine and that updating a post-processing model is easier than refactoring the routing engine itself. It also states a limit: it only tested the idea with Uber's own proprietary routing engine.
Learning a correction on top of a strong baseline appears all over machine learning. Gradient boosting fits each new tree to the errors of the trees before it, and residual connections in neural networks let a layer learn only the change it makes to its input. Weather services run statistical models over the output of physical forecasts for the same reason. It also fits the habit from chapter 17, to build a baseline before building a model, and to measure the model against that baseline.
We still have to decide what the model is trying to minimise, and the answer isn't obvious, because the residuals are skewed and the cost of an error isn't the same on both sides of zero.
04Fix 2: a loss function that knows late is worse than early
Training a model means choosing a loss function, a formula that turns an error into a cost, and then adjusting the model to reduce the average cost. Squared error is the obvious choice, where an error of 10 minutes costs 100 times an error of 1 minute. That works for tidy data and fails for ours, for two reasons. One is the long tail. Every so often a road closure or an accident turns a 20-minute trip into three hours, and under squared error that single trip can outweigh thousands of ordinary ones. So the model bends itself to explain an event it can't predict. A second problem is fairness. Squared error treats an early arrival and a late one of the same size as the same mistake, and for Farah they are not.
Absolute error, the opposite choice, charges 10 minutes exactly ten times as much as 1 minute, so outliers matter far less. It has its own cost. Its gradient is the same size whether the error is a second or an hour, so the final stage of training jittery. A well-known compromise is the Huber loss: quadratic for small errors and linear for big ones, joined smoothly at a threshold . Uber's DeeprETA paper writes it, for actual time and prediction , as
Inside the threshold it behaves like squared error, with smooth gradients that shrink as the prediction improves. Outside, the penalty grows by a fixed amount per second of error, so the closure trip contributes a large but bounded amount. Uber's paper says that changing "smoothly interpolates" between squared and absolute error.
A second step makes the loss lopsided. Uber's paper multiplies the Huber loss by a weight that depends on which side of the truth the prediction landed:
Read the cases carefully. When the actual time was shorter than predicted, so the traveller arrived early and the weight is . When the trip ran longer than predicted, so she arrived late and the weight is . With the two sides are equal and we recover plain Huber (halved). With below one half, lateness costs more than earliness. Its authors say this is "useful in situations where being a minute late is worse than being a minute early". It also says that the two parameters let the loss "mimic other commonly used regression loss functions" and tailor the model's point estimate to what the consumer needs. Uber doesn't publish its production values of or .
This picture shows the two parameters at work. Near zero both curves are parabolas, so small errors are cheap and training is smooth, and past 60 seconds both turn into straight lines. Amber has weight 0.3 on the early side and 0.7 on the late side, so its right half is more than twice as steep. Values are illustrative.
4.1 What the weight does to the prediction
A lopsided loss changes more than how the model feels about its mistakes. It changes the number the model reports, because the best single guess depends on how costly each direction is. Take the simplest case, where the loss is the asymmetric absolute error. If the guess is , the loss falls on the early side with slope and on the late side with slope . At the best the two pulls balance: , which simplifies to . So the best guess is the point that a fraction of trips exceed. That point is the quantile at level . With a large the loss turns into an asymmetric squared error, whose best guess is a close cousin called an expectile. In its introduction the paper names both, saying that user-facing ETAs "may call for a set of ETA quantiles or expectiles", while fare estimation "requires a mean ETA".
One trip has actual durations that vary from day to day around a median of 10 minutes, with a long tail on the slow side. We train a single prediction for it with the asymmetric Huber loss and , with a small . Will the best prediction be below the median, at the median, or above it? And on what fraction of days will the trip run later than the prediction?
Show the answer
Above the median, and about 30% of days. Lateness costs 0.7 and earliness 0.3, so the prediction moves up until trips that exceed it are the fraction . Below, an experiment measures it on a lognormal spread of durations.
Try it Find the best single prediction under different loss settings
import numpy as np
rng = np.random.default_rng(3)
y = rng.lognormal(np.log(600), 0.35, 200_000) # one trip, many days
def huber(e, d):
a = np.abs(e)
return np.where(a < d, 0.5 * e**2, d * a - 0.5 * d**2)
def loss(c, w, d):
weight = np.where(y < c, w, 1 - w) # y < c: arrived early
return weight * huber(y - c, d)
grid = np.linspace(300, 1200, 901)
print(f"{'omega':>5} {'delta':>6} {'best c':>7} {'late':>6}")
for w, d in [(0.5, 1e6), (0.5, 30), (0.3, 30), (0.2, 30), (0.2, 1e6)]:
c = grid[np.argmin([loss(g, w, d).mean() for g in grid])]
print(f"{w:>5} {d:>6.0f} {c:>7.0f} {100*(y > c).mean():>5.1f}%")
print("mean", round(y.mean()), " median", round(np.median(y)),
" p80", round(np.quantile(y, 0.8)))
omega = 0.5 the best prediction is the median, 600, for a small delta and the mean, 638, for a huge one, and about half the trips run late. With omega = 0.3 it rises to 715 and 30.8% of trips are later than it. With omega = 0.2 it reaches 798, near the 80th percentile of 806, and 20.8% are late. A huge delta with omega = 0.2 gives 772, the expectile.This trip's durations have a median of 600 seconds and a mean of 638, since the long tail pulls the mean up. With the best prediction is the median, 600, when is small, so half of the trips run late, and it moves to the mean, 638, when is huge. With and a small the prediction rises to 715 and 30.8% of trips are later than it, the 70th percentile, as the formula says. At it rises to 798, close to the 80th percentile at 806, and the share of late trips drops to 20.8%. With a large and , the best prediction lands at 772, the expectile, a little lower than the quantile. One model and one dataset produce answers from 600 to 798 seconds depending on two numbers in the loss, so choosing them is a product decision as much as a statistical one.
Pushing the number up costs something too. If every ETA shown to a rider is padded to the 80th percentile, riders see longer waits than they'll experience, and some of them will pick another option. Which quantile a rider-facing screen should show is a question for experiments, and the sources we read don't say where Uber landed. What they do say is that the loss is how the choice gets encoded in the model.
Uber's paper adds two small devices around the loss. A ReLU, which returns zero for any negative input, is applied to the final output, so the predicted ETA can never be negative. And the output is clamped, to limit the damage from extreme predictions. It also explains why Uber didn't take the textbook route for skewed data, a log transform. Predicting the logarithm of the time tames the skew, but turning the prediction back into minutes means exponentiating, and that "usually results in some extreme values, which may affect user experience". A loss that is robust in minutes avoids the round trip.
| Loss | Best guess for one trip is | Plus | Minus |
|---|---|---|---|
| Squared error | the mean | Smooth; right target for fares | Dominated by rare huge errors; early and late equal |
| Absolute error | the median | Robust to outliers | Constant gradient size makes late training noisy; early and late equal |
| Huber | between the two, set by | Smooth near zero, robust in the tails | Still symmetric |
| Quantile loss | a chosen quantile | Direct control of how often the ETA is late | Non-smooth; no robustness knob |
| Asymmetric Huber | between a quantile and an expectile, set by and | Robust, smooth, and tunable per consumer | Two parameters to choose and to explain |
Uber chose the last row for DeeprETA, which its 2022 blog post and paper describe as launched for all four-wheel ETA prediction, and the paper gives the reason in one line: the loss "is robust to outliers and can balance a range of commonly used point estimates metrics". Google's graph model, which we reach in section 07, takes the symmetric route instead, a Huber loss on travel times with weights that shrink the influence of long segments. Each company is tuning something different. Uber's model is consumed in different forms by different callers, while Google's feeds a route ranker that picks among candidate routes.
This trade-off shows up whenever a wrong guess costs more in one direction. Retailers deciding how much stock to hold face the newsvendor problem, whose best answer is a quantile of demand set by the ratio of the cost of running out to the cost of holding extra. Forecasting systems that must avoid under-provisioning train with quantile losses, and robust regression leans on Huber for the same reason as here.
We've now fixed the target and the cost. Next, how to get a messy request, a pair of coordinates and a timestamp, into a model that must answer in a few milliseconds.
05Fix 3: turn every feature into a table lookup
The standard way to feed numbers to a neural network is to scale them to a sensible range and pass them through dense layers. Try it on Farah's request. Time of day is a number between 0 and 1440 minutes, the origin is two floating-point numbers, and the speed on the main road is another. Two problems appear at once. How these numbers relate to travel time isn't smooth or monotone. Eight in the morning is bad, nine at night is fine, and 8:05 and 8:06 behave alike while 8:05 and 8:35 may not. Place is no different: the junction by the metro station is slow, the one 300 metres on is fast, and two floating-point numbers give the network no easy way to represent a neighbourhood with its own quirks. A stack of dense layers can learn such shapes, but only by spending parameters and depth on carving up the input range, and depth costs milliseconds.
Uber's team reports a fix: discretise everything, then embed. An embedding is a table of learned short vectors, one row per possible value of a feature, and looking up a feature's row is a memory read whatever the size of the table. Uber's 2022 blog post says that "discretizing and embedding all inputs" gave "a significant lift over alternatives", and the paper adds the speed argument. Embeddings make up 99% of the model's hundreds of millions of parameters, "they contribute minimally to latency, because embedding look-up table takes time". Uber's blog post adds that a single prediction touches roughly 0.25% of the parameters. Capacity is huge and the cost per request is small, because most of the model is a lookup that reads only the rows the request needs.
5.1 Three kinds of feature
A categorical feature already has a finite set of values, and its embedding is a row lookup, , where is a matrix with one row per value. Uber's example is the minute of the week: 7 days of 24 hours of 60 minutes is 10,080 values, each with a vector of 8 numbers. After training, a plot of those vectors shows "local continuity" and forms a one-dimensional curve. So the model has learned that neighbouring minutes are similar without anyone telling it. A raw number would have forced it to rediscover that structure.
A continuous feature such as speed is first cut into bins and then looked up as , where assigns each value to its bin. Its example is speed split into 256 quantile bins, which gave better accuracy than feeding the raw number. They are quantile bins: each holds the same share of the training data, so the first bin might be the slowest 1/256 of all observations and the last the fastest. Uber found quantile bins beat equal-width bins and offers one explanation, that for any fixed number of bins, quantile bins keep the most information about the original value, measured in bits. A practical reading is that real distributions are skewed. Equal-width bins would put nearly every trip in a handful of bins and leave the rest empty.
A geospatial feature, a latitude and longitude, needs more care, because the number of distinct places is vast and uneven, with a dense old town and an empty ring road. Uber uses geohashes. A geohash names a rectangle on the map by repeatedly halving: is the point in the western or eastern half of the world, then the northern or southern half of that, and so on, writing one bit for each answer. Uber's paper gives the recipe: scale latitude and longitude into 32-bit integers, interleave their bits into one 64-bit integer, encode it in base 32, and keep the first characters. Each character contributes 5 bits, so a longer string names a smaller rectangle. Cells are roughly 40 by 20 kilometres at length 4 and roughly 150 metres on a side at length 7. Uber uses lengths 4, 5, 6 and 7 together. Fine cells locate a pickup precisely but each has few training trips, and coarse cells have plenty of trips but blur the location, so giving the model all four lets it lean on whichever has enough data. Origin, destination and the origin-destination pair each get their own features.
5.2 Too many cells, and two hash functions
The pair is where the numbers explode. If a city has a million fine cells, there are up to a million squared origin-destination pairs. Giving every cell its own embedding row, which the paper calls exact indexing, would make the tables enormous. A common way out is the hashing trick: pass the geohash string through a hash function, a deterministic scrambler that turns any string into a number, and take the result modulo to get one of rows. Now the table has a fixed size whatever the number of cells. What it costs is collisions, where two unrelated places land on the same row and share one vector.
A million geohash cells are hashed into 500,000 rows (illustrative sizes). With one hash function, roughly what fraction of cells share their row with at least one other cell? Now give each cell two rows, chosen by two independent hash functions, and call it a collision only if another cell matches on both. Roughly what fraction now collide?
Show the answer
With one hash, each cell finds another cell in its row with probability , which for and is about 86.5%. A simulation with these sizes gives the same figure. With two independent hashes, another cell has to match in both, and the chance is about , which is 4 in a million, or 0.0004%. A cell's vector is built from two table rows, and for the pair to be confused with another cell's, both rows have to coincide.
That is the idea in the paper's Algorithm 1. It uses two independent instances of MurmurHash3, a fast general-purpose hash, with different seeds, and it applies them to the origin cell, the destination cell and the pair at each of the four resolutions. Each location feature is thus represented by two embedding rows, and the network can combine them, so a collision in one table is outvoted by the other. Uber's blog post says this multiple feature hashing gave the best accuracy and latency of the three schemes it compared, while still saving space over exact indexing, and that a single hash was "the same or slightly worse" depending on resolution.
In the paper's ablation, removing the hashing scheme and indexing the exact geohash string instead cut the improvement in mean absolute error from 7.83% to 7.41% and the improvement in median error from 6.25% to 5.10%, while the 95th-percentile figure stayed at 7.99%. Its authors read this as richer geospatial embeddings helping in typical cases but not in extreme ones. A likely reason for exact indexing doing worse, though the paper doesn't say so, is probably that a rarely visited fine cell gets its own row trained on very few trips, while hashed rows are shared and get more data.
| Encoding location | Plus | Minus |
|---|---|---|
| Raw latitude and longitude as two numbers | Tiny, no tables | The network must carve up the map itself with depth, which costs latency |
| One embedding row per geohash cell (exact) | No collisions | Table size grows with the number of cells; rare cells have under-trained rows |
| One hash function, fixed number of rows | Fixed memory | Unrelated places share rows; the paper found it the same or slightly worse |
| Two hash functions, per resolution | Fixed memory; collisions need to coincide twice | Two lookups per feature, and more bookkeeping |
Uber chose the last row and published it in 2022. Because the whole encoding is lookups, it was the part that improved accuracy without adding latency, and the paper counts it as its second contribution after the post-processing formulation itself.
Hashing features came from large-scale linear models, where it was used to keep feature spaces a fixed size, and the paper cites that line of work. Recommendation models use embedding tables for user and item IDs, as chapter 16 describes, and large systems often hash the IDs into a fixed number of rows for the same reasons of memory and speed.
Why not just give the network the real numbers and let it learn the shape?
It can, but it pays in depth. A dense network has to build up a lookup-like response from smooth pieces, layer by layer, and each layer costs time on every request. Binning pushes that work into training: the table already stores the shape. For a model that has to answer in milliseconds, a wide table and a shallow network is a better use of the budget than a narrow table and a deep one.
06Fix 4: letting features talk to each other, cheaply
After embedding, Farah's request is a list of short vectors, one for each feature: the minute of the week, the origin at four resolutions, the destination, the pair, the speed bin, the routing ETA bin and so on. Call the list , with vectors of numbers each. Next comes the question of how to combine them, because the effect of one feature depends on the others. A long routing distance means one thing on a quiet Sunday and another in the Friday rush, and a destination near a stadium matters only when the match ends. A plain concatenation fed into a dense layer can learn some of this, but the interactions have to be discovered one weight at a time.
Uber's answer is self-attention, the operation at the centre of the transformer architecture (chapter 8). Each vector produces a query, a key and a value by multiplying with learned matrices: , , . A feature's query is compared with every other feature's key, and the comparison scores, passed through a softmax so they add up to one, say how much attention to pay to each one. Each feature's output is a weighted sum of all the values, added back onto its own input:
Here is an table of attention weights, keeps the scores in a stable range, and adding is a residual connection. In a language model each vector is a word and their order matters, so a position is added. Here each vector is a feature and the order of features means nothing, so the paper includes no positional encoding. Uber's paper gives an example close to Farah's. Inputs are vectors for time, location, traffic and the A-to-B distance, and the layer "scales the importance of the distance given the time, the location and the traffic condition".
Standard attention has a cost problem. That table has entries, each a dot product of length , so the work is of the order . Uber's setting is the reverse of a language model: many features, and a tiny vector for each. Uber puts the query, key and value size at 4, so , and the quadratic term is the expensive one. Uber's blog gives a sample calculation with 40 features and vectors of size 8: operations for standard attention, against for the version Uber picked. It reports that the original "provided good accuracy" but "was too slow to meet the latency requirements".
A faster version is the linear transformer. Softmax attention can't be rearranged because the softmax needs every score before it can normalise. It replaces the exponential with a feature map , a function that keeps everything positive, and defines the output row for feature as
The sums over don't involve at all. They can be computed once, as a small matrix, and each feature then reads that matrix with its own query. No table is ever built, and the cost falls to the order of . Only the order of multiplication changes: becomes , the same product grouped differently. An experiment checks that grouping changes nothing and measures what it saves.
Try it Softmax attention against the reordered linear form, as the feature count grows
import numpy as np, time
rng = np.random.default_rng(0)
d = 8 # embedding size per feature
phi = lambda z: np.where(z > 0, z + 1, np.exp(z)) # elu(z) + 1
def softmax_attn(Q, K, V): # builds the L x L matrix
S = np.exp(Q @ K.T / np.sqrt(d))
return (S / S.sum(1, keepdims=True)) @ V
def linear_attn(Q, K, V): # builds a d x d matrix
q, k = phi(Q), phi(K)
return (q @ (k.T @ V)) / (q @ k.sum(0))[:, None]
def explicit_linear(Q, K, V): # same maths, L x L matrix
W = phi(Q) @ phi(K).T
return (W / W.sum(1, keepdims=True)) @ V
def us(f, *a, reps=30):
t = time.perf_counter()
for _ in range(reps):
f(*a)
return (time.perf_counter() - t) / reps * 1e6
Q, K, V = (rng.normal(size=(40, d)) for _ in range(3))
gap = np.abs(linear_attn(Q, K, V) - explicit_linear(Q, K, V)).max()
print(f"reordering changes the output by at most {gap:.1e}")
for L in (16, 64, 256, 1024):
Q, K, V = (rng.normal(size=(L, d)) for _ in range(3))
print(f"L={L:5d} softmax {us(softmax_attn, Q, K, V):9.1f} us"
f" linear {us(linear_attn, Q, K, V):8.1f} us")
9.7e-17, which is rounding error. At 16 features the softmax form is faster (7.0 us against 10.1 us). At 64 the linear form is about twice as fast, at 256 about 12 times (366.5 us against 29.4 us), and at 1,024 about 61 times (6607.2 us against 108.6 us). Timings vary from run to run.Line one confirms that building the full table and normalising it gives the same answer as the reordered form, to within rounding error. Timings show the cost curves crossing. At 16 features the table is tiny and the reordered form is slower, because it does more small steps. By 64 features the linear form is about twice as fast, at 256 about twelve times, and at 1,024 about sixty, since one grows with the square of and the other grows with itself. Exact numbers vary between machines. Uber's blog example uses 40 features, where the saving is modest per layer and matters when multiplied by the traffic.
A softmax attention and its linear form aren't the same function, though. Only the grouping of the linear version's own matrices is exact. Linear attention is a different mechanism, whose accuracy has to be checked. Uber also considered two other speed-ups from the literature, Linformer and Performer, and picked the linear transformer after experiments.
6.1 One bias per kind of trip
After the interaction layer comes a fully connected layer with 2,048 units, and then a last problem. A ride and a food delivery have different distributions, and so do pickups and drop-offs, short and long trips, and different parts of the world. Uber's paper offers two ways to cope. One embeds the request type as one more feature, so that the transformer layer can learn how it interacts with the rest. Another is a calibration layer, which adds a learned bias for each request type to the output:
The residual for request of type is the shared network's output plus a bias that depends only on the type. It shifts the whole prediction for deliveries up or down relative to rides. That fixes the average error without needing the shared layers to carry it. Its authors say this adds "minimal latency". They also tried multi-head and mixture-of-experts structures, which would let each type have its own sub-network, "however the latency does not meet the requirement". Their ablation shows the calibration layer is worth a little: without it the mean-error improvement drops from 7.83% to 7.73%.
Put together, DeeprETA is the stack in the picture below: bins, embedding tables, one interaction layer and one dense layer with a bias.
6.2 How it compared
Uber's blog post says the team tested seven architectures, a plain multi-layer network, NODE, TabNet, a sparsely gated mixture of experts, hypernetworks, a transformer and a linear transformer, and that an encoder-decoder with self-attention won. Table 2 of the paper compares DeeprETA with the models Uber used as baselines, each trained on the same 14 days of global data and tested on the next 7. Each number is the improvement over the routing engine's own ETA, so higher is better.
| Model (2022 paper, Table 2) | Mean error improvement | Median error | 95th-percentile error |
|---|---|---|---|
| XGBoost (per-region ensembles) | 5.07% | 1.79% | 5.98% |
| ResNet, 4 blocks of 512 | 7.39% | 6.19% | 7.27% |
| HammockNet | 7.58% | 6.12% | 7.56% |
| DeeprETANet | 7.83% | 6.25% | 7.99% |
| without calibration layer | 7.73% | 6.12% | 7.85% |
| without feature hashing | 7.41% | 5.10% | 7.99% |
Two things stand out. First, the median is where the neural models gain most over XGBoost: the tree ensemble improves the typical trip by only 1.79%, and every network improves it by about 6%. Second, the differences among the neural models are small, from 7.39 to 7.83 in mean error. Parameter counts explain part of this. All three networks have about 141 million parameters and more than 99% of them sit in embedding tables, with only 0.5 to 1.2 million elsewhere. Most of the gain over XGBoost seems to come from the discrete embeddings and the loss, and the choice of what sits on top of them matters at the margin. DeeprETA won because it was both slightly more accurate and, with a single shallow layer, fast enough.
| Interaction layer | Plus | Minus |
|---|---|---|
| Concatenate and use dense layers | Cheapest to run | Interactions found only through weights; the ResNet baseline sits here |
| Standard self-attention | Explicit pairwise interactions, "good accuracy" in Uber's tests | Quadratic in the number of features; too slow for the latency budget |
| Linear transformer | Same idea, cost linear in features | A different attention mechanism, so it has to be validated |
| Mixture of experts or multi-head decoders | Separate capacity per request type | Latency did not meet the requirement |
Uber picked the linear transformer plus a bias layer, and says the decision came from measuring both accuracy and latency. Uber's blog adds that the plan is to keep improving the dataset, features, transformations, architectures, training algorithms and loss functions. Reordering matrix products is also what linear-attention language models use to avoid the table on very long inputs. Here it's applied in the opposite regime, a short sequence of wide features.
So far a trip is a bag of features about its two ends, plus a routing ETA that already summarises the road in between. Google took the other route and put the road itself inside the model.
07Fix 5: let traffic flow along the road graph
Uber's model looks at the two ends of Farah's trip and takes the routing engine's word for what lies between them. Google's mapping team faced a different version of the problem: estimate the time along a given route as accurately as possible, and its engineers had a reason to put the road network inside the model. Google's CIKM 2021 paper gives the reason in two sentences. Travel times on a segment "may be affected by traffic conditions that are further away, or not immediately on the user track", and conditions "may have changed by the time a user traverses to a road segment further along their route". A jam that spills back from a side street slows the main road before anyone on the main road can see the cause. Rush hour starts while Farah is still on the elevated expressway.
Its previous design is the obvious one. It treats each road piece alone, predicts its time and adds the pieces up. Per the paper, Google's prior production models were of this kind, "segment-level linear regression models". Each prediction sees only its own segment's speeds. It can't know that the junction three pieces ahead has just filled up, because that information sits in a segment it isn't looking at.
7.1 Supersegments
The fix is to give the model the neighbourhood. Google calls a unit of it a supersegment: a sequence of connected road segments that follow a typical traffic route. In the paper a supersegment is a graph, with each road segment a node and an edge wherever two segments connect. Road segments average 50 to 100 metres, and a supersegment averages about 20 of them, so a typical one is roughly a kilometre or two of road. DeepMind's post of September 2020 explains the choice of unit. A separate network for each supersegment would mean training millions of models, and sequence models like recurrent networks struggled to take in the structure of the road network, but sampling subgraphs lets a single model handle everything from two nodes to hundreds. Models are trained per region, so each region's model has its own vocabulary, and the paper says about 1 million predefined supersegments cover the most common routes: most freeways, major arterials and some popular shortcuts. Less busy surface streets outside those get simpler per-segment models.
Inputs describe both the present and the past. Each segment carries its real-time average speed and travel time for each of the 17 two-minute windows before the prediction, its historical speed and time for five eight-minute windows before the prediction moment and seven after it (averaged over the past 17 weeks), its length, and a priority, its road class such as highway. A supersegment as a whole carries its real-time travel time. Segment IDs and supersegment IDs also get learned embeddings of sizes 16 and 64. Those embeddings let the model remember habits of particular places, and the vocabulary covers 99.5% of the IDs, with the remainder spread over 200 and 20 shared out-of-vocabulary buckets.
Google's model also predicts into the future. A separate model is trained for each horizon , the number of seconds from now at which the traversal begins, with horizons of 0, 600, 1,200, 1,800 and 3,600 seconds. At serving time a route is a chain of supersegments. Supersegment one is queried at horizon 0, and its predicted travel time tells you when the traveller reaches the second, and that picks the horizons to use for that one, and so on, interpolating between the two nearest horizons. Farah's airport trip, say, passes through dozens of supersegments, and the one she'll reach after 40 minutes is read from a blend of the 30-minute and 60-minute models. That is how the system anticipates the evening traffic building ahead of her.
7.2 Message passing, step by step
The network that reads a supersegment is a graph neural network (GNN), built from what the paper calls Graph Network blocks. Chapter 18 introduced the central idea, message passing: every node updates its own state from messages sent by its neighbours, and doing it repeatedly lets information travel. A block has three update functions, one each for edges, nodes and the whole supersegment, and three aggregation functions that sum things up:
Read the three updates in order. An edge joins a source node to a target node , and its new state is computed from its old state, its two end nodes and the supersegment's global state . A node's new state comes from , the sum of the new states of all edges touching it, plus its own old state and . Last of all, the global state is updated from the sums of all new edge and node states. In the paper the three functions are small multilayer perceptrons and the aggregations are plain sums.
Google's model chains three of these blocks in an encode, process, decode pattern. First, the encoder turns raw speeds and IDs into latent states for every node, edge and the supersegment. Then the processor, a block applied twice with the same weights, lets neighbours exchange messages. Finally the decoder turns the final states into predictions: a travel time for the whole supersegment, a time for each segment, and a cumulative time up to each segment. In production the paper uses only the supersegment-level output, because "summing the individual segment predictions … can lead to an accumulation of error". Segment-level outputs still earn their keep as extra training signals, as section 08 shows.
How far can a fact travel? Take a toy chain of seven segments with a jam on the fifth, and let each round add half of every neighbour's state to a segment's own. After one round the two neighbours carry 50% of the jam's strength. After two rounds the segments two steps away carry about 17%, after three rounds about 5%, and the signal shrinks with every step. In the real model the global state shortens the distances, because it collects every node and edge and hands the summary back to all of them in the next round, so after one block every segment of a 20-segment supersegment has heard something about every other. Toy numbers are only an illustration of the mechanism.
Google also tried feeding the model more neighbours. An extended supersegment adds off-route segments that connect to the route, so the average graph grows from about 20 segments to between roughly 96 and 237 in the paper's four cities. With an added binary feature marking which segments are on the route, offline error fell by 0.01 to 0.29 RMSE, at the cost of more storage, slower training and slower inference. Google presents this as an extension that suits cases where those costs aren't a concern, and not as part of the launched model.
7.3 What it bought
The paper evaluates on four regions, New York, Los Angeles, Tokyo and Singapore, using training data from January 2020 and reporting root mean squared error in seconds. Its Table 2 shows how the pieces trade off. For New York, with the prediction made for now (horizon 0) and for an hour ahead (horizon 3,600), the errors were:
| New York, offline RMSE in seconds (2021 paper, Table 2) | Horizon 0 | Horizon 3,600 |
|---|---|---|
| Sum of real-time speeds | 42.31 | 69.60 |
| Sum of historical speeds | 48.03 | 51.80 |
| DeepSets (a bag of segments, no graph) | 37.33 | 46.68 |
| Graph network | 36.84 | 46.55 |
The table holds three lessons. Live speeds win now and history wins an hour out, exactly as in section 02, and any learned model that sees both beats either. Moving from the two data-only baselines to a learned bag of segments is a large step, about 5 seconds at horizon 0 and 5 to 23 seconds at the hour horizon. Moving from the bag of segments to the graph is a small step: the paper reports that the graph network beat DeepSets by between 0.12 and 0.77 RMSE across regions and horizons, a significant margin by a t-test over five seeds but modest in size. Its authors note that these are errors over single supersegments, and that they accumulate over a whole route.
In production, the comparison that Google reports is against its previous system, which didn't use the graph at all. Google's paper defines a negative ETA outcome as a case where the error against the observed duration is over some threshold, and doesn't publish the threshold. Deployed worldwide, the graph model cut negative outcomes by more than 40% in cities such as Sydney. DeepMind's September 2020 post gives improvements of up to 50% in Berlin, Jakarta, São Paulo, Sydney, Tokyo and Washington, with a range from 16% in London and Copenhagen to 51% in Taichung City. Google's online experiment, which measures the error of whole-route travel times over a week in January 2021, shows the same ordering as the offline one: for New York the graph network scored 118.63 seconds against 119.76 for DeepSets, 130.05 for real-time sums and 154.83 for historical sums.
These numbers look inconsistent until you notice what each compares. That small gap to DeepSets is against a strong, already-learned baseline. Meanwhile the big reduction in negative outcomes is against what was in production, a segment-level linear model, and it counts a different quantity, bad errors beyond a threshold, and that can fall steeply when typical error falls modestly. The paper's 40-plus figure for Sydney and the blog's "up to 50%" probably come from different measurement windows or thresholds, and neither source says which. Both are real, and they answer different questions.
| How to model the road between the ends | Plus | Minus |
|---|---|---|
| Sum of per-segment models | Simple, cheap, easy to explain | Each piece is blind to its neighbours; errors add up |
| Bag of segments (DeepSets) | Learns from many segments at once | Ignores how segments connect |
| Graph network on supersegments | Traffic on neighbours reaches each segment; one model for all route shapes | Training instability, need to cache outputs, only ~1 million supersegments covered |
| Graph network on extended supersegments | Sees congestion on connecting roads | Graphs 5 to 10 times larger; more storage and slower inference |
Google chose the third row and reports it as deployed: its blog gave the gains in September 2020 and its paper describes online tests in late 2020 and January 2021. Uber and Google solve complementary problems. Uber's model post-processes a route estimate and has no road graph inside it, while Google's model is the graph and produces road times. Nothing in the sources says either company combines them. In principle, times from a graph model could supply a routing engine's edge weights, with a learned correction on top. That is design reasoning, not a published system.
Graph networks have been deployed at scale elsewhere. Google's paper lists Pinterest and Amazon for recommendations, Alibaba for e-commerce, Snapchat for friend ranking and Baidu Maps for traffic predictions. In each case the data is a graph, and the useful signal comes from what neighbours know.
Why not predict each segment and add them up?
Each prediction has an error, and the errors of consecutive segments add up along the route. Google's paper says as much when it explains why production uses the supersegment's own output and not the sum of its segments. A model that predicts the whole stretch at once can be wrong by one number, not twenty.
08Making the graph model safe to ship
The architecture was only half of Google's work. Google's paper is direct about the other half: "The primary bottleneck to deploying was the high variability of models during training." A model saved at one point in training could give noticeably different ETAs from a model saved a few thousand steps later, and "models saved at different points of training will result in different end user experiences". One day's model might be a little worse in Sydney than the day before's. DeepMind's post adds a cause. Training batches mix tiny graphs of two nodes with graphs of over a hundred, so the size of the gradient swings from step to step and the model is "highly sensitive to the training curriculum".
8.1 A loss with three parts
The first stabiliser is the loss, which combines three terms for each horizon:
Here is the supersegment-level error, is the same kind of error summed over every segment, and is the error of the cumulative time up to each segment, with weights and . Each term uses a Huber loss with , the same robust shape as in section 04 and this time symmetric. Each example is divided by its free-flow time raised to the power 0.75, where free-flow time is how long the stretch would take with little or no traffic. A long stretch has large raw errors, and the division keeps long supersegments from dominating the sum while still giving them some extra influence. Google notes that the per-segment term is much less affected by length than the per-supersegment term, and that is why both are kept. Extra segment-level terms are there because, in the authors' words, "good segment-level travel time prediction helps the final performance", even though only the supersegment output is served.
8.2 A learning rate that tunes itself
The learning rate, the size of each update step, is the second. A fixed rate that is right early in training is too big late, and a decay schedule has to be chosen by hand. DeepMind's post says exponential decay and ensembling were tried first and that the best result came from MetaGradients, which let the system learn its own schedule. Borrowed from reinforcement learning, the idea is to treat the learning rate as a parameter and improve it by gradient descent too. Take a step with the current , look at the loss on a fresh example after the step, and nudge in the direction that would have made that loss lower. Google writes the update as
where is the new example, the parameters after the step, and the second factor says how much the parameters moved because of . It uses a meta learning rate of 0.01, updates every 100 iterations, and combines the method with Adam. What it reports is that MetaGradients "consistently decays the learning rate over time, which ensures stable training", and the paper's figure shows lower variance across seeds with it.
A third stabiliser is an exponential moving average (EMA) of the weights, used for evaluation and serving: with . This is a running average that weights recent parameters most, with an effective window of about steps, so jitter between neighbouring checkpoints cancels. Google's figure shows that both EMA and MetaGradients lower variance within a run and across runs, which it calls "critical for inference in production".
8.3 What was tried and not shipped
The paper is open about experiments that helped offline and weren't launched. Two unsupervised auxiliary losses, deep graph infomax and a graph auto-encoder, lowered RMSE by 0.05 to 0.23, but the best variant differed per region and horizon, so tuning it everywhere would be expensive, and "the potential performance improvements were not deemed significant enough for the additional costs". Replacing the sum aggregation with other combinations, such as min, max, mean and a square-root-normalised sum, gained up to 0.34 RMSE depending on region and horizon, again with no single winner, so using all of them at once is suggested as "a reasonable preference" for future work. Learnable segment and supersegment embeddings helped a little, for example a New York horizon-0 error of 36.87 with both against 37.55 without.
| Stabilising training | Plus | Minus |
|---|---|---|
| Fixed learning rate | Nothing to tune | Saved models differ run to run and step to step |
| Hand-set exponential decay, ensembles | Standard and predictable | Schedule chosen by hand; ensembles cost serving compute. Tried first, according to the DeepMind post |
| MetaGradients plus an EMA of the weights | The schedule is learned; variance across seeds and checkpoints drops | Extra machinery and hyperparameters (meta learning rate, update frequency) |
Google chose the third row, and the paper calls both devices "a necessary addition to make the GNNs production-ready". Averaging weights in time appears widely, from classical Polyak averaging to image-generation models that serve an EMA copy of their weights, and the meta-gradient idea came from a reinforcement learning paper, Xu et al., as the GNN paper cites it. Any model that millions of people feel directly teaches the same lesson: how stable it is across retraining matters nearly as much as how accurate it is on average.
09Serving: a few milliseconds, billions of times
A model that wins on a test set still has to answer while Farah's screen is waiting. Each company published a different answer to the same constraint, and the difference is instructive. Uber runs its model inside the request. Google runs its model ahead of time and lets the request read the result.
Uber's 2022 blog post describes the path of one request. A consumer's request reaches a service called uRoute, which asks the routing engine for the route and its ETA. uRoute then sends that ETA, with the other features, to the Michelangelo online prediction service, Uber's platform for serving models, which returns the DeepETA prediction. In the paper's online test the model's step ran in production with a median latency of 3.25 milliseconds and a 95th percentile of 4 milliseconds, stable as the request rate rose, on a fleet of hosts with four cores each. Uber's blog says the prediction is made to complete in "a few milliseconds at most". End-to-end latency of the whole ETA request isn't published.
Here is Farah's pickup estimate walked through, with what is known about each step.
- RequestHer app sends the pickup point, the airport and the time. Latency of the network hop and the front-end services isn't published.
- RouteThe routing engine finds the best path on the road graph with current speeds and returns its time, the RE-ETA. Uber's 2015 post said its routing engine answered in single-digit milliseconds at hundreds of thousands of requests a second. That figure is for the engine, seven years before the 2022 system.
- FeaturesThe request is turned into bins: minute of week, speed quantile, geohash cells at four resolutions each hashed twice, trip and request type. Uber's paper treats bin lookups as constant time and doesn't publish the cost of feature assembly.
- PredictThe model reads its embedding rows, runs one linear transformer layer and one dense layer, and adds the bias for the request type. Measured latency is 3.25 ms median and 4 ms at the 95th percentile.
- AddThe residual is added to the routing ETA, passed through the ReLU and clamped. Farah's 9.0 plus 2.5 becomes the 11.5 minutes the app could show. Numbers are illustrative.
- UseThe same prediction machinery can produce several ETAs for different callers. Uber's blog says DeepETA can output multiple ETAs tailored to each consumer, for instance a mean for fares and a lateness-averse figure for a rider screen, and the paper makes the same case for per-consumer estimates.
- LogThe features and the routing ETA are logged, and when the trip finishes its real duration is attached. That pair is a training example.
Why did Uber make the model so shallow? A look at the latency budget gives the answer. Time per request is the sum of everything above, the budget is a few milliseconds, and the only part under the model team's control is the model. Embedding lookups cost almost nothing, so most parameters go there. One attention layer is affordable only in its linear form. Mixture-of-experts and multi-head decoders would have added capacity, and they were rejected because "the latency does not meet the requirement". Every design choice in sections 05 and 06 is a way of buying accuracy without spending milliseconds.
9.1 The Google way: predict ahead and cache
A graph network is too heavy to run per request. A route crosses many supersegments, and the paper says that "making predictions for these supersegments on the fly is not practical nor scalable". Google's answer is a shared lookup table that holds fresh predictions for each predefined supersegment at each of the fixed horizons, updated periodically by running the models in a loop. When a request arrives, the server fetches the numbers for the supersegments on the route and interpolates between adjacent horizons. Google tested refreshing every 15 seconds and found "no measurable regression up to a frequency of 2 minutes, indicating staleness is not an issue".
That tolerance saves real compute. About 1 million supersegments at 5 horizons is 5 million table entries. Refreshing every entry each 15 seconds would mean about 333,000 predictions a second, and refreshing every 2 minutes would mean about 42,000, an eight-fold reduction. This is our arithmetic from the published figures, since the paper doesn't state how many model runs a refresh needs. There are other details in the paper, such as separate real-time and historical speeds for the exact turn a supersegment follows, for busy segments where the speed distribution splits at a junction, and fallback models for segments with no supersegment or no recent data.
| Where the model runs | Plus | Minus |
|---|---|---|
| Heavy model per request | Freshest inputs, any route | Latency and cost scale with route length and request rate |
| Small model per request on top of a routing ETA (Uber, 2022) | Handles any origin and destination; 3 to 4 ms | Model capacity limited by the budget; needs a routing engine in the loop |
| Heavy model offline, lookup per request (Google, 2020) | Cost independent of request rate; can afford a graph network | Only predefined supersegments; staleness up to the refresh interval |
| Learned route representations queried by a small model | Fast queries | Google considered this kind of approach, CompactETA, and chose the table instead |
Each company picked the option that fit its constraint. Uber handles arbitrary pickup points with no fixed road pieces, so it runs a small model per request. Google's ETAs are built from a fixed set of common routes, so it can afford to precompute. A similar split between per-request and precomputed scoring appears in recommendation systems as the difference between ranking at request time and serving a cached candidate list, and in search as the difference between a query-time model and a precomputed index.
Why is a stale supersegment prediction acceptable?
Because the inputs are themselves averages over minutes. Real-time speeds come in two-minute windows and the model already predicts for horizons spaced 10 minutes or more apart. A table that is a minute out of date shifts the answer by less than the model's own noise, and the paper's test found no measurable loss up to a two-minute refresh.
10Training data, labels and the feedback loop
A model of this kind is only as honest as its training set, and an ETA training set has some traps. Its label is the actual time of arrival, and the paper defines it by request type. For a pickup it is the time from the driver accepting the request to beginning the ride or delivery trip, and for a drop-off it is the time from the start of the trip to its end. Reading the definition for Farah's pickup, it includes the minutes the driver spends finding her by the kerb and any time she takes to get into the car. That is what the rider cares about, and it is also why handover time is part of what the model learns.
Uber's 2022 paper describes the data directly. It covers global ETA requests, rides and delivery, collected from September 13 to October 1, 2021. Trips with a travel time over two hours were removed as outliers. It is split sequentially, in time. Its first 14 days are the training and validation data, divided 90% and 10% in order, and the following 7 days are the test set. Training data holds about 1.4 billion requests. Splitting in time and not at random is the discipline from chapter 17: a model that will be used on tomorrow's trips must be tested on trips from after its training data, otherwise it is graded on questions it has effectively seen. Uber's paper says the models are retrained and validated weekly by an automated workflow, on two Nvidia Quadro RTX 5000 GPUs for the experiments.
Google's training examples come from traversal events: each example is one traversal of a supersegment, labelled with the actual time in seconds along the supersegment and each of its segments. Features for it are collected backwards in time from the traversal by the length of the horizon. A single supersegment appears in many examples. Offline numbers use January 2020 data, and the online test uses November 2020. Google notes that November 2020 could be affected by pandemic traffic patterns, so the authors chose regions where the deviation from regular traffic was smallest.
10.1 When traffic changes under the model
Roads are not stationary. Both designs get the present from real-time speeds and the regular rhythm from history, and what neither can see directly is the unusual. Google's historical average runs over 17 weeks. That handles weekly rhythms and smooths away one-off events, and also means a recurring change, like a new bridge or a school term, takes weeks to be fully reflected. Uber's model retrains weekly on recent data, and that keeps up with slow drift but lags behind a sudden regime change. Uber's blog says continuous, incremental training is planned so that ETAs "use fresher data". How either company handles an event such as a stadium emptying isn't published. What the designs imply is that a stadium crowd shows up in the model only through real-time speeds, once the cars have already slowed, and through the time and place features if the same event recurs often enough to be learned.
10.2 A loop in the labels
One more problem is built into how ETA data are collected, and neither company has published on it, so what follows is our reasoning from the structure of the system. Labels exist only for trips that happened. When a rider requests a car, the matching step computes ETAs for several candidate drivers and, roughly speaking, favours the ones with short predicted arrival times. Only the chosen driver's real arrival time is ever observed. If the model's predictions have some random error, then choosing the driver with the lowest predictions picks, more often than chance, a driver whose ETA was too optimistic. Logged trips are therefore probably a slightly biased sample, with the model's optimistic mistakes over-represented, and a model trained on them is trained on a world its predecessors helped shape. A similar pattern appears in section 10 of the YouTube case study as a feedback loop in recommendations.
Nothing in the sources says how Uber or Google counters this. Standard remedies, which the papers don't claim, include logging the ETAs of unchosen candidates, adding randomness to which driver is chosen so that some trips are unselected-by-ETA, and weighting examples by the probability they were chosen. An ETA model is also part of its own environment in a milder way: the minutes a rider sees influence whether she requests the car and which option she picks, and so shape the future requests the model is asked about.
| How the model is refreshed | Plus | Minus |
|---|---|---|
| Retrain from scratch weekly (Uber, 2022) | Simple to validate and roll back; a clean test every time | Up to a week behind a sudden change |
| Continuous incremental training (planned, per the 2022 blog) | Fresher data in the model | Harder to validate and to keep stable; every checkpoint is live |
| Separate models per region, with their own vocabularies (Google, 2021) | Local driving behaviour; regions retrain independently | Many models to run; small regions have little data |
Uber's published practice in 2022 was the first row, with the second named as future work. Google's choice of per-region models appears in both its blog and its paper. Whichever way the model is refreshed, the habit that protects it is the one the whole chapter has leaned on: judge every change against held-out trips from after the training window, and against live traffic, which is the subject of the next section.
11How anyone knows an ETA got better
Every change in the last seven sections was a bet that Farah's estimate would improve, and the bet has to be checked with numbers that mean something. Published practice has two layers. Offline, you replay held-out trips and measure error. Online, you run the new model against real traffic before it is trusted.
11.1 The offline metrics
Uber's paper measures three things on trips from after the training window. First is the mean absolute error (MAE), the average of over trips, and it describes the typical miss. Second is the median absolute error, also called p50, which is the miss that half the trips beat. Third is the 95th-percentile absolute error, p95, the size of the miss that only 5% of trips exceed, and it describes the tail. All three are reported as a relative improvement over the routing engine's own error:
The numerator is how many seconds of average error the model removed, and the denominator is the routing engine's average error, so a result of 7.83% means the model removed that share of the routing engine's error. P50 and p95 versions are computed the same way. Google's paper reports root mean squared error, , in seconds, and says MAE shows similar results. It uses RMSE for its decisions about which architectures go to online tests. Squaring makes large misses count more, and that matches Google's interest in avoiding badly wrong routes.
Neither paper reports a metric that is popular in other ETA write-ups, MAPE, the mean absolute percentage error, which divides each miss by the true time. It has a trap for ETA. A pickup that takes 2 minutes and is predicted at 1 minute is a 50% error, while a 60-minute trip predicted at 54 is a 10% error, although the second is a bigger problem for the person waiting. Short trips have small denominators and dominate the average. That's a reason to report absolute errors and to report them by trip length, and a reason to treat a percentage as a summary and never as the target.
11.2 Slices and the tail
An average over all trips can hide a lot, so both papers report by slice. Uber splits by request type. Its Table 3 reports the improvement in mean error, median error and 95th-percentile error for each kind of trip:
| DeeprETANet, offline (2022 paper, Table 3) | Mean error | Median error | 95th percentile |
|---|---|---|---|
| Delivery requests | 7.46% | 2.26% | 11.05% |
| Ride requests | 7.86% | 6.25% | 7.62% |
The slices differ in an informative way. For rides, the typical trip improved much more than for deliveries (6.25% against 2.26%), and for deliveries the tail improved most (11.05%). In the paper's phrasing, rides have "significantly lower p50 error" and deliveries "significantly lower p95 error". Split by city, in the paper's Table 6, the numbers show where the gains were and weren't. DeeprETANet's mean-error improvement over the routing ETA was 7.20% in New York, 6.80% in Los Angeles, 6.60% in Mexico City and 4.80% in London, where the XGBoost ensembles managed only 1.39%. Training counts differ: London had 102.8 million ride and 18.3 million delivery requests in the data, Mexico City 180.4 million and 16.1 million. Without slices, none of these differences would show.
Two cautions follow from earlier sections. First, our asymmetric loss pushes predictions later on purpose, so absolute-error metrics, which treat early and late alike, can't tell whether the model is doing what it was asked. A complete check would also report the signed error and the share of trips that run later than the ETA. Neither paper prints that share, so we can't say what Uber's value is. Second, the hashing result in section 05 showed that a change can improve the median and leave the 95th percentile alone, so the tail has to be watched on its own.
11.3 The online test
The offline split has a limit that section 10 explained. It judges the model on trips that happened under the old system. Uber's paper therefore ran online shadow experiments: for two weeks the new model ran on live requests across the world, its predictions were recorded, and they were compared with the actual arrival times alongside the production model's, with nothing shown to riders or drivers. A shadow test keeps the matching loop from section 10.2 out of the measurement. Launch required beating the online XGBoost on mean, median and 95th-percentile error across mega-regions, Uber's term for its large geographic regions. Aggregated over several launches, Table 7 of the paper reports these improvements over production XGBoost:
| DeeprETANet vs production XGBoost, online (2022 paper, Table 7) | Mean error | Median error | 95th percentile |
|---|---|---|---|
| Delivery requests | 2.91% | 4.74% | 3.92% |
| Ride requests | 2.66% | 4.15% | 3.23% |
Offline, DeeprETANet beat the routing ETA by 7.83% and XGBoost by 5.07%, a gap of about 2.8 percentage points. Online, the improvement over XGBoost was 2.7 to 2.9% in mean error. Units differ, since one is relative to the routing engine's error and the other to XGBoost's, so we shouldn't equate them, but the two are roughly the same size and the same sign, and that is what a good offline test should deliver. Google's online comparison, in the same spirit, measured whole-route travel times over a week in January 2021 and found the graph model ahead of every baseline in all four regions. Experiments on the marketplace itself, such as whether better ETAs change cancellations or matching quality, aren't published in the sources we read. Uber's only statement of value is that low single-digit percentage gains in ETA error "unlock tens of millions of dollars" a year.
Why report improvement over the routing engine and not seconds of error?
Absolute errors depend on what trips are in the sample, since a market of airport runs has bigger misses than one of three-minute hops, so seconds can't be compared across cities or months. A ratio against a fixed baseline can. Uber's absolute errors aren't printed at all, and the relative form is what the papers share.
12What went wrong, and what it cost
Neither company has published a post-mortem of an ETA failure, so we can't tell a story of an outage. Each probably has internal incident reviews, but none appear in the sources. What the sources do contain is a series of dead ends and compromises, and each one shaped the final design.
Earliest is Goldeta's cold start. Uber's first ETA system, which adjusted open-source routing with the company's own trips, did worse in new cities than in old ones, because a city with no history had nothing to learn from. Uber's 2015 post says the response was its own routing engine and a historical traffic system fed by driver phones, launched in April 2015, and it reports that rush-hour commutes were the least predictable trips even afterwards. Uber's 2022 design answers cold start in another way, by training one global model on global data, with country, region and city identifiers as features, so a small city shares what the model learned elsewhere.
Next was the scaling wall of the tree ensembles. Uber's blog says the team contributed improvements to the open-source XGBoost library so that its trees could grow deeper, creating one of the largest ensembles in the world at the time, and then found that scaling it further was "untenable". That cost a rebuild on a different model family, with the loss, the embeddings and the serving path all redone.
DeepETA's own paper lists compromises that the numbers make visible. Log-transforming the target tames skew but "results in some extreme values" on the way back, so the team designed a new loss in place of the standard fix. Mixture-of-experts and multi-head decoders would have captured the differences between ride and delivery better, and they "did not meet the latency requirement", so a single bias per request type stayed. Hashing improved the median and left the 95th-percentile error unchanged. And the whole approach was tested only on Uber's own routing engine, which the authors name as a limitation.
Google's list is similar in spirit. Training variance was the main obstacle to deploying, and it took MetaGradients and the weight average to fix. Several offline improvements, such as extended supersegments, unsupervised auxiliary losses and richer aggregators, were not launched, because they depended on region and horizon or cost more than they returned. Coverage is partial: about a million predefined supersegments cover freeways, arterials and popular shortcuts, and quieter streets fall back to simpler per-segment models. Gains were also uneven, from 16% in London and Copenhagen to 51% in Taichung City according to the DeepMind post. It doesn't say what explains the spread.
Only one cost figure appears in either source, Uber's: error reduced by low single-digit percentages is worth tens of millions of dollars a year. At that price, a rebuild that shaves a few percent off the error is worth years of work, and it explains why so much of the engineering effort in the papers goes into avoiding small regressions.
| What happens | What Farah sees | What the design does | Source |
|---|---|---|---|
| A road segment has no recent speeds | Nothing unusual | Fallback models cover segments without real-time or historical inputs | Google paper (published) |
| An accident or closure appears in live speeds | A longer, honest ETA | Real-time speed features and the routing engine's traffic weights carry it | Both papers (published) |
| An event no feature has seen | An ETA that is too short and then wrong | Only real-time speeds help once cars slow; weekly retraining is slower than the event | Our reasoning from the design |
| A very long trip over two hours | An unreliable ETA | Such trips were removed from Uber's training data | Uber paper (published) |
| A saved model differs from the last one | An ETA that shifts for no reason | MetaGradients and EMA reduce variance across checkpoints | Google paper (published) |
| A cached supersegment table is stale | Usually nothing | Tested up to a two-minute refresh with no measurable loss | Google paper (published) |
Why not add a safety margin to the ETA afterwards instead of changing the loss?
A fixed margin shifts every ETA by the same amount, but the right shift varies. A short pickup in a quiet street has a tight spread and needs almost no padding, and a long trip through a bottleneck has a wide spread and needs a lot. A lopsided loss lets the model learn how much padding each situation wants, because the best prediction under that loss is a quantile of that situation's own distribution.
13The whole system
We can now draw the full design. Down the left side runs Farah's request on the online path, where the routing engine produces a baseline, the residual model corrects it and a lookup of graph-model predictions supplies segment-level times. Down the right side runs the offline loop: the trip's real duration is logged, assembled into a time-ordered training set, used to train and validate the next model, and tested against live traffic before it replaces the old one. This picture merges what the two companies published, so no single company runs exactly this diagram.
That loop closes when a promoted model changes the ETA that Farah sees tomorrow, and that changes which drivers are matched and which trips are logged. Several parts of this picture are unpublished: the production values of the loss parameters, absolute error levels, how the downstream consumers use the model's outputs, how often each lookup table is refreshed in current systems, and what has changed since 2021 and 2022, the years of the two papers.
| Component | What it does | Added because |
|---|---|---|
| Routing engine | Shortest path on the road graph, sum of segment times | Geography is exact and free; no model should have to rediscover it (§02) |
| Residual model | Predicts how wrong the routing ETA will be | Systematic errors the graph can't see (§03) |
| Asymmetric Huber loss | Sets which number the model reports | Late costs more than early, and the tail is long (§04) |
| Bins, embeddings and double hashing | Turn features into table lookups | Shape of the response without depth, memory without collisions (§05) |
| Linear transformer and bias layer | Mix features, calibrate per request type | Interactions at linear cost; heterogeneity at almost no cost (§06) |
| Graph network on supersegments | Predicts segment-route times from neighbours' state | Traffic spills along roads; summing segments adds error (§07) |
| MetaGradients and EMA | Stabilise training | Models saved at different times gave different ETAs (§08) |
| Lookup table of predictions | Serves the graph model's outputs per request | The model is too heavy to run per request (§09) |
| Time-ordered data, weekly retraining | Keeps the models current and honestly tested | Traffic drifts; random splits leak the future (§10) |
| Shadow and online tests, sliced metrics | Judge changes on slices and the tail | Averages hide regressions in regions and request types (§11) |
14Summary
- An ETA is a prediction with a spread, used by fares, matching and delivery planning, and it has to be accurate, fast, general and stable at billion-requests-a-week scale.
- A routing engine alone is a sum of road-piece times. It can't see which route a driver takes, the minutes spent at the kerb, differences between task types, or the difference between mean and safe-side estimates.
- Learn the residual, not the answer. Predicting the gap between the routing ETA and the actual time (Uber, 2022) keeps the model small, because the graph already supplies the geography. In a toy test the same cells reached 87 seconds of error as a residual table and 145 from scratch.
- Asymmetric Huber loss encodes lateness. Huber is quadratic near zero and linear in the tails, and the weight sets the best prediction to a quantile or expectile at level , so one model can be tuned to a consumer's needs.
- Discretise and embed every feature. Quantile bins for continuous values, tables for categories, and geohashes at four resolutions with two independent hashes make the model wide, shallow and fast, with 99% of its parameters in lookups.
- Two hash functions make collisions rare. A million cells in half a million rows collide for 86.5% of cells with one hash and about 0.0004% when both must match.
- Linear attention fits the many-features, small-vectors case. Reordering the matrix products turns an table into a summary, and a per-type bias layer handles ride and delivery differences without a latency hit.
- Google puts the road graph into the model. Supersegments of about 20 connected segments, message passing, and a model per horizon let traffic on neighbours reach each segment, and the deployed model reduced negative ETA outcomes by 40% or more in cities like Sydney.
- Stability is a requirement. A three-part loss, MetaGradients for the learning rate and an average of the weights stopped saved models from giving different ETAs.
- Serving shapes the model. Uber runs a shallow model inside the request at a 3.25 ms median and 4 ms p95, and Google precomputes graph predictions and tolerates a refresh of up to two minutes.
- Judge by slices, the tail and live traffic. Report MAE, p50 and p95 against a routing baseline by request type and city, use shadow tests that keep the matching loop out of the measurement, and remember that labels exist only for trips that happened.
15Build this
Each idea in this chapter is easy to nod along to and easy to get wrong. You can rebuild the whole stack at toy scale in a day with synthetic data, and watch every fix change what the model reports.
Build a small world where you control the truth: a 30 by 30 grid city whose edges have free-flow speeds, a congestion field that varies by area and hour, a few closures, drivers who choose slightly different routes, a handover time that differs for pickups and drop-offs, and noise. Your truth is what no real system can see, so every model can be judged against it.
- Simulate 200,000 trips. For each, log the features, a routing ETA computed by Dijkstra on speeds that are ten minutes old, and the actual time. Report MAE, p50 and p95 of the routing ETA, overall and by trip length.
- Train two models on the same binned features: one predicting the actual time, one predicting the residual with a Huber loss. Compare errors at 1,000, 10,000 and 100,000 training trips.
- Add the asymmetric weight. Sweep over 0.5, 0.35 and 0.2, and plot the share of trips that run late against mean error. Check that the late share lands near for a small .
- Encode origin and destination cells with a single hash, then with two, into tables smaller than the number of cells. Measure collisions and error, and compare with exact indexing.
- Add one attention layer over the feature embeddings, first softmax and then linear, and time both at batch size 1 as you add features.
- Give the model the road graph: two rounds of message passing over the segments of a route, against a sum over the same segments with no edges. Make a slice where a jam sits just off the route and see which model notices it.
- Cache predictions per route piece, refreshed every 15 seconds, 2 minutes and 10 minutes, and plot error against staleness.
16Interview questions
BeginnerWhy not use the routing engine's ETA directly?
A routing engine sums the times of road segments along one best path. It doesn't know which route the driver will take, how long finding the kerb takes, that a pickup and a restaurant drop-off behave differently on the same path, or that the fare needs a mean while a rider screen may need a safer figure. Uber's 2022 paper lists route uncertainty, human error, distribution shift and uncertainty estimation. A routing ETA is a strong starting point, and its errors are systematic enough to learn.
BeginnerWhat does it mean to predict the residual?
Instead of predicting the actual time from scratch, the model predicts the difference between the actual time and the routing ETA, and the system adds it back: ETA = routing ETA + residual. Routing supplies the part that road geometry determines, and the model learns only the systematic gap for this hour, place and request type. In a toy test, tables with identical cells reached 87 seconds of error as a residual model and 145 seconds, no better than the routing ETA, from scratch. Boosting and residual networks use the same idea.
IntermediateExplain the asymmetric Huber loss and what its two parameters do.
Huber loss is squared error for errors below and linear above it, so it's smooth near zero and robust to outliers. Its asymmetric version multiplies it by when the actual time is below the prediction (arrived early) and by when it's above (arrived late). With a small the best single prediction is the quantile at level , since the fraction of trips later than it settles at ; with a large it's an expectile. So pushes ETAs later, and controls outlier robustness. Uber's 2022 paper introduced it for DeeprETA and doesn't publish production values.
IntermediateWhy bucketize continuous features and embed them?
Responses to features like time of day or speed aren't smooth or monotone, and a dense network would need depth to carve the input range into regions. Uber's paper found that quantile-binning continuous features (256 bins for speed) and embedding them beat raw values, and that quantile bins beat equal-width ones, because each holds equal data and keeps the most information. An embedding lookup is constant time, so the table can be huge (99% of about 141 million parameters) without costing latency, which stays in a shallow network.
IntermediateHow does multiple feature hashing help with geospatial features?
Geohash cells, and especially origin-destination pairs, are too many for one embedding row each. A single hash into a fixed table makes unrelated cells collide: with cells and rows, the chance a cell shares a row is about , which is 86.5% for a million cells in half a million rows. Two independent hashes give each cell two rows, and a confusion needs both to match, with probability about . Uber's network combines the two vectors, so one collision is outvoted. Uber uses MurmurHash3 with two seeds at geohash lengths 4 to 7, for origin, destination and the pair.
IntermediateWhy did Uber use a linear transformer?
Self-attention over the features gives explicit pairwise interactions, but the standard form builds an table at cost of the order . With many features and tiny vectors (size 4), that's too slow for a few-millisecond budget. A linear transformer replaces the softmax with a feature map and regroups the products so a summary is computed once, giving cost of the order . It's a different attention mechanism, so Uber validated its accuracy, and it compared Linformer and Performer too.
IntermediateWhich metrics would you report for an ETA model, and how would you slice them?
Mean absolute error for the typical miss, median for the central trip, and a high percentile such as p95 for the tail, each as an improvement over the routing ETA so they compare across places. Add the signed error and the share of trips that run late, since absolute error can't see the asymmetry the loss was built for. Slice by request type, trip length, region and hour. Uber's paper shows why: deliveries gained 11.05% at p95 but 2.26% at the median, and London's gain was 4.8% against New York's 7.2%. Treat MAPE with suspicion, since short trips with small denominators dominate it.
DeepHow does Google's supersegment GNN work, and why precompute its outputs?
A supersegment is a graph of about 20 connected road segments (50 to 100 m each), with per-segment real-time and historical speeds. A Graph Network encodes it, runs two rounds of message passing with shared weights, and decodes a travel time for the whole supersegment, with segment-level outputs as training aids. There is one model per horizon (0, 10, 20, 30 and 60 minutes), and a route queries supersegments in order, interpolating horizons by the predicted arrival time. A route crosses many supersegments, so running the model per request isn't scalable. Google keeps a shared table of fresh predictions for about a million supersegments and found no measurable loss with refreshes up to every two minutes.
DeepWhat would go wrong when you train an ETA model on logged trips, and how would you check?
Labels exist only for trips that happened, and the matching step favours drivers with short predicted ETAs, so the logged trips over-represent cases where the model was optimistic, and the model learns from a sample its predecessors shaped. Neither company's papers discuss this, so it's reasoning from the system's structure. To check, log the predicted ETAs of unchosen candidates, randomise a small share of assignments, compare the model's error on randomised and non-randomised trips, and weight training examples by the probability they were chosen. A shadow experiment avoids the loop for evaluation, since nothing the model outputs is acted on.
DeepThe model ships next month. What stability and rollout checks do you want?
Google's paper says its main deployment obstacle was variance across saved models, fixed with MetaGradients for the learning rate and an EMA of the weights, so I'd compare predictions of consecutive checkpoints on a fixed trip set and require small disagreement. I'd evaluate sliced by request type, city and trip length, against the production model and the routing baseline, on a time-ordered test set. Then a multi-week shadow run, as Uber did with a two-week global shadow, with launch criteria on mean, median and p95 error, and a fallback path for missing inputs, as Google has for segments without speeds. Only then would I move to a live experiment on marketplace metrics.