Shopify’s Shared Generative Model Improves Search and Product Recommendations
- William Smith
- 522 reads
A shared model generates product candidates for search and recommendations, with reported gains in relevance, recall and Shop home feed conversions.

Shopify’s generative discovery model puts search and product recommendations on a shared foundation: one model learns from product information and buyer activity, then generates candidate products for both experiences. The model is running in production as a candidate generator, and Shopify reports gains in search relevance and Shop home feed conversions.

The practical idea is simple. A search for “backpack” gives a system an explicit query, while a recommendation request relies more on the buyer’s browsing and purchase history. Both tasks need to connect buyer context with product knowledge. Training them together can let patterns learned in one task help the other, while a shared product representation makes it possible to generate relevant candidates across a catalog of several billion products.
That shared approach has real engineering constraints. Product candidates must be generated quickly enough to leave time for later ranking stages, and the model must produce codes that map to eligible catalog items. Shopify’s design addresses those problems with compact product identifiers, joint training, task-specific refinement and optimized decoding.
What the production results show
Shopify reports online gains for recommendations on the Shop home feed: orders rose 7.95% relative to the comparison system, converters rose 8.60%, and conversion rate increased 9.85%. In offline testing, the model adds 2.65 percentage points of Incremental Pool Recall to the recommendation system. Shopify also describes it as the strongest standalone candidate generator in its evaluation.
For search, adding the model to the production system improved OneDCG@10 by 2.1 points overall and by 2.7 points for signed-in users, where personalization is available. Shopify says 25% of queries improved on net in top-ten relevance. OneDCG@10 evaluates the ordering of the first ten results against a fixed reference of ten ideal results, which makes scores comparable across queries with different numbers of relevant items.
| Search setup | Combined OneDCG@10 | Personalized OneDCG@10 |
|---|---|---|
| Production system without the generative model | 30.6 | 33.0 |
| Production system with the generative model | 32.7 (+2.1) | 35.7 (+2.7) |
| Generative model alone | 28.5 | 33.6 |
The standalone figures put the combined results in context. The model alone is below the full production system for combined search, while its personalized score exceeds the production system without it. Its value is therefore not just that one model can replace a complete retrieval stack. The reported gains come from adding generated candidates to a system that already has other stages.
These figures describe different kinds of evidence. The home feed changes are online outcomes; recall and search relevance are offline retrieval measures. They show promise across both tasks, but they don’t by themselves tell teams how results vary by product category, merchant, or query type. That level of detail is part of what practitioners would want to assess before applying the approach elsewhere.
Turning products into a vocabulary the model can generate
A catalog with billions of products creates a representation problem. A raw product ID distinguishes one record from another, but its digits don’t describe the item. If every ID were a separate output token, the model would need to learn a distinct representation for each product, including many products with few interactions. Training such a vocabulary would be sparse and expensive.
Shopify instead encodes product content as an embedding, a vector representation, then converts that embedding into a short sequence of discrete codes called a semantic ID. Products with related content can share parts of their code sequences. Training on one product can then help the model learn representations that are useful for its neighbors.

Shopify compared two tokenizer methods, RQ-VAE and RQ-KMeans, and selected RQ-KMeans based on downstream performance at the same codebook shape. The method repeatedly clusters product embeddings, subtracts the selected cluster center, then encodes the remaining residual. Each stage captures information the earlier stages did not. The chosen setup has three codebooks, each with 8,192 entries, so every product receives a three-token semantic ID.

These codes reflect similarity in the embeddings; their positions don’t have fixed meanings such as category, brand or color. In one catalog example, products with the prefix [6001] include different vests and gilets. Adding [5561] narrows that group to padded gilets, and a third code identifies a smaller set of gray designs. Another branch, [6001, 4551], leads to workwear-style gilets, including indigo denim vests under [6001, 4551, 879].
![Two semantic-ID branches share the prefix [6001] for vests and gilets, then distinguish smaller groups as additional tokens are added.](/articles/25/rXv30oy6XAIleyw3fEAcY1U2y0Ts1Uo4.webp)
Because more than one product can map to the same complete code sequence, generation still needs a way to select a specific item. Shopify explored serving-time collision handling, including a lightweight ranking step that uses product popularity when mapping codes back to products. The technical report describes the methods and experiments in greater detail.
Joint training connects intent with behavior
The model starts from an open-weight pretrained language model, then adapts to commerce data available for this purpose, including product catalog information and eligible buyer interactions. Continued pretraining teaches it to connect product descriptions and attributes with semantic IDs, as well as to learn from search and recommendation examples.
Shopify tested whether the two tasks help each other by removing each data stream in turn. With the baseline training mix, search relevance OneDCG@10 was 28.8, search purchases Recall@10 was 33.4, and recommendation Recall@50 was 21.0. Removing search data left recommendation Recall@50 at 20.9. Removing recommendation data reduced search relevance to 28.5 and search purchases Recall@10 to 32.6. When a stream was removed, its share of training tokens was redistributed among the remaining streams.
The changes are modest in this ablation, but they support the case for shared training: recommendation performance slips slightly without search examples, and both search measures decline without recommendation examples. Shopify’s approach treats product discovery as a shared learning problem, with task-specific signals contributing to the same foundation.

