Skip to content

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

Shopify Engineering 10 min read Research hardMaster

Using Propensity Score Matching to Uncover Shopify Capital’s Effect on Business Growth

Shopify estimated the causal effect of Shopify Capital on merchant sales using propensity score matching, treating US first-time Capital adopters in January 2019 as the treatment group and Canadian shops that later pre-qualified (when Capital wasn't yet available in Canada) as the control. Log-transformed shop covariates fed propensity scores, followed by greedy nearest-neighbour caliper matching, with balance checked via standardized mean differences, love plots, eCDF/density plots and variance ratios. A simple regression on log1p six-month GMV found a +36% geometric-mean sales lift, with a bootstrapped 95% confidence interval of 13% to 65%.

Assumes: causal inference basicslinear regressionconfidence intervals and bootstrapping

Related posts

  • The generative recommender behind Shopify's commerce engine

    Shopify Engineering hardMaster

    Shopify built a foundational generative recommender on HSTU that treats buyer journeys as raw event sequences and trains an autoregressive, causally masked model to predict the next product. The quality gains came from three ideas. Timestamps are encoded directly in attention through RoPE-style rotary encoding plus relative time bias, including the current session time. Negative sampling is scaled with shared and positive-aware hard negatives under sampled softmax. A boosting-inspired objective rewards recall that the rest of the retrieval ensemble misses. Optimized CUDA kernels gave up to 7.3x training speedup, and online A/B tests showed +0.94% Shop orders, +5% high-quality CTR and +0.71% conversion. Next steps explore semantic IDs to replace huge product-ID embedding tables.

  • Shopify's Playbook for Scaling Machine Learning

    Shopify Engineering easyNovice

    Shopify's approach to scaling machine learning grew out of its first ML product, an order fraud detector that replaced a rule-based system with a high false-positive rate. Teams should pick a problem users care about, confirm the data is trustworthy and accessible, account for downstream dependencies such as fulfillment, and optimize for product outcomes rather than raw model scores. Shopify shipped a simple logistic regression model, built in Python, serialized to PMML, scheduled with Airflow and served in real time from Rails. To scale to hundreds of models, Shopify relies on input/output reconciliation, shadow backtesting, drift monitoring, platform-enforced best practices and automated model operations.

  • Evolution of Product Classification at Shopify: From Categories to Comprehensive Product Understanding

    Shopify Engineering mediumAdept

    Shopify's product classification evolved from a 2018 TF-IDF logistic regression model through a 2020 multi-modal classifier to a Vision Language Model system built on the Shopify Product Taxonomy, which covers over 10,000 categories and 1,000+ attributes. A Dataflow pipeline makes two dependent calls to a VLM service (currently Qwen2VL 7B with FP8 quantization, served via NVIDIA Dynamo on Kubernetes with in-flight batching and KV caching): one predicts the category, the other predicts category-specific attributes, and both must succeed. Training data comes from multiple LLM annotators, with judge models arbitrating disagreements and humans reviewing edge cases. The system handles over 30 million predictions a day, merchants accept 85% of predicted categories, and hierarchical precision and recall doubled compared with the earlier neural approach.

  • 5 Steps for Building Machine Learning Models for Business

    Shopify Engineering mediumAdept

    A five-step workflow for building ML models in a business context: confirm ML is warranted (defer it for brand-new products and beat a heuristic baseline first), start with simple models and basic features or off-the-shelf pretrained components, and pick a metric tied to business impact before optimizing. The advice also covers sanity-checking outputs via confusion matrices and residuals, since 98% accuracy on rare-event fraud data can mean a useless model. Model iteration should run through staging flows or A/B tests with fair comparisons and attention to run-to-run variance, and teams should watch prediction stability for individual users across retrains.

  • Test Budget: Time Constrained CI Feedback

    Shopify Engineering mediumAdept

    Shopify's Test Infrastructure team evaluated a "test budget" for its 170,000-test Rails monolith: tests chosen by call-graph test selection are reordered with prioritization heuristics so failures surface early, and execution stops at a fixed time limit. Six criteria (failure rate, average duration, churn, coverage, complexity, random) were compared using Time to First Failure, APFD and a Convergence Index. Historical failure rate performed best, finding 80% of failures after running 60% of the selected suite, while churn and complexity were nearly useless. The analysis suggests stopping at under 70% of the test-selection suite would still catch the first failure in most builds.

The quest for software engineering knowledge.

Look:
Layout: