Direct answer: OneRec is Kuaishou's end-to-end generative recommendation architecture that replaces the traditional three-stage funnel (retrieval → pre-ranking → ranking) with a single sparse Mixture-of-Experts encoder-decoder (~1B parameters, 24 experts, top-2 active = ~13% active per pass). It maps a billion-item corpus into hierarchical tokens via Balanced K-Means quantization, autoregressively generates full 5–10 item sessions instead of isolated single items, and aligns list quality via Iterative Preference Alignment (DPO) using beam-search self-hard negatives — achieving +1.68% total watch time and +6.56% average view duration on Kuaishou's main traffic.
This is a public engineering overview of Kuaishou's OneRec paper — read the full Substack edition for P99 serving optimizations and production latency trade-offs at Collapsing the Recommendation Funnel: Inside Kuaishou's OneRec.
Why Cascaded RecSys Funnels Hit an Architectural Ceiling
Nearly every web-scale recommender system runs a multi-stage funnel: fast two-tower ANN retrieval over millions of items, a lightweight pre-ranker over thousands, and a heavy cross-feature ranker over dozens.
That cascade keeps latency tractable, but it creates two structural caps:
- Recall bottlenecks everything downstream: If retrieval drops a great item because a dot product misses fine-grained interactions, the heavy ranker never sees it.
- Pointwise scoring ignores session coherence: Ranking items independently forces teams to bolt on brittle re-ranking heuristics for intra-list diversity and pacing.
Earlier generative recommenders (like TIGER) proved models could generate item IDs directly, yet in production they were typically deployed as just another retrieval source. Kuaishou's OneRec goes all the way: one generative model serving full sessions from a billion-item catalog.
The Three Technical Pillars of OneRec
1. Balanced Semantic Quantization (Fixing Codebook Collapse)
Autoregressive generation requires mapping continuous multimodal item embeddings into discrete token sequences. Standard Residual Quantized VAEs (RQ-VAE) suffer from codebook collapse — an "hourglass" distribution where a small handful of code words absorb most items.
OneRec replaces RQ-VAE with multi-level Balanced K-Means quantization (L = 3 layers, K = 8,192 clusters per layer), strictly partitioning the item pool so every centroid receives an equal number of vectors. Each video becomes a balanced hierarchical semantic ID like <a_9><b_1><c_5>, progressively narrowing from coarse themes to a specific item.
2. Session-Wise List Generation on a Sparse MoE Backbone
Instead of predicting one next item at a time, OneRec takes 256 historical user interactions as encoder input and autoregressively generates an entire high-value session (5–10 items) in one shot, conditioned on session dwell time and engagement quality.
To keep P99 serving latency viable at a 1-billion-parameter scale, OneRec uses a T5-style encoder-decoder whose decoder feed-forward layers are replaced with a sparse Mixture-of-Experts (MoE) layer (24 experts, top-2 routed), activating only ~13% of total parameters per forward pass.
3. Iterative Preference Alignment (IPA) with Self-Hard Negatives
Standard Next-Token Prediction (NTP) teaches valid session syntax, not subtle ranking margins between two plausible playlists. Because you cannot show two exploratory sessions to the same user simultaneously, Kuaishou bridges preference data with an offline multi-head attention Reward Model (RM) predicting watch time, view-through rate, and likes:
- Run beam search (beam size 128) to generate candidate sessions.
- Score all 128 sessions with the offline Reward Model.
- Pair the highest-scoring session (chosen) against the lowest-scoring session (rejected) as self-hard negatives.
- Fine-tune OneRec iteratively with Direct Preference Optimization (DPO) on a rolling snapshot.
Live Production Impact on Kuaishou Main Traffic
- +1.68% lift in total watch time
- +6.56% increase in average view duration
- Replaced a complex multi-stage retrieval/pre-ranking/ranking cascade with a single unified generative architecture
Read the full breakdown — including Kuaishou's P99 serving realities and infrastructure trade-offs — in the complete Substack edition: Collapsing the Recommendation Funnel: Inside Kuaishou's OneRec.
Go deeper: Recommendation Systems at Scale (Free 21-Chapter Book) · Two-Tower Models in Production · How Meta Broke the Fat Row Scaling Wall.