ShopifyShuying SunExplainer
Shopify’s generative discovery model (2026) - Shopify
Summary
Shopify built a shared generative discovery model trained jointly on search and recommendation data to personalize product discovery across its commerce ecosystem. Products are represented by semantic IDs: three-token codes produced by an RQ-KMeans tokenizer that clusters product embeddings, allowing related products to share representations. The model starts from an open-weight pretrained language model and is adapted through continued pretraining, multi-task fine-tuning, and multi-teacher distillation. In production, the model improved the Shop home feed by 7.95% in orders and 9.85% in conversion rate, and boosted search OneDCG@10 by 2.1 points overall and 2.7 points for signed-in users. Multi-token prediction generates all three codewords in a single pass, reducing p95 latency compared to autoregressive generation while allowing a larger candidate set.
Context
Shopify operates a commerce ecosystem spanning merchant storefronts, the Shop app, and a Catalog API. The challenge is using search, browsing, and purchase signals to find relevant products for each buyer across a catalog of billions, within the latency budget of a live request.
Approach / What changed
Shopify trained a shared generative discovery model on both search and recommendation data. Products are represented by semantic IDs produced by an RQ-KMeans tokenizer that converts product embeddings into three-token codes. The model is a pretrained language model adapted through continued pretraining, multi-task fine-tuning, and multi-teacher distillation. At serving time, multi-token prediction generates all three codewords in a single pass to reduce latency, and a lightweight ranker selects the best candidates.
Takeaways
Training search and recommendation together on a shared model improves both: removing recommendation data dropped search purchases Recall@10 from 33.4 to 32.6, and removing search data dropped recommendation Recall@50 from 21.0 to 20.9.
Semantic IDs from RQ-KMeans tokenization let products with few interactions benefit from training on their neighbors, because related products share code prefixes and update shared representations.
Multi-token prediction generates all three semantic-ID codewords in one model pass, reducing p95 latency compared to autoregressive generation and allowing a larger candidate set with a lightweight ranker.
FAQ
How does the model represent products without a billion-entry vocabulary?
Products are represented by semantic IDs: a three-token code produced by an RQ-KMeans tokenizer. The tokenizer clusters product embeddings, subtracts the cluster centers, and repeats on the residuals. Related products can share codes, so products with few interactions benefit from training on their neighbors.
How does multi-token prediction reduce latency?
Multi-token prediction (MTP) generates distributions for all three codeword positions in a single model pass, then combines them into valid semantic IDs. This reduces sequential model work compared to autoregressive generation, lowering p95 latency at 50 QPS per instance on B300 MIG 3g.90gb.
Does training search and recommendation together improve both?
The model is trained jointly on search and recommendation data. When recommendation data was removed, search purchases Recall@10 dropped from 33.4 to 32.6. When search data was removed, recommendation Recall@50 dropped from 21.0 to 20.9. This shows each task benefits from the other's training data.
Source and freshness
- Source
- shopify.engineering
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.