Predicting Food Delivery Time at Cart

Shubham Grover, Soumyajyoti Bannerjee, Vaibhav Agarwal, Sunil Rathee, Akshita Sood11 Aug 2023

Problem

Swiggy shows a promised delivery time on the cart page, before the customer pays. A pessimistic promise lowers the chance that a customer places the order. An optimistic one produces late orders and unhappy customers. The same number also feeds courier assignment, customer care decisions and the system that handles delayed orders, so an error reaches all of them. Delivery time depends on interacting factors: restaurant, order, courier availability, distance and traffic.

Example from the article: A customer adds a coffee to the cart and compares the promised times of two nearby restaurants before paying.

Solution in brief

One multi-input, multi-output (MIMO) neural network predicts every leg of the order: assignment, first mile, wait, last mile and total time. The legs share inputs and hidden layers, and high-cardinality categories (restaurant, customer geohash, city) use entity embeddings trained inside the model. Features combine historical and near real time moving averages. Quality is measured with MAE, bi-directional compliance and egregious delay.

Questions this case answers
  • How to predict an end-to-end duration made of dependent stages when the stages share most of their inputs and each stage is also needed on its own
  • How to evaluate a regression model by customer-visible reliability and extreme errors instead of average error only
  • How to predict the delivery time shown at checkout so that it is accurate and customers trust it?
  • How to predict several linked legs of an order (assignment, pickup, travel) without training a separate model for each?

Tools and methods

  • MIMO neural network — one shared trunk with a separate head per delivery leg.
  • Entity embeddings — dense vectors for restaurants, geohashes and cities, learned together with the network.
  • Moving-average features — historical and near real time averages per leg, window and pivot.
  • Food preparation time model — its prediction is reused as an input feature.
  • MAE, BDC, ED — accuracy metrics tied to what the customer experiences.
Continue reading — it's free

Google or a one-time email code. No password.