Recommendation Systems¶
A recommendation system is, at heart, a search problem run as a funnel: millions of candidates are filtered cheaply and widely first, then scored expensively and narrowly last. This section walks the full arc of a modern recommender — from the search-engine intuition (the RAG ↔ RecSys mapping), through the math of matrix factorization, the two-tower retrieval model, learning-to-rank, deep ranking architectures, multi-task learning, re-ranking, bias mitigation, evaluation, and the 2026 LLM frontier. Intuition first, then the formalism, with nothing skipped.
Rapid Recall
Every large recommender is a three-stage cascade: retrieval / candidate generation (recall + speed, billions → thousands in <50 ms), ranking (precision, a cross-encoder scoring the survivors), and re-ranking (list-level quality and business constraints — diversity, freshness, calibration, exploration, debiasing). The deepest shared idea with RAG is the bi-encoder / cross-encoder split: retrieval embeds user and item separately so the item side can be precomputed and indexed (two-tower), while ranking feeds user + item features jointly for richer interactions but can't be precomputed. Collaborative filtering learns from behavioral co-occurrence and dies on cold start; content-based uses item features and rescues cold items but traps you in a bubble; two-tower fuses both. Offline metrics (Recall@K for retrieval, NDCG for ranking) are a filter; online A/B testing is the verdict.
The funnel, one line¶
Multi-channel retrieval (recall + speed) → ranking (precision, cross-encoder, multi-task) → re-ranking (list-level + business) → measured offline as a filter, online as the verdict.
What each page covers¶
- The RAG ↔ RecSys Mapping: why the pipeline skeleton transfers 1:1 from RAG, what flows through it that does not (behavioral IDs vs. text, the absent query, cold start), and the bi-encoder/cross-encoder split that unifies both.
- Candidate Generation & Matrix Factorization: the sparse interaction matrix, MF as low-rank completion on observed cells only, SGD vs ALS, bias terms, implicit feedback, sparse storage and horizontal scaling, and why MF is not PCA and only rhymes with LoRA.
- Content-Based Filtering & the Two-Tower Model: item-feature scoring and its cold-start/serendipity trade-offs, then the two-tower architecture that upgrades MF's ID lookups to feature-eating neural nets and fuses CF with content.
- Multi-Channel Retrieval, ANN & MIPS: the division of labor between the vector factory (the model) and the lookup (ANN), running many recall channels in parallel, and matching the index metric (dot product/MIPS vs cosine) to the training objective.
- Learning to Rank & Where the Data Comes From: the pointwise/pairwise/listwise paradigms (RankNet, LambdaRank, LambdaMART, ListNet), and the impression-log flywheel with its three label corruptions.
- Deep Ranking Architectures & Multi-Task Learning: the feature-interaction lineage (FM → Wide&Deep → DeepFM → DCN-v2) and multi-task models (Shared-Bottom, MMoE, PLE) with training-loss vs serving-fusion weights.
- Re-Ranking & Bias Mitigation: list-level objectives (MMR/DPP diversity, calibration, freshness, explore/exploit) and the position-bias vs popularity-bias distinction with their mitigations.
- Feature Placement Across the Funnel: where context and user history live and how richly each stage can use them, governed by the separable-vs-joint line.
- Evaluating Recommenders: offline set metrics (Recall@K) vs order-aware metrics (NDCG, MAP, MRR, GAUC), evaluating stages separately, online metrics, and the offline–online gap.
- The 2026 LLM Frontier: LLMs as offline feature generators, as narrow rerankers, and the genuine architectural shift — semantic IDs and generative retrieval (TIGER) — plus the frictions that keep classical behavioral signal on the head.
The connective tissue¶
Two ideas recur through every page. The first is "separate now, joint later": separability buys precomputation and retrieval-scale speed; joint scoring buys accuracy — the same reason RAG splits retrieval from re-ranking is the reason RecSys splits retrieval from ranking. The second is that your training labels are corrupted by the system's own past behavior, not true preference — position bias, popularity bias, the feedback loop, and the offline–online gap are all faces of that one problem, and multi-task learning, re-ranking, exploration, and debiasing are all responses to it. Hold those two threads and the twenty topics collapse into one story.