Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Pinterest Engineering 13 min read Case study hardMaster

Beyond Two Towers: Launching the 3-Tower Engagement Co-Train Model (Part 2)

Pinterest's ads lightweight ranking adds a third cross tower to its two-tower engagement model. The cross tower runs cross-attention between user sequences and candidate-derived query tokens, and a shared-bottom inter module jointly predicts CTR, gCTR30 and oCTR. Co-training keeps a fast two-tower head that scores all candidates, and the three-tower path rescores only a utility top-K subset. The three-tower predictions cut offline loss by about 30%. Serving optimizations brought P99 inference from over 200 ms to about 30 ms: caching Pin preprocessing in the Pin tower, BF16, late expansion of user features, and pre-layer normalization.

Assumes: two-tower retrieval modelscross-attentionmulti-task learningads ranking pipelines

Related posts

  • Meta Adaptive Ranking Model: Bending the Inference Scaling Curve to Serve LLM-Scale Models for Ads

    Meta Engineering hardMaster

    Meta Adaptive Ranking Model serves LLM-scale ads ranking models (O(10 GFLOPs) per token, O(1T) parameters) at O(100 ms) latency by routing each request to an appropriately complex model and computing user signals once per request instead of once per ad candidate. Key techniques include in-kernel broadcast of request-level embeddings, the Wukong Turbo architecture refinements, GPU-offloaded feature preprocessing, selective FP8 post-training quantization, operator fusion with grouped GEMM, and multi-GPU embedding sharding, reaching 35% MFU across heterogeneous hardware. Launched on Instagram in Q4 2025, it delivered +3% ad conversions and +5% CTR for targeted users.

  • Sequence learning: A paradigm shift for personalized ads recommendations

    Meta Engineering hardMaster

    Meta replaced its DLRM ads ranking models, which depended on thousands of hand-engineered aggregated sparse features, with sequence learning over event-based features (EBFs). These features preserve the order and fine-grained attributes of a person's engagement and conversion events. An event model compresses per-attribute embeddings and adds timestamp encodings, and a transformer-based sequence model uses multi-headed attention pooling keyed by the candidate ad, cutting attention cost from O(N²) to O(M·N). Variable-length sequences are made production-viable through jagged tensor support in PyTorch, GPU kernels, Jagged Flash Attention, quantization and vector quantization. The result was a 2-4% conversion lift on select segments, with plans to scale sequences 100x and explore linear attention and state space models.

  • From Scoring to Spelling: Rebuilding Ads Retrieval at Instacart

    Instacart Tech hardMaster

    Instacart replaced its BERT-based ads retrieval model, which scored every atomic product ID in a fixed vocabulary, with a generative model that autoregressively decodes Semantic IDs (RQ-VAE codeword sequences) via beam search. The goal was to fix vocabulary bottlenecks, cold-start bias toward popular items, and incoherent candidate sets. Prompts combine a retailer-type token, user history SIDs and cart SIDs. SIDs shrink embedding parameters 125x and give new products coverage from day one, while beam width and temperature act as dials between precision and diversity. Serving moved from Python on CPU to a Go service on TensorRT-LLM and Triton. Mean latency dropped 10–17% despite roughly twice the candidates, and A/B tests showed +5% CTR and +34% add-to-carts.

  • Meta’s Generative Ads Model (GEM): The Central Brain Accelerating Ads Recommendation AI Innovation

    Meta Engineering hardMaster

    GEM is Meta's LLM-scale foundation model for ads recommendation, trained on thousands of GPUs and used as a teacher to improve hundreds of downstream vertical ranking models; it lifted ad conversions 5% on Instagram and 3% on Facebook Feed. The architecture handles non-sequence features with an extended Wukong design (stackable factorization machines), long user-behavior sequences with a pyramid-parallel structure, and cross-feature learning with InterFormer, plus multi-domain learning across surfaces, for 4x the efficiency of earlier ranking models. Knowledge reaches downstream models through direct and hierarchical transfer that combines distillation with a Student Adapter for stale supervision, representation learning and parameter sharing, which Meta reports as 2x as effective as standard distillation. A rebuilt training stack (HSDP for dense layers, 2D sharding of embedding tables, jagged-sequence kernels, FP8 activations, SM-free NCCLX collectives, compile caching) delivered 23x effective FLOPs with 1.43x MFU on 16x more GPUs.

  • GenRecs Tokenization: Transforming Ads Recommendation at Meta with Stable Model Vocabulary

    Meta Engineering hardMaster

    Meta's ads recommender replaces per-item IDs with GenRecs Tokenization, a stable semantic vocabulary. Each ad, product or page is encoded with pre-trained multimodal models, decomposed into subspaces (e.g. residual decomposition) and quantized against learned codebooks into short token sequences, so similar items share tokens. This lets new and tail items inherit what the model learned about related items, enabling cold-start generalization and cross-campaign transfer. Paired with GEM and the Adaptive Ranking Model it delivered a +0.35% conversion lift. Across eight tokenizer versions, intrinsic metrics (cluster purity, distribution balance, codebook utilization) correlated with downstream CTR accuracy, so the tokenizer can be iterated without full model retraining.

The quest for software engineering knowledge.

Look:
Layout: