~/learn/ML System Design · Retrieval & ranking systems

Ranking, re-ranking & business logic

Score candidates precisely, then shape the final list for people and policy.

6 min readlesson 9 of 15ranking modeldiversitybusiness rules

why this matters

Interviewers want rich features in ranking, and business-aware re-ranking after it.

The ranking model sees each (user, candidate) pair with rich features: user history, item stats, context (time, device), and cross features ('has this user watched this creator before?'). Typical choices: gradient-boosted trees (strong baseline) or deep models such as Wide & Deep, DCN or DLRM.

Loss choices: pointwise (predict P(click) per item — simple, most common), pairwise (learn that A should rank above B), listwise (optimize the whole list, e.g. directly for NDCG).

Re-ranking applies rules a model shouldn't learn on its own: remove items already seen, don't show five posts from the same creator in a row, boost fresh content, enforce safety and legal policies, blend in ads.

Diversity

ranked by score:   A A A B C A D
after re-ranking:  A B A C D A A   (diversity: max 2 in a row)

Interview trap

A list of the 10 individually best items is often a bad list — they may all be near-duplicates. Mention diversity explicitly.

Pro tip

Filtering hard constraints (blocked users, out-of-stock items) should happen as early as possible to avoid wasting ranking compute.

key takeaways

  • Rankers use cross features.
  • Pointwise loss is the common default.
  • Re-rank for diversity, freshness and policy.

check your understanding

Why add a re-ranking step after the ranking model?