Two stages in a recommendation pipeline

A recommender at large e-commerce scale cannot apply a heavy personalized model to millions of
catalogue items — it would take too long. So the pipeline splits in two:

  1. Candidate retrieval — quickly selects hundreds of candidates from the full catalogue using
    ANN search, BM25, collaborative filtering or other light methods.
  2. Reranking — a more precise model takes those 100–500 candidates and orders them optimally for
    this shopper and this context.
Catalogue: 500,000 SKUs
↓ candidate retrieval (ANN, BM25)
Candidates: 300 items
↓ reranking (gradient boosting / neural ranker)
Final output: top 10 for the widget

The split is what lets a system balance speed at retrieval against quality at ranking.

What a reranking model considers

Unlike retrieval, a reranker works with a rich feature set:

Feature group Examples
User Affinity profile, purchase history, session length
Item Margin, availability, rating, category popularity
Context Device, time of day, current category
Interaction How well the item matches this shopper’s profile
Business signals Promoted SKUs, campaign positions

The models are gradient boosting (LightGBM, XGBoost), neural rankers, or hybrids.

Business rules inside reranking

Reranking is where ML personalization meets business logic. Rules enter in two forms.

Hard constraints applied over the model:

  • Out-of-stock items always at the tail
  • Items not available for sale excluded entirely
  • A mandatory boost for priority SKUs

Soft constraints applied as features:

  • Margin as an additional feature that the model weighs but does not always follow
  • Freshness and trend signals, with a configurable weight

Tip: do not hard-boost already popular products — they rank well through personalization
anyway. Boosting pays off for under-discovered items with good margin that the algorithm
undervalues for lack of history.

Diversity as a reranking task

Reranking also handles diversity: if all ten candidates are jeans from one brand, that is a poor
result. Diversification algorithms such as maximal marginal relevance and determinantal point
processes plug into this stage, balancing relevance against variety.