ReadingResearchRadarInvestment framework
Sign in / Sign up
← Back to reading
NewsMaterial3 min readDisconfirmAI Editorial

Shopify Engineering Team: Why Search and Recommendation Share a Single Generative Model

Shopify details the architectural decisions behind its shared generative discovery model: encoding billions of products into three-token sequences using semantic IDs, jointly training search and recommendation to mutually enhance each other, and deploying a 2.6B parameter model in production within millisecond-level latency budgets.

2026-11-12 02:27 GMT+8

In industrial systems, search and recommendation typically follow separate pipelines: search handles explicit queries, while recommendation relies on implicit behavioral signals. The Shopify engineering team proposes a more fundamental observation—that both share the same set of inputs and objectives. A search query provides an explicit signal of intent, whereas recommendation infers intent from browsing and purchasing behavior; yet both require product knowledge and buyer context to identify relevant items. This common foundation makes joint training a natural choice rather than an engineering compromise.

To serve both search and recommendation with a single language model, a shared product vocabulary is essential first. Shopify’s catalog contains billions of products; the raw numeric product ID itself carries no product information, and treating every product as an independent output would create a vocabulary of billions of entries, resulting in extremely sparse training samples. Their solution is the semantic ID: first, an embedding model encodes product content into vector representations, then RQ-KMeans converts these embeddings into discrete three-token sequence codes, with each codebook level containing 8,192 entries. The key effect is that related products share encoding prefixes—for example, products starting with [6001] cover various vests and gilets, while [6001, 5561] further narrows down to padded gilets in different colors. This means that training data for one product can update the shared representation of its neighbors, providing a learning pathway for products with sparse interactions.

Does joint training truly benefit both tasks? Shopify provided ablation experiments to answer this. Removing search data caused recommendation Recall@50 to drop from a baseline of 21.0 to 20.9; removing recommendation data caused search OneDCG@10 to drop from 28.8 to 28.5, and search purchase Recall@10 to drop from 33.4 to 32.6. Both directions showed declines, indicating that shared training indeed produced cross-task gains. The team also found that while supervised fine-tuning teaches the model to reproduce historical samples, accurately predicting the next token does not fully equate to retrieval quality—multiple products can satisfy the same intent, yet training samples only record one observed purchase or click. To address this, they introduced reinforcement learning, using an LLM relevance judge to provide reward signals, which yielded an additional 1.5-point lift in OneDCG@10 for the search task.

Sign in / Sign up
ReadingResearchRadarInvestment framework

Production deployment constraints dictate model scale and inference methods. Shopify positions the generative model as a candidate generator, sharing the latency budget of a live request with downstream ranking. They selected Liquid AI’s LFM2-2.6B, achieving a p95 latency of 25.5 milliseconds (with beam width 100), whereas the larger Qwen3-14B, despite higher quality, incurred a 108.4-millisecond latency that left insufficient time for subsequent ranking stages. For constrained decoding, they built upon the STATIC method to represent the catalog prefix tree as a sparse index on the GPU, enforcing constraints via a CUDA/C++ plugin within TurboMind, reducing constraint overhead from over 50 milliseconds to approximately 1 millisecond. Multi-token prediction further compressed the autoregressive generation of three codewords into a single forward pass, saving time to generate a larger candidate set for refinement by a lightweight ranker.

It must be clarified that all the aforementioned performance figures are self-reported production metrics from Shopify, without independent verification. Online gains (orders +7.95%, conversion rate +9.85%) come from Shop home feed recommendation experiments, while search quality improvements stem from internal OneDCG@10 evaluations. The applicability conditions of this architecture are tightly coupled with Shopify’s product catalog structure, request latency budgets, and participating merchant scale; systems with different product distributions, latency constraints, or interaction densities may not be able to directly reuse the same decisions. The team itself notes that the next goal is to integrate intent understanding, candidate generation, and ranking into a single model, introducing online continuous training—meaning the current architectural positioning (as a candidate generator) is itself a phased engineering choice rather than a final form.

Sources

  • shopify.engineeringShopify↗
Continue researching →