← All drillsBuild a Two-Tower Retrieval Engine
What you'll be able to do- ✓Build a two-tower retrieval model — separate user and item encoders trained into one shared embedding space
- ✓Train with in-batch negatives and sampled softmax, and correct the popularity bias they introduce
- ✓Measure retrieval honestly with Recall@K, NDCG@K, and catalog coverage against a popularity baseline
- ✓Index millions of item vectors with IVF and HNSW, and read the recall-versus-latency trade-off from your own measurements
- ✓Retrieve items that have never been interacted with, by putting content features in the item tower
- ✓Explain why production recommenders split retrieval from ranking, and measure what each stage contributes
- ✓Serve the engine behind an API and report the p99 latency it sustains under concurrency
Build the candidate-generation layer that sits under every large recommender — the stage that turns a catalog of millions into a shortlist of hundreds, fast enough to run on every request.
⌁ YouTube, Netflix, Spotify, and Pinterest all run two-tower retrieval in front of their rankers; it is also the architecture behind modern semantic search and RAG retrieval.
Start this internshipCreate an account to unlock the 11 sections, the workbench, and AskThili.
BeginSections
1. Build a Two-Tower Retrieval Engine
🔒 locked2. The Retrieval Problem
🔒 locked4. In-Batch Negatives
🔒 locked5. The Popularity Trap
🔒 locked6. Evaluating Retrieval
🔒 locked7. Indexing the Towers
🔒 locked8. Recall vs Latency
🔒 locked10. Retrieval → Ranking
🔒 lockedDig deeper
📄Deep Neural Networks for YouTube Recommendations (Covington, Adams & Sargin, 2016, RecSys)
paper📄Sampling-Bias-Corrected Neural Modeling for Large Corpus Item Recommendations (Yi et al., 2019, RecSys)
paper📄Efficient and robust approximate nearest neighbor search using Hierarchical Navigable Small World graphs (Malkov & Yashunin, 2016)
paper📄Billion-scale similarity search with GPUs (Johnson, Douze & Jégou, 2017)
paper🔗thili-ai/thilitower — the reference implementation you build in this course
code