Journals / Case study

How Swiggy predicts the delivery time it shows at the cart

In August 2023 a Swiggy team described the model behind the delivery time shown before an order is placed. One neural network predicts five numbers at once, from finding a rider to reaching the door. Swiggy reports faster training and smaller errors than the model before it, without giving a single figure in minutes.

07 NOV 20269 min readMarketplaces · Time series · Embeddings · Machine learning Based on: Swiggy, 2023
Diagram of the legs behind Swiggy's cart promise. A bar split into four parts: O2A, find a rider; FM, ride to the restaurant; WT, wait for food; LM, ride to the customer. Together they make O2R, the time shown at the cart. Below, the post's example of two orders whose food is ready at minute 15. Order A's nearest rider is 10 minutes away, so a rider is assigned within about 5 minutes and rides 10. Order B has 5 riders already outside, so assignment waits until close to minute 15 and the ride is about zero.
Diagram: MORARI. Source: Swiggy

Before you pay for a food order, the app tells you how long it will take. For many people that number decides whether they order. On 11 August 2023 Shubham Grover, Soumyajyoti Bannerjee, Vaibhav Agarwal, Sunil Rathee and Akshita Sood of Swiggy, the Indian food delivery app, described the model behind it.

The problem: a promise that cuts both ways

Swiggy calls the number the promised delivery time, or pSLA. "It’s also a double edged sword. If the order is delayed, the customers end up unhappy. But if the delivery time promise is conservative, it reduces the propensity of the customer to place an order." The team's phrase for the target: "You have to operate within the Goldilocks zone."

The number drives other systems. "Our assignment system takes this time as an input and assigns the right delivery executive to fulfil what was promised to the customer." Customer care uses it for tickets, and an exception system steps in when an order runs past it.

Many things move it: the kind of kitchen, the number and type of dishes, how many riders are free, distance, and the city. "For example travel times during evening rush hours in Bangalore are very different from Gurgaon."

How they built it

Predict the legs, not only the total. The model has five targets: time to assign a rider (O2A), the rider's trip to the restaurant (first mile), the wait for food, the trip to the customer (last mile), and the total, order to reached (O2R). The cart shows the total. Assignment and delay handling use the legs.

One network for all five. Swiggy uses "a MIMO (multi input, multi output) deep learning model supplemented with entity embeddings." Every output shares the inputs and the first hidden layers, then branches into its own small sub-network. Separate networks were "not only inefficient to train and deploy but also left unrealised performance benefits on the table." A shared one can learn that "O2A + FM + WT + LM = O2R".

Diagram of Swiggy's cart model. Inputs: numbers such as the prep-time estimate, kitchen stress, riders against active orders and last-mile distance; moving averages of history and near-real-time behaviour per restaurant, zone and leg; and learned embeddings for restaurant, customer geohash and city, with hundreds of thousands of values. They feed shared hidden layers used by every output, so the model can learn that O2A plus FM plus WT plus LM equals O2R. Five heads come out: O2A assign, FM first mile, WT wait, LM last mile, and O2R, the promise. Swiggy-reported gains: about 50 percent less training memory, about a fifth of the old training time, nearly 30 percent better MAE on assignment time, and 5 percent better MAE on the total from embeddings.
The shape of the 2023 cart model, redrawn from the post's description. Diagram: MORARI. Source: Swiggy

Embeddings for big categories. Restaurants, customer geohashes and cities have "hundreds of thousands of unique values", too many for one-hot encoding. The model learns a short vector for each instead, trained with the rest of the network.

Model the dispatcher too. The post's sharpest example is drawn above: two orders whose food is ready at minute 15. For order A the nearest rider is 10 minutes away, so the system assigns within about five minutes. For order B five riders wait outside, so it assigns "as close to the 15th minute as possible." Same kitchen time, different assignment times. So assignment and first mile are learned together, and the prep-time estimate the dispatcher uses is fed in as an input: "To account for the Assignment engine’s behaviour we consume the same prediction as an input".

Features with memory. Kitchen stress from recent orders placed and prepared, "Stress in the system (active DEs vs active orders)", last-mile distance, and past and near-real-time speeds around both ends. Travel times repeat by hour and by week, so most features are moving averages over several windows. Rain, holidays and live traffic feeds are not mentioned.

Measure what customers feel. Besides mean absolute error (MAE), Swiggy tracks bi-directional compliance, the share of orders within plus or minus X of the prediction, and egregious delay, the share beyond plus Y. The post never gives X or Y.

What it delivered

All results are Swiggy-reported, against an earlier model the post does not name. The shared design cut "training memory footprint by around 50%", so training fit in memory, "reducing our training times to nearly a fifth." Learning the legs together gave "a nearly 30% improvement in the MAE for O2A predictions". In-model embeddings cut the total's MAE by 5%.

