Candidate Generation: Two-Tower Models and Collaborative Filtering

~45 min read

How to narrow millions of items to hundreds of candidates in milliseconds: two-tower retrieval, matrix factorization, and content-based approaches.

Candidate Generation: Two-Tower Models and Collaborative Filtering is a Pro topic

Sign in, then upgrade to Pro or Power to unlock this topic and the full AI Engineering curriculum.

Key points

  • Two-tower models pre-compute item embeddings offline and serve only user embeddings online — this is what makes sub-10ms retrieval over millions of items possible
  • The candidate generation stage must optimize for recall, not precision — any great item not retrieved here can never be recommended regardless of ranker quality
  • Collaborative filtering captures community taste (users like you liked X) but fails cold start; content-based works for new items but causes over-specialization — production systems blend both