Loading…
Building world-class product search at Shopify: Where C++ excellence meets ML innovation
2023-10-18
- Source
- Shopify
- Published
- Added to Yomu
Summary
Shopify describes a product-search stack built for multi-tenant commerce, where real-time indexing, retrieval, ranking, experimentation, and merchant controls must operate at global scale. Commerce ranking combines classical information retrieval with transformers, neural rankers, LightGBM, Catboost, and signals such as relevance, purchase popularity, brand trust, and navigational intent, while supporting privacy, multi-language, and accessibility requirements. RankFlow, a Python-like domain-specific language, lets data scientists change ranking logic without C++ expertise, while TurboDSL compiles and executes it with type safety, vectorized operations, cache optimization, predictable latency, and efficient memory use. The team first shipped SimScorerDSL in C++, then built TurboDSL without changing the DSL syntax, enabling continued experimentation during the transition. TurboDSL achieved a 48% speedup in ranking feature computation, and automated pull-request analysis compares component timings, statistical significance within a ±2% tolerance, and side-by-side results to detect performance or accuracy regressions.
Context
Commerce search at Shopify must support rapid machine-learning iteration while delivering millisecond latency at high query volumes across millions of merchants. The system also needs real-time inventory updates, complex pricing and product variants, merchant-specific ranking in a multi-tenant environment, and globally low-latency results. Traditional C++ systems limit iteration speed, while Python or Java introduce latency and memory overhead; hybrid approaches add deployment complexity, version skew, and operational overhead.
Approach / What changed
Shopify built RankFlow, a domain-specific language with Python-like syntax, and TurboDSL, a high-performance execution engine. RankFlow allows data scientists to deploy ranking changes without C++ expertise, while TurboDSL executes the same DSL with compiled-C++ performance, type safety, vectorized operations, cache optimization, predictable latency, and efficient memory use. A two-phase rollout began with SimScorerDSL, followed by TurboDSL while preserving DSL compatibility. Automated pull-request analysis tracks component timings and compares performance and accuracy changes.
Takeaways
- RankFlow gives data scientists Python-like ranking syntax while retaining access to ML models and features without requiring C++ expertise.
- TurboDSL preserved the existing DSL syntax during the transition from SimScorerDSL and achieved a 48% speedup in ranking feature computation.
- Every pull request receives component-level timing analysis, statistical significance testing with a ±2% tolerance, and side-by-side comparisons to identify meaningful performance or accuracy changes.