nayaread
HomeFavouritesTopicsSources
HomeFavouritesTopicsSources
NayaRead links to original engineering blogs. All copyright belongs to the respective authors.
Pinterest Engineering·Aug 26, 2026·11 min read·Pinterest Engineering60

Scaling Conditional Learned Retrieval for Pinterest Home Feed

AI summarygenerated from the source article

Pinterest cut its candidate retrieval p90 latency by 85%—from 80ms down to 12ms—while scaling personalized feed recommendations across millions of multi-intent users. 👇

Standard two-tower recommendation models compress a user's entire profile into a single vector embedding. That breaks when someone is simultaneously planning a home renovation, searching for recipes, and saving fashion ideas. A single embedding gets pulled in opposite directions, producing generic results. Running separate conditional queries solved the context problem, but sending individual model requests for every user context quickly exploded compute costs.

Pinterest built Conditional Learned Retrieval (CLR) to evaluate multiple user intentions inside a unified model framework. They merged user action sequences, board contexts, and pin conditions into a shared foundation model, then overhauled their training and serving stacks to handle multi-condition retrieval efficiently.

CLR converts context signals into condition tokens and appends them directly to the user's recent action sequence. A conditioned sequence transformer uses these tokens as queries over user history. A user sequence foundation model (PinFM) encodes the interactions, using a contrastive alignment loss to align condition tokens directly with the candidate pin embedding space.

To avoid building bespoke features for every new condition, Pinterest replaced custom condition pipelines with a unified "Slot Architecture" that buckets inputs into three predefined slots: * `condition_os` slot: Holds dense embeddings for pins, boards, or interest text. * `condition_id` slot: Holds specific categorical identifiers or hierarchical semantic IDs. * `condition_type_id` slot: Maps condition sources into a 32-dimensional learned embedding.

Training this foundation model introduced massive computational overhead, which Pinterest halved by introducing two lossless throughput optimizations: * Request-level training: Groups identical user-condition pairs within a batch to run through the user tower once, re-duplicating output embeddings post-forward pass for loss calculation. * M-Falcon optimization: Flattens multiple conditions for a single user onto one user sequence. A custom block attention mask lets condition tokens attend to the user history, but masks condition tokens from seeing each other.

For serving, Pinterest migrated CLR inference to AWS g6e.4xlarge GPU instances using NVEmbed to package dense models and multi-gigabyte embedding tables into a single artifact. They refactored the serving path into a "1 query → N condition" ranking setup, evaluating all candidate conditions for a user in a single batch request.

The redesigned architecture achieved seven-figure cost savings and reduced p90 model latency from 80ms to 12ms. It doubled offline training throughput, enabled automated condition tuning, and allowed Pinterest to retire legacy heuristic candidate generators across the home feed.

Read original on medium.com

Score breakdown

  • Technical depth53
  • Practical value60
  • Originality100
  • Writing quality100
  • Source reputation0
  • Recency96
  • External engagement0
  • On-site engagement0

NayaRead shows a summary and links to the original article. The full article is hosted on medium.com.

More like this

Engineering at Meta

From User Sequences to Scaling Laws: A Multi-Stage Architecture for Meta’s Ads Ranking

Aug 5, 2026·7 min read
Etsy — Code as Craft

Making Ads Count: Using MMoE and Auxiliary Tasks to Better Connect Buyers & Sellers

Amanda Steigman·Mar 20, 2026·11 min read
Shopify Engineering

How Shopify Uses Recommender Systems to Empower Entrepreneurs - Shopify

Jan 25, 2019·10 min read
Netflix Tech Blog

GenPage: Towards End-to-End Generative Homepage Construction at Netflix

Netflix Technology Blog·Jun 29, 2026·23 min read