AI Surge Pricing System
Balancing Riders and Drivers Cell by Cell, Minutes Ahead
Design the system that measures and forecasts riders and drivers in small map cells, turns the gap into a surge multiplier every minute, and serves one explainable, capped price to every rider in the cell.
Overview
Surge pricing raises the fare in a small area when more people want rides than there are drivers nearby. It does two jobs at once. The higher price tells some riders to wait, walk or take a train, and it tells drivers that this place and time is worth driving to. Both close the gap between riders and drivers.
Uber's own case study of a sold-out concert at Madison Square Garden (March 21, 2015) shows the loop working: app opens near the venue jumped to about 4 times normal, surge ran between 1.2x and 1.8x, the number of active drivers in the area rose to about twice its earlier level, and the completion rate held steady. The same study shows the opposite on New Year's Eve 2014 to 2015, when a bug switched surge off across New York City for 26 minutes: completion rates fell steeply and wait times rose.
The design problem is doing this for every small patch of every city, every minute. The counts in one cell are small (a handful of riders and drivers), so they are noisy. Waiting until the gap is visible is late, because drivers need minutes to arrive. And the price must be fair and explainable: capped in emergencies, stable enough not to flicker, and the same for every rider in the cell at the same moment.
Questions to ask first
- What is the goal of surge? — Keep pickup times short and most requests fulfilled; not revenue alone
- How small is a pricing area? — H3 hexagons at resolution 8, about 0.74 km² each
- How often does the price change? — Every 60 seconds per cell
- Do two riders in the same cell see different surge? — No: one multiplier per cell and product at a time
- How long does a quoted price hold? — 5 minutes (a rule we chose)
- Are there legal limits? — Yes: emergency caps per city; every decision is logged
What you will be able to do
- Explain why surge closes the gap from both sides, using the concert and New Year's Eve cases.
- Count and pool riders and drivers per hexagon so small, noisy counts do not set the price.
- Forecast the gap 5 to 15 minutes ahead and turn it into a multiplier with a curve, step limits and a cap.
- Serve one locked, explainable price per cell at 50,000 quotes a second, with a safe fallback when data is late.
- Measure whether surge helps with switchback experiments, and follow emergency pricing rules.
Key concepts
- Supply and demand per cell
- H3 hexagon grid
- Spatial smoothing
- Short-term demand forecast
- Imbalance ratio
- Multiplier curve
- Step limits and caps
- Fare quote lock
- Switchback experiments
- Emergency price caps
Functional requirements
- Count riders looking for a ride and open drivers per map cell every minute
- Forecast demand and supply per cell for the next 5, 10 and 15 minutes
- Set one surge multiplier per cell and product every 60 seconds
- Smooth across neighboring cells so prices do not jump at a street
- Lock the price in a fare quote the rider accepts before requesting
- Show riders why the price is higher, and show drivers where demand is
- Apply city caps, emergency freezes and manual overrides
- Log every decision with its inputs for audit and model training
Non-functional requirements
- A fare quote reads the multiplier in under 20 ms at p99 (a target we chose)
- A cell's multiplier is at most 2 minutes old in normal operation (a target we chose)
- No multiplier above the city cap, ever; no rise above 0.3 in one minute
- If the pricer stops, quotes keep working on a safe fallback, not on no price
- Every decision kept for as long as the legal team requires
Interview questions
- Why use surge at all instead of just making riders wait?
- How do you define the area a surge price applies to?
- How do you measure demand when surge itself suppresses requests?
- How do you turn a forecast into a multiplier that does not flicker?
- What happens if the surge pipeline goes down?
- How would you test a new surge curve?
- How do you handle emergencies and regulators?
- How does the system scale to 900,000 cells?
Sign up free to read the full topic
More System Design topics
Start free on Cariara · Coding problems · System design studio