When you open Swiggy or Zomato on a Friday evening, that crisp “35 mins” badge on a restaurant card is not a static estimate. It is the output of a multi-stage, real-time machine learning pipeline balancing kitchen throughput, fleet positioning, two-wheeler traffic physics, and hyper-local building friction—all computed before you even tap Place Order.

Consider a classic Lead Product Analyst case question:
“Our static 35-minute ETA model is breaking down every Friday night. Late deliveries are spiking, support refunds are climbing, and checkout conversion drops whenever we pad the timer. How do we redesign the ETA engine from scratch?”
A junior candidate answers: “We take the trailing 30-day average delivery time for that restaurant, segmented by hour of day.”
That approach fails immediately in production. Trailing averages are blind to real-time kitchen congestion, weather shocks, rider supply deficits, and order composition—treating a zero-prep Diet Coke identically to three customized main courses.
1. Decomposing the Physical Supply Chain
Top-tier analytics teams never predict end-to-end delivery time as a single monolithic target. Instead, they decompose total ETA into four distinct, observable operational components—each driven by different physical constraints and telemetry streams:
Total Predicted ETA = max(Kitchen Prep Time, Rider Arrival Time)
+ First-Mile Handoff & Bagging
+ Modal Travel Time (Restaurant → Customer)
+ Last-Mile Drop-Off Friction Penalty
Notice the max(Kitchen Prep Time, Rider Arrival Time) term: kitchen preparation and rider dispatch run in parallel, not sequentially. Optimizing one without synchronizing the other destroys unit economics.
2. The Four Core Sub-Models
Stage 1: Item & Queue-Level Kitchen Preparation Time (KPT)
Predicting prep time at the restaurant level misses SKU complexity and real-time load. A cold coffee takes 2 minutes on an empty counter—but if the merchant’s POS tablet has 40 active tickets printing simultaneously, that 2-minute coffee inherits a 15-minute queue penalty.

- Key Features: Item-level baseline prep distribution (p50/p80), item concurrency factor (parallel vs. sequential cooking stations), active merchant ticket backlog, dine-in peak proxy, and historical merchant “Food Ready” button bias (correcting for merchants who tap Ready early to avoid SLA penalties).
- Target Variable: True
Rider_Pickup_Timestamp - Order_Accepted_Timestampon orders where the rider arrived before the food was bagged.
Stage 2: Just-In-Time Rider Dispatch & Arrival
Rider idle time at the restaurant is the silent killer of hyperlocal unit economics. If a rider reaches the restaurant in 4 minutes while the biryani takes 22 minutes, the platform burns 18 minutes of paid fleet capacity.
.47DzLlxO_ZlPNMU.webp)
- The Synchronization Objective: Trigger rider assignment at
Order_Time + (Predicted_KPT - Predicted_Rider_Travel_to_Merchant - Buffer)so the rider walks in at the exact minute the bag is sealed. - Key Features: Real-time spatial supply-demand ratio within a 1.5 km H3 hexagon, rider acceptance probability, and merchant parking/pickup friction.
Stage 3: Two-Wheeler Modal Travel Time
Standard mapping APIs are calibrated primarily for four-wheeled passenger cars. In dense Indian urban corridors (like Bengaluru’s Outer Ring Road or Mumbai’s Western Suburbs), a four-wheeler stuck in gridlock moves at 9 km/h, whereas a two-wheeler filters through traffic lanes and shortcuts at 21 km/h.
.BBzZeRWn_tvCpj.webp)
- Key Features: Base routing API duration, live H3-to-H3 two-wheeler velocity telemetry from active fleet GPS pings, turn-density penalties, rainfall intensity flags (which erase two-wheeler lane-filtering advantages), and signal wait distributions.
Stage 4: Hyper-Local Last-Mile Friction Penalty
Dropping an order at an independent street-facing house takes 60 seconds. Navigating a 20-tower gated society, waiting at the security gate for MyGate/NoBroker visitor approval, walking to Tower G, and waiting for service elevators takes 10 to 12 minutes.
.C76Be1On_d0PHT.webp)
- The Feature Engineering Fix: Cluster historical drop-off coordinates using geohash / H3 Level 10 micro-cells (
~65m × 65m) and compute the historical delta betweenRider_Arrived_at_Gate_TimestampandOrder_Delivered_Timestamp. High-rise complexes automatically receive an empirically learned +8 to +12 minute last-mile penalty.
3. The “Aha!” Insight: Asymmetric Error & The Business Trade-Off Matrix
Accuracy metrics like RMSE or MAE treat a 10-minute early delivery and a 10-minute late delivery as equally bad. In consumer food tech, the cost function is sharply asymmetric:
| Prediction Error Regime | Customer Experience | Financial & Funnel Impact |
|---|---|---|
| Under-Promise (Pessimistic ETA) Show 55 mins → Deliver in 32 mins | User abandons cart at restaurant browse/checkout screen | Immediate Conversion Loss: Every +5 mins of displayed ETA drops checkout conversion by ~2.5%–4.0% |
| Calibrated Sweet Spot Show 35 mins → Deliver in 31–34 mins | High pre-checkout trust + mild “Delivered Early!” delight | Optimal LTV: Maximizes both upfront conversion and repeat order frequency |
| Over-Promise (Optimistic ETA) Show 25 mins → Deliver in 48 mins | Anxiety, support escalations, cold food, refund demands | Retention Destruction: Late orders (>10 min breach) cut 30-day user retention by 15%+ |
Segment-Aware Buffer Tuning
Instead of applying a uniform safety buffer across all users, leading platforms run a Quantile Regression model (predicting p50, p75, and p90 arrival times) and dynamically select the displayed quantile by user cohort:
- New / Acquisition Users (Orders 1–3): Serve the p80 / p85 prediction (+4 to +6 min safety buffer). First-time users have zero brand forgiveness; guaranteeing an on-time or early first delivery protects long-term cohort retention.
- Power / Subscription Users (e.g., Swiggy One / Zomato Gold): Serve the p55 / p60 prediction (tightest realistic ETA). High-frequency users are highly elastic to displayed delivery speed at checkout and exhibit higher tolerance for minor 2–3 minute variances.
4. Production SQL: Diagnosing ETA Misses & Rider Idle Leakage
Before retraining any ML model, an analyst must quantify where Friday night variance actually originates. This production query decomposes Friday peak orders into KPT Prediction Error, Rider Wait Time, and Last-Mile Breach across restaurant tiers:
WITH friday_peak_orders AS (
SELECT
o.order_id,
o.restaurant_id,
r.cuisine_category,
o.user_segment, -- 'new_user', 'regular', 'power_subscriber'
o.displayed_eta_mins,
o.predicted_kpt_mins,
o.predicted_travel_mins,
o.predicted_last_mile_mins,
-- Actual observed timestamps
EXTRACT(EPOCH FROM (o.food_ready_ts - o.order_accepted_ts)) / 60.0 AS actual_kpt_mins,
EXTRACT(EPOCH FROM (o.rider_arrived_merchant_ts - o.order_accepted_ts)) / 60.0 AS rider_arrival_mins,
EXTRACT(EPOCH FROM (o.rider_arrived_customer_ts - o.rider_picked_up_ts)) / 60.0 AS actual_travel_mins,
EXTRACT(EPOCH FROM (o.delivered_ts - o.rider_arrived_customer_ts)) / 60.0 AS actual_last_mile_mins,
EXTRACT(EPOCH FROM (o.delivered_ts - o.order_accepted_ts)) / 60.0 AS actual_total_mins
FROM analytics.fact_food_orders o
JOIN analytics.dim_restaurants r
ON o.restaurant_id = r.restaurant_id
WHERE o.order_status = 'DELIVERED'
AND EXTRACT(DOW FROM o.order_accepted_ts) = 5 -- Friday
AND EXTRACT(HOUR FROM o.order_accepted_ts) BETWEEN 19 AND 22
AND o.order_accepted_ts >= CURRENT_DATE - INTERVAL '30' DAY
)
SELECT
cuisine_category,
user_segment,
COUNT(order_id) AS total_orders,
-- 1. SLA Breach Rate (> 5 mins late vs promised ETA)
ROUND(100.0 * AVG(CASE WHEN actual_total_mins - displayed_eta_mins > 5 THEN 1 ELSE 0 END), 2) AS late_breach_pct,
-- 2. Root-Cause Error Decomposition (Actual - Predicted in mins)
ROUND(AVG(actual_kpt_mins - predicted_kpt_mins), 2) AS kpt_bias_mins,
ROUND(AVG(actual_travel_mins - predicted_travel_mins), 2) AS travel_bias_mins,
ROUND(AVG(actual_last_mile_mins - predicted_last_mile_mins), 2) AS last_mile_bias_mins,
-- 3. Fleet Synchronization Efficiency (Rider waiting at restaurant)
ROUND(AVG(GREATEST(0, actual_kpt_mins - rider_arrival_mins)), 2) AS avg_rider_idle_mins
FROM friday_peak_orders
GROUP BY 1, 2
HAVING COUNT(order_id) >= 100
ORDER BY late_breach_pct DESC;
5. Experimentation & Rollout Playbook
When deploying a redesigned ETA model, evaluate success using a Dual-Guardrail A/B Test (randomized at the H3 spatial cluster × time-window level to prevent rider pool interference):
- Primary Conversion Metric: Session-to-Order Checkout Conversion Rate (ensuring tighter ETAs lift top-of-funnel volume).
- Primary Quality Guardrail: Severe Late Delivery Rate (
Actual ETA - Displayed ETA > 7 mins) and 14-day repeat order rate. - Unit Economics Guardrail: Average Rider Idle Time at Merchant (
< 3.5 minstarget) and Order Cancellation / Support Refund Rate per 1,000 orders.