Manuscript Offprint
arXiv:2610.33435PinGER: Token-Efficient Generative Retrieval with Semantic IDs
Xinyi Li
Palo Alto, CA, USA
Zelun Wang
Palo Alto, CA, USA
Hanlin Lu
Palo Alto, CA, USA
Yaxin Li
Palo Alto, CA, USA
Jaewon Yang
Palo Alto, CA, USA
Sujan Reddy Ale
Palo Alto, CA, USA
Yilin Chen
Palo Alto, CA, USA
Arkin Dharawat
Palo Alto, CA, USA
Bella Huang
Palo Alto, CA, USA
Jiajing Xu
Palo Alto, CA, USA
Yi-Ping Hsu
Palo Alto, CA, USA
Hanyu Li
Palo Alto, CA, USA
Lulu Yao
Palo Alto, CA, USA
Xiangyi Chen
Palo Alto, CA, USA
Charles Rosenberg
Palo Alto, CA, USA
Abstract
Generative retrieval replaces nearest-neighbor search with token-by-token decoding of an item's semantic ID (SID). But existing SID-based methods primarily use L levels of tokens sequentially to represent each item in the input history. As a result, a fixed context window holds L times fewer items than it would with one embedding per item. We present PinGER, a generative retriever deployed at Pinterest that retains SID outputs while making input histories compact, built on three ideas. (1) An asymmetric attention mask over interleaved SID and dense tokens lets later items attend only to the dense ones, so the model is supervised at every SID position in training yet serves one token per item while computing the same function. (2) Generation is controllable through goal-conditioned outputs, reinforcement learning, and a prefix-diversity penalty, which together steer retrieval toward surface-specific goals and diverse candidates. (3) A serving stack built for efficient wide-beam generation is paired with decoding constrained to valid identifiers and candidate resolution from a host-local index. Deployed in Related Pins, PinGER lifts saves of fresh Pins by 3.60% and overall saves by 0.62%, while reducing the surface's end-to-end latency by 0.7% and eliminating the cost of the nearest-neighbor search it replaces.
CCS Concepts
• Information systems → Recommender systems.
Keywords
Sequential Recommendation, Recommendation System
ACM Reference Format:
Xinyi Li, Sujan Reddy Ale, Yi-Ping Hsu, Zelun Wang, Yilin Chen, Hanyu Li, Hanlin Lu, Arkin Dharawat, Lulu Yao, Yaxin Li, Bella Huang, Xiangyi Chen, Jaewon Yang, Jiajing Xu, and Charles Rosenberg. 2018. PinGER: Token-Efficient Generative Retrieval with Semantic IDs. In Proceedings of XXX (Conference acronym 'XX). ACM, New York, NY, USA, 11 pages. https://doi.org/XXXXXXX.XXXXXXX
1 Introduction
Retrieval is the first stage of an industrial recommender: from a corpus of order items, it selects the candidates a downstream ranker will score, under a tight latency budget. The dominant approach is two-tower retrieval with approximate nearest neighbor (ANN) search [6]: user and item towers embed both sides in a shared space and retrieval returns the items nearest the user vector, so the two interact only through a final dot product. Since sequential recommenders scale like language models [35], generative retrieval (GR) instead generates the next item as a language model generates the next token [25].
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from permissions@acm.org.
Conference acronym 'XX, Woodstock, NY
© 2018 Copyright held by the owner/author(s). Publication rights licensed to ACM. ACM ISBN 978-1-4503-XXXX-X/2018/06 https://doi.org/XXXXXXX.XXXXXXX
Li et al.
(a) Input vs supervision (L = 2)
Problem
(b) Serving cost

(c) Diversity
Our solution
Figure 1: Three obstacles to efficient SID retrieval (top) and our answers (bottom). s: SID token, e: dense token.
A GR model can represent items in one of two forms. Embedding GR, such as PinRec [3], reads and predicts one dense embedding per item, so a fixed context covers a long history, but it still retrieves through an ANN index. SID GR, introduced by TIGER [25], quantizes each item into a semantic ID (SID) of L discrete codes and generates it with beam search, so the output space can be decoded directly into items and steered during generation. As a result, no ANN index sits on the request path, and a new item is retrievable as soon as it has an SID. Its inputs are costly, however, since every history item takes L tokens, even though history matters: Recall grows by 10% as the training context grows from 1,024 to 6,144 tokens (Section 5.2.1). We ask whether one model can have both, reading history at one token per item while keeping SID outputs, their supervision, and the diversity their output space allows.
Three obstacles stand in the way (Figure 1). The first is that input and supervision pull in opposite directions. In a causal model, every token the model is trained on is also input for every later token. SID tokens give rich supervision, one label per code, but cost L input tokens per item, and compressing them removes the token-level supervision. Naive fixes pick one side: a separate dense encoder and SID decoder loses direct attention to distant history and gets one label per forward pass, while merging each item's SIDs into one token keeps the input short but trains on one label per item instead of L. The second is beam decoding cost. A KV cache avoids recomputing the history [16], but every beam still attends over all of it, so cost grows with beam width, and some beams lead to no matching item. The third is diversity. Because beam scores accumulate over levels, the beams collapse onto a few prefixes (11.9 distinct level-1 codes among 100 beams; Table 3), and temperature sampling, the usual remedy, lowers spread further and produces more SIDs that do not exist in the corpus.
Prior work leaves these obstacles open. On input and supervision, every prior design pays on one side. Deployed SID retrievers keep multi-token SIDs in the input and pay at serving [5, 8, 12, 25, 36], as do methods that restructure SIDs to cut decoding steps [13, 20, 30]; COBRA [33] and GPR [14] add a dense token or a second decoder on top and pay even more. SPARC [22] and ACERec [29] take the other side: they merge each item's SIDs into one input token, so they train on one label per item instead of L. On serving cost, speculative decoding [21, 28] and serving co-design [11] accelerate GR but keep full-model wide-beam decoding, and shared-prefix attention [15] has not been applied to SID beam search. On diversity, no GR work diversifies beam search, so the usual knob remains temperature. Finally, embedding GR and SID GR have never been compared head to head online; the only direct comparison, LIGER [32], is offline.
We address all three with PinGER (Pinterest GEnerative Recommender; Figure 1), which interleaves the two item forms in one causal backbone: in training, each history item contributes its L SID tokens followed by one dense token, and every SID token is a prediction target. An asymmetric attention mask lets SID tokens read the dense history and the shallower codes of their own item, while dense tokens read only earlier dense tokens. No later position ever reads a past SID token, so serving drops them and reads the history at one dense token per item, computing exactly the same function (Section 3.3). In training, sparsity-aware attention kernels compute only the entries the mask permits, so a history costs less attention than in TIGER while supplying the same supervision (Section 3.3.4). The model is thus trained with the full SID supervision of TIGER and served at the input cost of embedding GR. For diversity, a hierarchical prefix penalty selects beams one at a time, charging each candidate by the depth of the prefix it shares with beams already chosen (Section 3.5). For serving, cascade attention reads the shared history once per request rather than once per beam, constrained decoding keeps every beam on an SID that exists, and a host-local index resolves SIDs to items without a network call (Section 4).
We deploy PinGER at Pinterest and evaluate it offline and online. Offline, it matches TIGER's Recall@100 while serving 6× fewer tokens, and at equal serving tokens it exceeds TIGER by 9.5% and the production embedding retriever, PinRec, by 3.9× (Section 5.2). At the deployed penalty, the beams span 7.9× more distinct level-1 prefixes than under greedy decoding (Section 5.2.3). End to end, serving is 18 to 31 ms faster at the median than PinRec at matched load (Section 4.4). Online, replacing PinRec with PinGER on Related Pins raises saves by 0.62% and saves of fresh Pins by 3.60% (Section 5.3). A further analysis shows that PinGER surfaces previously undervalued Pins, breaking the engagement feedback loop of recommender systems.
Our contributions are:
• Decoupling input from supervision. The first role-dependent attention mask for GR: SID tokens are supervised in training but read by no later position, so they cost nothing at serving. Unlike TIGER, which pays L tokens per item, or merged-token models, which train on one label per item, PinGER matches
TIGER at 1/L the serving tokens. Role-dependent masks exist outside GR [10, 34].
• Hierarchy-aware beam diversity. The first diversified beam search for GR: a penalty that grows with shared-prefix depth, exact, with W additions per step in one fused kernel per level.
• Cascade decode for SID retrieval. The first use of shared-prefix attention for SID beam decoding, where reparenting a beam reduces to moving an L-token suffix: faster than paged attention at and at , with less KV memory.
• Online evidence. The first head-to-head online A/B between embedding GR and SID GR, deployed on Related Pins at Pinterest.
Efficient beam decoding. Wide-beam SID decoding is the serving bottleneck, and prior work attacks it from two sides. Speculative decoding with draft models or heads [21, 28] and serving co-design [11] accelerate generative recommenders but keep every beam attending over the full history. Paged KV caches [16] and shared-prefix attention [15] share the stored history across beams, yet still read it once per beam; we fold the beam into the query dimension so the history is read once per request (Section 4.1). Decoding must also stay on SIDs the corpus contains: we adopt the vectorized trie of STATIC [26] to constrain each level, and resolve SIDs to items from a host-local index (Section 4.2).
Diverse beam search. In language generation, diverse beam search penalizes beams that choose the same token at the same step [19, 27], a flat penalty with no notion of hierarchy. SIDs are hierarchical, so we charge each candidate by the depth of the prefix it shares with beams already chosen (Section 3.5). We know of no generative retrieval work that diversifies beam search; the usual knob is temperature, which we show lowers both spread and validity.
3 Method
3.1 Background and problem setup
We study the retrieval stage of a sequential recommender, following the setup of PinRec [3] and UniPinRec [18]. A user u interacts with items drawn from a corpus I of order Pins, and their history at time t is the chronological sequence
in which item was acted on with action on surface at time . Writing for the space of such histories, retrieval returns an ordered candidate list for a downstream ranker.
Item representation. We represent each item both as a dense embedding and as an SID , assigned by a tokenizer as residual codes over codebooks of size [25], where denotes its depth- prefix. Retrieval is autoregressive generation of the next item's identifier,
decoded by beam search of width W into a set of SIDs that are then resolved to items.
Section roadmap. Section 3.2 describes the tokenizer , Section 3.3 the sequence layout, the attention mask over it, and the training objective, and Section 3.4 the input features and the conditioning that steers generation. Sections 3.5 and 3.6 then cover decode-time and training-time steering; resolving generated identifiers back to items is a serving concern and is covered in Section 4.
3.2 Semantic IDs
SIDs are encoded from each Pin’s PinCLIP [2] fusion embedding , a content-only vector of the Pin’s image and text. An RQ-VAE [17] quantizes into an SID with codebooks of size , selecting one code vector per level. Because content alone misses the Pin–Pin similarities induced by engagement, we also distill the Pin’s OmniSage [1] embedding , a graph embedding that combines content features with user engagement, into the quantized representation, while keeping as the only input so that SIDs do not change when OmniSage is updated. Training details are in Appendix A.1.
3.3 Interleaved sequence modeling
We use dense tokens on the input side, where one token per item keeps a long history within the context budget, and SIDs on the output side, which remove the ANN index and let decoding shape diversity (Section 3.5). An encoder–decoder would place the two in separate backbones, but its decoder then sees the history only through cross-attention and receives one next-item label per forward pass. We therefore keep both representations within a single causal backbone, with the following designs.
3.3.1 Interleaved layout. During training the user sequence is represented by dense embeddings and SID tokens interleaved. Each history item i contributes consecutive tokens (Figure 2(a)): its
Li et al.
(a) Training: interleaved sequence
L SID tokens + 1 dense token per item

(b) Serving: one token per item
past SID tokens are dropped; the history is plain causal attention

(c) Attention maps and training kernel rows = queries, columns = keys

Figure 2: (a) Interleaved sequence in training. (b) Sequence at serving, with past SID tokens dropped. (c) Training and serving attention maps, and the training kernel's split of a query tile (Section 3.3.4).
SID tokens , embedded by the per-level codebooks, followed by one dense token . All tokens share the position index , so the positional encoding counts items rather than tokens.
3.3.2 Asymmetric mask. Attention is restricted by a single predicate, stated as three rules (Figure 2(c)).
(1) The dense stream is closed. A dense query attends only to dense keys with , never to an SID token.
(2) SID queries read dense history plus their own prefix. The level- SID token of item attends to and to every with .
(3) Nothing else. An SID token never attends to another item's SID tokens, nor to the dense token of its own item.
Rule 3's second half is a causality constraint imported from serving: at decode time the next item's own embedding is precisely the unknown, so a training-time path from to would be unreproducible at inference. Rules 1 and 3 together mean that no position outside item ever attends to item 's SID tokens. Those tokens can therefore be dropped from the sequence without altering any dense hidden state, and hence without altering the distribution over the next identifier. So training runs at tokens per item and serving at one, over the same context and computing the same function of the history: at decode time only the dense tokens are kept, and the sole SID tokens present are those of the beam being extended (Figure 2(b)).
3.3.3 Supervision. The pretraining objective of the sequence model is SID cross-entropy, applied per level with logits weight-tied to the corresponding RQ-VAE codebook and uniform weights across levels. Every SID token is a prediction target; dense positions carry a reserved level identifier and are never targets, so the model is never asked to regress an embedding. A sequence of S tokens, or items, therefore yields next-token predictions per forward pass, where an encoder-decoder supervises only the codes of a single target item. Each prediction is conditioned on the dense history and the true shallower codes of its own item, so level is trained given and , the same condition under which beam search generates it at inference.
3.3.4 Sparsity-aware attention kernels. The asymmetric mask makes serving cheap, but training still runs at tokens per item, and at long contexts attention dominates the step time. Most of this attention is masked. In Figure 2(c), the unmasked entries are the dense-token columns, which every later token reads, and a small triangle per item for its SID tokens. Off-the-shelf sparse attention cannot exploit this structure. FlexAttention [9] skips a block only if it is fully masked. Every block below the diagonal contains part of a dense column, so no block is skipped and the cost equals that of full causal attention.
We instead wrote custom forward and backward kernels for this mask. Each query tile contains whole items, so all of its rows attend to the same earlier dense tokens. The kernel gathers these tokens and computes their attention without a mask. It then computes attention among the tile's own tokens, where each SID token reads the shallower codes of its own item; this is the only part that needs the mask. Online softmax [7] combines the two. The backward pass splits the work by key: dense keys reduce to causal attention over the dense tokens, and each SID key is read only by tokens of its own item. Compared with TIGER, the attention cost is lower by a factor of about despite the extra token per item (Appendix A.2). At serving, the mask reduces to standard causal attention, so these kernels are not needed.
We further drop the level-L SID token from the training input, since the dense token that follows it is never a prediction target (Figure 3) and no later token attends to it. This keeps every target and shortens the sequence to L tokens per item. Together, the two changes raise training throughput by 94% over a plain TIGER model at the same context length.
3.4 Feature embeddings and goal conditioning
We adopt the feature set of PinRec [3] and UniPinRec [18], and the outcome-conditioned generation of PinRec. Under the interleaved layout the features are attached to each of an item's L SID tokens and to its dense token, and the conditioning is applied once per SID token. Figure 3 shows the resulting dataflow.
Item features. By Rule 1 the dense token is the only channel through which item i reaches later positions, so it is where the item's

Figure 3: The interleaved sequence model: event features at every position, SID fusion producing the dense token, goal conditioning at every level head, per-level cross-entropy, and DPO post-training (dashed; Section 3.6).
representation is assembled. The item representation concatenates two pretrained embeddings, each projected and -normalized: a content-only PinCLIP multimodal embedding [2], and a graph embedding OmniSage [1] that incorporates collaborative engagement signal. Because the graph embedding never reaches the tokenizer, collaborative signal can be carried in the sequence and updated as engagement evolves, with no refresh of the SIDs.
SID fusion module. The item’s SID embeddings serve twice: they occupy their own positions in the sequence, and they are also folded into by a SID fusion module – a single causal attention layer over the item’s tokens , read out at the dense position. Fusion adds no content beyond , since the tokenizer quantizes the same multimodal embedding; what it adds is a discrete view of the item – a position in the corpus hierarchy, over which the model can generalize when generating coarse prefixes, and a stable identity that frequent items can be memorized by. The feature therefore costs no extra input positions.
Event features. Each position also carries the timestamp, surface and action type of its event. These are concatenated with the position’s own embedding and projected, so position p of item i receives
where is the codebook embedding at the level- SID position and at the dense position. Following PinRec [3], encodes the absolute timestamp and the gap to the preceding position with sinusoids (Appendix A.3).
Goal conditioning. Like PinRec, we generate toward a desired outcome rather than an arbitrary next item. The goal vector concatenates embeddings of the target action and surface with an encoding of the request time, , and is appended to the hidden state before each level head,
where is the level- head and its output embeddings. Conditioning every level lets the goal steer both the coarse levels, which pick a region of the corpus, and the fine levels within it. At serving, the caller supplies the action, surface and time it wants, in the same form as the event features of past interactions. Conditioning controls what kind of item is generated, and the diversity penalty (Section 3.5) spreads the beam across items of that kind.
3.5 Decode-time steering: prefix diversity
Prefix collapse. The beam score accumulates over levels, so at each level the ranking is dominated by the prefixes already chosen. The W best continuations of one strong prefix usually outscore the best continuation of any other, and top-W selection keeps the beam inside a few subtrees. Because prefixes are semantic (Section 3.2), the retained beams are also similar in content: at W=100 they span only 11.9 distinct level-1 codes (Table 3).
Why not temperature sampling. Temperature sampling does not recover the lost spread: both spread and lookup@L degrade monotonically in T (Table 3). Sampling perturbs selection but not scoring, so beams admitted on improbable codes are outscored at the next level and their slots return to the dominant subtrees. The final level has no later level to prune a poor draw, so that is where temperature hallucinates and validity collapses: the generated identifiers name no corpus item. We therefore keep decoding greedy and introduce a prefix diversity penalty into the selection rule.
Hierarchical prefix penalty. At level , each parent beam and code form a candidate with score , where is the parent's accumulated score. Instead of taking the top candidates at once, we select the beams one at a time. Let be the number of beams already taken from parent , its -th best code, and the length of the longest common prefix of parents and . The next beam is
Li et al.
GPU: cascade decode

GPU: constrained decoding
CPU: in-memory resolution
keep only codes that extend a prefix in the corpus
index mmap'd once per host, shared by all replicas
Figure 4: The serving path: cascade decode, which splits beam attention into a shared history pass and a per-beam suffix pass; constrained decoding over the SID trie; and in-memory resolution of SIDs to items.
Each parent is penalized by the beams already chosen that share its prefix, weighted by the length of the shared prefix, so beams that agree at deeper levels are penalized more. With the rule reduces to top-W selection. The penalties are updated incrementally, with W additions per selected beam, and each level runs as one fused GPU kernel (Appendix A.4). Section 5.2.3 evaluates the trade-off between spread and recall.
3.6 Post-training: training-time steering
The pretrained model of Equation 2 is trained with a next-token loss on engaged items only, which has two problems. First, it has no contrastive loss to push the model away from negatives. Second, it is teacher-forced on individual codes, with no item-level objective that matches autoregressive decoding at inference. As a result, what the model retrieves is poorly aligned with what the ranker scores highly. We therefore post-train with DPO [24].
Preference pairs are sampled from the serving logs, where every impression is stored with the utility the production ranker computed at request time. Within each slate we sort items by this utility and pair the top three against the bottom three. Whereas OneRec [8] trains a separate reward model to label such pairs, we use the ranker's logged scores directly, so no reward model is trained or served.
Let be the log-probability the policy assigns to the prefix given the history , and the same under the frozen pretrained model. For a pair the DPO loss at level is
and we sum it over so that the coarse levels are trained as well. Subtracting the reference margin means the loss stops pushing on pairs the pretrained model already orders correctly. The total loss is , where is the pretraining next-identifier loss on the engaged items of the same slates. The anchor is necessary: with the DPO term alone, the policy drifts from the reference and recall collapses within a few thousand steps.
4 Serving Infrastructure
The serving stack inherits from the PinRec [3] and UniPinRec [18] deployments: a Triton inference server driving the transformer forward pass, with their feature fetch, request batching and ensemble routing unchanged. SID generation and Pin retrieval add

Figure 5: (a) Latency and (b) KV memory of one attention call at one layer, on one A10G (B=4, S=1018).
requirements that stack does not meet, which we address with three changes. Cascade decode applies shared-prefix attention [15] to beam decoding, so a request walks its history once rather than once per beam (Section 4.1). Constrained decoding restricts every level to codes the corpus contains, using the vectorized static trie of STATIC [26] held once per host (Section 4.2). Resolution maps each generated identifier to items through an in-memory, host-local index (Section 4.3). Section 4.4 reports the three composed.
4.1 Cascade decode
During decoding, all beams of a request share the user history, about tokens at serving, and differ only in the at most SID tokens generated so far. A contiguous KV cache gives each beam its own copy of the history, so memory grows as . PagedAttention [16] shares the history in fixed-size blocks, but two costs remain. A beam still copies every block it writes to, and since is far smaller than the block size (a multiple of 256 in the flash-attention kernel we use), most of each copied block is wasted. And each of the beams is a separate query row that reads the whole history again, so the cost grows linearly in .
We instead fold the beam into the query dimension. The query becomes a tensor attending to a history indexed by alone, so each request reads its history once for all beams, with no causal mask since the beams are siblings at the same decode step. Each beam then attends to its own suffix buffer, which holds only the current item's generated tokens. The two attentions return their outputs and log-sum-exps, which combine exactly into attention over the full sequence [15]; our kernel fuses the suffix attention and this merge into a single launch (Figure 4).
Figure 5 compares one attention call against a flat per-beam cache and a paged cache. The three are nearly identical at . As the beam widens, flat and paged attention grow linearly in , whereas cascade grows only from to ; it is faster than paged attention at and faster at . Memory follows the same pattern: cascade holds less KV than the paged cache at and less at , since only the small suffix buffers grow with the beam.
4.2 Constrained decoding
Unconstrained beam search can emit any of the codes at every level, so a generated SID may name no item in the corpus. Without a constraint, only about of generated SIDs resolve at level 5 (87% at level 4 and 98% at level 3), and the misses fall back to a coarser prefix than the one the model chose. Checking validity on the host at every level would stall the GPU inside the decode step.
Following STATIC [26], we keep the trie of valid prefixes on the GPU as static tensors. The first two levels are dense validity masks of size and . Deeper levels are sparse, so we store them in compressed sparse row form: prefixes are sorted, an offsets array marks where each prefix's children start, and a values array lists the children. A beam's state is the index of its prefix, so one batched gather reads the allowed codes of all beams, and after a beam picks a code, its new state is the start of its run plus the rank of the code within it. Decoding thus needs no pointer chasing and no host round trip, and runs inside the compiled decode graph. Codes outside the allowed set are masked to after the log-softmax, leaving top- expansion and the diversity penalty (Section 3.5) unchanged, and every beam then resolves at level 5. All replicas on a GPU share one copy of the trie through CUDA IPC. The constraint adds 0.30 and 0.59 ms to decoding at and (9.8% and 5.9%), nearly independent of corpus size, and the trie occupies only 168 and 1,368 MiB of GPU memory for corpora of 10 M and 100 M items (Table 6 in Appendix A).
4.3 In-memory serving
Once decoded, each beam's identifier and its coarser prefixes must be resolved to items. We serve this from a host-resident index, rebuilt daily. As in Section 4.2, each level is stored in compressed sparse row form: the keys are the SID prefixes in sorted order, the offsets mark where each prefix's item signatures start and end, and the values are the signatures themselves, so a lookup is one vectorized binary search plus a slice. Storing item signatures in addition to transitions requires roughly the decoding trie's memory. The indices are written once and memory-mapped read-only, so a single physical copy per host serves every replica.
Resolving at the finest level may not yield enough items, since a single level- prefix usually holds only a few. A beam that comes up short falls back to its coarser prefixes, widening the neighborhood one level at a time. Candidates are interleaved across beams round-robin, so a crowded leaf cannot monopolize the slate.
Table 1: Serving latency (ms) and GPU memory against PinRec at 200 QPS per host, on an AWS g6e host (NVIDIA L40S).
| e2e p50 | e2e p99 | model p99 | retrieval p99 | mem. % | |
|---|---|---|---|---|---|
| embedding | 79 | 110 | 24 | 31 | 40 |
| W=30 | 48 | 73 | 12 | 4 | 52 |
| W=60 | 51 | 77 | 13 | 8 | 52 |
| W=100 | 54 | 81 | 14 | 12 | 52 |
| W=250 | 61 | 92 | 20 | 19 | 52 |
| 60 | 93 | 23 | 16 | 53 |
Model: embedding forward pass or beam decoding; retrieval: remote nearest-neighbor call or host-local resolution. Diversity penalty disabled.
4.4 End to end: the composed system
We compare PinGER at five beam widths with PinRec at the same user sequence length and matched per-host load (Table 1). The two share a serving stack and differ only in model inference and Pin resolution. PinGER is faster at every beam width, mostly because retrieval moves onto the host: the host-local index replaces PinRec's remote nearest-neighbor call, which costs 31 ms at p99, and stays under 20 ms at p99 at every width.
Widening the beam adds latency to both decode and resolution, since each additional beam is another prefix to resolve, but not memory: GPU memory stays flat across beam widths, the serving counterpart of Figure 5(b), because cascade attention holds the history once however wide the beam.
5 Experiments
5.1 Shared setup
Datasets. We use the session-centric data of UniPinRec [18]. Each example pairs a user's historical action sequence, the Pins they engaged with across surfaces together with the action type, surface and time of each engagement, with a session from the target surface whose engaged Pins serve as targets. Examples are sampled by session rather than by user, so that the data reflects actual traffic. Evaluation uses held-out users in a later, non-overlapping time window, disjoint from training, and generated identifiers are resolved against the full production corpus.
Metrics. Offline we report Recall@k for at beam width W=100: the fraction of held-out next interactions whose SID is among the top k generated identifiers, micro-averaged over users. For the diversity analysis we also report distinct@1, the number of distinct level-1 prefixes among the W beams, and lookup@L, the share of generated SIDs that resolve to items in the production corpus. Online we report production A/B metrics (Section 5.3).
Implementation details. The backbone is a decoder-only transformer with 4 layers, hidden size 768 and 12 attention heads of dimension 64, with as many key-value heads as query heads. The SID fusion module is a single attention layer with 4 heads. Each SID has L=5 levels, each drawn from a codebook of K=2048 codes. Evaluation decodes greedily unless stated otherwise.
Li et al.
Table 2: Recall@100 of PinGER, TIGER and PinRec at the same serving cost and at the same recall, beam width 100.
| model | context length | serving | R@100 (%) | |
|---|---|---|---|---|
| Same serving cost | ||||
| PinRec | 1,024 | 1,024 | 1.01 | |
| TIGER | 1,024 | 1,024 | 3.65 | |
| PinGER | 6,144 | 1,024 | 4.00 | +9.5% |
| Same recall | ||||
| TIGER | 1,024 | 1,024 | 3.65 | |
| PinGER | 1,024 | 170 | 3.64 | 6.0× fewer |
Context length is the training context length; serving is the number of tokens read at serving time.
5.2 Offline results
5.2.1 Main comparison. Table 2 compares PinGER with PinRec and TIGER at matched cost. Context length is counted in tokens, and the two SID layouts spend it differently: TIGER uses L=5 tokens per history item and ours L+1, so at a fixed training context length TIGER sees slightly more items. At serving the asymmetry reverses: TIGER still reads every SID token, while PinGER reads one dense token per item, six times fewer. At the same 1,024 serving tokens PinGER's Recall@100 is therefore 9.5% higher than TIGER's and 3.9× PinRec's, and to match TIGER's recall it needs only 170 tokens.
This efficiency matters because history length matters. Both TIGER and PinGER gain about 10% in Recall@100 as the training context length grows from 1,024 to 6,144 tokens, and neither has saturated: each step up in context length still improves both (Table 5). With its efficient token usage, PinGER can capture these gains from longer history without a serving cost that scales with the number of SID tokens per item.
5.2.2 Ablations. Table 8 in Appendix A removes one component of Section 3.4 at a time, and we report the change in Recall@100. SID fusion matters most: without it Recall@100 falls by 27.0%, since the dense token is then built from the item features alone, without the item's own SID tokens. Goal conditioning is next, at 17.0%. The two item embeddings matter far less. Removing PinCLIP leaves recall essentially unchanged (Δ≈0): PinCLIP is redundant once its SIDs are in the input, since the SIDs are quantized from the PinCLIP embedding (Section 3.2) and SID fusion carries them into the dense token. Removing OmniSage costs 1.2%, as its engagement signal is only partly distilled into the SIDs.
5.2.3 Diversity penalty. Table 3 sweeps the prefix-diversity penalty λ on the 6,144-token model and, for comparison, the sampling temperature T. The penalty raises distinct level-1 prefixes among the 100 beams from 11.9 under greedy decoding to 93.6 at λ=3, while the top-10 lookup rate barely moves and recall falls only modestly. Greedy decoding concentrates the beam in the most probable subtrees, where the single held-out item usually lies, so spreading it trades next-item recall for coverage of the user's other interests. Temperature, by contrast, fails on both counts, for the reason given in Section 3.5. It unexpectedly lowers diversity, to 3.5 distinct prefixes at T=1.5, and only 13% of the top-10 identifiers exist in the corpus, against 74% under greedy decoding, so most of what temperature generates cannot be served. Recall@100 falls
Table 3: Diversity penalty λ versus sampling temperature T, beam width 100. Recall and lookup in %.
| decoding | R@10 | R@100 | distinct@1 | lookup@L top10 | lookup@L all |
|---|---|---|---|---|---|
| greedy | 1.54 | 4.00 | 11.9 | 74.3 | 60.6 |
| λ=0.3 | 1.35 | 2.86 | 39.4 | 74.1 | 61.6 |
| λ=0.5 | 1.26 | 2.47 | 49.9 | 73.9 | 59.6 |
| λ=1.0 | 1.14 | 2.07 | 68.3 | 73.4 | 55.3 |
| λ=3.0 | 0.93 | 1.42 | 93.6 | 72.3 | 50.5 |
| T=0.7 | 0.74 | 2.27 | 7.0 | 50.3 | 36.5 |
| T=1.5 | 0.20 | 0.60 | 3.5 | 13.2 | 8.0 |
accordingly, by 43% at T=0.7 and 85% at T=1.5, against 28.5% for the mildest penalty. The penalty therefore outperforms temperature sampling: at comparable settings it yields more diverse and more valid beams, and retains more recall.
5.2.4 Post-training. We also post-train the same model with the DPO of Section 3.6. Offline, post-training lifts recall by 2.3% and the difference in the log-likelihood between engaged and impression-only items by 86%. Online, the retrieved identifiers align better with the ranker, with a 10% improvement in candidate survival rate in the final slate.
5.3 Online A/B testing
We deploy PinGER on two surfaces, Related Pins and notifications, each in an A/B experiment against PinRec [3], the production embedding retriever, at a fixed candidate budget. All reported lifts are statistically significant at the 5% level (two-sided test).
5.3.1 Related Pins. Related Pins recommends Pins related to the one a user is viewing. We replace PinRec's nearest-neighbor retrieval path with PinGER, decoding with beam width 60 and diversity penalty λ=3.0, and resolving identifiers from level 5 down to level 3, over a two-week experiment. Table 4 shows gains on the surface that carry over site-wide: surface saves rise by 0.62% and grid clicks by 0.94%, and site-wide saves by 0.61%. The largest lift is on fresh content, where saves of Pins created in the last 28 days rise by 3.60%. We attribute this to the identifiers being derived from content embeddings (Section 3.2): a new Pin is retrievable as soon as it has an SID, whereas PinRec depends on engagement embeddings that take weeks to stabilize. Removing the nearest-neighbor index also retires its serving fleet, saving its infrastructure cost, and lowers Related Pins latency by 0.7%.
Effect of the diversity penalty. Users are also shown, and adopt, a wider range of interests, with 0.56% more novel interests impressed and 0.43% more interest domains adopted, the online counterpart of the beam diversity in Section 5.2.3. These gains depend on the penalty's strength. A separate arm with a weaker penalty, λ=1.0, lifts novel interests by only 0.36%, interest domains by 0.10% and grid clicks by 0.77%, and leaves surface impressions (+0.37%) and saves (-0.38%) without a significant change. The stronger penalty costs more recall offline (Table 3), but online it is the setting that pays.
Table 4: Online A/B results on Related Pins and notifications, relative to PinRec at an equal candidate budget.
| surface | type | metric | lift |
|---|---|---|---|
| Related Pins | Surface | saves / impressions | +0.62 / +0.70% |
| grid clicks | +0.94% | ||
| time spent | +0.34% | ||
| fulfilled sessions | +0.35% | ||
| Site-wide | saves / impressions | +0.61 / +0.59% | |
| sessions >5 min | +0.22% | ||
| Freshness | saves / impr., Pins <28 days | +3.60 / +4.90% | |
| Diversity | novel interests / domains | +0.56 / +0.43% | |
| System | latency | -0.7% | |
| Notifications | Engagement | email click / push open rate saves from notifications | +0.90 / +0.25% +0.62% |
Segment analysis. An in-depth analysis traces the engagement gains to three groups (Table 7 in Appendix A). (1) High-utility Pins: among the top decile of Pins by engagement, PinGER's candidates take a larger share and have a higher save rate, even though the ranker places them lower than PinRec's. (2) Undervalued Pins: PinGER surfaces more Pins with little prior engagement, and these Pins have a higher save rate. This breaks the feedback loop common in traditional recommenders, where items that are already engaged are surfaced ever more often. (3) Most active users: the users who engage most receive a larger share of PinGER's candidates and save them more often, which we attribute to a more diverse and fresher feed.
5.3.2 Notifications. Pinterest's email and push notifications recommend Pins to bring users back to the platform. Here PinGER supplies half of the candidate pool, replacing PinRec candidates so that the total budget is unchanged, decoding with beam width 100 and diversity penalty . Table 4 shows consistent gains in notification engagement. Unlike Related Pins, a stronger penalty, , gave a smaller click-rate gain, , and raised unsubscribes, so we deploy the milder setting: beyond a point, diversity in a short notification slate costs more than it returns.
6 Conclusion
We presented PinGER, a generative retriever deployed at Pinterest. An asymmetric attention mask over interleaved SID and dense tokens lets the model train with SID supervision at every position and serve the history at one token per item, and a serving stack built for wide beams removes nearest-neighbor search from the request path.
Future work includes sharing a single SID-based backbone between retrieval and ranking, in the spirit of UniPinRec [18], and applying the interleaved layout to LLM-based recommenders [4, 12], whose multi-token item representations limit the history that fits in their context.
References
[1] Anirudhan Badrinath et al. 2025. OmniSage: Large Scale, Multi-Entity Heterogeneous Graph Representation Learning. arXiv preprint (2025).
[2] Josh Beal et al. 2026. Pinterest Multimodal Embeddings for Content Understanding. arXiv preprint (2026).
[3] Edoardo Botta, Jaewon Yang, Yi-Ping Hsu, Laksh Bhasin, Yilin Chen, Prabhat Agarwal, Anirudhan Badrinath, Jiajing Xu, and Charles Rosenberg. 2026. PinRec: Unified Generative Retrieval for Pinterest Recommender Systems. In Proceedings of the ACM SIGKDD Conference on Knowledge Discovery and Data Mining (KDD). doi:10.1145/3770855.3818462
[4] Junyi Chen, Lu Chi, Bingyue Peng, and Zehuan Yuan. 2024. HLLM: Enhancing Sequential Recommendations via Hierarchical Large Language Models for Item and User Modeling. arXiv preprint arXiv:2409.12740 (2024). doi:10.48550/ARXIV.2409.12740
[5] Liam Collins, Jiwen Ren, Donald Loveland, Bhuvesh Kumar, Clark Mingxuan Ju, Xuan Guo, Mo Li, Alvin Hou, Yi Cui, Peng Yang, Jian Wang, Saud Afzal Shafi, Nga Than, Ruiming Lu, Wenfeng Zhuo, Dongheng Li, Lili Zhang, Mingtao Zhang, Jinchao Ye, Vincent Xue, Chunhui Zhu, and Neil Shah. 2026. LLM-Based Generative Retrieval for Snapchat Content Recommendation. arXiv preprint arXiv:2607.28895 (2026). doi:10.48550/ARXIV.2607.28895
[6] Paul Covington, Jay Adams, and Emre Sargin. 2016. Deep Neural Networks for YouTube Recommendations. In Proceedings of the ACM Conference on Recommender Systems. 191–198. doi:10.1145/2959100.2959190
[7] Tri Dao. 2023. FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning. arXiv:2307.08691 [cs.LG] https://arxiv.org/abs/2307.08691
[8] Jiaxin Deng, Shiyao Wang, Kuo Cai, Lejian Ren, Qigen Hu, Weifeng Ding, Qiang Luo, and Guorui Zhou. 2025. OneRec: Unifying Retrieve and Rank with Generative Recommender and Iterative Preference Alignment. arXiv preprint arXiv:2502.18965 (2025). doi:10.48550/ARXIV.2502.18965
[9] Juechu Dong, Boyuan Feng, Driss Guessous, Yanbo Liang, and Horace He. 2024. FlexAttention: A Programming Model for Generating Optimized Attention Kernels. arXiv preprint arXiv:2412.05496 (2024).
[10] Li Dong, Nan Yang, Wenhui Wang, Furu Wei, Xiaodong Liu, Yu Wang, Jianfeng Gao, Ming Zhou, and Hsiao-Wuen Hon. 2019. Unified Language Model Pretraining for Natural Language Understanding and Generation. In Advances in Neural Information Processing Systems. 13042–13054.
[11] Zhou Fang, Yuhang Huang, Ang Zhang, Yihan He, Ruichao Xiao, Chao Li, Yavuz Yetim, Sibyl Yang, Xiaohan Wei, Fei Tian, Liang Wang, Chonglin Sun, Liyuan Li, Nathan Yan, and Gaoxiang Liu. 2026. GRACE: Generative Recommender Acceleration Engine for Real-Time Ads Retrieval. arXiv preprint arXiv:2608.00938 (2026). doi:10.48550/ARXIV.2608.00938
[12] Ruining He, Lukasz Heldt, Lichan Hong, Raghunandan H. Keshavan, Shifan Mao, Nikhil Mehta, Zhengyang Su, Alicia Tsai, Yueqi Wang, Shao-Chuan Wang, Xinyang Yi, Lexi Baugher, Baykal Cakici, Ed H. Chi, Cristos Goodrow, Ningren Han, He Ma, Römer Rosales, Abby Van Soest, Devansh Tandon, Su-Lin Wu, Weilong Yang, and Yilin Zheng. 2026. PLUM: Adapting Pre-trained Language Models for Industrial-scale Generative Recommendations. In Proceedings of the ACM Web Conference. 8093–8104. doi:10.1145/3774904.3792802
[13] Yupeng Hou, Jiacheng Li, Ashley Shin, Jinsung Jeon, Abhishek Santhanam, Wei Shao, Kaveh Hassani, Ning Yao, and Julian J. McAuley. 2025. Generating Long Semantic IDs in Parallel for Recommendation. In Proceedings of the ACM SIGKDD Conference on Knowledge Discovery and Data Mining. 956–966. doi:10.1145/3711896.3736979
[14] Jie Jiang, Jun Zhang, Yi Li, Yue Liu, Changping Wang, Yuan Wang, Yuling Xiong, Xun Liu, Haiyang Wu, Qian Li, Enming Zhang, Jiawei Sun, Xin Xu, Zishuai Zhang, Ruoran Liu, Suyuan Huang, Zhaoxin Zhang, Zhengkai Guo, Shuojin Yang, Menghao Guo, Huan Yu, and Shi-Min Hu. 2026. GPR: Towards a Generative Pre-trained One-Model Paradigm for Large-Scale Advertising Recommendation. In Proceedings of the ACM SIGKDD Conference on Knowledge Discovery and Data Mining. 7477–7488. doi:10.1145/3770855.3818425
[15] Jordan Juravsky, Bradley Brown, Ryan Ehrlich, Daniel Y. Fu, Christopher Ré, and Azalia Mirhoseini. 2024. Hydragen: High-Throughput LLM Inference with Shared Prefixes. arXiv preprint arXiv:2402.05099 (2024).
[16] Woosuk Kwon, Zhuohan Li, Siyuan Zhuang, Ying Sheng, Lianmin Zheng, Cody Hao Yu, Joseph E. Gonzalez, Hao Zhang, and Ion Stoica. 2023. Efficient Memory Management for Large Language Model Serving with PagedAttention. In Proceedings of the 29th ACM Symposium on Operating Systems Principles (SOSP).
[17] Doyup Lee, Chiheon Kim, Saehoon Kim, Minsu Cho, and Wook-Shin Han. 2022. Autoregressive Image Generation using Residual Quantization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR).
[18] Hanyu Li, Yi-Ping Hsu, Aditya Mantha, Prabhat Agarwal, Laksh Bhasin, Jialu Wang, Hongtao Lin, Bella Huang, Yaxin Li, Xinyi Li, Chuxi Wang, Kousik Rajesh, Hooshmand Shokri Razaghi, Shunyao Li, Zongyue Qin, Jaewon Yang, James Li, Dhruvil Deven Badani, Jiajing Xu, and Charles Rosenberg. 2026. UniPinRec: Unifying Generative Retrieval and Ranking at Pinterest Scale. In Proceedings of the 20th ACM Conference on Recommender Systems (RecSys). doi:10.1145/3773078.3831921
[19] Jiwei Li, Will Monroe, and Dan Jurafsky. 2016. A Simple, Fast Diverse Decoding Algorithm for Neural Generation. arXiv preprint arXiv:1611.08562 (2016).
[20] Xinyu Lin, Haihan Shi, Wenjie Wang, Fuli Feng, Qifan Wang, See-Kiong Ng, and Tat-Seng Chua. 2025. Order-agnostic Identifier for Large Language Model-based
Li et al.
Generative Recommendation. In Proceedings of the International ACM SIGIR Conference on Research and Development in Information Retrieval. 1923–1933. doi:10.1145/3726302.3730053
[21] Xinyu Lin, Chaoqun Yang, Wenjie Wang, Yongqi Li, Cunxiao Du, Fuli Feng, See-Kiong Ng, and Tat-Seng Chua. 2025. Efficient Inference for Large Language Model-based Generative Recommendation. In Proceedings of the International Conference on Learning Representations.
[22] Chang Liu, Changfa Wu, Hui Qian, Binbin Cao, Jian Wu, Yuliang Yan, Zhu Han, and Bo Zheng. 2026. SPARC: Sequence-aware Progressive Attribute Routing and Compression Framework for Generative Recommendation. arXiv preprint arXiv:2607.25339 (2026). doi:10.48550/ARXIV.2607.25339
[23] Xiaodong Liu, Congfei Zhang, Hsiang wei Chao, Siman Wang, Tong Zhao, Xiao Bai, Vincent Zhang, Jingxiao Ma, Zhe Liu, Wenfeng Zhuo, Zichu Li, Jitin Krishnan, Yunzhi Zhou, Yajun Wang, Jinchao Li, and Yu Zhang. 2026. EGR: Embedding-Native Generative Retrieval with a Shared LLM. arXiv preprint arXiv:2607.23038 (2026). doi:10.48550/ARXIV.2607.23038
[24] Rafael Rafailov, Archit Sharma, Eric Mitchell, Christopher D. Manning, Stefano Ermon, and Chelsea Finn. 2023. Direct Preference Optimization: Your Language Model is Secretly a Reward Model. In Advances in Neural Information Processing Systems (NeurIPS).
[25] Shashank Rajput, Nikhil Mehta, Anima Singh, Raghunandan Hulikal Keshavan, Trung Vu, Lukasz Heldt, Lichan Hong, Yi Tay, Vinh Q. Tran, Jonah Samost, Maciej Kula, Ed H. Chi, and Mahesh Sathiamoorthy. 2023. Recommender Systems with Generative Retrieval. In Advances in Neural Information Processing Systems.
[26] Zhengyang Su, Isay Katsman, Yueqi Wang, Ruining He, Lukasz Heldt, Raghunandan Keshavan, Shao-Chuan Wang, Xinyang Yi, Mingyan Gao, Onkar Dalal, et al. 2026. 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 V. 2. 8009–8020.
[27] Ashwin K. Vijayakumar, Michael Cogswell, Ramprasath R. Selvaraju, Qing Sun, Stefan Lee, David Crandall, and Dhruv Batra. 2018. Diverse Beam Search for Improved Description of Complex Scenes. In Proceedings of the AAAI Conference on Artificial Intelligence (AAAI).
[28] Yejing Wang, Shengyu Zhou, Jinyu Lu, Ziwei Liu, Langming Liu, Maolin Wang, Wenlin Zhang, Feng Li, Wenbo Su, Pengjie Wang, Jian Xu, and Xiangyu Zhao. 2026. NEZHA: A Zero-sacrifice and Hyperspeed Decoding Architecture for Generative Recommendations. In Proceedings of the ACM Web Conference. 8073–8082. doi:10.1145/3774904.3792797
[29] Ming Xia, Zhiqin Zhou, Guoxin Ma, and Dongmin Huang. 2026. Unleash the Potential of Long Semantic IDs for Generative Recommendation. arXiv preprint arXiv:2602.13573 (2026). doi:10.48550/ARXIV.2602.13573
[30] Tianlu Xie, Xin Ku, Mingjie Sun, Yunhao Sha, Lixiang Wang, Peng Wang, Yiyu Wang, Wenjin Wu, Zhaojie Liu, Peng Jiang, and Wenwu Ou. 2026. From a Static Multi-Level Small Semantic Codebook to a Dynamic Single-Level Large Semantic Codebook for Generative Recommendation. arXiv preprint arXiv:2608.21012 (2026). doi:10.48550/ARXIV.2608.21012
[31] Zhe Xu, Prachi Agrawal, Kavosh Asadi, Tianyi Chen, Carl Hu, Justin Johnson, Wuwei Lan, Mingfu Liang, Xi Liu, Tik On Lui, Oladipo Ositelu, Sandeep Pandey, Ankit Peshin, Feng Qi, Anil Ramakrishna, Kaushik Rangadurai, Frank Shyu, Luke Simon, Yang Yang, and Chiyu Zhang. 2026. The Case Against Generation for Retrieval: Discriminative Language Models as Effective Retrievers. arXiv preprint arXiv:2607.25346 (2026). doi:10.48550/ARXIV.2607.25346
[32] Liu Yang, Fabian Paischer, Kaveh Hassani, Jiacheng Li, Shuai Shao, Zhang Gabriel Li, Yun He, Xue Feng, Nima Noorshams, Sem Park, Bo Long, Robert D. Nowak, Xiaoli Gao, and Hamid Eghbalzadeh. 2025. Unifying Generative and Dense Retrieval for Sequential Recommendation. Transactions on Machine Learning Research (2025).
[33] Yuhao Yang, Zhi Ji, Zhaopeng Li, Yi Li, Zhonglin Mo, Yue Ding, Kai Chen, Zijian Zhang, Jie Li, Shuanglong Li, and Liu Lin. 2025. Sparse Meets Dense: Unified Generative Recommendations with Cascaded Sparse-Dense Representations. In Advances in Neural Information Processing Systems.
[34] Zhilin Yang, Zihang Dai, Yiming Yang, Jaime G. Carbonell, Ruslan Salakhutdinov, and Quoc V. Le. 2019. XLNet: Generalized Autoregressive Pretraining for Language Understanding. In Advances in Neural Information Processing Systems. 5754–5764.
[35] Jiaqi Zhai, Lucy Liao, Xing Liu, Yueming Wang, Rui Li, Xuan Cao, Leon Gao, Zhaojie Gong, Fangda Gu, Jiayuan He, Yinghai Lu, and Yu Shi. 2024. Actions Speak Louder than Words: Trillion-Parameter Sequential Transducers for Generative Recommendations. In Proceedings of the International Conference on Machine Learning. 58484–58509.
[36] Guorui Zhou, Hengrui Hu, Hongtao Cheng, Huanjie Wang, Jiaxin Deng, Jinghao Zhang, Kuo Cai, Lejian Ren, Lu Ren, Liao Yu, Pengfei Zheng, Qiang Luo, Qianqian Wang, Qigen Hu, Rui Huang, Ruiming Tang, Shiyao Wang, Shujie Yang, Tao Wu, Wuchao Li, Xinchen Luo, Xingmei Wang, Yi Su, Yunfan Wu, Zexuan Cheng, Zhanyu Liu, Zixing Zhang, Bin Zhang, Boxuan Wang, Chaoyi Ma, Chengru Song, Chenhui Wang, Chenglong Chu, Di Wang, Dongxue Meng, Dunju Zang, Fan Yang, Fangyu Zhang, Feng Jiang, Fuxing Zhang, Gang Wang, Guowang Zhang, Han Li, Honghui Bao, Hongyang Cao, Jiaming Huang, Jiapeng Chen, Jiaqiang
Liu, Jinghui Jia, Kun Gai, Lantao Hu, Liang Zeng, Qiang Wang, Qidong Zhou, Rongzhou Zhang, Shengzhe Wang, Shihui He, Shuang Yang, Siyang Mao, Sui Huang, Tiantian He, Tingting Gao, Wei Yuan, Xiao Liang, Xiaoxiao Xu, Xugang Liu, Yan Wang, Yang Zhou, Yi Wang, Yiwu Liu, Yue Song, Yufei Zhang, Yunfeng Zhao, Zhixin Ling, and Ziming Li. 2025. OneRec-V2 Technical Report. arXiv preprint arXiv:2508.20900 (2025). doi:10.48550/ARXIV.2508.20900
A Additional detail
Table 5: Full context-length sweep, beam width 100: Recall@100 of PinRec, and of TIGER and PinGER each trained at three context lengths, with the serving length each requires.
| context length | model | items | R@100 (%) | serving |
|---|---|---|---|---|
| 1,024 | PinRec | 1,024 | 1.01 | 1,024 |
| 1,024 | TIGER | 204 | 3.65 | 1,024 |
| PinGER | 170 | 3.64 | 170 | |
| 2,048 | TIGER | 409 | 3.88 | 2,048 |
| PinGER | 341 | 3.78 | 341 | |
| 6,144 | TIGER | 1,228 | 4.06 | 6,144 |
| PinGER | 1,024 | 4.00 | 1,024 |
Context length and serving in tokens; items is the history length that context length holds.
Table 6: Cost of constrained decoding on one A10G. Latency ms, resident trie MiB; uniform-random corpora bound both columns from above.
| W=100 | W=400 | resident | B/SID | |
|---|---|---|---|---|
| unconstrained | 3.007 | 10.115 | - | - |
| 10 M corpus | +0.295 | +0.596 | 168.0 | 17.6 |
| 100 M corpus | +0.298 | +0.593 | 1,367.8 | 14.3 |
Table 7: Segment analysis on Related Pins: PinGER's candidates against PinRec's. Share is the relative change in the segment's share of the retriever's impressions; save rate is the relative change in the segment's save rate.
| segment | share | save rate |
|---|---|---|
| top 10% of utility | +23% | +5.4% |
| of these, in the top 5 slots | -19% | +4.2% |
| Pins with the fewest prior saves* | +20% | +13% |
| most active users | +46% | +12% |
*Lowest decile of saves over the prior seven days. †Top segment by saves over the prior seven days.
A.1 Tokenizer training
The MLP encoder maps to a latent . A residual quantizer then produces the discrete code and a quantized vector , from which the decoder reconstructs . Let be the residual at
Table 8: Ablations at a 6,144-token context, beam width 100. Recall in %; is relative to the full model.
| R@10 | R@100 | |||
|---|---|---|---|---|
| full model | 1.54 | — | 4.00 | — |
| – PinCLIP | 1.56 | * | 4.04 | * |
| – OmniSage | 1.50 | 3.95 | ||
| – goal conditioning | 1.38 | 3.32 | ||
| – SID fusion | 0.98 | 2.92 |
*No measurable change (+1.6% and +1.1%).
level and the selected code vector. We train with the standard RQ-VAE objective
where denotes the stop-gradient and weights the commitment term. Codebooks are updated by gradient descent on this loss.
Engagement distillation. User interactions induce Pin–Pin similarities that x does not capture. Let y denote the Pin’s OmniSage [1] embedding, a graph embedding learned from user engagement. Feeding y into the RQ-VAE would make SIDs move whenever OmniSage is updated, so we keep x as the only input and distill engagement into via y instead. A distillation head produces . In a batch of size we form temperature-scaled cosine similarities, mask the diagonal, and match neighborhood distributions with a KL divergence:
This term must flow into the codebooks, so we do not use residual -means, which has no gradient path from into the codes.
Progressive masking and dead codes. Following PLUM [12], we sample a cutoff at training time and form from only the first residual levels, so earlier codebooks are forced to compress more of the content and engagement signal. To keep the K-way vocabularies from collapsing we track an EMA of assignment counts and reinitialize any code whose EMA falls below one from randomly permuted encoder latents in the current batch.
A.2 Attention cost of the training kernels
For items, the kernels of Section 3.3.4 compute about attention scores. TIGER computes about , since each token attends to all codes of the earlier items, and FlexAttention computes about under our mask. Compared with TIGER, the attention cost is therefore lower by a factor of despite the extra token per item.
A.3 Timestamp gaps in the interleaved layout
The gap encoded by in Equation 3 needs care in the interleaved layout. At the first SID position of an item it is the true gap , but at the other positions the predecessor belongs to the same item and the gap is zero. The dense token instead copies the encoding of the first SID position, which matches serving, where the dense token directly follows the previous item’s dense token.
A.4 Computing the prefix penalty
The rule of Equation 5 is cheap to compute. A parent’s -th selected candidate is always its -th best code, so each parent’s codes are sorted once per level and only the counts change. Selecting a winner increments only , and since the penalty is linear in , the penalty vector is updated by adding the column , which takes additions per step and never stores the matrix. The steps depend on each other and must run in sequence, so the loop for each level runs as one fused GPU kernel.