# Scaling Conditional Learned Retrieval for Pinterest Home Feed

[Pinterest](https://yomu.fyi/company/pinterest) · Pinterest Engineering · Aug 26, 2026

**Type:** Problem & solution

## Summary

Pinterest home feed candidate generation relies on large-scale retrieval, but standard two-tower models produce single embeddings that struggle to capture diverse concurrent user intentions. To solve this, Pinterest expanded Conditional Learned Retrieval (CLR) to generate condition-aware embeddings conditioned on explicit interest, Pin, and Board contexts. The team evolved model representations by appending condition tokens to user sequences in transformers, integrating the PinFM foundation model, and introducing hierarchical semantic IDs to improve cold-start coverage. On the serving side, engineers consolidated duplicate feature requests and shifted inference to GPU instances using NVEmbed under a one-query-to-many-documents paradigm. These infrastructure and modeling changes unlocked new condition types, achieved seven-figure cost savings, and reduced p90 model retrieval latency from 80ms down to 12ms.

## Context

Pinterest home feed candidate generation faced limitations using traditional two-tower retrieval models, as single user embeddings could not adequately represent the multiple simultaneous intentions of users. Additionally, early conditional retrieval implementations treated each condition as a separate user-level feature request, causing compute cluster costs to scale rapidly as new condition types were introduced.

## Approach / What changed

Pinterest expanded Conditional Learned Retrieval by supporting interest, Pin, and Board conditions, bootstrapping training data from existing heuristic candidate generators. The architecture scaled user modeling via a Conditioned User Sequence Transformer and the PinFM foundation model, while Pin representations were augmented with hierarchical semantic IDs from residual-quantized VAEs. For serving, Pinterest consolidated multi-condition requests to eliminate duplicate features and migrated to GPU instances using NVEmbed to treat conditions as items in a ranker setup.

## Takeaways

- Semantic IDs built by quantizing static content embeddings with residual-quantized VAEs allowed long-tail Pins to share an embedding space with popular items and inherit collaborative signals across five hierarchical layers.
- Migrating CLR serving to GPUs with NVEmbed and aligning inference with a 1-query-N-doc structure reduced p90 model latency by 85 percent from 80ms to 12ms and generated seven-figure cost savings.
- The Conditioned User Sequence Transformer appends condition tokens to the user history sequence, enabling the model to dynamically attend to relevant past interactions for each retrieval context.

**Tags:** [Architecture](https://yomu.fyi/topic/architecture), [Machine Learning](https://yomu.fyi/topic/machine-learning), [Performance](https://yomu.fyi/topic/performance), [Recommendation Systems](https://yomu.fyi/topic/recommendation-systems), [Scalability](https://yomu.fyi/topic/scalability)

[Read original post](https://medium.com/pinterest-engineering/scaling-conditional-learned-retrieval-for-pinterest-home-feed-ecfba7e5a426)
