Variance Reduction Below the Randomization Grain
Instacart improves CUPED variance reduction for region-day switchback experiments by training an order-level model (gradient boosted trees) on pre-treatment features and aggregating its predictions to the region-day grain as the CUPED covariate. Across 10 lateness experiments, order-level CUPED cut variance by 18-40% versus 5-10% for region-day CUPED, shortening experiment runtimes by about a third on average. Features must be unaffected by treatment, and a placebo mean-difference test on the aggregated prediction catches contamination, as with ETA model experiments that shift which orders get placed. The approach applies wherever interference forces coarse cluster randomization but outcomes are observed at a finer unit.
Related posts
- Reducing experiment duration with predicted control variates
Etsy Code as Craft mediumAdeptEtsy upgraded its experimentation platform's variance reduction from CUPED to CUPAC, which feeds pre-experiment features (over 100, up from 3) into LightGBM models whose predictions serve as the covariate in a linear CUPED-style adjustment. Average variance reduction rose from 7% to 27%, with a range of 2% to 77% depending on metric stability. That cuts average experiment duration by almost 3 days. The pipeline runs as an Airflow DAG: BigQuery computes features, Dataflow runs batch predictions, Spark fits the regression, and t-tests follow. Because per-metric models are costly to train and maintain, Etsy still encourages CUPED for team-specific metrics and plans to automate CUPED's pre-experiment data collection.
- Roonomics: How Economics Helped Us to Build a Churn Prediction Model
Deliveroo Engineering mediumAdeptDeliveroo replaced a high-recall, rule-based restaurant churn flagging system with a ranked probability model tuned for precision, because retention teams have limited capacity and false positives carry a real opportunity cost. The model uses rolling-window cross-validation to avoid leakage, a precision-oriented score for the rare-event setting, business-importance weighting for prioritisation, and Shapley values for per-restaurant explanations, and it runs weekly as an Argo pipeline. Offline, it cut flagged restaurants by over 90% and raised precision 8x at the cost of recall, with calibration curves tracking the 45-degree line. A randomised treatment/control experiment is under way to test whether acting on the flags actually reduces churn.
- Leveraging PyFixest for High-Cardinality Marketplace Modeling at Instacart
Instacart Tech hardMasterControlling for high-cardinality fixed effects (e.g. thousands of regions, shoppers or customers) makes standard OLS intractable, because each dummy variable expands the Gram matrix and matrix inversion scales as O(k³). The Frisch-Waugh-Lovell theorem removes the dummy variables by demeaning, and the method of alternating projections handles multiple fixed effects by iteratively demeaning until the residual falls below a tolerance. A worked example shows convergence at a geometric rate. The post covers Instacart Marketplace's geo:time switchback and static-geo experiment designs. Benchmarks up to 20k categories show pyfixest consistently fastest with trivial memory use, compared with statsmodels (pinv dummies and mixedlm) and scikit-learn's sparse LSQR solver.
- Linear Regression Using ClickHouse Machine Learning Functions
ClickHouse mediumAdept
Delivery times can be predicted with a linear regression trained entirely inside ClickHouse using stochasticLinearRegressionState and evalMLMethod, with no Python or Spark involved. The worked example uses 2,293 last-mile orders from one courier in Jilin. Features are built in SQL: geoDistance for pickup-to-delivery distance, one-hot pickup-hour columns, and a randUniform 80/20 train/test split. Distance is standardized for gradient descent and the target is log-transformed to keep predictions positive. The model reaches about 58 min MAE and 78 min RMSE overall, improving to roughly 30 and 42 minutes for deliveries under two hours, while accuracy degrades for longer journeys.
- Scaling Subscriptions at The New York Times with Real-Time Causal Machine Learning
NYT Open hardMasterThe New York Times replaced its monthly batch Dynamic Meter model with real-time algorithms that decide within milliseconds whether to show a registration wall, a paywall, or allow access. Separate models for unregistered and registered users use S-Learner predictors trained on an always-on randomized control trial, so they can estimate counterfactual outcomes per action. Per-objective predictions are combined with convex weights, and the action that maximizes the combined objective is chosen. The weights are re-tuned daily by backtesting on recent RCT data with U-NSGA-III so that target paywall and registration-wall rates are met, and a new model ships only if the constraint loss is low enough. Performance is measured against the random policy's surface in KPI space, with A/B tests also used, and the approach raised subscription and registration rates while holding wall rates steady.