How Shopify improved consumer search intent with real-time ML

Jonathan Sabbagh
9 min readadvanced
--
View Original

Overview

Shopify has enhanced consumer search intent on its platform by integrating AI-powered search capabilities, specifically through Semantic Search, which improves the understanding of user intent. This article details the development of real-time machine learning (ML) assets and the design of streaming pipelines that process embeddings for images and text, ultimately boosting sales for merchants.

What You'll Learn

1

How to implement real-time ML pipelines for embedding processing

2

Why streaming data pipelines are preferred over batch processing for real-time applications

3

How to manage memory efficiently in ML inference pipelines

4

When to use embeddings for improving search intent in e-commerce

Prerequisites & Requirements

  • Understanding of machine learning concepts and data processing
  • Familiarity with Google Cloud services, particularly Dataflow(optional)

Key Questions Answered

How does Shopify process embeddings in real-time?
Shopify processes approximately 2,500 embeddings per second, translating both text and images into numerical vectors. This is achieved using Google Cloud's Dataflow for streaming analytics, which allows for near real-time updates of product information on merchant storefronts.
What challenges does Shopify face in maintaining a streaming pipeline?
Maintaining a streaming pipeline involves challenges such as managing memory efficiently, ensuring high throughput, and balancing cost with performance. For example, Shopify had to adjust the number of threads in their Dataflow workers to reduce memory consumption while maintaining adequate processing speed.
Why did Shopify choose near real-time embeddings over batch processing?
Shopify opted for near real-time embeddings to provide instant updates for merchants, enhancing the customer experience and potentially boosting sales. The data indicated that timely updates lead to better search relevance and user satisfaction, despite the added complexity of the pipeline.
What is the role of embeddings in improving search intent?
Embeddings transform textual and visual content into numerical vectors, allowing Shopify to measure similarity and improve the accuracy of search results. This enhances the understanding of consumer intent, leading to more relevant product matches.

Key Statistics & Figures

Embeddings processed per second
2,500
This rate translates to approximately 216 million embeddings processed daily across Shopify's image and text pipelines.
Memory footprint reduction
~2.6x
This reduction was achieved by optimizing the number of threads in the Dataflow worker processes.

Technologies & Tools

Some links below are affiliate links. We may earn a commission if you make a purchase.

Backend
Google Cloud Dataflow
Used for powering the streaming analytics service that processes embeddings.
Backend
Apache Beam
Utilized for managing the data processing pipelines within Dataflow.

Key Actionable Insights

1
Implementing real-time ML pipelines can significantly enhance user experience by providing immediate updates to product listings.
This is particularly important in e-commerce, where timely information can lead to increased sales and customer satisfaction.
2
Optimizing memory usage in ML inference can reduce costs and improve performance.
By adjusting the number of threads in Dataflow workers, Shopify managed to decrease memory usage by approximately 2.6 times, which allowed them to revert to less expensive machine types.
3
Using embeddings is crucial for improving search intent in online platforms.
By understanding the intent behind searches, businesses can better match products to consumer needs, enhancing the overall shopping experience.

Common Pitfalls

1
Overloading memory in ML inference pipelines can lead to Out of Memory (OOM) errors.
This often occurs when processing large images or datasets without proper memory management strategies, which can disrupt the entire pipeline.
2
Relying solely on batch processing can delay updates and reduce the relevance of search results.
In fast-paced environments like e-commerce, delays in data processing can lead to missed sales opportunities and a poor user experience.

Related Concepts

Machine Learning In E-commerce
Real-time Data Processing
Embedding Techniques In AI
Google Cloud Services For ML