Ecommerce ops · Production

Shopify builds Merlin, an internal ML platform for distributed training and batch inference at scale

The problem

Shopify needed to redesign their ML platform to handle diverse, often conflicting requirements across internal use cases (fraud detection, revenue predictions) and external use cases (product categorization, recommendation systems), enabling data scientists to move faster from prototype to production.

Workflow diagram · grounded in source
1
Create Merlin Project
trigger
“The user starts by creating a Merlin Project where they can place their code and specify the requirements and packages they need for development”
2
Prototype on Merlin Workspace
ai_action
“the user will create a Merlin Workspace, the sandbox where they use Jupyter notebooks to prototype on a distributed and scalable environment”
3
Distributed model training
ai_action
“integrated its Tensorflow training code with Ray Train, for distributing training across a Ray cluster”
4
Distributed batch inference
ai_action
“We used Ray ActorPool to distribute each step of batch inference across a Ray cluster”
5
Orchestrate production runs via Airflow
integration
“The jobs can be scheduled to run periodically, call the production Merlin API to spin up Merlin Workspaces and run Merlin jobs on them.”
6
Monitor with Datadog and Splunk
validation
“Each Merlin Workspace gets its own dedicated Datadog dashboard which allows users to monitor their Merlin job. It also helps them understand more about the computation load of their job and the resources it requires. On top of this, each…”
Reported outcome

Merlin is empowering Shopify with scalability, fast iteration, and flexibility, validated by onboarding the product categorization model which required large-scale computation and complex ML flows.

Reported metrics
Platform capability outcomesscalability, fast iteration and flexibility
Gap between prototyping and productionminimizes the gap between prototyping and production
Code changes required for distributed trainingeasy and required few code changes
Reported stack
MerlinRayRay TrainRay TuneRay ActorPoolJupyterHubKubernetesTensorFlowDockerDatadogSplunkSparkAirflowOozie
Source
https://shopify.engineering/merlin-shopify-machine-learning-platform
Read source ↗

Frequently asked questions

What did this team achieve with this AI workflow?

Merlin is empowering Shopify with scalability, fast iteration, and flexibility, validated by onboarding the product categorization model which required large-scale computation and complex ML flows.

What tools did this team use?

Merlin, Ray, Ray Train, Ray Tune, Ray ActorPool, JupyterHub, Kubernetes, TensorFlow, Docker, Datadog.

What results were reported?

Platform capability outcomes: scalability, fast iteration and flexibility; Gap between prototyping and production: minimizes the gap between prototyping and production; Code changes required for distributed training: easy and required few code changes (source-reported, not independently verified).

How is this ecommerce ops AI workflow structured?

Create Merlin Project → Prototype on Merlin Workspace → Distributed model training → Distributed batch inference → Orchestrate production runs via Airflow → Monitor with Datadog and Splunk.