Scaling Conditional Learned Retrieval for Pinterest Home Feed
A new machine learning model that captures diverse user intents.
1Limitations of Traditional Retrieval
Pinterest home feed candidate generation is a large-scale User-to-Pin retrieval problem. The conventional two-tower model encodes users and Pins separately. However, users can have multiple intentions simultaneously: planning a renovation, saving recipes, exploring fashion, or organizing travel ideas. A single retrieval embedding vector struggles to capture this diversity.
2Conditional Learned Retrieval (CLR)
CLR extends the two-tower model by conditioning the user tower on an explicit retrieval context. Instead of a single user embedding, CLR can generate condition-aware embedding vectors that reflect different aspects of a user's interests. This approach grounds retrieval in the user's overall behavior while capturing intent diversity. This formulation was previously studied in two different Pinterest research papers.
3Interest Conditions
Pinterest has a predefined interest taxonomy. CLR was initially bootstrapped using a few interests sampled from user-to-interest signals. Later, a new user interest signal generated by LLMs was used as conditions. This increased retrieval diversity, providing a broader range of content for ranking and blending.
4Pin Conditions
Users' recently engaged Pins were clustered and used as conditions. Cluster medoids were selected and represented using pre-trained embeddings, replacing legacy heuristic candidate generators. This transition yielded significant metric improvements and simplified the serving stack.
5Board Conditions
Users interact with Pins distributed across various Boards on the platform. Pins and Boards form a bipartite graph. Random walks on this graph enable recommendations of both Pins and Boards. Board conditions were represented using pre-trained embeddings in the same space as Pins, achieving major metric wins.
6Automated Condition Budgeting
Migration to GPU-based serving significantly reduced latency and freed capacity. The team used Claude Code to automate experiments, continuously reading feedback to optimize the number of conditions per request. Automated tuning policies improved key engagement metrics with low cost increase.
7Pin Tower Improvements
Initially, signature images were used for Pin IDs, which behaved like random hash numbers. For the billion-scale ID space, a 20GB pretrained ID embedding table was created, sharded across multiple GPUs using TorchRec. Later, semantic IDs were added by quantizing static content embeddings into hierarchical codes.
8Benefits of Semantic IDs
Semantic IDs are hierarchical codes that cluster similar content together. Visually and semantically similar Pins share nearby codes. Long-tail Pins suffer from cold start issues and limited training data. Semantic IDs enable them to share embedding space with popular Pins, leveraging collaborative signals.
9Semantic ID Architecture
Semantic IDs have five hierarchical layers with 2048 possible codes each. Five small embedding tables (one per layer) provided sufficient representation. After lookup, semantic ID embeddings are fused sequentially through five MLP layers. Finally, signature image and semantic ID embeddings are fed into the Pin's feature cross layer.
10Serving Infrastructure Redesign
The serving infrastructure was redesigned to make multi-condition retrieval efficient at production scale. This enabled support for more condition types and more condition sources per user. While each condition type required training CLR models, Pinterest's existing heuristic candidate generators helped bootstrap these use cases.
11Metric Improvements
Extending CLR to different condition types increased retrieval candidate diversity and positively impacted engagement. Adding Pin and Board conditions brought significant metric wins and simplified the serving stack. Automated condition budgeting improved key engagement metrics with low cost increase.
12Future Potential
Conditional Learned Retrieval evolved from early interest-conditioned retrieval into a retrieval system for Pinterest home feed. Scaling model foundations and redesigning serving infrastructure made multi-condition retrieval efficient at production scale. This approach better captures user intents, enhancing the platform's personalization capabilities.
Original article: Pinterest Engineering — Pinterest'te Koşullu Öğrenilmiş Alımı Ölçeklendirme