TL;DR
Snap Inc. has successfully launched SnapLGR, an end-to-end Large Language Model (LLM)-based generative retrieval system for short-video recommendations on Snapchat. By co-designing behavior-aware semantic tokenization, a two-stage vocabulary grounding pipeline, and a highly optimized inference stack, they achieved a massive 45.7× boost in serving throughput and significant engagement gains in live production.
What Problem Does This Paper Address?
Modern recommendation systems rely heavily on a "retrieval" stage to filter down billions of candidate items into a manageable few hundred for final ranking. Generative Retrieval (GR) is a paradigm shift that treats retrieval as a sequence generation task: given a user's history, a model directly generates a sequence of discrete tokens representing the identifier—a Semantic ID (SID)—of the next item the user will enjoy.
While early GR systems relied on small, randomly initialized encoder-decoder models (like T5), upgrading to large, pretrained decoder-only LLMs offers massive potential due to their rich semantic priors. However, doing this at production scale introduces three major hurdles:
- Tokenizer Design: Mapping items to SIDs that capture both content semantics and user behavior without causing massive token collisions (where completely different videos get assigned the exact same ID).
- Vocabulary Grounding: Pretrained LLMs have no inherent understanding of these newly introduced SID tokens; they must be mapped into the model's existing internal knowledge space.
- High-Throughput Serving: LLMs are computationally heavy. Executing wide-beam search at Snapchat's scale within strict latency and GPU budgets is incredibly difficult.
Methods
The authors address these challenges through a tightly integrated three-stage pipeline:
- Multimodal, Behavior-Aware SIDs: They extract multimodal embeddings using Qwen3-VL and quantize them into hierarchical SIDs using a Residual Quantization Variational Autoencoder (RQ-VAE). Crucially, they inject collaborative filtering signals by adding a contrastive loss based on Personalized PageRank (PPR) scores derived from a user-video engagement graph. This forces co-engaged videos to have similar SIDs and spreads out token assignments to prevent collisions.
- Two-Stage Vocabulary Grounding:
- Continued Pretraining (CPT): To teach the LLM the new SID vocabulary, they freeze the LLM backbone and train only the new SID token embeddings on a video-to-text-description task.
- Supervised Fine-Tuning (SFT): They then fine-tune the entire LLM (Qwen3-0.6B) on chronological user interaction sequences to predict future engaged SIDs.
- Infrastructure Co-optimization: To make serving practical, they bypassed standard Python runtime bottlenecks by migrating to TensorRT-LLM’s CUDA-backed beam search, implemented a decentralized worker-loop architecture to eliminate driver-node bottlenecks, and utilized asynchronous I/O overlapping.
Datasets
The system was trained and evaluated on Snapchat's internal, large-scale short-form video dataset and user interaction sequences. Text descriptions for the videos were generated using Gemini 2.5 Flash to facilitate the CPT grounding stage. No public benchmarks were used, as this study focuses on a live production deployment.
Key Insights and Ideas
- Decoder-Only Dominance: Causal decoder-only architectures (like Qwen) inherently outperform traditional encoder-decoder architectures (like T5) for generative retrieval at every parameter scale. Remarkably, a tiny 13M Qwen model performs nearly as well as a 220M T5 model, proving that the architecture itself is structurally superior for this task.
- The SFT Semantic Wipe: Continued Pretraining (CPT) successfully aligns new SID tokens with the LLM's text knowledge space. However, subsequent SFT aggressively overwrites these pure text semantics to prioritize collaborative user-behavior relationships. Despite this "wipe," the initial grounding from CPT remains vital for downstream retrieval gains.
- Graph-Informed Tokenization: Incorporating graph-based behavioral signals (PPR) into the tokenizer dramatically improves codebook utilization (from 31.8% to 49.1%) and uniqueness. Spreading out the code space prevents massive "mega-collision" buckets that confuse the model.
Key Results
- Live Production Impact: In a 7-day live A/B test against an incumbent TIGER-style generative retrieval baseline, SnapLGR achieved statistically significant gains across core feed engagement metrics: +0.37% View Time, +0.09% Time Spent, and +0.18% Deep Sessions.
- Offline Quality: SnapLGR achieved a 2.51× increase in Pass@10 and a 2.40× lift in Recall@32 compared to the T5 baseline.
- Massive Engineering Speedups: Compounding software and hardware optimizations delivered a 3.63× training throughput increase and a staggering 45.7× cumulative speedup in per-GPU inference throughput over the unoptimized baseline.
Limitations and Future Work
The authors note that the correlation between token collision metrics and final retrieval quality isn't completely linear; a legacy tokenizer with worse collision resistance occasionally outperformed a cleaner variant in specific retrieval metrics. This indicates that the interplay between code distribution and retrieval performance warrants deeper study.
For future work, the team plans to explore scaling up to even larger LLM backbones to fully exploit their extensive pretrained world knowledge for generative retrieval.
Summary updated