← Lessons

quiz vs the machine

Gold1480

System Design

Recommendation in Commerce

Suggesting relevant products with candidate generation and ranking stages.

5 min read · core · beat Gold to climb

Why recommend

Recommendations drive a large share of e commerce revenue by surfacing products a shopper is likely to buy: related items, frequently bought together, and personalized picks.

Two stage architecture

Recommender systems usually split into two stages to balance scale and quality.

  • Candidate generation: cheaply narrow millions of products down to a few hundred using signals like co purchase, category, and recent views.
  • Ranking: apply a richer, more expensive model to order those candidates by predicted relevance.

This keeps the expensive model running on a small set rather than the entire catalog.

Online and offline

  • Offline jobs precompute embeddings and co occurrence tables in batch.
  • Online serving combines those precomputed signals with real time context such as the current session and cart.

Pitfalls

  • The cold start problem: new shoppers and new products lack history, so fall back to popularity or content based signals.

Key idea

Use cheap candidate generation to shrink the catalog, then an expensive ranking model, and handle cold start with fallbacks.

Check yourself

Answer to earn rating on the learn ladder.

1. Why split recommendation into candidate generation and ranking?

2. What is the cold start problem?