Chapter 7: ML system design and experiments

Candidate generation: two-tower and matrix factorization

Every video, shop or music app must find a short list of good items in a huge catalog before the page loads. Recommender design interviews ask exactly this. They ask how you get the short list, how you train its model and how you serve it fast.

22 minInteractive lessonChapter 7: ML system design and experimentsLesson 7 of 13

What you will learn

  • Explain matrix factorization from implicit feedback
  • Train a two-tower model with in-batch softmax and explain sampling bias correction
  • Serve candidates with an ANN index

Key terms

candidate generation
the first stage that picks a short list of items from a huge catalog
embedding
a list of numbers that places a thing in a space; similar things sit close
two-tower model
two networks that each turn a user or an item into a vector
ANN index
a structure that finds near-closest vectors fast, at a small cost in accuracy

Prerequisites

Take Ads click prediction: pCTR, calibration and expected value first. It comes right before this lesson in the course.

Where this lesson picks up: You built an ad ranker that scores each ad with care, one at a time, by calibrated pCTR × bid. A careful score for every item is too slow for a huge catalog, so how does a system choose which items to score?

What comes next

With a short list of good candidates in hand, in what order do you show them?

Next lesson: Ranking and re-ranking: multi-objective, diversity, cold start

More lessons in this part

Take the lesson

Short cards, one idea at a time, with quick checks as you go.