Manuscript Offprint
arXiv:2611.08804Generative Search and Recommendation at Shopify
Abstract
Search and recommendation at Shopify require retrieving relevant products from a changing catalog of billions of products under strict latency constraints. We present SID-LLM, which casts both tasks as generating semantic IDs: short sequences of content-derived tokens representing products. We jointly pre-train SID-LLM on catalog and behavioral data, giving search and recommendation a shared representation and training objective. We show that reinforcement learning further improves judged search relevance. Furthermore, distillation from task-specific experts improves recommendation quality over joint supervised fine-tuning without a statistically detected loss in search quality. Finally, for efficient serving, we pair multi-token prediction with a lightweight ranker, improving retrieval quality over our autoregressive baseline while reducing latency.
We evaluate SID-LLM both as a standalone retriever and as a component of Shopify’s production search and recommendation systems. As a standalone search system, SID-LLM achieves quality comparable to Shopify’s existing multi-model search stack while meeting production latency requirements. Integrating SID-LLM into the search and recommendation stacks provides significant gains in both offline evaluations and online A/B tests. Together, these results demonstrate the practical value of semantic-ID generation as a unified approach to product discovery at scale.
1 Introduction
Search and recommendation connect buyers with relevant products across Shopify’s large and diverse catalog across millions of merchants on their web storefront, Shopify-built Shop App, and Shopify’s Catalog API designed for conversational commerce and AI agents. Both require understanding products and their relevance to a particular buyer at the scale of billions of products with very low latency.
We present SID-LLM, a generative model for search and recommendation. It represents products as semantic IDs (SIDs), short sequences of content-derived tokens, and learns to generate relevant identifiers from the context available for each task. This gives search and recommendation a shared formulation and allows us to investigate unifying them within one model.
This report describes SID-LLM from semantic-ID tokenization and training through production integration. We study the choices that determine retrieval quality and serving cost, and explore distillation from task experts into a unified student. Adding SID-LLM provides significant gains in both online and offline evaluations of Shopify’s search and recommendation stacks while meeting strict latency requirements for online serving.
*Equal contribution. †Liquid AI. ‡Project supervision.

