AITeky Learn

AiTeky Original Interactive Learning & Practice Advanced

Retrieve and rank: how large recommenders choose what you see

Build the two stages behind a feed: a two-tower model that retrieves candidates, a learned ranker that orders them, a correction for position bias in click logs, a diversity re-ranker, and an honest offline-to-online plan with sample sizes.

A shop has 1.5 million products and one phone screen with ten slots. No model can look at every product for every visit in a fraction of a second, and none should. Large recommenders work in two stages: a fast retrieval stage that picks a few hundred candidates out of millions, and a slower, more careful ranking stage that orders those few hundred and shows ten. Most of the engineering is in what happens around those two boxes: the data, the biases, the business rules and the measurement.

The recommender systems course covered collaborative filtering and matrix factorisation. This course picks up where it stops: how the pieces are put together at scale. You build a two-tower retrieval model and see how much of what people want it reaches; you train a learned ranker and compare ways of teaching it; you discover that click logs lie, because people click what is at the top, and correct for it; you add diversity, which can raise clicks, not only variety; and you see why a better offline number does not always mean a better live result.

Everything is built in plain Python with numpy, pandas and scikit-learn so that it runs in your browser. The towers are trained by a small gradient-descent loop you can read. All the data are simulated with a fixed random seed: 2,000 users, 1,500 items and 80,000 candidate pairs, in a shop where we know every user's true taste. That is the advantage of a simulation: we can check what a method claims against the truth. The rates, prices and costs are assumptions flagged in the lessons. Real traffic is messier; use the lessons for the method and measure your own.

You need the recommender systems and machine learning courses; the search with vectors and graphs course is a companion for the retrieval side.

  • Learn lessons explain one idea at a time and let you compute it.
  • Industry ready lessons decide and plan. Each ends with the interview questions that go with it.

Locked. Sign up free

Learn

Understand each idea with everyday examples. No coding background needed.

  1. 01 50 min Free sample πŸ”’ AiTeky Pass Two stages: retrieve a few hundred, then rank a few Build a simulated shop of 2,000 users and 1,500 items, measure how many of what people later buy is inside the top K of a popularity list, see that the candidate list caps what any ranker can do, and work out the time budget that forces two stages at scale.
  2. 02 50 min πŸ”’ AiTeky Pass Two-tower retrieval: users and items in the same space Train a two-tower model with a gradient-descent loop you can read, where a user vector and an item vector are scored by their dot product, learned from purchases with the other items in the batch as negatives, and measure how it beats the popularity list, how training length matters, and what it does for rarely bought items.
  3. 03 50 min πŸ”’ AiTeky Pass Learning to rank: pointwise, pairwise and what each teaches Take 40 candidates per user from the two-tower stage, build ranking features, train a pointwise logistic model, a pointwise boosted-tree model and a pairwise model that learns from differences within a user, and compare them by nDCG at 10 against a random order, the single best feature and an oracle ceiling.
  4. 04 50 min πŸ”’ AiTeky Pass Click logs lie: position bias and how to correct for it Simulate the clicks an old popularity-ordered system collected, show that the click rate falls with position whatever the item, train a ranker on raw clicks, on clicks weighted by the inverse of the chance of being seen, and with the position as an input, and score all three against the true chance of a click that only a simulation knows.

Industry ready

Real problems from real jobs, and the questions interviewers ask about them.

  1. 05 55 min πŸ”’ AiTeky Pass On the job: making the list varied without losing clicks Take a trained ranker's top 10, measure how many categories each list covers and how many clicks it expects, re-rank with maximal marginal relevance at several settings and with a hard "at most N per category" rule, find the setting that gains variety at no cost in expected clicks, and write the recommendation.
  2. 06 55 min πŸ”’ AiTeky Pass On the job: will the new ranker win online? Compare an old popularity ranker with two new rankers by replaying the old system's click logs, by a random slice and by the truth a simulation knows, show that the replay gets the order wrong, simulate live tests of different sizes to see how often they would show the win, and write the launch plan.

We use essential cookies to run the site. With your permission we also set one anonymous ID to count unique visitors, and analytics cookies to see which pages help learners. Cookie notice

Join AiTeky Learn. It's free.

Create a free account to track your progress, save items for later and get study suggestions.

Sign up free Log in