The Multi-Stage Funnel Architecture

By Ludovico Bessi, Senior ML Engineer at Google Β· Updated

The multi-stage funnel is the architecture every large recommender uses: cheap retrieval narrows millions of items to thousands, a pre-ranker trims them to hundreds, a heavy ranker scores those, and a re-ranker builds the final page. Each stage trades accuracy for speed so the whole request fits in a ~200 ms budget.

The Core Constraint

Suppose a ranking model costs 0.1 ms of GPU time per item and your catalog has 100 million items. Scoring everything for one request would take 10,000 seconds. Even a model a thousand times cheaper would blow a 200 ms budget. The arithmetic forces a funnel: spend a tiny amount of compute on a very large number of items, then progressively more compute on fewer items.

Catalog            10⁸–10⁹ items
Retrieval          β†’ 10³–10⁴      cheap, high recall
Pre-ranking        β†’ 10²–10Β³      light model
Ranking            β†’ 10¹–10Β²      heavy model, many features
Re-ranking         β†’ final slate  list-level logic

YouTube's 2016 paper described exactly this: a candidate generation network narrowing millions of videos to hundreds, and a ranking network ordering those hundreds. Almost every large system since β€” TikTok, Instagram, Pinterest, LinkedIn β€” follows the same pattern with more stages.

Stage 1: Retrieval (Candidate Generation)

Goal: recall. Out of the whole catalog, return a few thousand items that contain most of what the user would like. Precision does not matter much yet; missing a great item here means no later stage can recover it.

Constraints: must search the whole catalog in a few milliseconds. That rules out models that look at user and item features together. Retrieval models therefore keep the user side and item side separate so items can be precomputed and indexed.

Typical sources:

  • Embedding retrieval: two-tower models plus ANN search.
  • Item-to-item: "similar to what you just watched", from co-engagement or embeddings.
  • Graph-based: random walks over user–item graphs (Pinterest's Pixie, PinSage embeddings).
  • Heuristic: trending, fresh, followed creators, location-based.

Real systems run many of these in parallel and merge the results (see Multiple Retrieval Paths & Blending).

Stage 2: Pre-Ranking

Goal: cut thousands of candidates to hundreds cheaply, so the heavy ranker has a manageable input.

Pre-rankers are small models β€” often a two-tower or a small MLP over a subset of features β€” trained to imitate the main ranker's ordering (distillation) or on the same labels. Their main risk is disagreement with the ranker: if the pre-ranker throws away items the ranker would have loved, quality is lost silently. Measuring recall of the ranker's top items at the pre-ranking stage is the key health metric.

Stage 3: Ranking

Goal: precision. Order a few hundred candidates as accurately as possible.

The ranker can afford rich features (user history, item statistics, real-time context, cross features between user and item) and large models. It usually predicts several outcomes at once β€” click, watch time, like, share, skip, hide β€” and combines them into a single score (see Multi-Objective Optimization). Architectures are covered in Deep Ranking Models.

Stage 4: Re-Ranking

Goal: turn a scored list into a good slate.

Item-level scores ignore interactions between items: ten near-identical videos might each score highly but make a terrible feed. Re-ranking applies list-level logic: diversity, deduplication, freshness boosts, creator fairness, ad insertion, and policy filters. See Re-ranking & Business Logic.

Designing the Funnel

Budget allocation

Work backwards from the latency budget. A typical split for a 200 ms feed request might give retrieval 20–40 ms (parallel sources), feature fetching 20–30 ms, ranking 50–80 ms, and re-ranking plus serving overhead the rest. The right split depends on where quality comes from in your system β€” measure it.

Stage consistency

Each stage is trained on data shaped by the stages around it. Two classic issues:

  • Sample selection bias: the ranker is trained only on items that were shown, which survived retrieval and ranking. It has never seen the long tail of candidates retrieval might produce. Adding unshown retrieved candidates as negatives, or training retrieval on "would the ranker like this?" labels, helps.
  • Objective mismatch: retrieval trained on clicks while ranking optimizes watch time will feed the ranker the wrong candidates. Align training targets across stages where possible.

Measuring each stage

Stage Metric
Retrieval Recall@K of engaged items; coverage of the ranker's final top-N
Pre-ranking Recall of the ranker's top items; rank correlation with ranker
Ranking AUC / log loss per task, NDCG, calibration
Re-ranking Diversity, novelty, policy compliance, online metrics
End to end A/B test on the product metrics

The Funnel Is Being Questioned

Two trends push against the classic funnel:

  • Cheaper compute per item. GPU retrieval and efficient architectures let some systems score far more candidates with stronger models, merging stages (LinkedIn has described GPU-based exhaustive retrieval over very large corpora).
  • Generative recommenders. End-to-end models such as Kuaishou's OneRec generate recommendations directly instead of filtering a candidate set, aiming to replace retrieval and ranking with one model (see Sequential Generative Recommenders).

Even so, the funnel remains the default because it is the cheapest way to combine recall over huge catalogs with expensive, precise models.

Key Takeaways

  1. Compute per item times catalog size forces a funnel: retrieval, pre-ranking, ranking, re-ranking.
  2. Retrieval optimizes recall with separable models; ranking optimizes precision with rich features.
  3. Pre-rankers must agree with the ranker; measure their recall of the ranker's top items.
  4. Re-ranking handles list-level concerns that item scores cannot.
  5. Stage interactions create selection bias and objective mismatch; align and measure each stage.