Figure 1. Overview of SID-LLM.
Each task retrieves candidate products for downstream ranking (Section 7). We distinguish three tasks according to the context available at retrieval time.
Recommendation. Given a buyer's interaction history , retrieve products they are likely to find useful or purchase. The history contains actions such as clicks, carts, favorites and purchases, together with the products involved and their timing. There is no explicit query expressing the buyer's current need, so the model must infer it from this context. The task is to identify products the buyer is likely to engage with next.
Non-personalized search. Given a textual query , retrieve products relevant to the expressed intent without conditioning on buyer-specific preferences. Relevance requires interpreting the requested product type, attributes and constraints even when the buyer and merchant describe the same product differently.
Personalized search. Given a query and a buyer profile , retrieve products that satisfy the query while accounting for the buyer's preferences. The profile summarizes information about the buyer derived from their past behavior. The query specifies the immediate need; the profile helps distinguish among products that could meet it.
Retrieval as semantic-ID generation. We represent each product by a short semantic ID obtained by quantizing its content embedding (Section 3). Given the task-specific context, SID-LLM learns to generate target SIDs through next-token prediction; we also study predicting their tokens in parallel (Section 4.1). At inference, constrained decoding produces candidate SIDs, which are resolved to eligible products before downstream ranking (Section 7)
1.2 Traditional recommendation systems vs. SID-LLM
Industrial recommendation systems commonly separate candidate retrieval from ranking (Covington et al., 2016). A two-tower retriever (Yi et al., 2019) encodes the buyer and each product separately and scores their compatibility with an inner product. This supports efficient nearest-neighbour retrieval, but compresses the buyer's history into a fixed vector before scoring candidates. Multi-interest methods (Li et al., 2019) use several buyer vectors, each still computed independently of the candidate.
Sequential generative recommenders learn to predict the next item from the interaction sequence (Zhai et al., 2024). Representing products as atomic IDs gives each product its own learned embedding, with no content-based relationship between identifiers. Semantic-ID generation (Rajput et al., 2023) instead shares tokens across related products. In SID-LLM, the history remains part of the prompt throughout generation, and a pretrained language backbone provides an initial representation of product language. We evaluate the resulting generator both on its own candidates and on the purchases it adds to the combined candidate pool (Section 9.2.1).
1.3 Lexical matching, semantic search, and generative search
Lexical retrieval matches query terms to product text through an inverted index, using a scoring function such as BM25 (Robertson and Zaragoza, 2009). It is useful for exact terms such as brands and model numbers, but encounters a vocabulary mismatch when buyers and merchants use different words for the same thing (Furnas et al., 1987). Dense semantic retrieval addresses this mismatch by encoding queries and products into a shared vector space (Karpukhin et al., 2020; Nigam et al., 2019) and searching an approximate nearest-neighbour index (Jégou et al., 2011; Malkov and Yashunin, 2020). Like two-tower recommendation, it scores separately computed representations.
Generative retrieval replaces the index lookup with identifier generation (De Cao et al., 2021; Tay et al., 2022). In SID-LLM, the query and optional buyer profile condition the prediction of each SID token. The model learns which identifiers fit the context, while a catalog index constrains generation to identifiers that resolve to eligible products (Section 8.3). Shopify's search stack combines lexical, embedding and generative retrieval, and we evaluate SID-LLM's contribution through end-to-end stack ablations (Section 9.1.2).
Contributions
• A study of semantic-ID tokenization, including quantization methods, codebook sizes and product collisions (Section 3).
-
A comparison of language backbones and autoregressive versus multi-token prediction for generative retrieval (Section 4).
-
A training recipe combining catalog, search and recommendation data, with ablations of the data mixture, post-training objectives and distillation from task experts (Sections 5 and 6).
• Production integration and inference methods for fast, eligibility-constrained retrieval over a changing catalog (Sections 7 and 8).
- Offline and online evaluation of the gains from adding SID-LLM to the search and recommendation stacks (Section 9).
2 Evaluation Metrics
We use three primary offline metrics: search relevance measured by OneDCG@10, search purchase Recall@10, and recommendation Recall@50. We report additional metrics only for specific analyses, such as discovery and incremental candidate-pool recall.
Offline scores depend on more than the model: the relevance judge (Section 2.1.1), the query set, the retrieval index, the users scored for recommendation and the inference code all changed during the project. We call one fixed combination an evaluation protocol (Table 21 in the appendix). Tables using these protocols name them in their captions; separate recommendation cohorts are described alongside their results. Absolute scores compare only within a table.
2.1 Search
2.1.1 OneDCG
An LLM judge grades each returned product from 0 to 3 for its relevance to the query and to the profile of the buyer who searched. The grade and a static score , which depends on neither the query nor the buyer, set the product's gain, . The static score is a weighted sum of four quality signals between 0 and 1: the product's ratings and popularity, the brand's prevalence and the shop's sales. Its weights sum to one, so the gain runs from 0 to 100 and the static score is worth at most one grade. A perfectly relevant product with every quality signal at zero gains 46.7. Protocols E1 and E2 (Table 21) use earlier versions of the judge, which read the query alone and combine the grade with the quality signals differently. We report OneDCG@k: the DCG@k (Järvelin and Kekäläinen, 2002) of these gains, divided by the DCG of results that all receive the maximum gain of 100. Unlike in NDCG, the normalizer is a constant rather than each query's ideal DCG, so the score measures absolute relevance and is comparable across queries.
2.1.2 Purchase recall
Purchase Recall@k is the share of a converted search session's purchased products that appear among the first retrieved, averaged over sessions. Products are matched across shops by a universal product identifier, and a purchase without one counts as a miss.
2.2 Recommendation
2.2.1 Recommendation recall
Recommendation Recall@k scores the products a user buys in a held-out week after their interaction history: the share of them among the first recommended, averaged over the users with at least one such purchase.
3 Semantic ID Tokenizer Model
The tokenizer maps each product to a short semantic ID (SID), which the downstream LLM uses as a sequence of discrete tokens (Section 4). We write codebook sizes in level order, separated by hyphens. Our final tokenizer uses residual -means (RQ-KMeans) with codebooks 8192-8192-8192, meaning three levels of 8,192 codes each.
3.1 Tokenizer construction
We start from one 768-dimensional embedding per product, produced by an in-house model trained for product search. RQ-KMeans quantizes the embedding in stages: the first codebook approximates the original vector, and each subsequent codebook approximates the residual left by the previous levels. The three centroid indices form the product's SID.
We fit on the 25M products with the highest gross merchandise value (GMV), a sample that gives higher downstream search relevance than random sampling in both codebook shapes tested (Table 27 in the appendix). We fit each level with standard k-means on GPU (cuML), using scalable k-means++ initialization and up to 20 iterations with early stopping at convergence. Once the codebooks are fitted, we assign every product greedily to the nearest centroid at each level.
3.2 Design choices
We select tokenizers using downstream retrieval quality and serving latency. Each comparison trains an LLM on the candidate SIDs and scores it against a baseline under the same evaluation protocol (Section 2). We screen with small models and short runs, then confirm promising choices with larger or longer runs and load-test the finalists.
Quantization method. RQ-VAE (Lee et al., 2022) learns a neural encoder before residual quantization; RQ-KMeans quantizes the product embeddings directly. At matched codebook shape, RQ-KMeans gives higher OneDCG@10 despite producing fewer unique SIDs (Table 1). This motivates our choice of RQ-KMeans and shows that uniqueness alone is insufficient for selecting a tokenizer. Similar findings have been reported in industry (D'Amico et al., 2026; Zhou et al., 2025).
Table 1. RQ-VAE vs. RQ-KMeans as the tokenizer of a downstream LLM. All codebooks are fit on the same sample of product embeddings. Unique SIDs: distinct SIDs as a share of all products. Resnik: mean similarity of purchased-item pairs for the same query, computed separately from August search logs (Section D.1). OneDCG@10: evaluation protocol E1 (Table 21). Best OneDCG@10 in bold.
| Method | Codebooks | Unique SIDs (%) | Resnik (bits) | OneDCG@10 |
|---|---|---|---|---|
| RQ-VAE | 1024-1024-1024-1024 | 69.1 | 6.25 | 0.3518 |
| RQ-KMeans | 1024-1024-1024-1024 | 35.3 | 8.32 | 0.3804 |
| RQ-KMeans | 8192-8192-8192 | 30.4 | 8.68 | 0.3945 |
Behavioral coherence. To examine how well the tokenizers group products that satisfy similar search intents, we adapt Resnik similarity (Resnik, 1995) to the SID prefix tree. We score pairs of distinct items purchased for the same query using the information content of their longest shared SID prefix: sharing a prefix that covers fewer items receives a higher score. We average over item pairs within each query, then equally across 12,799 queries. Across these three configurations, higher similarity accompanies higher downstream search quality, despite lower SID uniqueness (Table 1). This suggests that grouping products around shared search intent is an important property of the representation. The data and metric are detailed in Section D.1.
Codebook size. Larger codebooks improve retrieval quality but increase serving cost. The 32768-8192-8192 tokenizer scores higher than 8192-8192-8192, but its p95 latency reaches 50 ms at the target load of 100 requests per second (Table 2). We choose 8192-8192-8192 to preserve latency headroom. The full size and balancing sweep and the measurements at other request rates are in Section D.
3.3 Collisions and product resolution
Different products can share a SID, including duplicate or closely related listings. Increasing uniqueness through balancing or heuristic de-duplication does not consistently improve downstream retrieval. Adding a
Table 2. Codebook quality and p95 serving latency at 100 requests per second. Both RQ-KMeans tokenizers are fit on the top 25M products by GMV, each with its own LFM2-2.6B downstream LLM, on one NVIDIA B200 node. OneDCG@10: evaluation protocol E2 (Table 21). Better value per column in bold.
| Codebooks | OneDCG@10 | p95 latency (ms) |
|---|---|---|
| 8192-8192-8192 | 0.3464 | 40.5 |
| 32768-8192-8192 | 0.3538 | 50.0 |
fourth CRID token (Ling et al., 2026) gives a small relevance gain but increases decoding latency, so we retain three semantic codewords. Detailed comparisons and the cluster-size analysis are in Section D.
In search, we resolve each SID to the eligible product with the highest static quality score (Section 2.1.1). Recommendation allows confident SIDs to contribute multiple products, using the joint-probability resolution described in Section 7.2.
4 Semantic ID LLM Model
4.1 Autoregressive vs. multi-token prediction
A SID is a short, fixed-length sequence of codewords (three in our tokenizer, Section 3), and a SID-LLM can emit it in two ways. Autoregressive (AR) decoding predicts one codeword per step: the prefill encodes the request, and each successive codeword is drawn from a distribution conditioned on the codewords already chosen, so a length-three SID costs one prefill and two further backbone passes. Multi-token prediction (MTP) instead predicts all three codeword distributions from the request prefix alone, in a single prefill, with no codeword attending to another; the catalog index constrains these independent per-position distributions to valid combinations, and a beam walk over it assembles the candidate SIDs. MTP trades the exact factorization of the joint SID distribution for parallelism—dropping the sequential dependence between codewords is precisely what lets it decode in one pass instead of three.
The two modes expose a quality–latency trade-off (Table 3). On its own, MTP scores below AR on both top-10 search metrics, and widening its beam from 100 to 250 barely moves either, so more beam search does not close the gap. What MTP buys is speed: predicting the whole SID in one prefill roughly halves median server-side latency, and its median and p95 stay nearly flat as offered load rises while its p99 grows only to about 61 ms at the highest load—far below AR’s, whose per-codeword passes make its tail balloon under load (Table 16). Re-scoring MTP’s 250 candidates with the learned ranker (Section 8.4) more than recovers the gap, reaching OneDCG@10 and Recall@10 above AR on both, while staying faster than AR at every percentile. We therefore serve MTP paired with the ranker for search. Recommendation uses an AR model with joint-probability product resolution (Section 7.2). The unified student studied in Section 6.2 is experimental and starts from the AR model.
4.2 Backbone ablations
We compare four backbones: LFM2-2.6B (Liquid AI, 2025), Qwen3-1.7B-Base, Qwen3-4B-Base and Qwen3-14B-Base (Qwen Team, 2025). Training recipes differ across backbones (Section 5.2 and Table 10); the 1.7B model follows the 4B recipe. Table 4 summarizes the quality–latency trade-off. The Qwen3 models improve average quality at higher latency. We deploy the LFM2-2.6B backbone, which has the lowest p95 latency in this comparison.
Table 3. Autoregressive vs. multi-token prediction: LFM2-2.6B pre-trained to predict one SID token per step (autoregressive) or the whole SID at once (multi-token prediction). The multi-token model is decoded at two beam widths, then with a learned ranker that re-scores its 250 candidates. Every arm returns 100 products per query. Evaluation protocol E5 (Table 21). Best value per column in bold.
| Arm | Beam width | Search relevance | Search purchases |
|---|---|---|---|
| OneDCG@10 | Recall@10 | ||
| Autoregressive | 100 | 0.3083 | 0.3246 |
| Multi-token prediction | 100 | 0.2804 | 0.2839 |
| Multi-token prediction | 250 | 0.2811 | 0.2840 |
| Multi-token prediction + ranker | 250 | 0.3365 | 0.3450 |
Table 4. Backbone quality–latency trade-off. Mean quality gain is the equal-weight mean relative gain over LFM2-2.6B in search relevance (OneDCG@10), search purchases (Recall@10) and recommendation (Recall@50). Latency change is relative to the same baseline; positive values indicate higher latency. Evaluation protocol E5 (Table 21).
| Backbone | p95 latency (ms) | Latency change (%) | Mean quality gain (%) |
|---|---|---|---|
| LFM2-2.6B | 30.35 | 0.0 | 0.0 |
| Qwen3-1.7B-Base | 73.29 | +141.5 | +1.0 |
| Qwen3-4B-Base | 105.00 | +246.0 | +3.5 |
| Qwen3-14B-Base | 142.87 | +370.7 | +4.9 |
5 Pre-training
5.1 Data
Our goal is to make SID-LLM perform well on both the search and recommendation tasks. In order to do that, we pre-train the model with three different categories of data: product attribute data, search data and recommendation data (Table 5). Furthermore, we explore adding general text, math and coding replay data during the pre-training phase and use that for the larger models (Section 5.1.4).
During training, we split each training example into a prompt and a completion, and apply the loss only to the completion. The details on how each of the examples is split can be seen in Figure 2 and in the following sections.
In order to evaluate the importance and appropriate dosage of the different data streams, we perform shorter training runs (~30k steps) with different data mix configurations.
5.1.1 Product attribute data
To teach the model the product catalog and how textual product attributes map to SIDs, we construct a product attribute dataset from the catalog data. During training, we sample a single product attribute from the following list: title, category, brand, price, other product attributes, shop name, and shop country code. We then make the model predict the SID as the completion based on the product attribute in the prompt.
We create two separate product attribute datasets: one containing all products in the catalog and one consisting only of products with at least $1,000 of sales over the last year. Both datasets form the training examples the same way, but the second one samples the attribute only from the title and the shop name.
We ablate the usefulness of the product attribute datasets to the final tasks, and notice that product attribute data has a positive impact on search metrics, but does not affect the recommendation metrics meaningfully (Table 6).
Table 5. Pre-training data mix of LFM2-2.6B: 100,000 steps of 1,048,576 tokens each. Epochs are passes over a stream's rows. "Loss tokens" counts only those that carry the loss; "Tokens" counts all.
| Source | Examples (M) | Epochs | Tokens (B) | Tokens (%) | Loss tokens (%) |
|---|---|---|---|---|---|
| Product attributes | |||||
| Product documents | 913.0 | 1.33 | 32.41 | 30.9 | 31.0 |
| Top-GMV product documents | 226.2 | 8.00 | 6.76 | 6.5 | 7.7 |
| Search | |||||
| Search session examples | 144.5 | 3.88 | 41.46 | 39.5 | 5.3 |
| LLM-judged examples | 61.9 | 3.00 | 1.41 | 1.3 | 1.7 |
| LLM-judged personalized examples | 1.1 | 76.20 | 0.65 | 0.6 | 0.2 |
| Recommendation | |||||
| Interaction sequences | 34.9 | 0.10 | 12.32 | 11.8 | 27.1 |
| New-product purchases | 57.1 | 0.23 | 5.67 | 5.4 | 16.3 |
| New-merchant purchases | 50.3 | 0.25 | 3.12 | 3.0 | 8.1 |
| New-category purchases | 14.2 | 0.06 | 1.04 | 1.0 | 2.8 |
| Total | 1,503.2 | – | 104.86 | 100.0 | 100.0 |
| Product attributes | |
|---|---|
| Attribute to product id mapping:- simplified_title: waterproof trail running shoe- id: <sid_start>...<sid_end> | |
| Attribute to product id mapping:- category: Apparel & Accessories > Shoes > Athletic Shoes- id: <sid_start>...<sid_end> |
| Search | |
|---|---|
| Personalized search:User profile:{"personas": [["interests": [[{"name": ..., "last_seen": ...,"recommended_products": [...],"key_brands": [...], ...],"summary": ...}],"taste": {"aesthetic": [...],"colorPreferences": [...]]}<search_query> trail running shoes<click><sid_start>...<sid_end><purchase><sid_start>...<sid_end> |
| Recommendation (CPT) | |
|---|---|
| User interactions:<dt_365d>|<purchase>|<sid_start>...<sid_end><dt_90d>|<cart>|<sid_start>...<sid_end>⋮<dt_1d>|<cart>|<sid_start>...<sid_end><dt_1d>|<purchase>|<sid_start>...<sid_end> |
| Recommendation (SFT) | |
|---|---|
| User interactions:<dt_365d>|<purchase>|<sid_start>...<sid_end><dt_90d>|<cart>|<sid_start>...<sid_end>⋮<dt_1d>|<cart>|<sid_start>...<sid_end><dt_1d>|<sid_start>...<sid_end> |
<click> special token <sid_start>...<sid_end> a product's SID completion (loss) <dt_30d> time since the previous event
Figure 2. Training examples of each kind of data. The shaded completion carries the loss; the prompt before it is masked. A product attribute example names one attribute. A recommendation completion holds the user's last 30 days of events in the continued pre-training (CPT) format and one purchased product in the supervised fine-tuning (SFT) format.
Table 6. Product attribute data: LFM2-2.6B pre-trained on the baseline mix (Table 25) and on the same mix without its product attribute data, whose tokens go to the other streams in proportion. Evaluation protocol E3 (Table 21). Better value per column in bold.
| Arm | Search relevance | Search purchases | Recommendation |
|---|---|---|---|
| OneDCG@10 | Recall@10 | Recall@50 | |
| Baseline | 0.2876 | 0.3336 | 0.2096 |
| No product attribute data | 0.2818 | 0.3250 | 0.2099 |
5.1.2 Search data
We train the model with search data constructed from two sources: real search session interactions and synthetic LLM judgments.
Search session examples. We collect search sessions from the different Shopify search surfaces and construct training examples from them. Each training example represents a single search session for a given user. As seen in Figure 2, an example contains a JSON buyer profile (if available), the search query, and the SIDs of the products the user interacted with, each prefixed with an interaction token. The interaction token indicates which interaction type (click, purchase, add-to-cart, etc.) happened for that given product in this search session. The buyer profile is an LLM-written summary of the buyer's interests, brands, and taste.
LLM-judged examples. In order to extend beyond data from real search sessions, we generate more data using the existing search stack and an LLM judge. To do that, we sample real user search queries and use the existing search system to generate candidate products for them. We then use an LLM judge to rate the relevance of each query-product pair. Next, we combine the relevance score with a static product quality score to come up with a combined score for each pair. Finally, we construct training examples similar to the search session examples by thresholding on the combined score. Products that exceed the minimum score threshold get labeled as clicks, products that exceed a higher threshold get labeled as purchases, and products that fall below the minimum threshold get excluded from the training example.
Additionally, we construct similar LLM-judged personalized examples where the main differences from the non-personalized examples are including a buyer profile as context and using a personalized LLM judge like the one in Section 2.1.1 to label the query-profile-product triplet for relevance.
5.1.3 Recommendation data
The recommendation data teaches SID-LLM to predict what a buyer will interact with next, given their history. It has two parts: interaction sequences and discovery streams.
Interaction sequences. A buyer's clicks, carts, favorites, checkouts and purchases in time order. Each event is a time-since-previous token, an action token and the product's SID. The last 30 days of events are the completion, and everything before is the prompt (Figure 2). Raw histories are dominated by old clicks that no longer reflect what the buyer wants, so we compress them: we drop clicks older than 30 days and carts, favorites and checkouts older than 90 days, and keep purchases at any age. We apply the same compression to the fine-tuning prompts, so the model sees the same kind of history in both stages.
Discovery streams. Most of what a buyer interacts with next is something they have already seen, so a model trained only on interaction sequences learns to repeat the history. The more valuable recommendations are the products the buyer does not know yet. We add three streams that list only a buyer's first purchases: of a new product, from a new merchant, and in a new category. Each stream has its own task description. Every event in these streams is a discovery, so every event carries the loss.
We measure discovery with discovery Recall@50: recall over target purchases of products the buyer has never interacted with. Compared with the same recipe without these changes, the fine-tuned model gains about 10% in discovery Recall@50 and about 2% in overall Recall@50 (Table 7).
Table 7. Effect of the discovery recipe on Qwen3-14B-Base, both models fine-tuned: the base recipe vs. the same recipe with compressed interaction histories and the three discovery streams. 250k purchasers (February 2026 validation set), RQ-KMeans 8192-8192-8192 SIDs, beam 50. Discovery recall is over the 152,700 buyers with a new-product target. Best value per column in bold.
| Model | Recall | Discovery recall |
|---|---|---|
| Recall@50 | Recall@50 | |
| Base recipe | 0.2880 | 0.0585 |
| + compression and discovery streams | 0.2945 | 0.0646 |
5.1.4 General-domain replay data
We investigate whether maintaining the pre-trained base models' general-domain capabilities helps on the search and recommendation tasks. We ablate the presence vs. absence of general-domain replay data during pre-training and measure model performance both on the search and recommendation tasks, as well as general-domain tasks.
Our replay data consists of the following datasets: educational web text from FineWeb-Edu (Penedo et al., 2024), algorithmic code from OpenCoder (Huang et al., 2025) and math from SwallowMath-v2 (Fujii et al., 2025). When adding replay data, we scale the other datasets down to 90%, and therefore assign 10% of the loss tokens to replay data. The token proportions are detailed in Table 25.
We ablate the replay data on both LFM2-2.6B and Qwen3-14B-Base (Table 8). For the LFM2-2.6B model, adding replay data hurts both search and recommendation performance. However, for the larger Qwen3-14B-Base model, adding replay data has a roughly neutral effect on those tasks. For both models, MMLU (Hendrycks et al., 2021) drops sharply if replay data is not present, meaning that the models suffer catastrophic forgetting of their general capabilities. Adding replay data recovers some of the capabilities in both models. As our final goal is to perform well on the search and recommendation tasks, we choose to add replay data only when training the larger models.
Table 8. General-domain replay at 10% of the loss tokens (Table 25). LFM2-2.6B trains for 30,000 steps and Qwen3-14B-Base for 20,000, on the same mixes, whose shares are solved for the LFM2 tokenizer. Search and recommendation: evaluation protocol E3 (Table 21). MMLU: 5-shot accuracy; chance is 0.25. Backbone: the released model, before any SID training. Compare arms within a model only: training length and recommendation decoding differ between the models. Better arm per model in bold.
| Arm | Search relevance | Search purchases | Recommendation | MMLU |
|---|---|---|---|---|
| OneDCG@10 | Recall@10 | Recall@50 | Accuracy | |
| LFM2-2.6B | ||||
| Backbone | – | – | – | 0.6461 |
| No replay | 0.2876 | 0.3336 | 0.2096 | 0.2489 |
| Replay | 0.2871 | 0.3276 | 0.2027 | 0.3185 |
| Qwen3-14B-Base | ||||
| Backbone | – | – | – | 0.8044 |
| No replay | 0.2962 | 0.3572 | 0.2207 | 0.2534 |
| Replay | 0.2969 | 0.3553 | 0.2230 | 0.3940 |
5.1.5 Data mix
In addition to ablating the value of product attribute data and general-domain replay data to the final search and recommendation tasks (Sections 5.1.1 and 5.1.4), we also evaluate whether the presence of recommendation data helps the search task performance and vice versa. We notice that recommendation data helps the search task, whereas search data helps the recommendation task only slightly (Table 9).
Having gained an understanding of how the different data streams contribute, we adapt the baseline mix (Table 25) to the full-length training run: we cap how many times the smaller streams repeat and give the freed share of the loss tokens to the recommendation data and to the product attribute data of the full catalog. The final data mix is detailed in Table 5.
Table 9. Cross-task transfer: LFM2-2.6B trained on the joint baseline mix (Table 25) and with either the search or recommendation streams removed. The other streams take the freed tokens in proportion. A dash marks the task whose training data were removed. Evaluation protocol E3 (Table 21). Best value per column in bold.
| Arm | Search relevance | Search purchases | Recommendation |
|---|---|---|---|
| OneDCG@10 | Recall@10 | Recall@50 | |
| Baseline | 0.2876 | 0.3336 | 0.2096 |
| No search data | – | – | 0.2087 |
| No recommendation data | 0.2854 | 0.3263 | – |
5.2 Training
We start from three pre-trained backbone LLMs of different sizes: LFM2-2.6B (Liquid AI, 2025), Qwen3-4B-Base and Qwen3-14B-Base (Qwen Team, 2025). To use the SIDs as tokens, we add one token per codeword of each SID level (Section 3) to the vocabulary of each backbone, as well as special tokens for the task formats (Figure 2). We initialize the rows added to the embedding matrices at the mean of the existing rows.
We train each model in two stages, which we describe in the following sections: embedding alignment and continued pre-training. In both stages, we use the AdamW optimizer (Loshchilov and Hutter, 2019) and pack the training examples into fixed-length sequences. The settings of each stage are detailed in Table 10.
Table 10. Training recipe per stage, with stage 2 split into the phases of its warmup-stable-decay schedule (Section 5.2.2). LR: learning rate. Warmup is linear. Replay: the general-domain replay data's share of the loss tokens (Section 5.1.4). In both stages, AdamW has and , gradients are clipped at norm 1.0, and a step holds 1,048,576 tokens in packed sequences of 4,096 tokens.
| Model | Steps | Tokens (B) | Peak LR | Warmup steps | Schedule | Weight decay | Replay (%) |
|---|---|---|---|---|---|---|---|
| Stage 1: embedding alignment | |||||||
| All models | 4,000 | 4.2 | 200 | Cosine to zero | 0.0 | 0 | |
| Stage 2: continued pre-training, warmup and stable phases | |||||||
| LFM2-2.6B | 78,000 | 81.8 | 3,000 | Constant | 0.1 | 0 | |
| Qwen3-4B-Base | 40,000 | 41.9 | 3,000 | Constant | 0.1 | 10 | |
| Qwen3-14B-Base | 40,000 | 41.9 | 3,000 | Constant | 0.1 | 10 | |
| Stage 2: continued pre-training, decay phase | |||||||
| LFM2-2.6B | 20,000 | 21.0 | 0 | Linear to zero | 0.1 | 0 | |
| Qwen3-4B-Base | 20,000 | 21.0 | 0 | Linear to zero | 0.1 | 0 | |
| Qwen3-14B-Base | 20,000 | 21.0 | 0 | Linear to zero | 0.1 | 0 | |
5.2.1 Embedding alignment
The newly added SID embeddings have not yet learned the meanings of their codewords. To give these new tokens meaningful embeddings before full training, we apply an embedding alignment step; training only the new embeddings while the backbone and its original embeddings stay frozen. This stage leverages only product attribute data (Section 5.1.1), in both directions: from an attribute to the SID and from the SID to an attribute. We train it without weight decay, so that the original embeddings stay exactly as they were. We ablate the embedding alignment stage on LFM2-2.6B and notice that it improves both the search and recommendation metrics slightly (Table 11), so we use it for all three models.
Table 11. Embedding alignment: both arms add the SID tokens to the vocabulary of LFM2-2.6B and pre-train on the baseline mix (Table 25). With alignment, a first stage of 4,000 steps of 1,048,576 tokens trains only the new embeddings, on product documents; without it, all weights train from the start. Evaluation protocol E3 (Table 21). Better arm in bold.
| Arm | Search relevance | Search purchases | Recommendation |
|---|---|---|---|
| OneDCG@10 | Recall@10 | Recall@50 | |
| Baseline | 0.2876 | 0.3336 | 0.2096 |
| No embedding alignment | 0.2860 | 0.3268 | 0.2067 |
5.2.2 Continued pre-training
In the second stage, we train all weights on the final data mix (Table 5). For the larger Qwen3 models, we also add the general-domain replay data (Section 5.1.4). We choose the peak learning rates with learning-rate sweeps on LFM2-2.6B and Qwen3-14B-Base. Qwen3-4B-Base diverged at higher learning rates, so we use the same peak learning rate as for Qwen3-14B-Base.
We use a warmup-stable-decay (WSD) learning-rate schedule (Hägele et al., 2024; Hu et al., 2024): the learning rate warms up, stays constant, and finally decays linearly to zero. In our learning-rate sweep on LFM2-2.6B, WSD matched or outperformed a cosine schedule at each peak learning rate up to the one we use. Since the constant phase has no fixed length, we can start the decay from any of its checkpoints, resuming with the checkpoint's optimizer state. To choose the checkpoint, we evaluate a few candidates on the search and recommendation tasks and decay the best one. Given that we are data-constrained on the search task, we observe that the search metrics tend to deteriorate late in the constant phase, so the best checkpoint to start decay from is not the latest one.
During the decay, we train on a fresh shuffle of the data and replace the recommendation streams with a single stream in the fine-tuning format (Figure 2), keeping recommendation's share of the tokens. For the Qwen3 models, we also drop the replay data. Metrics before and after the decay can be seen in Table 12.
Table 12. Effect of the learning rate decay on search and recommendation metrics. Evaluation protocol E4 (Table 21). Best value per column in bold.
| Arm | Search relevance | Search purchases | Recommendation |
|---|---|---|---|
| OneDCG@10 | Recall@10 | Recall@50 | |
| Constant learning rate, step 78,000 | 0.3108 | 0.3173 | 0.2075 |
| Decayed, step 98,000 | 0.3211 | 0.3415 | 0.2142 |
| Decayed, fine-tuning-format recommendation data | 0.3194 | 0.3392 | 0.2533 |
6 Post-training
Post-training has two goals: improve judged search quality and combine task-specific capabilities in one model. We first study adapting the multi-token prediction generator using feedback from a relevance judge. We then investigate task unification starting from the autoregressive model (Section 6.2). These are separate experiments; we evaluate the search-quality methods on search only.
6.1 Improving search quality
Pre-training builds catalog knowledge and learns patterns in search and buyer interactions. For a given query, however, many products may be relevant, including products absent from the recorded interactions. Post-training lets us give the generator more direct supervision about which products satisfy the query and the buyer's preferences. We compare three ways to use this supervision: learning from positively judged candidates, learning preferences between candidates, and obtaining feedback on candidates generated during training.
All three methods start independently from the same LFM2-2.6B checkpoint after continued pre-training and learning-rate decay (CPT+MTP). A fine-tuned Qwen3.5-2B judge scores products against the query and buyer profile, when available. For the offline methods, candidates come from search engine results pages (SERPs) and, in some variants, the CPT+MTP generator. We deduplicate candidates by SID and retain the highest judge score. Both offline objectives use a relevance token in the prompt to distinguish the desired output from purchase prediction. Data construction, loss definitions and training settings are detailed in Section F.
6.1.1 Supervised fine-tuning
Soft-target cross-entropy (CE) trains the model to generate SIDs of high-scoring products. We retain candidates meeting a score threshold and weight them by their judge scores, so several products can provide targets for the same query. At each SID position, a codeword's target probability is the sum of the weights of products containing it. The MTP model learns these distributions in parallel.
6.1.2 Preference optimisation
Offline CE+DPO. Direct preference optimisation (DPO; Rafailov et al. 2023) adds supervision from low-scoring candidates as well as positive ones. We combine positive-target CE with a preference loss that favors higher-scoring products over lower-scoring ones, relative to the frozen CPT+MTP reference. The candidate weights depend on distance from the positive–negative threshold. Queries with positive candidates but no negatives still contribute CE. We compare SERP-only training with a variant that also includes generated candidates.
GRPO. Group relative policy optimisation (GRPO; Shao et al. 2024) obtains judge feedback on candidates generated as training proceeds. For each query, constrained MTP beam traversal proposes 32 SIDs. We score the first product returned when resolving each SID and use the judge's score as its reward. Rewards are centered within the query group, and a clipped policy objective with a KL penalty against the initial model updates the generator.
Our implementation uses ranked proposals rather than independent policy samples, a modified reward normalization, and asynchronous generation and training. We do not apply importance correction for the lag between the generation and training policies. Here, feedback during training comes from the judge; it does not require live buyer interactions. The complete procedure is given in Section F.4.
6.1.3 Results and interpretation
Table 13 compares the generators under protocol E5, without a ranker. All three approaches improve OneDCG@10 over CPT+MTP, with GRPO achieving the highest observed score. Adding DPO on SERP candidates provides only a small improvement over CE. Including generated candidates increases the score further, but also changes the data and training schedule, so that comparison does not isolate the effect of the preference loss. Increasing the DPO coefficient adds no practically meaningful improvement.
Table 13. Search post-training from the same CPT+MTP initialization, without a ranker. Evaluation protocol E5 (Table 21). All-source CE+DPO includes generated candidates. Data and training budgets differ across methods. A dash indicates purchase recall not reported for that arm. Best value per column in bold.
| Recipe | Search relevance | Search purchases |
|---|---|---|
| OneDCG@10 | Recall@10 | |
| CPT+MTP | 0.2811 | 0.2840 |
| Soft-target CE, SERP | 0.2930 | 0.2767 |
| CE+DPO, SERP | 0.2937 | – |
| CE+DPO, all sources | 0.2950 | 0.2745 |
| CE+DPO, all sources, DPO weight 2 | 0.2950 | – |
| GRPO | 0.2970 | 0.2782 |
Purchase recall declines despite the improvement in OneDCG@10. These metrics capture different aspects of retrieval. Purchase recall measures recovery of observed purchases and is affected by exposure bias: relevant products that buyers were never shown cannot appear as positive targets. Improving judged quality can therefore involve retrieving alternatives that receive no credit under purchase recall. We interpret the two metrics together; the observed decline does not establish whether these alternatives would lead to more or fewer purchases if shown.
6.2 Unifying search and recommendation
Search and recommendation depend on shared knowledge of products and buyer preferences. A unified model would let us train and update these capabilities together, while serving requests with different kinds of context. The challenge is to preserve the quality available from task-specific post-training. We study this question starting from the autoregressive CPT (Table 3), which has already been pre-trained on both tasks.
6.2.1 The cost of joint fine-tuning
Our baseline is joint supervised fine-tuning (joint SFT): 5,000 steps on a mix of recommendation and search examples. We compare it with experts fine-tuned on each task separately (Table 20). At the same step budget, the recommendation expert improves Recall@50 by 1.7% over joint SFT, but loses search quality. The search expert has no detectable advantage over joint SFT on search and substantially reduces recommendation quality (Table 14). We call the recommendation gap the unification tax: mixing the fine-tuning data leaves some of the specialist's gains unrealized.
Our goal is therefore to recover the recommendation gains while retaining joint SFT's search quality. Weight merging (Ilharco et al., 2023) does not resolve this trade-off in our experiments (Section C.2 and Figure 9), motivating an approach that learns from each expert on its own task.
6.2.2 Distilling task experts into one model
We train and freeze an expert for each task, then distill both into a student initialized from the CPT (Figure 3). Each training example is routed to its task's expert. A search example receives guidance from the search expert, and a recommendation example from the recommendation expert. The experts' distributions provide supervision over alternative codewords as well as the labeled product, giving the shared student a way to learn their task-specific predictions (Hinton et al., 2015; Ma et al., 2026).
The loss combines reverse KL divergence to the expert with cross-entropy on the labeled product's SID. The first term transfers the expert's predictions; the second anchors training to the labeled target. For a prompt

Figure 3. Distilling task experts into a shared model. Each expert is fine-tuned from the CPT and frozen. A student initialized from the same CPT learns from examples of both tasks, with each example routed to its task's expert.
Table 14. Absolute metric performance across model variations, the first row (CPT) is the base checkpoint all students and experts start from, second row is the effect of training with a 1:1:1 dataset mixture. Merged experts shown use task arithmetic, weights (1,1).
| Model | Recommendation | Search | ||
|---|---|---|---|---|
| Recall@50 | Discovery Recall@50 | Purchase Recall@10 | Relevance OneDCG@10 | |
| CPT | 0.1939 | 0.0288 | 0.3246 | 0.3083 |
| Joint SFT | 0.2411 | 0.0423 | 0.3259 | 0.3061 |
| Rec. expert (LoRA, 5k steps) | 0.2453 | 0.0456 | 0.3206 | 0.2990 |
| Rec. expert (LoRA, 10k steps) | 0.2458 | 0.0471 | 0.3126 | 0.2909 |
| Search expert (full FT) | 0.1924 | 0.0287 | 0.3257 | 0.3059 |
| Merged experts (LoRA) | 0.2454 | 0.0457 | 0.3200 | 0.2969 |
| Merged experts (full FT) | 0.2439 | 0.0437 | 0.3240 | 0.3000 |
| Distillation, gold prefix | 0.2453 | 0.0466 | 0.3267 | 0.3055 |
| Distillation, teacher prefix | 0.2442 | 0.0464 | 0.3260 | 0.3053 |
, task , gold SID and frozen expert , the student minimizes
Both models condition on the gold prefix, and the KL is exact over the full vocabulary. Teacher selection, training settings and the objective and prefix comparisons are described in Sections C.1, C.3 and E.
6.2.3 Results and implications
Table 14 reports absolute scores for recommendation Recall@50 and discovery Recall@50, and for search purchase Recall@10 and OneDCG@10 under protocol E5. Figure 4 shows relative changes from joint SFT with 95% paired-bootstrap intervals; a change is significant when its interval excludes zero. Cohorts and evaluation details are given in Section E.1.
The distilled student improves Recall@50 by 1.76% and discovery Recall@50 by 10.03% over joint SFT, with no detected change on either search metric (Table 14 and Figure 4). It recovers much of the

Figure 4. Search against recommendation Pareto frontier, as change (%) from joint SFT at the origin, with 95% paired-bootstrap whiskers: (a) Recall@50 against OneDCG@10, (b) Recall@50 against purchase Recall@10, (c) discovery Recall@50 against OneDCG@10. Hollow markers: full fine-tuning. For a full sweep over model merges see Figure 9.
recommendation teacher's gain while avoiding the search losses observed when using that teacher directly. Discovery is important here because overall recall is dominated by purchases of products already in the buyer's history. A breakdown on the same users attributes most of the student's overall recall gain to purchases of products new to the buyer (Table 24).
These results support task-routed distillation as a route to a shared model that retains the benefits of specialization. They do not isolate distillation from the additional training budget and teacher choices, and the intervals still allow small search losses. Each model was trained once on a development benchmark that also guided teacher and recipe selection, so the intervals are nominal. Distilling directly from the CPT removes the joint-SFT stage, although an earlier two-stage recipe performs better on search purchase recall (Section C.3). Neither recipe recovers the CPT's full OneDCG@10, leaving room to improve the search teacher or apply search-specific post-training (Section 6.1.2). The unified student remains experimental; production uses the task-specific models described in Section 7.
7 Integration
7.1 Search
SID-LLM plays two roles in the Shopify search stack: it is one of the retrievers, and it supplies features to the rankers. Keyword retrieval, embedding retrieval and SID-LLM each contribute candidates, and two learned ranking stages, L2 and L3, then order the merged set. SID-LLM contributes its top 100 SIDs for the query and the buyer's profile (Section 8), each resolved to one product (Section 3).
SID-LLM scores only the products it generates, so we turn its output into features that every candidate has, whichever retriever found it. For each candidate, we compute its cosine similarity to each of SID-LLM's top 50 products, with embeddings from the in-house model the SIDs are built from (Section 3.1). The maximum, mean and minimum of these similarities are features of both rankers.
7.2 Recommendation
In Shopify's recommendation stack, SID-LLM is one candidate generator among several. For each buyer, it generates 200 candidate products from their interaction history, using the same prompt format it was fine-tuned on. These candidates are pooled with those from the other generators, and the downstream ranking stages order the combined pool. The production model is the AR LFM2-2.6B, paired with the joint-probability decoder described below.
From semantic IDs to products. A SID names a cluster of similar products rather than a single product: of the SIDs the model predicts, 78.9% are shared by more than one product. The model can therefore predict the right SID and still miss the purchase, if the decode picks the wrong product from the cluster. Instead of taking one product per SID (Section 3), we let the most confident SIDs contribute more: we score each candidate product by its joint probability with the user. The beam gives , the summed log-probability of the SID's tokens. Within the SID's cluster, we take , where pop is a popularity score. A product scores , and the decode keeps the 200 highest-scoring products, considering up to ten per SID. A popular product from a confident SID can therefore outrank the top product of a SID further down the beam. The score has no tuning parameter.
We compare decodes with the model and its 200 beam SIDs held fixed (Table 15). Joint scoring improves Recall@50, both over one product per SID and over a fixed schedule that gives the three highest-ranked SIDs two products each. Against one product per SID, it raises Recall@50 by 15.8%.
Table 15. Relative change of each SID-to-product decode against one product per SID, for the production SID-LLM with its 200 beam SIDs held fixed, evaluated on 9,990 held-out purchasers. Best value in bold.
| Decode | Recall change (rel. %) |
|---|---|
| Recall@50 | |
| One product per SID | – |
| Two products for the top 3 SIDs | 6.7 |
| Joint probability | 15.8 |
8 Inference and Deployment
SID-LLM generates candidates for production search and recommendation stacks (Section 7). This section describes the online search serving path, which uses MTP with a learned ranker. Recommendation uses an AR model and joint-probability product resolution (Section 7.2). The catalog holds billions of products; hundreds of millions of them are eligible at any time and resolve to about distinct SIDs (Section 3), and a sixth of product records change daily. Serving has strict latency requirements: each search request must return its valid SIDs within tens of milliseconds on a fraction of one GPU (Figure 5). We build on STATIC (Su et al., 2026), which flattens the catalog trie into a compressed-sparse-row index on the accelerator, so that constraining a decoding step is a vectorized gather rather than a host round trip; in our setting, this reduces the constraint overhead from 18–33 to about 1 ms per request. We extend the index from one catalog-wide constraint to per-request eligibility.
8.1 Inference engine
Generative retrieval pairs variable-length inputs with wide, shallow, constrained decoding rather than long sequential generation. Complete serialized prompts range from six tokens to an enforced limit of 1,500 in SID-LLM's tokenizer and vary widely between tasks: a non-personalized search prompt is a short query, a personalized one adds a user profile, and a recommendation prompt encodes up to 100 interaction events (Figure 2). For search, decoding is a constrained beam search of width , followed by re-ranking to

Figure 5. Search serving path (top) and artifact pipeline (bottom). Shaded: engine processes; dotted: the ranker extension of the search path (Section 8.4); dashed: artifacts loaded at startup.
Table 16. End-to-end server-side latency (ms) on one B200 3g.90gb partition under simulated production search traffic: the same 37,924 requests per rate and arm; all 455,088 succeeded. The third arm adds the ranker (Section 8.4).
| Offered requests/s | AR, beam 100 | MTP, beam 250 | MTP + ranker, 250 to 100 | ||||||
|---|---|---|---|---|---|---|---|---|---|
| p50 | p95 | p99 | p50 | p95 | p99 | p50 | p95 | p99 | |
| 25 | 19.2 | 31.2 | 38.9 | 9.7 | 18.2 | 22.2 | 17.5 | 28.2 | 34.0 |
| 50 | 21.2 | 36.5 | 50.5 | 9.4 | 17.6 | 22.8 | 17.5 | 29.2 | 38.2 |
| 75 | 24.0 | 45.3 | 161.0 | 9.2 | 17.8 | 25.5 | 17.8 | 31.8 | 59.3 |
| 100 | 28.2 | 63.3 | 568.7 | 9.1 | 18.4 | 61.2 | 18.5 | 36.6 | 231.4 |
return candidates, each represented by three output codewords. We enforce the decoding constraints through a CUDA/C++ plugin inside the inference engine.
8.2 Decoding strategy
Autoregressive (AR) decoding requires one backbone pass per codeword (the prefill, then two incremental passes), each conditioned on the codewords chosen so far. Multi-token prediction (MTP, Section 4.1) predicts all three codeword distributions in one prefill, each conditioned on the request prefix rather than on earlier codewords; the index constrains their combinations, and a beam walk over it assembles candidates. Table 16 reports end-to-end server-side latency on simulated production search traffic across offered loads.
In offline evaluation, MTP scores below AR on both top-10 metrics, and widening its beam from 100 to 250 does not close the gap (Table 3). For search, the ranker (Section 8.4) more than makes up the difference, raising both metrics above AR.
8.3 Catalog index
Each day we rebuild the index from a fresh catalog snapshot (Figure 5, bottom). Because several products can share one SID, an eligibility rollup makes a SID eligible in every market where at least one of its products is. In the snapshot described here, 354M SIDs are eligible in at least one market and can be retrieved. Each serving process loads one validated snapshot at startup, so eligibility is current as of that snapshot until redeployment. Because a request's market determines which SIDs are valid, the index also carries compact membership representations that preserve shared prefixes, so we can express which products satisfy each constraint without duplicating the underlying catalog structure; we describe it only functionally.
8.4 Ranker
The ranker extends only the search path; recommendation resolves AR-generated SIDs into 200 products using joint-probability scoring (Section 7.2). For search, the generator returns candidates, and a 350M-parameter LFM2 model, served as a second engine process, re-ranks them jointly in one prefill in which the query and profile attend causally and the candidate embeddings bidirectionally. The ranker's two artifacts, a per-SID static quality score (the auxiliary score ) and a 128-dimensional int4 product-embedding table keyed by SID, come from the same daily pipeline (Figure 5, bottom); both models share one 89.0 GiB GPU partition (Figure 7 in the appendix).
We distill a relevance judge model with a Qwen3.5-9B backbone into the ranker. For each training query, the judge reads the query, the buyer profile when there is one and the product text, and gives , its relevance score for candidate of the 250 from Table 3's MTP generator; the ranker sees each product only as its embedding . The ranker's score combines two signals: a relevance estimate from the candidate's final hidden state, which has attended to the query, the profile and the other candidates, and an embedding match between and a query vector that the ranker predicts from the query and profile. Training minimizes . The binary cross-entropy fits to on the candidates the judge could score. The LambdaLoss term (Wang et al., 2018) trains the order: it penalizes pairs that orders differently from , the mix of relevance and static score in Section 2.1.1's gain, weighted by their effect on NDCG over the 100 candidates returned. The cosine term makes that embedding match servable. The product-embedding model's query-product similarity alone already ranks candidates well, and an ablation without it degrades the ranker markedly, but only the product embeddings are cached; embedding each query would keep that model in memory and add its latency. therefore pulls toward that model's own query embedding , projected like the table into 128 dimensions, so approximates the similarity without running the query encoder. We keep the checkpoint with the lowest held-out loss over 10 epochs.
The served order sorts candidates by , where is the ranker's score, the generator's log-probability of the candidate, and the tilde denotes min-max normalization over the request's candidates. Because the auxiliary score is computed like the relevance metric's static score (Section 2.1.1), purchase recall is the more independent of the two metrics; both measure the whole blend. MTP with the ranker scores above AR on both metrics (Table 3) and is faster than AR at every percentile and offered rate, increasingly so under load (Table 16); we therefore serve MTP with the ranker.
9 Evaluation Results
9.1 Search
9.1.1 Online
We evaluated several successive versions of SID-LLM through a series of A/B tests in Shopify's search stack. The treatment arms included both its candidate retrieval and the features it supplies to downstream rankers (Section 7.1). We assessed success using purchases, high-quality clicks and clicks, measured both in aggregate and separately for head, torso and tail queries, with these segments defined by query frequency.
The results of these evaluations supported deploying SID-LLM in production as part of Shopify's search stack.
9.1.2 Offline
To measure what SID-LLM adds to search, we compare three configurations of Shopify's search stack (Section 7.1): the full stack, the stack without SID-LLM, and SID-LLM alone. Removing SID-LLM disables both its candidate retrieval and the features it supplies to downstream rankers. The SID-LLM-only configuration retains its own ranker (Section 8.4), but bypasses the other retrievers and the downstream L2 and L3 rankers.
With its own built-in ranker, SID-LLM alone achieves search evaluation scores close to that of the entire multi-model search stack without it (Table 17). The full stack performs best, showing that SID-LLM also adds value alongside the existing retrieval and ranking components.
Table 17. Search-stack ablation on the combined evaluation and on personalized search only. Changes are relative to the full stack with SID-LLM within each setting. Evaluation protocol E6 (Table 21).
| Configuration | Combined | Personalized only | ||
|---|---|---|---|---|
| OneDCG@10 | Change (%) | OneDCG@10 | Change (%) | |
| Full stack with SID-LLM | 0.32690 | — | 0.35718 | — |
| Full stack without SID-LLM | 0.30570 | —6.5 | 0.32979 | —7.7 |
| SID-LLM only | 0.28500 | —12.8 | 0.33608 | —5.9 |
9.2 Recommendation
9.2.1 Offline
Pool recall. SID-LLM is one candidate generator among several (Section 7.2). What matters is what it adds to the pool of candidates the ranking stages see. Each candidate generator contributes its top 200 products per user, and the pool is the union of all generators' candidates and can contain more than 200 products. Pool recall is the share of a user's orders in a held-out 7-day window that appear in the pool. It is averaged over users with at least one such order.
Incremental pool recall. To measure one generator's contribution, we remove it from the pool and record how much pool recall drops. This leave-one-out drop is the generator's incremental pool recall. It counts the purchases that only that generator finds.
Results. We put our best SID-LLM model, the LFM2-2.6B with the joint-probability decode (Section 7.2), into the production pool next to the other production candidate generators (Table 18). We evaluate on 70,747 users with a purchase in the held-out week. We compare it with recent engagement, which recommends products the buyer has recently interacted with, and HSTU (Zhai et al., 2024), a generative recommender over item IDs.
SID-LLM adds more to the pool than any other generator. Its incremental pool recall is 2.65 points, 61% more than recent engagement, the second-best candidate generator by incremental pool recall (1.64 points). It is also the best at retrieval, with the highest Recall@50 of all production candidate generators.
Table 18. SID-LLM in the production candidate pool. All values are in %, and incremental pool recall is in percentage points of pool recall, with 200 candidates per generator.
| Candidate generator | Recall@50 | Incremental pool recall |
|---|---|---|
| SID-LLM (LFM2-2.6B) | 24.61 | 2.65 |
| Recent engagement | 17.28 | 1.64 |
| HSTU | 17.21 | 0.78 |
9.2.2 Online
We ran an A/B test on our home feed using SID-LLM with the joint-probability decoder (Section 7.2 and Table 19). On the impacted surface, adding SID-LLM raised attributed orders by 7.95%, converting users by 8.60% and conversion rate by 9.85%. All three lifts are significant after Dunnett correction (Dunnett, 1955).
Table 19. A/B test in the home feed, the SID-LLM arm against control. Every lift is significant after Dunnett correction.
| Surface | Lift (%) | ||
|---|---|---|---|
| Orders | Converters | CVR | |
| Impacted surface | 7.95 | 8.60 | 9.85 |
10 Conclusion and Future Directions
In this report, we presented SID-LLM, Shopify’s generative search and recommendation model. We study the training stages and model variants used for search and recommendation, including SID tokenization, pre-training data and methodology, and post-training. Production search uses multi-token prediction combined with a lightweight ranker to improve retrieval quality while keeping latency low. Production recommendation uses an autoregressive model with joint-probability product resolution. Separately, we investigate task unification through routed multi-teacher distillation with gold prefixes, producing an experimental unified student. Adding SID-LLM provides significant gains in Shopify’s end-to-end search and recommendation systems.
Our goal for the future is to incorporate more of our discovery stack into the one generative model. The results comparing the SID-LLM model to an entire traditional search stack are promising, and in the future we anticipate product search to move more and more towards a single model. Additionally, we are training the model to do more tasks, such as personalized related-product recommendation and personalization taking into account in-session context.
Future work includes test-time scaling using Chain-of-Thought reasoning, and especially making it efficient enough to deploy in production. Additionally, SID-LLM currently can only ingest text and SIDs, and we anticipate multi-modal understanding of products to provide further gains and avenues of research.
Acknowledgements
The authors would like to thank Aaron Yuen and Sarthak Shah for driving product direction and coordinating the effort. Thanks to Linjun Yang for leadership in the project. Thanks to Antoine Atallah for early support on the project. Thanks to Edoardo Mosca for guidance and management on the inference engine effort.
References
Paul Covington, Jay Adams, and Emre Sargin. Deep neural networks for YouTube recommendations. In Proceedings of the 10th ACM Conference on Recommender Systems (RecSys), pages 191–198, 2016. doi: 10.1145/2959100.2959190.
Edoardo D'Amico, Marco De Nadai, Praveen Chandar, Divita Vohra, Shawn Lin, Max Lefarov, Paul Gigoli, Gustavo Penha, Ilya Kopyitsky, Ivo Joel Senese, Darren Mei, Francesco Fabbri, Oguz Semerci, Yu Zhao,
Vincent Tang, Brian St. Thomas, Alexandra Ranieri, Matthew N. K. Smith, Aaron Bernkopf, Bryan Leung, Ghazal Fazelnia, Mark VanMiddlesworth, Timothy Christopher Heath, Petter Pehrson Skiden, Alice Y. Wang, Doug J. Cole, Andreas Damianou, Maya Hristakeva, Reid Wilbur, Tarun Chillara, Vladan Radosavljevic, Pooja Chitkara, Sainath Adapa, Juan Elenter, Bernd Huber, Jacqueline Wood, Saaketh Vedantam, Jan Stypka, Sandeep Ghael, Martin D. Gould, David Murgatroyd, Yves Raimond, Mounia Lalmas, and Paul N. Bennett. Deploying semantic ID-based generative retrieval for large-scale podcast discovery at Spotify. arXiv preprint arXiv:2603.17540, 2026. URL https://arxiv.org/abs/2603.17540.
Nicola De Cao, Gautier Izacard, Sebastian Riedel, and Fabio Petroni. Autoregressive entity retrieval. In International Conference on Learning Representations (ICLR), 2021. URL https://arxiv.org/abs/2010.00904.
Charles W. Dunnett. A multiple comparison procedure for comparing several treatments with a control. Journal of the American Statistical Association, 50(272):1096–1121, 1955.
Kazuki Fujii, Yukito Tajima, Sakae Mizuki, Masaki Kawamura, Hinari Shimada, Taihei Shiotani, Koshiro Saito, Masanari Oi, Taishi Nakamura, Takumi Okamoto, Shigeki Ishida, Kakeru Hattori, Youmi Ma, Hiroya Takamura, Rio Yokota, Jun Sakuma, and Naoaki Okazaki. Rewriting pre-training data boosts LLM performance in math and code. arXiv preprint arXiv:2505.02881, 2025. URL https://arxiv.org/abs/2505.02881.
George W. Furnas, Thomas K. Landauer, Louis M. Gomez, and Susan T. Dumais. The vocabulary problem in human-system communication. Communications of the ACM, 30(11):964–971, 1987. doi:10.1145/32206.32212.
Alexander Hägele, Elie Bakouch, Atli Kosson, Loubna Ben Allal, Leandro Von Werra, and Martin Jaggi. Scaling laws and compute-optimal training beyond fixed training durations. In Advances in Neural Information Processing Systems (NeurIPS), 2024. URL https://arxiv.org/abs/2405.18392.
Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Song, and Jacob Steinhardt. Measuring massive multitask language understanding. In International Conference on Learning Representations (ICLR), 2021. URL https://arxiv.org/abs/2009.03300.
Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015. URL https://arxiv.org/abs/1503.02531.
Shengding Hu, Yuge Tu, Xu Han, Chaoqun He, Ganqu Cui, Xiang Long, Zhi Zheng, Yewei Fang, Yuxiang Huang, Weilin Zhao, Xinrong Zhang, Zheng Leng Thai, Kaihuo Zhang, Chongyi Wang, Yuan Yao, Chenyang Zhao, Jie Zhou, Jie Cai, Zhongwu Zhai, Ning Ding, Chao Jia, Guoyang Zeng, Dahai Li, Zhiyuan Liu, and Maosong Sun. MiniCPM: Unveiling the potential of small language models with scalable training strategies. arXiv preprint arXiv:2404.06395, 2024. URL https://arxiv.org/abs/2404.06395.
Siming Huang, Tianhao Cheng, Jason Klein Liu, Weidi Xu, Jiaran Hao, Liuyihan Song, Yang Xu, Jian Yang, Jiaheng Liu, Chenchen Zhang, Linzheng Chai, Ruifeng Yuan, Xianzhen Luo, Qiufeng Wang, Yuan Tao Fan, Qingfu Zhu, Zhaoxiang Zhang, Yang Gao, Jie Fu, Qian Liu, Houyi Li, Ge Zhang, Yuan Qi, Yinghui Xu, Wei Chu, and Zili Wang. OpenCoder: The open cookbook for top-tier code large language models. In Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (ACL), 2025. URL https://arxiv.org/abs/2411.04905.
Gabriel Ilharco, Marco Tulio Ribeiro, Mitchell Wortsman, Suchin Gururangan, Ludwig Schmidt, Hannaneh Hajishirzi, and Ali Farhadi. Editing models with task arithmetic. In International Conference on Learning Representations (ICLR), 2023. URL https://arxiv.org/abs/2212.04089.
Kalervo Järvelin and Jaana Kekäläinen. Cumulated gain-based evaluation of IR techniques. ACM Transactions on Information Systems, 20(4):422–446, 2002.
Hervé Jégou, Matthijs Douze, and Cordelia Schmid. Product quantization for nearest neighbor search. IEEE Transactions on Pattern Analysis and Machine Intelligence, 33(1):117–128, 2011.
Vladimir Karpukhin, Barlas Oğuz, Sewon Min, Patrick Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih. Dense passage retrieval for open-domain question answering. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), 2020. URL https://arxiv.org/abs/2004.04906.
Yoon Kim and Alexander M. Rush. Sequence-level knowledge distillation. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1317–1327, 2016. URL https://arxiv.org/abs/1606.07947.
Doyup Lee, Chiheon Kim, Saehoon Kim, Minsu Cho, and Wook-Shin Han. Autoregressive image generation using residual quantization. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2022. URL https://arxiv.org/abs/2203.01941.
Chao Li, Zhiyuan Liu, Mengmeng Wu, Yuchi Xu, Huan Zhao, Pipei Huang, Guoliang Kang, Qiwei Chen, Wei Li, and Dik Lun Lee. Multi-interest network with dynamic routing for recommendation at Tmall. In Proceedings of the 28th ACM International Conference on Information and Knowledge Management (CIKM), pages 2615–2623, 2019. doi: 10.1145/3357384.3357814.
Gui Ling, Zhihong Chen, Yu Li, Tong Xiong, Kunhai Lin, Kaixuan Zhang, Yuliang Yan, Dan Ou, Haihong Tang, and Bo Zheng. Beyond semantic IDs: Encoding business-value ranking into document identifiers for generative retrieval. In Conference on Empirical Methods in Natural Language Processing (EMNLP): Industry Track, 2026. URL https://arxiv.org/abs/2607.11392.
Liquid AI. LFM2 technical report. arXiv preprint arXiv:2511.23404, 2025. URL https://arxiv.org/abs/2511.23404.
Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In International Conference on Learning Representations (ICLR), 2019. URL https://arxiv.org/abs/1711.05101.
Wenhan Ma, Jianyu Wei, Liang Zhao, Hailin Zhang, Bangjun Xiao, Lei Li, Qibin Yang, Bofei Gao, Yudong Wang, Rang Li, Jinhao Dong, Zhifang Sui, and Fuli Luo. MOPD: Multi-teacher on-policy distillation for capability integration in LLM post-training. arXiv preprint arXiv:2606.30406, 2026. URL https://arxiv.org/abs/2606.30406.
Yu. A. Malkov and D. A. Yashunin. Efficient and robust approximate nearest neighbor search using hierarchical navigable small world graphs. IEEE Transactions on Pattern Analysis and Machine Intelligence, 42(4): 824–836, 2020. doi: 10.1109/TPAMI.2018.2889473.
Sam McCandlish, Jared Kaplan, Dario Amodei, and OpenAI Dota Team. An empirical model of large-batch training. arXiv preprint arXiv:1812.06162, 2018. URL https://arxiv.org/abs/1812.06162.
Priyanka Nigam, Yiwei Song, Vijai Mohan, Vihan Lakshman, Weitian Ding, Ankit Shingavi, Choon Hui Teo, Hao Gu, and Bing Yin. Semantic product search. In Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD), pages 2876–2885, 2019. doi: 10.1145/3292500.3330759.
Guilherme Penedo, Hynek Kydlíček, Loubna Ben Allal, Anton Lozhkov, Margaret Mitchell, Colin Raffel, Leandro Von Werra, and Thomas Wolf. The FineWeb datasets: Decanting the web for the finest text data at scale. In Advances in Neural Information Processing Systems (NeurIPS), Datasets and Benchmarks Track, 2024. URL https://arxiv.org/abs/2406.17557.
Boris T. Polyak and Anatoli B. Juditsky. Acceleration of stochastic approximation by averaging. SIAM Journal on Control and Optimization, 30(4):838–855, 1992. doi: 10.1137/0330046.
Qwen Team. Qwen3 technical report. arXiv preprint arXiv:2505.09388, 2025. URL https://arxiv.org/abs/2505.09388.
Rafael Rafailov, Archit Sharma, Eric Mitchell, Christopher D. Manning, Stefano Ermon, and Chelsea Finn. Direct preference optimization: Your language model is secretly a reward model. In Advances in Neural Information Processing Systems (NeurIPS), 2023. URL https://arxiv.org/abs/2305.18290.
Shashank Rajput, Nikhil Mehta, Anima Singh, Raghunandan Keshavan, Trung Vu, Lukasz Heldt, Lichan Hong, Yi Tay, Vinh Q. Tran, Jonah Samost, Maciej Kula, Ed H. Chi, and Maheswaran Sathiamoorthy. Recommender systems with generative retrieval. In Advances in Neural Information Processing Systems (NeurIPS), 2023. URL https://arxiv.org/abs/2305.05065.
Philip Resnik. Using information content to evaluate semantic similarity in a taxonomy. In Proceedings of the Fourteenth International Joint Conference on Artificial Intelligence (IJCAI), 1995. URL https://ijcai.org/proceedings/1995/59.
Stephen Robertson and Hugo Zaragoza. The probabilistic relevance framework: BM25 and beyond. Foundations and Trends in Information Retrieval, 3(4):333–389, 2009. doi: 10.1561/1500000019.
Zhihong Shao, Peiyi Wang, Qihao Zhu, Runxin Xu, Junxiao Song, Xiao Bi, Haowei Zhang, Mingchuan Zhang, Y. K. Li, Y. Wu, and Daya Guo. DeepSeekMath: Pushing the limits of mathematical reasoning in open language models. arXiv preprint arXiv:2402.03300, 2024. URL https://arxiv.org/abs/2402.03300.
Zhengyang Su, Isay Katsman, Yueqi Wang, Ruining He, Lukasz Heldt, Raghunandan Keshavan, Shao-Chuan Wang, Xinyang Yi, Mingyan Gao, Onkar Dalal, Lichan Hong, Ed Chi, and Ningren Han. Vectorizing the trie: Efficient constrained decoding for LLM-based generative retrieval on accelerators. In Proceedings of the 32nd ACM SIGKDD Conference on Knowledge Discovery and Data Mining (KDD), pages 8009–8020, 2026. doi: 10.1145/3770855.3818506. URL https://arxiv.org/abs/2602.22647.
Yi Tay, Vinh Q. Tran, Mostafa Dehghani, Jianmo Ni, Dara Bahri, Harsh Mehta, Zhen Qin, Kai Hui, Zhe Zhao, Jai Gupta, Tal Schuster, William W. Cohen, and Donald Metzler. Transformer memory as a differentiable search index. In Advances in Neural Information Processing Systems (NeurIPS), 2022. URL https://arxiv.org/abs/2202.06991.
Xuanhui Wang, Cheng Li, Nadav Golbandi, Michael Bendersky, and Marc Najork. The LambdaLoss framework for ranking metric optimization. In Proceedings of the 27th ACM International Conference on Information and Knowledge Management (CIKM), pages 1313–1322, 2018. URL https://doi.org/10.1145/3269206.3271784.
Prateek Yadav, Derek Tam, Leshem Choshen, Colin Raffel, and Mohit Bansal. TIES-merging: Resolving interference when merging models. In Advances in Neural Information Processing Systems (NeurIPS), 2023. URL https://arxiv.org/abs/2306.01708.
Xinyang Yi, Ji Yang, Lichan Hong, Derek Zhiyuan Cheng, Lukasz Heldt, Aditee Kumthekar, Zhe Zhao, Li Wei, and Ed Chi. Sampling-bias-corrected neural modeling for large corpus item recommendations. In Proceedings of the 13th ACM Conference on Recommender Systems (RecSys), pages 269–277, 2019. doi: 10.1145/3298689.3346996.
Le Yu, Bowen Yu, Haiyang Yu, Fei Huang, and Yongbin Li. Language models are Super Mario: Absorbing abilities from homologous models as a free lunch. In Proceedings of the 41st International Conference on Machine Learning (ICML), 2024. URL https://arxiv.org/abs/2311.03099.
Jiaqi Zhai, Lucy Liao, Xing Liu, Yueming Wang, Rui Li, Xuan Cao, Leon Gao, Zhaojie Gong, Fangda Gu, Michael He, Yinghai Lu, and Yu Shi. Actions speak louder than words: Trillion-parameter sequential transducers for generative recommendations. In Proceedings of the 41st International Conference on Machine Learning (ICML), 2024. URL https://arxiv.org/abs/2402.17152.
Guorui Zhou, Honghui Bao, Jiaming Huang, Jiaxin Deng, Jinghao Zhang, Junda She, Kuo Cai, Lejian Ren, Lu Ren, Qiang Luo, Qianqian Wang, Qigen Hu, Rongzhou Zhang, Ruiming Tang, Shiyao Wang, Wuchao Li, Xiangyu Wu, Xinchen Luo, Xingmei Wang, Yifei Hu, Yunfan Wu, Zhanyu Liu, Zhiyang Zhang, Zixing Zhang, Bo Chen, Bin Wen, Chaoyi Ma, Chengru Song, Chenglong Chu, Defu Lian, Fan Yang, Feng Jiang, Hongtao Cheng, Huanjie Wang, Kun Gai, Pengfei Zheng, Qiang Wang, Rui Huang, Siyang Mao, Tingting Gao, Wei Yuan, Yan Wang, Yang Zhou, Yi Su, Zexuan Cheng, Zhixin Ling, and Ziming Li. OpenOneRec technical report. arXiv preprint arXiv:2512.24762, 2025. URL https://arxiv.org/abs/2512.24762.
A Hyper-parameters
Table 20 lists the settings of the models of Section 6.2.
Table 20. Settings of the models of Section 6.2, all started from the autoregressive CPT of Table 3. A node has eight B300 GPUs; all runs use AdamW (, ), gradient clipping at norm 1.0 and seed 42. The two-stage distillation (Section C.3) differs from distillation from the CPT in its student (joint SFT), its recommendation teacher (the 5,000-step LoRA expert), its rows (one SID per row with format tokens, which the loss also covers) and its hardware (8 nodes, accumulation 4).
| Joint SFT | Recommendation expert | Search expert | Distillation from the CPT | |
|---|---|---|---|---|
| Data | recommendation, search sessions, LLM-judged search (1:1:1) | recommendation | search sessions, LLM-judged search (1:1) | joint SFT's mix; prompt and three codewords |
| Trained weights | all | LoRA (rank 64, , dropout 0.05, all linear layers) or all | all | all |
| Steps | 5,000 | 5,000; teacher: 10,000 of 20,000 | 5,000 | 6,000 |
| Batch per step | 256 packed sequences of 4,096 tokens | as joint SFT | as joint SFT | 2,048 rows, prompts up to 2,048 tokens |
| Learning rate | , 500 warmup steps, cosine to | LoRA: , 300 warmup steps (teacher: 1,200), cosine to ; all: as joint SFT | as joint SFT | , 100 warmup steps, cosine to over the last 1,500 |
| Weight decay | 0.1 | LoRA: 0; all: 0.1 | 0.1 | 0 |
| Precision; averaging | bf16; none | bf16; none | bf16; none | fp32 master weights, bf16 autocast (teachers bf16); EMA, decay 0.998, published Equation (1), |
| Loss | CE on completions | CE on completions | CE on completions | LoRA rec. expert (10,000 steps); search expert |
| Teachers | – | – | – | 1 node; 8 rows per GPU, accumulation 32 (gold) or 4 and 64 (teacher prefix) |
| Hardware | 1 node | 1 node (teacher: 4) | 1 node |
B Evaluation Protocols
Table 21. Evaluation protocols (Section 2). Each scores a set of search queries, and E3–E6 share one set. Judge: a personalized judge also reads the buyer's profile (Section 2.1.1). Index: the products the SID-LLM decodes over in search; E6 runs the whole search stack end to end (Section 9.1.2). Users: the users scored for recommendation (Section 2.2.1); a dash marks a protocol without a recommendation evaluation.
| Protocol | Search | Recommendation | Used in | |
|---|---|---|---|---|
| Judge | Index | Users | ||
| E1 | query only | top 50M | – | Table 1 |
| E2 | query only | top 100M | – | Tables 2, 27, 28 and 30 |
| E3 | personalized | all eligible, 08-26 | 250,000 | Tables 6, 8, 9, 11 and 26 |
| E4 | personalized | all eligible, 09-22 | 10,000 | Table 12 |
| E5 | personalized | all eligible, 10-08 | 10,000 | Tables 3, 4, 13 and 34 |
| E6 | personalized | search stack, 10-26 | – | Table 17 |
C Teachers and distillation into joint SFT
C.1 Choosing the teachers
For each task we trained a LoRA expert and a fully fine-tuned one with the same data and steps (Table 20), and kept as the teacher the one that scored higher on its own task (Table 22). Search is scored on protocol E4, the only one on which both search experts were scored. The two recipes also differ in learning rate, warmup, weight decay and dropout, so the table compares tuned recipes rather than low-rank and full updates as such. The runs from the CPT use the LoRA recommendation expert's checkpoint at step 10,000 of a 20,000-step schedule, chosen on the same cohorts; it is not significantly better than the 5,000-step expert.
Table 22. Teacher selection: LoRA and fully fine-tuned experts for each task, with the same data and steps. First row: joint SFT's absolute scores; other rows: relative change (%) from joint SFT with 95% paired-bootstrap intervals. Search: protocol E4 (Table 21), not comparable with E5. Bold: significant improvement; ↓: significant loss.
| Model | Recommendation | Search (E4) | ||
|---|---|---|---|---|
| Recall@50 | Discovery Recall@50 | Purchase Recall@10 | OneDCG@10 | |
| Joint SFT (absolute score) | 0.2411 | 0.0423 | 0.3439 | 0.3182 |
| Rec. expert, LoRA | +1.73%[0.94, 2.51] | +7.81%[4.45, 11.05] | -1.91%↓[-2.56, -1.20] | -2.30%↓[-2.61, -2.00] |
| Rec. expert, full FT | +1.37%[0.70, 2.09] | +3.70%[0.73, 6.55] | -1.04%↓[-1.66, -0.43] | -1.57%↓[-1.83, -1.31] |
| Search expert, LoRA | -20.83%↓[-22.47, -19.18] | -32.69%↓[-37.12, -28.19] | -0.59%↓[-1.11, -0.08] | -0.03%[-0.20, 0.14] |
| Search expert, full FT | -20.19%↓[-21.82, -18.48] | -32.12%↓[-36.54, -27.69] | -0.30%[-0.80, 0.23] | 0.00%[-0.17, 0.17] |
C.2 The merge grid
The grid of Figure 9 merges experts of the same family on dense task vectors by interpolation (), with equal weights of 0.75, 1 and 1.25, and at (1,1) with TIES (Yadav et al., 2023) at densities 0.2 and 0.5 and with DARE (Yu et al., 2024) at density 0.1 with TIES sign election. No tested merge is significantly better than joint SFT on recommendation without being significantly worse on search.
C.3 Distillation into joint SFT
Before distilling into the CPT we distilled the 5,000-step experts into joint SFT, a two-stage recipe. Our first runs followed MOPD (on-policy prefixes, no CE anchor, 256 rows per step, pure bf16) and left the student where it started: at the starting weights the gradient noise scale (McCandlish et al., 2018) was about 1,100 rows for recommendation and 2,300 for search, against about 85 and 170 such rows per step, and at a learning rate of most AdamW updates were smaller than half a bf16 unit in the last place and were rounded away. The runs of Table 23 therefore use four times the batch, fp32 master weights and an exponential moving average of the weights.
The first four rows of the table are matched, and Figure 6 shows three of them per level. Replacing the on-policy prefix by the gold prefix raised the recommendation point estimates but lost more purchase recall, a loss that the CE anchor then removed; the two prefix runs were not compared directly and their intervals overlap widely, so on-policy sampling bought nothing we could measure, and the gold prefix, which needs no generation, became the default. The CE-only run has a different coefficient from the combined run's, and none of these runs starts from the CPT.
The final two-stage run (last row) uses the settings of distillation from the CPT. It is the stronger of the two recipes on search, with a significant gain in purchase Recall@10, and its recommendation recall is indistinguishable from its own teacher's. A no-teacher control at that scale, trained with the CE term alone and evaluated after 3,000 steps, trailed distillation by 0.73% [+0.04, +1.48] Recall@50 in a paired comparison, and an interim second seed gained 0.98% Recall@50 after 1,500 steps against 0.95% for the first, the only measurement of training variance in this study.
Table 23. Distillation into joint SFT from the 5,000-step experts. The first four rows are matched (2.7M rows, 1,024 per step, constant learning rate , fp32 master weights, EMA decay 0.997). KD: the divergence of Equation (1), ; CE only: the gold cross-entropy, weight 1, no teacher; KD + CE: . Last row: the final two-stage run, on 12.3M rows. Change (%) from joint SFT with 95% paired-bootstrap intervals; search: E5. Bold: significant improvement; : significant loss. Last column: the third-level change of Figure 6, without an interval.
| Model | Recommendation | Search (E5) | Held-out | ||
|---|---|---|---|---|---|
| Recall@50 | Discovery Recall@50 | Purchase Recall@10 | OneDCG@10 | Level-3 KL change | |
| On-policy prefix, KD only | +0.95%[0.30, 1.59] | +2.92%[-0.11, 5.95] | -0.13%[-0.65, 0.41] | -0.18%[-0.38, 0.00] | +43.30% |
| KD only | +1.05%[0.42, 1.78] | +4.89%[1.85, 7.86] | -0.71%↓[-1.26, -0.15] | -0.18%[-0.37, 0.01] | +24.09% |
| CE only | -0.37%[-1.11, 0.34] | -1.83%[-4.67, 1.14] | -1.03%↓[-1.69, -0.38] | -0.66%↓[-0.91, -0.42] | +54.81% |
| KD + 0.25 CE | +1.12%[0.43, 1.84] | +3.73%[0.75, 6.93] | +0.10%[-0.44, 0.66] | -0.04%[-0.23, 0.15] | -5.68% |
| KD + 0.25 CE, 12.3M rows (two-stage, final) | +1.59%[0.89, 2.37] | +8.01%[4.56, 11.33] | +0.79%[0.23, 1.37] | -0.01%[-0.20, 0.19] | -21.13% |

Figure 6. The last codeword is the hardest to distil: change in the held-out divergence per level from a run's first evaluation to its last (raw weights; runs into joint SFT: steps 200 to 2,600; from the CPT: 250 to 6,000). KD alone raises the third level, and the CE anchor reverses the rise. Top three rows: runs of Table 23; bottom row: the main method, with its own teacher.
Table 24. Retargeting and discovery on the 9,990 users of the Recall@50 cohort: Recall@50 over purchased products already in the user's interaction history (retargeting; 5,295 users) and over the others (discovery; 6,281 users; not the 20,000-user cohort of Table 14). Discovery share: the part of the Recall@50 change from discovery purchases. New products: the share of the top 50 that the user never interacted with (absolute). First row: absolute baseline scores. Other recall cells: relative change (%) from joint SFT with 95% paired-bootstrap intervals. Bold: significant improvement; ↓: significant loss.
| Model | Retargeting Recall@50 | Discovery Recall@50 | Discovery share of the change | New products in the top 50 |
|---|---|---|---|---|
| Joint SFT (absolute score) | 0.4747 | 0.0409 | – | 72.9% |
| CPT | –18.45%[-20.01, -16.91] | –32.36%[-39.76, -24.28] | 14% | 78.4% |
| Rec. expert (LoRA, 5k steps) | +0.73%[0.10, 1.34] | +11.88%[5.61, 18.68] | 68% | 73.3% |
| Rec. teacher (LoRA, 10k steps) | +0.76%[-0.04, 1.55] | +14.19%[6.38, 22.69] | 68% | 74.6% |
| Search expert (full FT) | –19.37%↓[-20.97, -17.83] | –32.46%↓[-40.37, -24.54] | 13% | 79.0% |
| Distillation, gold prefix | +0.53%[-0.24, 1.27] | +12.42%[5.19, 20.58] | 69% | 73.9% |
| Distillation, teacher prefix | +0.27%[-0.53, 0.99] | +10.47%[3.22, 18.57] | 83% | 74.1% |
Table 25. Baseline data mix of the LFM2-2.6B pre-training arms of Section 5: 30,000 steps of 1,048,576 tokens. Columns as in Table 5. The replay rows belong to the replay arm (Table 8), which gives general text 10% of the loss tokens and scales the other streams to 90%. Replay epochs are not computed.
| Source | Examples (M) | Epochs | Tokens (B) | Tokens (%) | Loss tokens (%) |
|---|---|---|---|---|---|
| Product attributes | |||||
| Product documents | 195.2 | 0.33 | 6.60 | 21.0 | 22.7 |
| Top-GMV product documents | 200.3 | 8.00 | 5.99 | 19.0 | 23.3 |
| Search | |||||
| Search session examples | 37.2 | 1.00 | 12.23 | 38.9 | 5.3 |
| LLM-judged examples | 33.4 | 2.00 | 0.76 | 2.4 | 3.2 |
| LLM-judged personalized examples | 1.1 | 76.20 | 0.63 | 2.0 | 0.5 |
| Recommendation | |||||
| Interaction sequences | 8.4 | 0.02 | 2.88 | 9.2 | 22.5 |
| New-product purchases | 12.0 | 0.05 | 1.36 | 4.3 | 13.5 |
| New-merchant purchases | 13.0 | 0.06 | 0.77 | 2.4 | 6.7 |
| New-category purchases | 3.5 | 0.02 | 0.25 | 0.8 | 2.3 |
| Total | 504.0 | – | 31.46 | 100.0 | 100.0 |
| Replay (replay arm only) | |||||
| FineWeb-Edu | 0.6 | – | 0.70 | 2.2 | 6.9 |
| OpenCoder algorithmic | 1.0 | – | 0.19 | 0.6 | 1.9 |
| SwallowMath-v2 | 0.1 | – | 0.12 | 0.4 | 1.2 |
Table 26. All LFM2-2.6B pre-training arms of Section 5, each one change from the baseline mix (Table 25). Evaluation protocol E3 (Table 21). A dash marks the task whose data the arm drops, or a task without an evaluation. Best value per column in bold.
| Arm | Search relevance | Search purchases | Recommendation |
|---|---|---|---|
| OneDCG@10 | Recall@10 | Recall@50 | |
| Baseline | 0.2876 | 0.3336 | 0.2096 |
| Product attributes | |||
| No product attribute data | 0.2818 | 0.3250 | 0.2099 |
| Search | |||
| No search data | – | – | 0.2087 |
| Search session examples at 2.6% of loss tokens | 0.2844 | 0.3179 | – |
| Recommendation | |||
| No recommendation data | 0.2854 | 0.3263 | – |
| Recommendation at 20% of loss tokens | 0.2843 | 0.3322 | – |
| Replay | |||
| General-text replay at 10% of loss tokens | 0.2871 | 0.3276 | 0.2027 |
| Training | |||
| No embedding alignment | 0.2860 | 0.3268 | 0.2067 |

Figure 7. Memory accounting for AR only and MTP with the ranker on one B200 3g.90gb partition (89.0 GiB), plus the ranker's host-mapped table files. Device totals are readings after a diagnostic run at 25 offered requests/s, with AR at beam 100 and MTP with the ranker at 250. Weight and index sizes are estimates; cache capacities are configured caps. Residual memory at peak is the measured device total minus these quantities, not an independently measured allocation. Host bars show table file sizes, not resident process memory.
D Additional tokenizer experiments
This section gives the behavioral coherence, sampling, codebook, de-duplication and collision analyses supporting Section 3. Results use the evaluation protocol identified in each table; absolute scores should only be compared within a table.
D.1 Behavioral coherence of semantic IDs
We adapt Resnik similarity (Resnik, 1995) to the tree formed by SID prefixes, measuring how specifically the tokenizers group distinct items purchased for the same query. This is a retrospective analysis of the three tokenizers in Table 1, using behavioral data separate from the E1 downstream search evaluation.
We use search logs from August 1–26, 2026, retaining impressed, non-sponsored primary-variant products from standard and agent search sessions with non-null product and session IDs. Queries are lowercase, punctuation is replaced by spaces, and whitespace is collapsed and trimmed; redacted or empty queries are excluded. An item is positive for a query if it has a last-click-attributed purchase in at least one session for that query. Purchases are pooled across sessions by normalized query.
We deduplicate listings by universal product ID (UPI). Each UPI uses one representative product, shared across all three tokenizers, chosen among its impressed products in the May embedding export. We select the product labeled with a purchase or high-quality click for the most queries, breaking ties by the lowest product ID. UPIs without a representative are excluded, retaining 68.6% of purchased items. The common universe contains 41,913,701 distinct impressed UPIs with a representative; each item contributes once to prefix frequencies.
Let be item 's SID and the longest common prefix of and . For prefix and two distinct items , define
The empty prefix has probability one, so pairs with different first codes score zero. Pairs sharing their full SID receive the information content of that full prefix. The score therefore measures shared information in bits, rather than shared prefix length.
For each query , let be its set of distinct purchased items after coverage filtering, and let be the set of unordered pairs of distinct items in . We report
where contains the 12,799 queries with at least two retained purchased items. Each query has equal weight. Repeating the analysis with high-quality clicks gives 5.93, 7.98 and 8.19 bits for RQ-VAE 1024-1024-1024-1024, RQ-KMeans 1024-1024-1024-1024 and RQ-KMeans 8192-8192-8192, respectively, preserving the purchase-based ordering.
D.2 Fitting sample
We compare fitting on the top 25M products by GMV with fitting on a random 25M products from the catalog. The top-GMV sample gives higher OneDCG@10 for both codebook shapes tested (Table 27).
Table 27. Codebook fit sample: the top 25M products by GMV vs. a random 25M, for an RQ-KMeans tokenizer at two codebook shapes. We train downstream a 2.6B LLM for each of the methods, and evaluate performance in the generative retrieval task. Evaluation protocol E2 (Table 21). Better fit sample per codebook in bold.
| Codebooks | OneDCG@10 by fit sample | |
|---|---|---|
| Top 25M by GMV | Random 25M | |
| 8192-8192-8192 | 0.3464 | 0.3445 |
| 32768-8192-8192 | 0.3538 | 0.3496 |
D.3 Codebook size and balancing
Increasing the codebook vocabulary generally improves downstream search relevance and the share of unique SIDs (Table 28). Non-uniform codebooks perform similarly to uniform ones with a similar vocabulary size. Balancing the last level raises uniqueness but lowers OneDCG@10 at all but one tested shape, so we use standard k-means.
Table 28. Codebook shape and last-level balancing for an RQ-KMeans tokenizer fit on the top 25M products by GMV. Evaluation protocol E2 (Table 21). Best OneDCG@10 per column in bold.
| Codebooks | SID tokens | Standard | Balanced last level | ||
|---|---|---|---|---|---|
| Unique SIDs (%) | OneDCG@10 | Unique SIDs (%) | OneDCG@10 | ||
| 1024-1024-1024 | 3,072 | 12.9 | 0.2278 | 15.2 | 0.2253 |
| 2048-2048-2048 | 6,144 | 21.0 | 0.2376 | 24.1 | 0.2366 |
| 4096-4096-4096 | 12,288 | 27.5 | 0.2469 | 31.1 | 0.2458 |
| 8192-2048-512 | 10,752 | 24.9 | 0.2466 | 27.3 | 0.2467 |
| 8192-2048-1024 | 11,264 | 27.0 | 0.2466 | 29.8 | 0.2450 |
| 8192-4096-1024 | 13,312 | 28.8 | 0.2505 | 31.6 | 0.2487 |
D.4 Serving latency across request rates
Table 29 expands the target-load comparison of Table 2. The larger codebook’s p95 latency rises sharply beyond the target load and reaches more than two seconds at 150 requests per second.
Table 29. Serving latency vs. codebook shape for the two RQ-KMeans tokenizers of Table 27 fit on the top 25M products by GMV, each with its own LFM2-2.6B downstream LLM, on one NVIDIA B200 node. p95: the 95th-percentile latency at a fixed rate of requests per second. At the target load of 100 requests per second, the larger codebook adds 9.5 ms (+23%) to p95; at 150 it saturates. OneDCG@10: evaluation protocol E2 (Table 21). Better per column in bold.
| Codebooks | SID tokens | OneDCG@10 | p95 latency (ms) at requests per second | |||
|---|---|---|---|---|---|---|
| 50 | 100 | 125 | 150 | |||
| 8192-8192-8192 | 24,576 | 0.3464 | 29.6 | 40.5 | 51.6 | 61.1 |
| 32768-8192-8192 | 49,152 | 0.3538 | 31.7 | 50.0 | 93.2 | 2,221.3 |
D.5 Heuristic de-duplication
With the standard RQ-KMeans setup, we observe fairly low uniqueness (number of unique SIDs compared to the total number of products). Some duplication is natural: the same product sold by several merchants has a different product id in each shop. Regardless, we attempt to overcome the duplication while maintaining or increasing downstream performance, and maintaining similar serving latency. We explore two heuristic solutions: a random deduplication token and CRID (Ling et al., 2026). In CRID, we choose a deduplication token based on the business-value ranking within each semantic cluster. For example, with CRID as token 4, we first fit 3 codebooks with RQ-KMeans and within each 3-token prefix assign a 4th token based on the GMV ranking of a product within that prefix. While these heuristics increase uniqueness, they decrease generative retrieval metrics (Table 30) when we hold the codebook size constant. While adding a 4th CRID token improves downstream retrieval performance slightly, it increases generation latency by 14% on average, and up to 30% at large beam widths and batch sizes. Therefore, we don’t adopt a heuristic deduplication strategy at tokenization time, but rather choose the simple RQ-KMeans.
Table 30. Heuristic de-duplication of colliding SIDs on the production 8192-8192-8192 tokenizer. Evaluation protocol E2 (Table 21). Best OneDCG@10 per group in bold. Each group uses its own time-matched baseline.
| Method | SID length | Unique SIDs (%) | OneDCG@10 |
|---|---|---|---|
| No de-duplication | 3 | 33.1 | 0.3204 |
| CRID as token 3 | 3 | 92.3 | 0.3180 |
| CRID as token 4 | 4 | 98.1 | 0.3253 |
| No de-duplication | 3 | 33.1 | 0.3193 |
| Random token 4 | 4 | 96.8 | 0.3157 |
D.6 Cluster-size distribution
Although the number of distinct SIDs is low relative to the number of products, about 70% of occupied SIDs contain exactly one product. The distribution is highly skewed (Figure 8 and Table 31). The largest clusters inspected contain identical or near-identical long-tail listings, such as products whose titles differ only in a part number (Table 32); fewer than 0.3% of the products in each of the three largest clusters sold in the past year.
We also inspected reconstruction error at each level and code perplexity, but did not find them predictive of downstream performance in our experiments. We therefore use retrieval quality and latency to select the tokenizer (Section 3.2).

Figure 8. Products per SID for the 8192-8192-8192 RQ-KMeans tokenizer on a log-log plot. Counts in Table 31.
Table 31. Products per SID for the tokenizer of Figure 8, by order of magnitude: the number of SIDs in each size range, the products they hold, and those products as a share of all products.
| Products per SID | SIDs | Products | Share of products (%) |
|---|---|---|---|
| 1 | 162,505,415 | 162,505,415 | 22.8 |
| 2–9 | 60,670,564 | 196,267,628 | 27.5 |
| 10–99 | 7,974,538 | 185,733,270 | 26.0 |
| 100–999 | 512,471 | 115,602,794 | 16.2 |
| 1,000–9,999 | 18,436 | 37,966,316 | 5.3 |
| 10,000–99,999 | 513 | 11,180,570 | 1.6 |
| 100,000–522,086 | 22 | 4,700,480 | 0.7 |
| All | 231,681,959 | 713,956,473 | 100.0 |
Table 32. The three largest SIDs of Figure 8, by title pattern: titles that are identical, ignoring case, once every word containing a digit (such as a part number or a size) is masked. Each row shows one title of the pattern, with the brand name replaced by [brand], and the number of products in the pattern.
| Example title | Products |
|---|---|
| Largest SID: 522,086 products, 99.99% from one shop[brand] SAU Series: Double-axis Compound Stroke Adjustable Cylinder - SAUJ63X250-20S | 520,819 |
| [brand] SAI Series: Double Axis Compound Stroke Adjustable Cylinder - SAIJ32X175-10H | 831 |
| [brand] SAU Series: Standard Compound Cylinder - SAU32X70S | 349 |
| 3 other title patterns | 87 |
| Second-largest SID: 357,508 products, all from one shop[brand] 1200 Boat Cover | 327,270 |
| [brand] 600 Pontoon Cover | 29,876 |
| [brand] 1200 Jet Ski Cover | 362 |
| Third-largest SID: 351,446 products, 99.94% from one shop[brand] SE: Double Acting Standard Air Cylinder - SE80X75S | 232,858 |
| [brand] SC series: double-shaft double-acting cylinder - SCD40X120 | 47,291 |
| [brand] SC series: Standard double-acting cylinder - SC50X1300STC | 40,952 |
| 115 other title patterns | 30,343 |
E Additional task-unification analysis
This section provides evaluation details and supporting experiments for Section 6.2. Teacher selection, the merge grid and the earlier two-stage recipe are described in Section C.
E.1 Evaluation cohorts
All changes are relative to joint SFT, for a metric . Joint SFT samples recommendation examples and two search streams in a 1:1:1 ratio (Table 20). Recommendation Recall@50 is evaluated over 9,990 held-out purchasers using 50 beam-decoded SIDs (Section 2.2.1). Discovery Recall@50 restricts targets to products absent from the user's interaction history and uses a separate cohort of 20,000 users (Section 5.1.3). Search uses the purchase Recall@10 of 25,000 converted sessions and the OneDCG@10 of 6,000 queries under protocol E5 (Sections 2.1.1 and 2.1.2 and Table 21).
We compute 95% paired-bootstrap intervals with 2,000 resamples. A change is significant when its interval excludes zero; an undetected change does not establish equivalence. Each model was trained once, and the development cohorts and queries also guided teacher, checkpoint and recipe selection, so the intervals are nominal.
E.2 Weight-merging results
We explore combining expert weights through task arithmetic, interpolation and sparse merging (Ilharco et al., 2023; Yadav et al., 2023; Yu et al., 2024). The grid is specified in Section C.2. None of the tested merges significantly improves recommendation without a significant search loss. The figure uses the earlier search protocol E4; the main results table uses E5.
E.3 Distillation from the CPT
The student trains on 12.3M rows with a warmup-stable-decay schedule (Hägele et al., 2024; Hu et al., 2024), a large batch and fp32 master weights (Section C.3), and we evaluate an exponential moving average of its weights (Polyak and Juditsky, 1992).
E.3.1 Objective and validation diagnostics
Our recipe adapts multi-teacher on-policy distillation (MOPD; Ma et al. 2026), retaining per-task routing and exact per-token reverse KL. The student starts from the CPT, the divergence is evaluated on gold prefixes rather than sampled student prefixes, as in word-level distillation (Kim and Rush, 2016), and a cross-entropy term anchors the student to the gold item. The held-out divergence is the student's exact per-level KL() from its recommendation teacher, teacher-forced on gold items in fixed validation prompts.
The case for the teachers and for the anchor comes from matched runs of an earlier recipe that distilled the 5,000-step experts into joint SFT (Table 23). CE alone, in effect continued joint SFT, gained nothing detectable on recommendation and lost search; distillation alone gained on recommendation but lost purchase Recall@10 significantly; both together kept the gain with no detected search change. Distillation alone lowered the held-out divergence at the first two levels and raised it at the third, and the anchor reversed the rise (Figure 6); our untested reading is that the shared update fits the broader levels at the expense of the more constrained third, which the hard label holds in place. equalises the two terms' initial gradient norms and was not tuned. The CPT recipe has no matched KD-only or CE-only run, so these runs motivate its anchor rather than establish that it needs one.

Figure 9. Weight merging slides along the experts' trade-off: merges of the fully fine-tuned (left) and LoRA (right) experts, labelled with their weights (, ), as change (%) from the fully fine-tuned joint SFT (the reference of both panels), with search on the earlier protocol E4. Solid: interpolation (); dotted: equal weights; TIES and DARE-TIES: weights (1,1) with the density shown (Section C.2).

Figure 10. Where the divergence of Equation (1) is taken, for one row whose gold item is (schematic; illustrative distributions). Gold prefix (top): every level is teacher-forced on the gold item, so KL and CE fall on the same tokens. Teacher prefix (bottom): the teacher's sampled SID, drawn once per row and step and not differentiated, sets the later levels' prefix and can leave the gold path (), while CE stays on the gold item; in training it is the gold item for 9% of rows and shares its first codeword for 45%.
E.3.2 Gold or teacher prefix
Beam search ranks 50 paths, but the gold prefix trains only the purchased item's. A prefix drawn from the teacher, one SID per row and step at temperature 1 with each level restricted to its own codewords, also covers the other branches in proportion to the teacher's probability, while CE stays on the gold item (Figure 10). In a second run from the CPT, with the same teachers, rows per step and schedule, it fits the teacher more closely (held-out divergence 0.060 against 0.072 at step 6,000) but retrieves no better: paired with the gold prefix, Recall@50 changes by -0.46% [-0.98, +0.04], and no direct contrast on either task is significant. Its draw is the gold item in only 9% of rows, so most third-level targets lie off the purchased path. We keep the gold prefix and read the held-out divergence as a diagnostic, not a criterion for choosing models.
E.4 Retargeting and discovery
Recall@50 is dominated by retargeting: 90% of joint SFT's hits in its top 50 are products already in the buyer's interaction history. On the same users, recommendation training moves discovery recall by 10.5–14.2% but retargeting recall by only 0.3–0.8%, so discovery purchases, a tenth of the hits, supply 68–83% of each model's gain (Table 24). The CPT and the search expert put more products new to the buyer in their top 50
(78–79% against 73%) yet lose both kinds of recall: recommending unseen products is not discovering the ones the buyer will buy. Panel (c) of Figure 4 therefore separates the routes most clearly, although discovery recall stays small, 4.1% for joint SFT.
F Search post-training details
This section gives the data construction, objectives and training settings for the search experiments in Section 6.1. Each method starts independently from the same CPT+MTP checkpoint. The judge-derived scores below are training signals; the primary evaluation metric is OneDCG@10 under protocol E5.
F.1 Offline data construction
The offline data consist of search sessions with a query, an optional buyer profile and candidate products scored by a fine-tuned Qwen3.5-2B relevance model. Candidates come from search engine results pages (SERPs) and, where available, up to 200 products generated by the CPT+MTP model per session. We remove unjudgeable candidates and non-finite scores, and deduplicate complete SIDs within each session by keeping the highest score.
The corpus contains approximately 1.8M session records. Positive filtering retains an estimated 1.38M records for CE with SERP targets and 1.49M for CE+DPO with SERP and generated targets. CE+DPO reserves approximately 9,000 sessions to monitor preference losses. We compare retrieval performance using protocol E5 (Table 21).
F.2 Supervised fine-tuning details
For soft-target CE, we retain candidates with judge score at least 0.71. We choose this value, approximately the mean judge score plus 0.75 standard deviations, to retain enough positive products in the training data. If candidate has score and three-codeword SID , its weight and the target distribution at level are
The codeword loss is , where is the query and profile prompt and is a full-vocabulary probability. For fixed targets, each level's CE equals forward KL divergence from plus its entropy. The objective matches the judge-derived codeword marginals. We add hard-label CE on completion-format tokens and divide the summed loss by the number of supervised tokens. Prompts carry no loss. The MTP readouts predict the three codewords in parallel without seeing target codewords in their inputs.
The offline prompt includes a new relevance token to signal that the model should generate products with high judged relevance. This distinguishes the new output objective from predicting observed purchases. We initialise the new token's embedding from the existing purchase token. We pack examples into 4,096-token sequences. Both offline methods use AdamW, a peak learning rate of , 100 warmup steps, cosine decay, weight decay 0.1, gradient clipping at 1.0, bf16 and seed 42, on eight B300 GPUs. Table 33 gives the schedule lengths and batch units. Each packed sequence can contain several queries. We train CE for 1,600 steps without a validation set. Both offline schedules use fixed step budgets without early stopping.
F.3 Offline CE+DPO details
CE+DPO adds a reference-relative preference loss to positive-target CE (Rafailov et al., 2023). After deduplication, positives score above 0.71 and negatives below it. We omit scores of exactly 0.71 and queries
Table 33. Post-training schedules. All runs use eight trainer GPUs and a 100-step learning-rate warmup. Offline batch sizes count packed sequences per GPU; GRPO counts candidate completions, 32 per query, and uses one additional B300 GPU for the judge. The constant GRPO learning rate follows warmup. Batch sizes across these units are not directly comparable.
| Method | Steps | Batch/GPU | Batch unit | LR schedule |
|---|---|---|---|---|
| Soft-target CE | 1,600 | 8 | Packed sequences | Cosine |
| CE+DPO | 1,250 | 8 | Packed sequences | Cosine |
| GRPO | 50,000 | 32 | Completions | Constant |
without positives; positive-only queries retain CE. Weights and confidences depend on distance from the threshold:
Let and let be the same score under the fixed CPT+MTP initialisation. For a positive and negative pair, define
The per-query codeword terms are
For each query, we compute the preference loss over its positive and negative candidates, weighted by . We average these terms over queries, not confidence mass, and add a separately token-normalised format CE term. We weight CE, DPO and format CE equally, with , and train for 1,250 steps. We also train a SERP-only variant and an all-source variant with the DPO coefficient doubled, each for 1,250 steps. We monitor preference losses on the held-out sessions during training.
F.4 GRPO details
For online optimisation, we use an asynchronous variant of GRPO (Shao et al., 2024). For each query, an MTP trie traversal with beam width 256 proposes the top 32 three-token SIDs, renormalising probabilities over allowed successors. These are ranked proposals rather than independent policy samples. For each SID, we look up product information and score the first product returned with the query and buyer profile, using our Qwen3.5-2B training judge.
Rewards are centred by the query group's mean and scaled by a component-level exponential moving standard deviation, with decay 0.995, a 200-batch warmup and a 0.01 floor. We assign unscored candidates the group mean. The policy objective uses token-level probability ratios, clipping at 0.2 and a KL coefficient of 0.04 against the fixed initial policy, with one update per generated batch and a loss averaged over tokens. We refresh generation weights every ten optimiser steps; generation and reward queues each hold up to eight batches. This procedure differs from the original GRPO in its ranked proposals, reward scaling and asynchronous updates.
We train for 50,000 steps with a global batch of 256 completions: eight queries with 32 proposals each. The training batches therefore contain 400,000 query presentations and 12.8M completions in total. We use AdamW at after warmup, gradient clipping at 1.0, bf16 and seed 42.
F.5 Interpreting the method comparisons
Table 13 compares generator-only results under protocol E5. Our primary metric is OneDCG@10. As defined in Section 2.1.1, this metric normalises by a constant theoretical maximum. We treat an absolute increase of at least 0.002 as a practically meaningful improvement; this is a decision threshold, not a statistical significance test.
GRPO achieves the highest score among the three methods, exceeding all-source CE+DPO with equal coefficients by 0.0021 and soft-target CE by 0.0040. All-source CE+DPO exceeds CE by 0.0020, close to the practical threshold, but adds generated candidates and changes the training schedule and validation split. It therefore does not isolate the effect of the preference loss. The closest SERP-only CE+DPO comparison gains 0.0007 over CE, below the threshold. Doubling the all-source DPO coefficient gives no practically meaningful improvement.
F.6 Evaluation and attribution limits
A matched all-source CE baseline with the CE+DPO corpus, 1,250-step schedule and inference setup is still needed to attribute any gain to DPO. The models share evaluation query sets and a SID trie; common decoding and serving settings would further control the comparison. Other remaining work includes per-query uncertainty estimates, repeated runs with different seeds, an audit of training-data overlap with E5, and verification of the independence of the training and evaluation judges. These results describe performance on the development benchmark. Complete reproducibility also requires archiving the GRPO source revision or training-image digest and its mapping to the evaluated model. Applying GRPO after the strongest offline method remains a subsequent experiment.
F.7 Additional GRPO comparison
The following comparison retains the results with the lightweight ranker. The ranker backend changes between the two configurations, so the pair does not isolate the effect of GRPO.
Table 34. GRPO on the multi-token prediction model of Table 3, without and with the ranker. Evaluation protocol E5 (Table 21). Better of each pair in bold. The ranker weights are shared, but the baseline ranker uses the HF backend and the GRPO ranker uses Liquid; that pair does not isolate the effect of GRPO.
| Arm | Search relevance | Search purchases |
|---|---|---|
| OneDCG@10 | Recall@10 | |
| Multi-token prediction | ||
| Without GRPO | 0.2811 | 0.2840 |
| With GRPO | 0.2970 | 0.2782 |
| Multi-token prediction + ranker | ||
| Without GRPO | 0.3365 | 0.3450 |
| With GRPO | 0.3453 | 0.3328 |