There are no minutes: no absolute error, no on-time share, no test of whether orders or complaints moved. The post does not say whether the cart shows the average, a padded figure or a percentile. Serving and speed are not covered.

The team named two open problems: data-poor groups of orders lag, and "standard loss functions being one-size-fits-all". First on its list: "Using a custom loss function to better optimise the business metrics".

What has changed since

The clock got shorter. In October 2024 Swiggy launched Bolt, food in 10 minutes from restaurants "within a 2 km radius of the consumer". Riders are not told which orders are Bolt, "meaning they are neither penalized nor incentivized based on delivery time." By its Q2 FY2027 letter to shareholders, Bolt and 99-Store together were "more than 25% of Food delivery volumes".

The single number gave way to a range. A Swiggy post first published in October 2026 says regional targets used to rely on "static city-level buffers applied on top of pointwise ETA predictions." The new model outputs a Lognormal distribution, so the business can "extract any percentile (p54, p77 or p89) at inference time for any city or cohort". It "replaced our legacy MAE-based custom loss" with negative log-likelihood. User-level A/B tests leak between customers who share riders, so the model ran in shadow mode first. Swiggy reports "a 13% relative increase in segments meeting compliance targets". That post does not cite the cart model. Our reading is that it continues the custom-loss work; we do not know whether the cart number itself moved to it.

Others went the same way. DoorDash described in March 2024 a two-layer ETA whose base layer gives "uncertainty estimation through probabilistic predictions", with a separate layer for the decision. Grab says it consolidated its ETA models "down to just 16".

The post itself holds a caution. On trees versus networks it links a benchmark paper that found "tree-based models remain state-of-the-art on medium-sized data". Swiggy says years of tests favoured networks at its scale, which most apps never reach.

Why it matters for your business

Indonesian apps describe the same moving parts. ShopeeFood's help centre says the shown estimate "dapat berubah tergantung pada ketersediaan Mitra Pengemudi, kondisi cuaca, kondisi lalu lintas". Gojek says "Proses pencarian driver akan disesuaikan dengan waktu persiapan makananmu di resto", which reads like Swiggy's order A and order B.

Two local peaks matter. Grab put Ramadan orders "antara pukul 4 dan 5 sore" in 2021 and reported a 28-minute average arrival in the first two weeks. BMKG forecasts a rainy season that comes late and runs short, with "puncak musim hujan 2026/2027 pada bulan Desember 2026" for most of the country. A moving average catches both late, so give the model flags for them.

You do not need Swiggy's network to use its ideas. Any business that quotes a time, from a cloud kitchen to a courier or a home-service booking, faces the same trade: quote long and lose the sale, quote short and lose trust. Predict the parts, quote from a range, and manage the promise like a product setting.

How we would build it today

Diagram of a cart promise for an Indonesian delivery app, in three bands. Log every order, every leg: timestamps for order, rider assigned, at restaurant, picked up and delivered; context such as zone, hour, day type, riders online, kitchen queue and distance; flags for rain in the zone, Ramadan and the hours before buka puasa, and payday. Model, start small: gradient-boosted trees per leg, then a range rather than a point, a median plus a few quantiles or a lognormal fit, then pick the shown number, the percentile that hits the on-time target in that zone and hour. Guards: clip to a sane range, check units on every input, alert when features drift. Prove it: shadow mode first, test by zone or time block and not by user because riders are shared, and track on-time rate, average overestimate and cart-to-order rate. Underneath: feed the same legs to dispatch, late-order alerts and customer care, and retrain weekly with a drift check.
Predict a range per leg, then choose the number to show per zone and hour. Diagram: MORARI. Source: Swiggy
  1. Log every leg. Order, rider assigned, at restaurant, picked up, delivered. Without these timestamps there is nothing to learn.
  2. Start with trees. Gradient-boosted trees per leg, our pick at a few thousand daily orders. Move to a shared network when trees stop improving.
  3. Predict a range. A median plus a few quantiles per order, or a lognormal fit, which Swiggy reports fit its data best. Check it on yours.
  4. Choose the shown number per zone and hour. Pick the percentile that hits your on-time target there. That is a business choice, not a model.
  5. Give dispatch and the promise the same prep estimate. If dispatch times riders to the kitchen, the promise has to know.
  6. Flag rain and Ramadan. A rain flag per zone and a buka puasa window, learned from your own history, not fixed extra minutes.
  7. Guard the inputs. Clip outputs to a sane range and check units. A 2024 Swiggy post (now only in the Web Archive) recalls an upstream service that sent data "in milliseconds instead of microseconds".
  8. Shadow before you show. Score live orders without displaying the new time, then test by zone or time block, not by user.
  9. Watch three numbers. On-time rate, average overestimate and cart-to-order rate, per zone and hour.

With a few hundred orders a day, steps 1, 4 and 9 are most of the value, in our view. The network can wait.