Targeting a Delivery-Fee Promo with an Uplift Model
Machine LearningModel answerLast updated
Design an end-to-end uplift system that picks which 20% of users get a free-delivery offer, covering experiments, modeling, evaluation, budgeted selection, fairness, interference and sequential testing.
A delivery marketplace can give a free-delivery offer to only 20% of its eligible customers, and the spend is capped. The goal is to get as many extra orders per dollar as possible, meaning orders that would not have happened without the offer.
For a customer with features x, treat the individual effect as:
uplift(x) = P(order | offer, x) − P(order | no offer, x)
Describe how you would build and validate a system that decides who receives the offer. Address each of the following:
- Data collection. How would you run an experiment to generate training data? Cover the randomization unit, how many users to treat, any permanent holdout, and how you track whether people actually saw and used the offer.
- Modeling. Which learners would you consider (T-, S-, X-, doubly robust learners, or direct uplift models)? Which features would you use, and how do you avoid leakage?
- Offline evaluation. Which metrics (Qini, AUUC, uplift-AUC and others) and which cross-validation scheme would you use?
- Decision rule. How do you pick the top-K users under a fixed budget when each user has a cost, or a cost curve across offer levels?
- Fairness guardrails. How do you keep targeting reasonable across geographic zones and customer tenure?
- Interference and positivity. How do you handle spillovers such as courier capacity limits and surge pricing, and what do you do when some users almost never or always get treated?
- Deployment. How would you roll the model out and run a sequential test to confirm the lift without being misled by response saturation?
Give a structured answer with concrete choices, numbers where useful, trade-offs, and common pitfalls.
Hints
Hint 1
Separate the quantity you want (incremental orders, net of who would have ordered anyway) from the quantity that is easy to predict (order probability), and note that cost depends on who redeems, not only on who is offered.
Hint 2
Randomized data with known assignment probabilities lets you use inverse-propensity or doubly robust pseudo-outcomes, and evaluation should be done on randomized data with the same user never appearing in both train and test.
Hint 3
Selection under a budget is a knapsack-style problem: rank by uplift per dollar, use Lagrange multipliers for multiple offer levels or group constraints, and account for noise at the top of the ranking.
Hint 4
Individual-level randomization can misestimate the effect of a deployed policy when treated users change supply for everyone in a zone, so think about randomizing treatment density across zones and time, and about alpha-spending for repeated looks.
Model answer
Hard Try it yourself first — then compare your approach, complexity and edge cases.
1. Frame the objective
- Estimand: the conditional average treatment effect on orders in a fixed window (say 14 days after assignment): τ(x) = E[Y | T=1, x] − E[Y | T=0, x].
- Cost: c(x) = P(redeem | T=1, x) × average fee waived. An offer to someone who would have ordered anyway is pure cost, so ranking by purchase probability is wrong, and ranking by uplift without cost is incomplete.
- Policy problem: choose a set S with |S| ≤ 20% of eligible users and Σc(x) ≤ B that maximizes Στ(x).
- Analyze intent-to-treat (ITT). The policy controls assignment, not redemption. Exclude members who already have free delivery, since their uplift is about zero.
2. Experiment design
- Unit: the user, stratified by zone × tenure bucket × recent-frequency decile.
- Treatment share: about 50% is the most statistically efficient for learning heterogeneity, but cost pushes it down. 30–40% is a reasonable compromise.
- Propensities: log the exact assignment probability e(x) and keep it within [0.1, 0.9] to preserve positivity.
- Persistent holdout: around 5% of users never receive promos, giving a clean baseline for long-run effects and retraining.
- Compliance funnel: assigned, delivered, seen, redeemed, ordered. The primary analysis is ITT. If needed, a complier effect is ITT divided by the exposure rate (an IV estimate).
- Sizing: with baseline conversion 0.25 and a 1pp minimum detectable effect, n per arm ≈ 16·p(1−p)/δ² ≈ 30k for the average effect. Heterogeneity needs roughly 10× that. Run at least 2–3 weeks to cover weekly seasonality.
3. Modeling
- Baselines: a T-learner (two outcome models) and an S-learner (one model with T as a feature). The S-learner tends to shrink small effects to zero.
- Primary model: a doubly robust learner.
- Fit μ₀(x), μ₁(x), and use the known e(x).
- Pseudo-outcome ψ = μ₁ − μ₀ + T(Y−μ₁)/e − (1−T)(Y−μ₀)/(1−e).
- Regress ψ on x with gradient-boosted trees.
- Cross-fit (5 folds) so nuisance predictions are out-of-fold.
- Alternatives: an X-learner helps when arms are unbalanced. A causal forest gives confidence intervals.
- Cost model: a separate model for redemption probability times fee.
- Features, all snapshotted at assignment: tenure, recency/frequency/monetary value, fees paid and checkout-abandonment signals, average order value, cuisine and time-of-day habits, zone supply/demand and typical fee, platform and notification opt-in, and responses to previously randomized promos only.
- Leakage traps: post-assignment behavior (opens, sessions), feature windows overlapping the outcome window, past-promo features from non-random targeting (they encode the old policy), and row-level splits that put one user in both train and test.
4. Offline evaluation
Use only randomized data.
- Qini / AUUC: sort by score; at fraction φ the incremental orders are Y_T(φ) − Y_C(φ)·N_T(φ)/N_C(φ). Normalize against random targeting.
- Cost-aware Qini: put cumulative spend on the x-axis, which matches the real objective.
- Policy value at 20%: estimate with the DR or IPW estimator and bootstrap intervals.
- Calibration by predicted-uplift decile: needed because the budget rule uses magnitudes, not just ranks.
- Uplift-AUC: a secondary sanity check.
- Cross-validation: group k-fold by user, stratified by treatment and zone, plus a forward-in-time split (train weeks 1–2, test week 3) to detect drift. Nest cross-fitting inside outer folds.
5. Decision rule under budget
- Single offer level: a knapsack. Rank by τ̂/ĉ, admit while τ̂ > 0 (or τ̂·margin > ĉ), and stop when the budget or the 20% cap binds.
- Multiple offer levels or a cost curve: a Lagrangian. For each user choose k* = argmax_k [τ̂_k − λĉ_k − μ], or no offer if all are negative. Find λ (budget) and μ (headcount) by bisection on a scoring snapshot.
- Winner's curse: the top of a noisy ranking is optimistic. Rank on a lower confidence bound or a shrunk estimate.
- Exploration: keep 5–10% randomized assignment so future data retains positivity.
6. Fairness guardrails
- Audit targeting rate, calibration and policy value by zone, tenure and income proxies. Zone can proxy for demographics.
- Add per-group min/max share constraints (for example 0.5×–1.5× population share) via group-specific multipliers, and report the efficiency cost.
- New users have wide intervals. Use cohort-level priors or a quota so the model does not starve them.
- Monitor complaints, ETAs by zone and courier earnings weekly.
7. Interference and positivity
- Interference: treating a large share of a zone raises demand, triggers surge and longer ETAs, and affects control users too. Individual randomization then misestimates the deployed policy's effect.
- Use a two-level design: randomize treatment density across zone-week clusters, then randomize users within them. Compare density levels to estimate spillover.
- Alternatively use geo or time-switchback experiments for the final validation.
- Add capacity-aware constraints: cap treatment when courier supply is tight.
- Positivity: keep propensities bounded, trim or clip extreme weights, and where a segment is never treated, do not extrapolate. Use exploration traffic for it.
8. Deployment and sequential test
- Roll out in stages: shadow scoring, then a small share, then the full 20%. Keep the holdout and an always-random slice.
- Compare the model policy with a baseline (such as rules-based or random 20%) at equal budget, measuring incremental orders per dollar.
- Sequential testing: use alpha-spending (O'Brien-Fleming) or an always-valid method (mSPRT) so repeated looks do not inflate false positives. Pre-register the primary metric and guardrails.
- Response saturation: early lift can come from pull-forward demand or a novelty effect, and heavy users saturate. Measure cumulative orders over a window long enough to see post-promo dips, compare against the persistent holdout, and avoid stopping on early peaks. Check lift by exposure count to detect fatigue.
Common mistakes
- Ranking by predicted purchase probability instead of uplift.
- Evaluating on non-randomized data.
- Ignoring cost and redemption.
- Ignoring spillovers and peeking at results without correction.