Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Etsy Code as Craft 8 min read Case study mediumAdept

Reducing experiment duration with predicted control variates

Etsy 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.

Assumes: A/B testing and statistical powerlinear regressiongradient boosted trees

Related posts

  • Variance Reduction Below the Randomization Grain

    Instacart Tech hardMaster

    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.

  • Scaling Model Evaluation at Pinterest with Ray (Part 4)

    Pinterest Engineering mediumAdept

    Pinterest fused model-evaluation metric computation into its Ray batch inference jobs, removing the separate Spark/Ray metrics job and the write-predictions-to-S3-then-reread handoff. The fusion relies on a metric contract (preprocess, compute partials per batch, reduce partials) that covers decomposable metrics like MAE, holistic metrics like ROC-AUC (approximated via per-threshold confusion matrices), and group-wise metrics like Precision@K. Group-wise metrics use Spark to pack complete segments into buckets so no segment spans a bucket. Overlapping CPU metric work with GPU inference via Ray's shared object store cut end-to-end evaluation time by 25–32% at 100 feature-importance experiments, with runtime scaling linearly in experiment count.

  • Building a dynamic inventory optimisation system: A deep dive

    Zalando Engineering mediumAdept

    Zalando's ZEOS builds replenishment recommendations by minimising a cost function that combines storage, lost sales, overstock, operations and inbound costs. Probabilistic demand forecasts feed a Monte Carlo simulation engine with gradient-free black-box optimisers. The weekly forecasting pipeline runs LightGBM through Nixtla's MLForecast with conformal inference, does pre-processing in PySpark on Databricks and feature transforms on SageMaker, and covers 5 million SKUs over about 3 years of history in under 2 hours. The optimisation service shares features via SageMaker Feature Store (online lookups at 10–20ms per SKU, S3-backed offline store). It serves daily batch transform jobs plus an interactive SQS/Lambda path for partner setting changes, keeping both paths consistent.

  • Measuring Commercial Impact at Scale at Canva

    Canva Engineering mediumAdept

    Canva's IMPACT app is an internal Streamlit-in-Snowflake tool that standardizes how experiment uplifts translate into company-level MAU and ARR, using logic aligned with the central finance model. The core method scales local uplifts by the exposed share of the user base: a 20% lift on a surface used by 10% of users counts as 2% company-wide. The architecture combines modular Streamlit components (functions, reusable statistical and MAU/ARR modules, SQL query templates), an app-owned database for results and session analytics, scheduled Snowpark jobs that precompute monthly forecast inputs, Cortex LLM summaries, and parallel queries via the Python connector's execute_async(). The result cut per-experiment analysis from 6+ hours to under 10 minutes, and the team moved to a PR-based development workflow as more contributors joined.

  • 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.

The quest for software engineering knowledge.

Look:
Layout: