This article details Pinterest's architectural evolution for ads lightweight ranking, moving beyond traditional two-tower models to a more sophisticated three-tower co-train approach. It highlights the system design challenges of balancing model complexity with stringent latency and cost constraints at Pinterest's scale, especially when scoring hundreds of thousands of ad candidates per request. The solution involves a hybrid serving flow that leverages both fast, less accurate two-tower predictions and richer, slower three-tower predictions.
Read original on Pinterest EngineeringPinterest's journey to improve ads lightweight ranking showcases a classic system design trade-off: enhancing model accuracy and expressiveness versus maintaining low latency and cost at massive scale. Building on their Nexus serving stack, which decoupled candidate generation from scoring, they introduced a "3-tower co-train model" to predict multiple engagement probabilities (pCTR, pGCTR30, pOCTR) simultaneously. This model design addresses the challenge of scoring hundreds of thousands of candidates per request, where simply increasing model complexity is not feasible.
The core innovation lies in a two-stage scoring flow that intelligently combines two-tower and three-tower predictions within a single co-trained model. This allows for:
This tiered approach is critical for managing the computational load associated with higher-order interactions while still meeting strict latency requirements for a large candidate pool.
The 3-tower model extends an existing two-tower setup with two main additions:
System Design Lesson
When designing large-scale ML serving systems, especially for ranking, consider a multi-stage retrieval and ranking pipeline. Start with simpler, faster models (e.g., two-tower) for initial candidate filtering or coarse ranking, then apply more complex, accurate models (e.g., three-tower, re-rankers) to a smaller, more relevant subset of candidates to balance performance and latency.
To make the complex three-tower model viable for serving, several critical optimizations were implemented to reduce P99 model inference latency from over 200 ms to about 30 ms: