AI System DesignAI System Design Case StudiesReal-Time Dispatch and Marketplace Matching
How to Predict Uber Driver Ride Acceptance at Scale
Question 6 of 47 · Updated
On this page
- 1. Frame the prediction problem
- 2. Requirements and objectives
- 3. Capacity planning
- 4. End-to-end architecture
- 5. Build reliable offer and outcome data
- 6. Point-in-time feature engineering
- 7. Selection bias: the central ML challenge
- Propensities and off-policy evaluation
- 8. Model selection and training
- 9. Probability calibration
- 10. Integrate with real-time dispatch
- 11. Practical Python example: evaluate probabilities and rank candidates
- 12. Online inference and offer lifecycle
- 13. Transactional state, storage and concurrency
- 14. Offline and online evaluation
- Classifier metrics
- Marketplace outcomes
- Infrastructure metrics
- 15. Experimentation and marketplace feedback loops
- 16. Driver fairness, autonomy and privacy
- 17. Reliability and failure handling
- 18. Scalability and engineering trade-offs
- 19. Model release, monitoring and continuous improvement
- 20. Interview-ready answer and follow-ups
- References and research transparency
I would build a calibrated binary classifier that estimates the probability that an eligible driver accepts a particular ride offer within its valid response window, then use that estimate as one input to a constrained real-time dispatch policy. I would log the offers that drivers actually receive, handle unobserved outcomes explicitly, and evaluate the resulting matching policy for rider wait, driver opportunity, earnings and marketplace health. A high acceptance probability is useful evidence, not permission to force a driver to accept or to exclude drivers who decline rides.
The source interview question asks: How would you build a model to predict whether an Uber driver will accept a ride request?
This is a proposed ride-hailing architecture, not a description of Uber's proprietary system. All example workloads, coefficients, offer durations, scores and target metrics are illustrative. Current company policies and internal model details are not established by the references below.
1. Frame the prediction problem#
The prediction unit is an eligible driver–ride offer at a specific decision timestamp. Define the label as acceptance of a delivered, valid offer within the product's response window.
Let x represent context known before making the offer and a represent the offer terms. The classifier estimates:
p(x, a) = P(valid acceptance within response window
| offer delivered, x, a)The conditioning matters. If the driver never receives the offer, their response is not observed. If a different candidate receives it, we do not know how this driver would have responded. A rider cancellation before delivery or expiration due to a technical error is not necessarily a driver rejection.
Distinguish four related outcomes:
| Outcome | Meaning |
|---|---|
| Offer delivery | The eligible driver receives the offer |
| Offer acceptance | The driver voluntarily accepts within the valid window |
| Assignment commitment | The dispatch system atomically assigns the accepted ride |
| Successful pickup or completion | The subsequent ride lifecycle succeeds |
Acceptance is not the same as successful commitment or completion. A driver can accept an offer that has already been invalidated, and an accepted assignment can subsequently be cancelled. Train and evaluate these outcomes separately when necessary.
The preceding ETA lesson estimates how long an assigned driver takes to reach the pickup. This classifier predicts a different outcome: whether a prospective driver voluntarily accepts the offer. ETA is an input to acceptance prediction, not a replacement for it.
Clarify whether the product uses sequential offers, concurrent offers under a documented matching protocol, or batched marketplace optimization. Also clarify what ride terms drivers see, how long offers remain valid, and what happens when a rider cancels. These design choices determine the label and the state machine.
2. Requirements and objectives#
Functional requirements
- Retrieve currently available, eligible drivers for a ride request.
- Compute point-in-time offer features for eligible candidates.
- Return calibrated probabilities with model and feature versions within the dispatch deadline.
- Combine acceptance probability with pickup ETA, service constraints, driver preferences and marketplace objectives.
- Preserve the driver's ability to decline without coercion or unauthorized penalty.
- Record candidate sets, selected offers, delivery events, outcomes and policy versions for learning.
- Fall back to an approved dispatch baseline when prediction is unavailable.
Illustrative non-functional requirements
| Dimension | Proposed objective |
|---|---|
| Inference | Batch candidate scoring within a 50 ms internal p95 budget |
| Availability | Dispatch remains functional if acceptance inference is unavailable |
| Feature freshness | Explicit freshness limits for location, availability and offer terms |
| Consistency | A driver and ride cannot acquire incompatible committed assignments |
| Privacy | Minimal authorized data use with limited retention and access |
| Fairness | Monitor opportunity allocation, driver earnings and rider outcomes |
| Auditability | Reconstruct what was known and which policy made an offer |
The numerical service objective is a planning target, not a measured Uber latency. Validate it with full-system load tests.
The business objective should not be raw acceptance rate alone. A policy that repeatedly offers only the easiest rides to the same small subset of drivers could improve acceptance while reducing access to work, increasing deadheading or degrading rider coverage. The model should support efficient, voluntary matching under explicit constraints.
3. Capacity planning#
Assume a hypothetical marketplace receives five million ride requests per day and evaluates twenty eligible candidates per request after spatial pruning. This creates up to 100 million candidate predictions per day, about 1,157 predictions per second on average. A fivefold peak factor gives roughly 5,787 predictions per second. If the candidate set is reevaluated during offer retries, the actual scoring workload will be higher.
At a compact 200 bytes of candidate-level event metadata, logging all 100 million evaluations would produce approximately 20 GB per day before indexes, replication, feature payloads and compression. Full feature-vector logging can substantially increase this cost. Use explicit retention, immutable dataset snapshots and appropriately governed sampling rather than retaining every raw feature indefinitely.
If a batch of twenty candidates fits in one scoring request, five million initial dispatches correspond to about 58 batch requests per second on average. This does not imply that a single model server can handle the entire system; measure serialization, feature retrieval, scoring, queueing, region skew and failover capacity. Also account for the separate workload of obtaining pickup ETAs and maintaining driver availability.
Prefer regional matching services with bounded candidate sets. Do not evaluate every driver in a metropolitan area for each request.
4. End-to-end architecture#
The diagram separates candidate eligibility, prediction, decision policy and transactional commitment. Inference workers do not grant an assignment. The offer service owns delivery and response windows; the assignment service owns concurrency and ride-state invariants.
Candidate selection first enforces legitimate operational requirements, including current availability, supported service type and driver-defined preferences. A spatial index can retrieve nearby eligible drivers, but geometric proximity is not the same as road-network travel time. Use actual route estimates for the relevant shortlist.
Log inference context and decisions through durable events. The offline pipeline joins these snapshots to later offer outcomes without leaking future information. A registry distributes approved model, preprocessing and calibration artifacts as a compatible bundle.
5. Build reliable offer and outcome data#
A training dataset assembled solely from completed rides is inadequate. It excludes declined, expired and undelivered offers, as well as potential candidates that the dispatch policy did not select.
Define an event contract that links the lifecycle:
| Event | Important fields |
|---|---|
| Candidate evaluation | decision_id, candidate_id, timestamp, policy/model version, feature snapshot |
| Offer created | offer_id, ride_id, driver pseudonym, terms version, expiry |
| Offer delivered | offer_id, delivery timestamp, delivery evidence |
| Driver response | offer_id, response type, server receipt time |
| Offer invalidated | offer_id, reason, timestamp |
| Assignment committed | ride_id, driver ID, offer_id, assignment version |
| Ride outcome | assignment ID, pickup/cancellation/completion state |
Maintain both event time and ingestion time. Validate identifiers, deduplicate retransmitted events, and handle late arrivals with explicit outcome watermarks. A duplicated acceptance message must not generate multiple training examples.
Use a label table rather than collapsing all non-acceptance into zero immediately:
- Confirmed timely acceptance of a delivered, valid offer: positive.
- Explicit decline of a delivered, valid offer: negative for the defined acceptance objective.
- Confirmed expiry of a delivered offer with no valid acceptance: negative if the product's target includes nonresponse, while preserving a distinct reason.
- Undelivered offers, unknown delivery status, technical failures or offers invalidated before an adequate response opportunity: unobserved or censored outcome.
- Candidates never offered the ride: counterfactual response unknown.
The exact treatment of late responses and delivery evidence must match the product contract. Never train a classifier on arbitrary client-side time stamps without server-side reconciliation. A driver who loses connectivity should not be treated as deliberately rejecting work.
Record the terms actually presented to the driver. If compensation, pickup point or relevant trip details change, the model must not associate a response to the wrong offer version. Where regulations or product policy limit what information a driver sees, avoid pretending that hidden information was part of their observed decision context.
6. Point-in-time feature engineering#
Useful features express offer feasibility and the driver's relevant, authorized context rather than a permanent judgment about a person's willingness to work.
| Feature family | Examples | Important caveat |
|---|---|---|
| Pickup accessibility | Road-network ETA, pickup distance, traffic, approach constraints | Use the estimate available before offer |
| Offer terms | Upfront displayed compensation, disclosed duration, authorized trip attributes | Match exactly what was offered |
| Driver preferences | Explicit service preferences, authorized destination or scheduling preferences | Respect consent and current choices |
| Marketplace context | Local supply/demand balance, time of day, recent request volume | Use aggregate data and freshness metadata |
| Availability | Online status, current eligibility and last location age | Recheck at offer and commitment |
| Data quality | Missing-feature flags, stale ETA, sparse regional data | Missing is not equivalent to zero |
A simple model can use time-of-day cyclical encoding or categorical buckets, pickup ETA, relative offer economics under approved definitions, and broad geographic context. Historical behavioral aggregates may be considered only if they have a legitimate purpose, governance approval, adequate support and fairness safeguards. A history of declining offers must not become an automatic punitive exclusion or permanent low-opportunity label.
Feature values must be computed from information known before the dispatch decision. Do not include eventual acceptance time, realized trip duration, the actual route taken after acceptance, future marketplace availability or updated compensation from a later offer. Use point-in-time joins based on feature availability timestamps as well as event timestamps.
Avoid identity-based memorization and unnecessary sensitive attributes. High-cardinality driver identifiers can encourage the model to learn historical exposure patterns rather than offer suitability. Prefer transferable contextual features and use governed analysis to identify performance differences among relevant cohorts.
For online serving, version the feature schema, normalize units consistently, and distinguish a legitimate zero (for example, zero observed eligible offers in a defined period) from missing information. Define acceptable freshness for each feature. Location, driver availability and terms require stricter current-state checks than slowly changing aggregates.
7. Selection bias: the central ML challenge#
Historical dispatch data is not a random sample of all possible driver–ride pairs. The previous policy selected certain drivers based on proximity, preferences and other context. Responses are observed only for delivered offers.
Training a standard classifier on delivered offers can estimate response probabilities in the distribution where the old policy actually provided exposure. It does not automatically identify how unoffered candidates would respond.
There are several distinct sources of bias:
- Exposure bias: the model observes outcomes for selected candidates, not the entire eligible set.
- Delivery bias: connectivity or device conditions may influence which selected offers are actually received.
- Policy confounding: existing dispatch decisions depend on factors also associated with driver acceptance.
- Feedback loops: a new policy changes the distribution of offers, responses and future training data.
A safe learning strategy starts by documenting the old policy and logging candidate sets, selected actions, delivery and outcomes. Compare model quality within supported contexts. For contexts with little or no exposure, use conservative estimates, avoid extrapolation and fall back to an approved policy.
Where ethically and operationally approved, controlled exploration among genuinely eligible, feasible offers can create better support for learning. It must respect driver preferences, avoid unsafe or unfair work allocation, and have monitoring and stop conditions. Never create fake ride offers merely to generate labels.
Propensities and off-policy evaluation#
For a simplified contextual decision with logged context x, selected action a, reward r, historical policy probability mu(a|x), and target policy probability pi(a|x), inverse propensity weighting estimates:
V_IPS = mean(pi(a|x) / mu(a|x) * r)This requires known or reliably estimated logged propensities, overlap between policies, consistent outcome definitions and appropriate assumptions. If the historical policy never offers an action in a context, its response cannot be recovered by dividing by a fabricated propensity. Small propensities produce high variance; clipping weights can reduce variance but introduces bias.
For example, if the logging policy chose an action with probability 0.5 and the proposed policy chooses it with probability 0.25, the observed reward receives weight 0.5 in the simplified estimator. This does not establish the response of an unoffered driver.
Doubly robust estimators combine an outcome model and propensity-based correction under their relevant assumptions. Evaluate effective sample size, weight distribution and support before relying on either approach. Sequential offers and concurrent assignments are more complicated than a one-step contextual bandit; their rewards and action probabilities may depend on previous responses and competing rides.
Offline replay is useful for checking eligibility and deterministic policy behavior. It cannot establish real acceptance improvement for different unobserved offers without justified counterfactual assumptions.
8. Model selection and training#
Start with a logistic regression baseline. It is fast, interpretable relative to more complex models and provides a probabilistic output:
z = intercept + sum(weight_j * feature_j)
p = 1 / (1 + exp(-z))Binary cross-entropy penalizes confident incorrect predictions:
loss = -mean(y * log(p) + (1-y) * log(1-p))For implementation, use numerically stable logit-based losses where available. Do not compute log(0). Use regularization, appropriate feature transforms and explicit handling of missing categorical values.
Gradient-boosted trees are a practical next candidate for tabular interactions, such as an offer's pickup time being more important under certain marketplace conditions. Compare against logistic regression on temporal holdouts and measure serving latency. Random forests can serve as another baseline but their probability estimates may need calibration and their serving costs depend on ensemble size.
Deep models or two-tower encoders may be valuable if complex spatial/contextual interactions or large candidate sets justify them. They add training, calibration and serving complexity. A small calibrated tabular model is often a sensible first release. Do not select an architecture merely because the marketplace operates at large scale.
Class weighting and resampling can address imbalance for some training objectives, but weighted training can alter the interpretation of raw probabilities. Recalibrate on a representative validation distribution and evaluate against the true deployment mix. Never assume that an artificially balanced test set measures real-world acceptance rates.
Use chronological splits: train on earlier decisions, tune hyperparameters on a later period, fit calibration on a separate period, then evaluate on an untouched future period. Group related candidate/offer records by dispatch decision or ride to avoid leakage. Add regional and cold-start evaluation where appropriate.
Keep the input features, model parameters, preprocessing, calibration data cutoff and approved target definition in the registry. Retraining is not equivalent to automatically deploying.
9. Probability calibration#
A score of 0.8 should mean roughly 80% acceptance among comparable, eligible, exposed offers receiving that prediction, subject to the model's calibration distribution. A model with strong ranking ability can still be poorly calibrated.
Suppose three candidate groups have mean predicted probabilities 0.2, 0.5 and 0.8. If their observed acceptance frequencies on representative held-out delivered offers are 0.25, 0.50 and 0.65, the highest-score group is overconfident. Using its raw 0.8 probability in a matching objective can create systematically bad decisions.
Use reliability diagrams to compare observed outcome frequency with predicted probability in bins. Include bin counts and uncertainty; small bins are noisy.
Evaluate:
- Brier score: mean squared difference between predicted probability and binary outcome. Lower is better on a comparable dataset.
- Log loss: strongly penalizes confident wrong probabilities.
- Calibration intercept and slope: help diagnose systematic bias and overconfidence.
- Expected calibration error: a bin-dependent summary that should be accompanied by reliability curves.
Platt scaling fits a logistic transformation of a model score. Isotonic regression fits a non-decreasing calibration function and can overfit when data are scarce. Temperature scaling adjusts logits and is a common option for neural classifiers. Compare methods on separate held-out data; do not choose a calibrator using the final test set.
Calibration is conditional on the population and outcome being evaluated. A globally calibrated model may be miscalibrated in a city, time window or pickup-distance range. Evaluate supported slices and sample sizes. A new dispatch policy may shift the distribution and invalidate calibration assumptions. Monitor and recalibrate as needed rather than treating the output as a universal probability.
10. Integrate with real-time dispatch#
The classifier is one input to decision-making. First filter candidates by hard eligibility and driver preferences. Then estimate pickup travel time and acceptance probability. Finally evaluate candidate offers using an explicitly governed marketplace objective.
A simple illustrative utility measured in equivalent seconds of value might be:
utility = acceptance_probability * benefit
- pickup_eta_seconds
- (1 - acceptance_probability) * retry_costThe coefficient units must be consistent and the objective must be validated. This is a teaching score, not an optimal stochastic dispatch policy. It charges the pickup-time term regardless of acceptance; a different objective could weight conditional travel costs by acceptance or model complete expected time across sequential decisions.
For two candidates:
| Candidate | Acceptance probability | Pickup ETA | Illustrative utility with benefit 600 and retry cost 60 |
|---|---|---|---|
| A | 0.90 | 240 s | 294 |
| B | 0.70 | 90 s | 312 |
Candidate B has lower acceptance probability but higher illustrative utility because its pickup ETA is much shorter. The result depends on the assumed objective. A driver outside their stated preferences remains ineligible even if their predicted probability is high.
A sequential policy should consider the cost of waiting for a response and the possibility of subsequent offers. A concurrent marketplace matching policy should consider that multiple riders may compete for the same drivers. For batched dispatch, construct a graph of eligible driver–ride pairs and optimize a constrained matching objective. A maximum-weight matching or min-cost flow formulation can be appropriate for a simplified static batch, subject to solver latency and explicit capacity constraints. Real marketplaces also have dynamic availability and uncertain acceptance, so a static solution is not a guarantee of optimal long-run outcomes.
Do not use a fixed probability cutoff as an automatic exclusion from future work. A low estimate can reflect unfamiliar context, sparse exposure or unsuitable terms. Preserve approved opportunity constraints, driver control and a documented fallback.
11. Practical Python example: evaluate probabilities and rank candidates#
This standard-library example demonstrates probability metrics and a synthetic one-step candidate-ranking function. It does not train a classifier, reproduce Uber's dispatch logic or determine driver compensation.
PYTHONfrom math import isfinite, log def evaluate(rows): n = 0 brier = 0. loss = 0. eps = 1e-15 for p, y in rows: if (not isfinite(p) or not 0 <= p <= 1 or type(y) is not int or y not in (0, 1)): raise ValueError('invalid probability or label') n += 1 brier += (p - y) ** 2 q = min(1 - eps, max(eps, p)) loss -= y * log(q) + (1 - y) * log(1 - q) if not n: raise ValueError('no observations') return brier / n, loss / n def choose(candidates): best = None for driver, p, eta, eligible in candidates: if not eligible: continue if (not isfinite(p) or not 0 <= p <= 1 or not isfinite(eta) or eta < 0): raise ValueError('invalid eligible candidate') # Synthetic benefit and costs in equivalent seconds. score = p * 600 - eta - (1 - p) * 60 key = (score, -eta) if (best is None or key > best[0] or (key == best[0] and driver < best[1])): best = (key, driver) return None if best is None else best[1] assert abs(evaluate([(.8, 1), (.2, 0)])[0] - .04) < 1e-12 assert abs(evaluate([(.8, 1), (.2, 0)])[1] + log(.8)) < 1e-12 assert evaluate([(1., 1), (0., 0)])[0] == 0 assert isfinite(evaluate([(1., 0)])[1]) assert choose([('A', .9, 240, True), ('B', .7, 90, True)]) == 'B' assert choose([('A', 1., 0, False), ('B', .7, 90, True)]) == 'B' assert choose([]) is None assert choose([('B', .5, 30, True), ('A', .5, 30, True)]) == 'A' for fn in [ lambda: evaluate([]), lambda: evaluate([(float('nan'), 1)]), lambda: choose([('A', .5, -1, True)]) ]: try: fn() except ValueError: pass else: raise AssertionError('invalid input accepted') print('11 checks passed')
Local execution returned: 11 checks passed. The checks cover Brier score, log loss, perfect predictions, numerically bounded loss for an extreme mistake, the synthetic ranking calculation, eligibility enforcement, an empty candidate set, deterministic tie-breaking and invalid inputs.
Both functions take linear time in the number of supplied observations or candidates and constant additional space, ignoring arbitrary-precision arithmetic. The log loss uses clipped probabilities for numerical stability, so it reports a finite approximation when a prediction of exactly zero or one is wrong; the theoretical unbounded log loss is infinite in that situation.
The ranker intentionally skips ineligible candidates and returns None if no eligible candidate is supplied. It does not reserve a driver. Real assignment requires fresh eligibility checks, driver consent, authorization, concurrency control, a governed objective and error-handling logic. Passing these unit tests does not validate the model's probabilities, causal effects, fairness or deployment latency.
12. Online inference and offer lifecycle#
A driver may accept while another dispatch transaction changes their availability or a rider cancels the request. Use a versioned state machine and conditional commits. A model prediction must never directly set an assignment to accepted.
An internal batch scoring request contains a decision ID, candidate snapshots, feature timestamps and model compatibility information. The response maps eligible candidate IDs to valid probabilities, plus model version, calibration version and inference status. Set deadlines, validate outputs and distinguish missing scores from zero probability.
Do not call the model individually for every candidate if batch scoring can meet the same quality and latency goals. Use vectorized feature assembly, efficient categorical encodings and a lightweight serving runtime. Where models are small enough, co-locating the scorer with the regional dispatch service may reduce network latency; separate serving allows independent scaling and isolation. Benchmark both options.
A rider-facing application should receive the committed matching status, not sensitive driver-level probability estimates. Driver-facing offers should display the actual authorized terms and response window, not pressure-inducing messages derived from predicted willingness.
13. Transactional state, storage and concurrency#
A possible schema separates predictions from offer and assignment authority.
| Entity | Key | Important fields |
|---|---|---|
| Driver availability | driver_id | state, availability_version, permitted preferences |
| Ride request | ride_id | state, pickup revision, request version |
| Dispatch decision | decision_id | candidate set reference, policy version, selected action |
| Offer | offer_id | ride_id, driver_id, terms version, expiry, delivery state |
| Prediction log | decision_id, candidate_id | probability, feature timestamp, model/calibration versions |
| Assignment | assignment_id | ride_id, driver_id, accepted offer reference, state |
| Outbox event | event_id | committed lifecycle transition |
Use atomic conditional operations to verify that the ride is still open, the driver is eligible under the current state, the offer remains valid and any conflicting assignment constraints are satisfied. Depending on the dispatch protocol, uniqueness constraints, transaction isolation or compare-and-set operations can enforce these invariants. The exact database implementation should be chosen around measured concurrency and partition boundaries.
Use an idempotency key for every accepted-offer commit. A duplicate network request must return the prior committed result or a consistent conflict, not create another ride. Events that notify downstream systems should be emitted from a transactional outbox or equivalent reliable mechanism.
If an acceptance arrives after expiry, process it according to the defined server-side policy. Do not simply trust a client timestamp to reopen an invalid offer. Record the appropriate outcome reason for later dataset construction.
Partition matching state so related ride/driver operations can be committed correctly. If cross-partition coordination is required, explicitly define reservation and reconciliation semantics. An eventually consistent cache can support discovery but cannot prove availability at commitment.
14. Offline and online evaluation#
Evaluate the prediction, matching policy and infrastructure separately.
Classifier metrics#
| Metric | Why it matters |
|---|---|
| Log loss | Measures quality of probabilistic predictions |
| Brier score | Measures squared probability error |
| ROC-AUC | Measures ranking discrimination across thresholds |
| PR-AUC or average precision | Useful when the relevant class is rare; depends on prevalence |
| Reliability curve | Detects miscalibration across probability ranges |
| Per-cohort error and coverage | Identifies unsupported or poorly modeled contexts |
Accuracy depends on the classification threshold and may obscure useful probability quality. A 0.5 threshold is not inherently the correct dispatch policy. Ranking and calibration are separate objectives.
For a fabricated example of four delivered offers with probabilities [0.8, 0.6, 0.3, 0.1] and outcomes [1, 0, 1, 0], the Brier score is (0.04 + 0.36 + 0.49 + 0.01) / 4 = 0.225. This illustrates the calculation, not measured classifier performance.
Report metrics by region, time, pickup ETA, offer characteristics, available-data quality and cold-start cohorts. Include uncertainty intervals and the number of evaluated decisions. Repeated offers for the same driver or ride are correlated, so statistical analysis must account for grouping.
Marketplace outcomes#
- Time from request to committed assignment and to pickup.
- Fraction of valid ride requests successfully matched.
- Offers and retries per successful assignment.
- Driver opportunity distribution, idle time, deadheading and earnings per relevant time unit.
- Rider and driver cancellations, complaints and satisfaction.
- Coverage of difficult-to-serve locations and times.
- Driver preference violations and unauthorized assignment incidents.
Raw acceptance rate is conditional on which offers were sent. A policy can raise that number by withholding challenging offers, without improving the overall marketplace. Track outcomes for the full eligible population, including requests never matched and drivers receiving few offers.
Infrastructure metrics#
Measure feature age, scoring p50/p95/p99, dependency errors, queue delay, fallback frequency, invalid probabilities, offer-delivery reliability, stale-version rejection, assignment conflicts and event-label join completeness. Distinguish model error from unavailable data and transaction failure.
15. Experimentation and marketplace feedback loops#
Deploy first in shadow mode. Produce predictions without altering real offers; compare them against outcomes from the existing policy on exposed candidates. This can assess calibration on that population, but not the true response of candidates who would have received a different offer under the proposed policy.
Use a staged live experiment only after offline quality, reliability, driver autonomy and fairness criteria are approved. Ride-level randomization can create interference because riders compete for shared drivers. Driver-level assignment can also affect surrounding rides and opportunities. Consider appropriately designed market clusters or switchback experiments, accounting for time-varying demand, carryover and the number of independent experimental units.
Predefine the primary outcome, duration, statistical approach and guardrails. A possible primary metric is time to valid assignment per eligible request, with driver opportunity, earnings, cancellations and pickup-time constraints. Analyze intent-to-treat on the assigned experimental population; do not restrict the main result to accepted offers or completed trips.
A new policy changes future data. If it repeatedly selects drivers predicted to accept, other drivers get fewer observed opportunities and the model becomes increasingly confident in a selected subset. Monitor exposure distributions, support gaps and policy-induced feature drift. Use representative audits and approved constrained exploration where warranted. Avoid automatically retraining on the latest data without examining changes in policy and sampling.
A controlled online result is more informative than retrospective replay for marketplace outcomes, but even a randomized experiment needs appropriate handling of interference and operational changes. Stop and roll back when safety or driver-impact guardrails fail.
16. Driver fairness, autonomy and privacy#
Drivers must remain free to accept or decline offers according to applicable product and legal obligations. A model built to improve matching should not silently become a disciplinary system.
Establish approved constraints on the use of historical acceptance signals. Do not infer sensitive traits, penalize drivers for lawful refusals or use predicted willingness to target disadvantageous compensation. Respect declared preferences, current availability and access requirements. Do not treat missing acceptance history as evidence that a new driver is unreliable.
Monitor the distribution of eligible offers, successful assignments, estimated and actual earnings, deadheading and idle time across relevant governed cohorts. Compare drivers with comparable availability and work preferences while recognizing that observational comparisons may be confounded. A single fairness metric does not guarantee equitable marketplace outcomes.
Assess the model's behavior for sparse-data regions, new drivers, accessibility-related preferences and variable network quality. Where sensitive attributes are lawfully used for fairness assessment, restrict their access and purpose rather than feeding them directly into the dispatch ranker. Investigate disparities and provide accountable human review and correction channels for affected drivers.
Use short-lived access to exact locations for legitimate dispatch purposes. Pseudonymize training data, enforce retention and deletion policies, restrict raw event access and prevent unauthorized requests for other drivers' scores or locations. Audit model access and significant policy changes. Current labor, privacy and transportation obligations require jurisdiction-specific expert review; this article makes no legal compliance guarantee.
17. Reliability and failure handling#
| Failure | Safe behavior |
|---|---|
| Model timeout | Use the approved eligibility-and-ETA baseline |
| Missing calibration artifact | Reject incompatible probabilities; fall back |
| Stale availability | Refresh or exclude the stale candidate for this decision |
| Routing dependency unavailable | Use only validated alternative eligibility and travel-time handling |
| Invalid probability output | Quarantine the response, alert and use fallback |
| Offer not delivered | Preserve unknown outcome; do not label as deliberate rejection |
| Duplicate acceptance | Idempotent commit and consistent response |
| Rider cancellation during offer | Invalidate offer according to authoritative state |
| Concurrent assignment conflict | Reject conflicting commit and continue safe matching |
| Event lag or missing labels | Monitor coverage; delay dataset maturity or release |
| Fairness or quality regression | Halt rollout, investigate and restore approved policy |
Enforce a common request deadline across feature access, routing and scoring. Use circuit breakers, bounded retries, backpressure and separate capacity for batch replay versus live dispatch. Do not retry an expired offer as if it were still valid.
The fallback policy must be evaluated independently for eligibility, reliability and driver impact. An outage should not silently remove protections. Log which decisions used fallback so subsequent training and experimentation can account for the changed policy.
18. Scalability and engineering trade-offs#
Keep candidate retrieval spatially partitioned and separate high-frequency location ingestion from scoring. Reuse compatible routing results, batch feature access and store slowly changing aggregates in efficient online caches. Avoid high-cardinality per-driver models as a default; they have sparse-data, governance and maintenance challenges.
Deploy regionally to reduce latency and limit incident blast radius. Scale by measured queue age, candidate count, CPU usage and p99 latency. Hot markets may need additional capacity. Do not assume the same model configuration or calibration works in every market without evidence.
| Choice | Benefit | Trade-off |
|---|---|---|
| Logistic regression | Fast, simple baseline | Limited nonlinear interactions |
| Gradient boosting | Strong tabular modeling | More serving and calibration complexity |
| Regional calibration | Can improve local reliability | Requires enough representative observations |
| Sequential offers | Simpler coordination | Response-window delay and repeated attempts |
| Batched matching | Can optimize competing assignments | Solver complexity and timing sensitivity |
| Constrained exploration | Better learning support | Requires strict governance and outcome monitoring |
Optimize total cost per successful, voluntary and policy-compliant match rather than per model call alone. Consider feature reads, routing computation, repeated offers, support burden and operational incidents. A more accurate classifier that adds large latency or degrades opportunity allocation is not necessarily a better system.
19. Model release, monitoring and continuous improvement#
Version the training data cutoff, preprocessing, model, calibration, feature schema and dispatch policy independently. Require a compatibility contract between the scorer and policy. An inference bundle must pass reproducibility, temporal evaluation, load tests, missing-feature tests and driver-impact review before promotion.
Track calibration drift, offer exposure, label maturity, event completeness, probability distributions, cold-start coverage and marketplace outcomes. Investigate whether changes arise from seasonality, revised offer terms, feature outages, new dispatch logic or underlying behavioral change. Retraining on shifted data without addressing the reason for the shift may amplify it.
Keep a documented rollback owner, incident runbook, approved fallback and experiment kill switch. A rollback of model weights does not undo completed assignments, and historical logs must remain interpretable with their original model and policy versions.
20. Interview-ready answer and follow-ups#
I would treat this as binary classification on a specific delivered ride offer, predicting the probability of voluntary acceptance within its valid response window. I would log candidate sets, actual offer terms, delivery and responses, construct point-in-time features such as pickup ETA, legitimate offer economics, marketplace context and driver preferences, and exclude unobserved outcomes rather than mislabel them as rejections.
I would train a logistic baseline and compare a gradient-boosted model, calibrating probabilities on a representative future-period holdout. Because the existing dispatch policy determines which offers are observed, I would explicitly account for selection bias, evaluate support, and use governed experiments where needed.
At inference time, I would batch-score eligible candidates and combine the acceptance probability with pickup time and marketplace constraints. The offer service would preserve driver choice, and a transactional assignment service would prevent double assignment and stale commits. I would monitor rider wait, driver opportunity, earnings, cancellations, calibration and latency, with a validated fallback when the model fails.
If the interviewer asks why not maximize acceptance alone, explain that acceptance is an intermediate outcome. Efficient and equitable matching requires balancing rider service, driver autonomy and scarce marketplace capacity. If asked whether unoffered drivers are negatives, the answer is no: their responses were never observed. If asked how to evaluate a new policy offline, explain logged propensities, overlap, counterfactual assumptions and why controlled online evaluation remains important.
References and research transparency#
This article uses the authorized offline research exception. The following established primary research, technical texts and official documentation links support classification, calibration, logged-policy learning, causal inference, experimentation and system engineering. Their current availability and contents could not be live-verified. The three Mermaid diagrams use standard fenced Mermaid syntax and were reviewed for structure; local Mermaid parser execution and website rendering were not available. The Python example was executed locally. These sources do not establish Uber's current internal dispatch implementation.
- Chen and Guestrin — XGBoost: A Scalable Tree Boosting System
- Guo et al. — On Calibration of Modern Neural Networks
- Swaminathan and Joachims — Counterfactual Risk Minimization: Learning from Logged Bandit Feedback
- Hernán and Robins — Causal Inference: What If
- Saito and Rehmsmeier — Precision-Recall Plot and Imbalanced Datasets
- Kohavi, Tang and Xu — Trustworthy Online Controlled Experiments
- H3 — Geospatial Indexing Documentation
- Apache Kafka — Documentation
- Google — Rules of Machine Learning: Best Practices for ML Engineering
- NIST — AI Risk Management Framework 1.0
References
- 1.
- 2.Guo et al. — On Calibration of Modern Neural Networksproceedings.mlr.press
- 3.
- 4.Hernán and Robins — Causal Inference: What Ifhsph.harvard.edu
- 5.
- 6.
- 7.
- 8.Apache Kafka — Documentationkafka.apache.org
- 9.Google — Rules of Machine Learning: Best Practices for ML Engineeringdevelopers.google.com
- 10.
Related questions
Explore other topics:Forward Deployed EngineeringMachine LearningMLOpsPython