Joint training alone doesn’t guarantee that a recommendation model will find products a buyer hasn’t already seen. Existing rule-based candidate generators already cover retargeting from interaction history. The more difficult discovery task is surfacing a relevant product with no prior interaction.
To give those cases more weight, Shopify upsamples examples centered on first purchases: a buyer’s first purchase of a product, from a merchant, or within a category. It also compresses histories by removing older clicks and stale interactions while preserving purchases, leaving more context for recent behavior. In an offline experiment, the combined changes raised discovery recall by roughly 10–15% relative at cutoffs of 10 and 50; overall recall increased by about 2% relative.
Another training change addresses the gap between predicting a historical interaction and retrieving a good result. A buyer may have clicked or purchased one product even though several products could have satisfied the same intent. For search, Shopify uses a language-model relevance judge to score generated candidates, then applies reinforcement learning to refine candidate generation from that feedback. Shopify reports a 1.5-point lift in OneDCG@10 from this step.
Finally, Shopify fine-tunes separate search and recommendation experts, then uses multi-teacher distillation to transfer their task-specific learning into one shared model. The aim is to retain the gains from specialization while maintaining one model for both discovery tasks.

Serving candidates within a live request
Candidate generation shares a request’s latency budget with later ranking, so a higher-quality model can still be a poor production choice if it leaves too little time for the rest of the stack. Shopify selected Liquid AI’s LFM2-2.6B for its balance of retrieval quality and serving speed, and uses the RIPL inference stack in production.
| Model | Search relevance OneDCG@10 | Search purchases Recall@10 | Recommendation Recall@50 | p95 latency |
|---|---|---|---|---|
| LFM2-2.6B, selected | 24.9 | 32.3 | 25.3 | 25.5 ms |
| Qwen3-1.7B | 24.9 | 32.5 | 26.0 | 46.1 ms |
| Qwen3-14B | 25.3 | 35.0 | 26.7 | 108.4 ms |
In Shopify’s comparison, the larger Qwen3 models score higher on some retrieval metrics but take longer to generate candidates. The latency figures measure the server-side generator call using TensorRT-LLM, with a beam width of 100 to produce 100 candidates. Requests came from production traffic; prompt lengths were 22 tokens at the median and 620 tokens at the 95th percentile. The selected LFM2 model uses a customized TensorRT-LLM engine. These test conditions matter when comparing the timings with other deployments.
Generation must also obey the catalog’s eligibility rules: only semantic-ID paths that resolve to allowed products should be produced. Shopify builds on STATIC, which stores the catalog’s prefix tree as a sparse GPU index. A CUDA and C++ plugin in TurboMind checks valid continuations through vectorized operations. Shopify says this reduced constraint-checking overhead from more than 50 ms to about 1 ms per request.
Eligibility can vary with each request. A buyer’s market, for example, affects which products can be returned, so the decoding constraints need to reflect request-specific filters. Shopify says it will describe its metadata-routing approach in a follow-up.
The three-token product representation also creates an opportunity to reduce sequential generation work. Autoregressive decoding predicts one code at a time. Multi-token prediction, or MTP, predicts distributions for all three positions in one model pass and combines them into valid semantic IDs. Shopify uses the time saved to generate a larger set of candidates, then applies a lightweight ranker. It reports that this combination improves quality over autoregressive generation while keeping p95 latency lower. The published comparison uses 50 requests per second per instance on B300 MIG 3g.90gb.

The next step is a broader discovery model
Today, the generative model supplies candidates to a multi-stage system. Later ranking stages narrow and order those candidates, which means retrieval sets a hard limit on what the rest of the stack can show. Shopify’s longer-term direction is to bring intent understanding, candidate generation and ranking into a more unified discovery model serving search, recommendations and ads, while honoring buyer privacy choices.

Getting there depends on a richer, ordered record of the shopping journey. Search queries, product views, purchases and store visits would be represented together with their order and timing, giving the model more context for how intent changes. A purchase can alter what is useful next; someone furnishing a small apartment who buys a table may need chairs that fit both the table and the available space.
Shopify also plans to add richer visual representations. Product images can convey shape, texture, pattern and style that descriptions may omit. Connecting those signals with text and the products a buyer has explored could help the model identify items that match a buyer’s preferences.
The third direction is continuous training from fresh interactions, including clicks and purchases. Shortening the time between a buyer action and a model update could help the shared system adapt as interests and catalog contents change, while allowing learning from search to improve recommendations and vice versa.
The current system’s strongest case is practical: semantic IDs make a very large catalog more learnable, joint training shares useful signals, and optimized decoding keeps generation within a live serving budget. The next questions are how the approach performs across different slices of traffic, how request-specific eligibility works at scale, and whether MTP’s quality and latency gains hold as the model takes on more of the discovery pipeline.