#AI

Enhancing Ad Relevance: Integrating Real-Time Context into Sequential Recommender Models

Enhancing Ad Relevance: Integrating Real-Time Context into Sequential Recommender Models
01

Summary

Pinterest Boosts Ad Relevance by 300% via Real-Time Contextual Modeling

Breaking the ROAS ceiling with a hybrid Two-Tower architecture that blends historical intent and immediate context.

Explore how Pinterest Engineering integrated real-time browsing signals into their sequential recommender models. This post details the transition from static offline embeddings to a dynamic hybrid system that significantly improves ad candidate quality and business performance.

  • 01Integration of a real-time context layer directly into the Two-Tower query architecture.
  • 02Use of synthetic data injection to bridge the gap between offline training and online serving signals.
  • 03A hybrid serving flow that optimizes latency by pre-computing long-term user sequences offline.
  • 04Significant 300% gain in candidate relevance on the 'Related Pins' surface.
  • 05Proven business impact with up to 1.4% ROAS lift in key markets.

RECOMMENDATION

Highly recommended for ML engineers building large-scale retrieval systems who need to balance long-term user interests with immediate session-based intent.

The Problem

Previous sequential models used offline user embeddings based only on historical offsite behavior, failing to account for real-time context like current browsing activity, which resulted in very low candidate survival rates (<1%) on contextual surfaces.

The Solution

The team developed a Contextual Sequential Two Tower Model that integrates a context layer into the query tower, utilizes synthetic data augmentation for training, and employs a hybrid inference flow combining offline sequence encoding with online context processing.

The Result

The model achieved a 3x to 10x improvement in Recall@K, increased median candidate relevance by 275-300%, and delivered a measurable lift of ~0.7% in overall ROAS, reaching ~1.4% in top revenue countries.

Trade-off

Due to technical complexities in merging real-time onsite and offsite data, the model relies on synthetic data during training, and the hybrid serving approach introduces additional online computational requirements compared to pure offline inference.

03

Key Concepts

Concept · 01

Two-Tower Model

A retrieval architecture that learns separate embedding functions for queries and candidates to enable efficient similarity searches.

  • Pinterest added a context layer to the user-side query tower to incorporate real-time signals.
Concept · 02

Sequential Recommender

A recommendation approach that models users' evolving preferences based on their chronological sequence of interactions.

  • Used a Transformer-based encoder to represent historical offsite conversion sequences.
Concept · 03

Hybrid Inference

A serving strategy that splits computation between offline batch processing and online real-time execution to optimize for both freshness and scale.

  • Stored Transformer hidden states in a feature store while computing the final context-aware layers at request time.