Matching a delivery order to a driver sounds like it should be simple — find the nearest available person and send them the job. At DoorDash's scale, across thousands of markets running simultaneously with wildly different densities of restaurants and Dashers, that naive approach leaves enormous efficiency on the table and produces worse outcomes for everyone: longer wait times for customers, less efficient routes for Dashers, and unnecessary delays for merchants. DoorDash built a dispatch system, referred to internally under names including DeepRed, that treats assignment as a continuous optimization problem solved with machine learning rather than a simple nearest-neighbor lookup.
Assignment as prediction plus optimization
The dispatch problem splits naturally into two parts that DoorDash's system handles separately but jointly. First, prediction: how long will this order take to prepare at this merchant, how long will this Dasher take to arrive at the merchant, and how long will the delivery leg itself take given current traffic and distance. Second, optimization: given those predictions for every plausible pairing of available orders and Dashers in a market, which assignment minimizes overall delivery time and cost while keeping the system fair and stable, rather than greedily optimizing one order at a time in a way that starves other orders of good options.
This two-part structure matters because a system that only optimizes assignment without good underlying predictions will make confidently wrong decisions, while a system with great predictions but naive greedy assignment will still make locally-optimal choices that are globally inefficient — sending the closest Dasher to every order one at a time, for example, can leave a cluster of later orders with no good options left.
Batching decisions instead of deciding order by order
Rather than assigning each incoming order to a Dasher the instant it's ready, DoorDash's dispatch logic considers batches of orders and available Dashers together over short time windows, which opens up assignments a purely sequential system would never find — such as one Dasher picking up two orders from restaurants near each other and delivering both efficiently, reducing total delivery time and cost across both orders simultaneously compared to sending two separate Dashers.
Naive: order arrives -> assign nearest available Dasher -> repeat
Batched: collect orders + Dashers in window -> jointly optimize
assignments (including multi-order batches) -> dispatchThis batching approach requires the system to make many assignment decisions within tight latency budgets, since customers and Dashers both expect a near-instant response, which pushed DoorDash toward efficient approximate optimization techniques rather than solving the assignment problem exactly, since exact solutions to this kind of matching problem don't scale to real-time constraints at high order volume.
Feedback loops between prediction and outcomes
Because the predictions feeding the optimizer — prep time, travel time, delivery time — are themselves machine learning models, DoorDash continuously retrains them against actual observed outcomes, closing the loop between what the system predicted and what actually happened on a given delivery. A model that consistently underestimates prep time at a particular merchant, for instance, will systematically produce late-running assignments until retraining corrects for that merchant's real behavior, which makes the accuracy of these underlying predictions as operationally important as the optimization logic sitting on top of them.
What broke when they scaled
Greedy "assign the nearest Dasher to this new order" looks optimal and produces stacked inefficiencies: one Dasher gets three bad trips while another idles, or a batch that should have been one stacked delivery becomes two cars. DoorDash's DeepRed (and related dispatch posts) frame assignment as prediction plus optimization: predict duration, acceptance probability, and cost, then solve a matching over a batch of orders and Dashers rather than a single FIFO.
Batching introduces delay: wait 30 seconds to build a better matching versus assign immediately. That trade is a product decision at lunch peak. Fairness and Dasher experience (not always the same person getting the worst miles) are constraints in the optimizer, not a later apology. Feedback loops matter: if you train on historical assignments, you encode yesterday's greedy policy.
Geo and time make the state space huge. You cannot run a global MIP every second; you shard by region and horizon, with heuristics for the rest. When predictions are wrong (rain, closed road), the optimizer needs a way to reassign without ping-ponging Dashers.
A smaller-team version of the same idea
Nearest Dasher with a cap on active deliveries, plus a simple stack if the second pickup is on the way. Measure late deliveries and Dasher idle time. Introduce a 10-second batch window in one city before you buy an OR-tools cluster. Log predicted vs actual duration; that log is the start of DeepRed, not the solver.
What you can borrow
- Split hard assignment problems into a prediction stage and an optimization stage, and invest in both — good optimization on bad predictions still produces bad outcomes.
- Batch decisions over a short time window when doing so unlocks better global outcomes, rather than always deciding greedily as each item arrives.
- Use approximate, latency-bounded optimization when an exact solution can't be computed within your real-time constraints.
- Continuously retrain the predictive models feeding an optimizer against real outcomes; stale predictions quietly degrade an otherwise well-designed system.