Search, Ads & Recommender Systems
One stand-alone series, three linearized tracks over the same engine. Read any track end-to-end from first principles: the product decision, the retrieval and ranking stack, objectives and bias correction, evaluation, serving, and the failure modes a senior engineer must anticipate. Search and recommendation share roughly 90% of the machinery β the tracks cross-link that shared core instead of repeating it.
Three tracks β pick where to start
- π Search (lessons 40β49, ~3.5h) β the query changes everything. Query understanding β inverted index & BM25 β dense & hybrid retrieval β learning-to-rank β semantic reranking β autocomplete β personalization β relevance evaluation β system design. The newest and most self-contained track; start at 40.
- π― Recommender systems (lessons 01β08, 12β39, ~6h) β no query, predict engagement. The retrieveβrankβrerank cascade, objectives, calibration, bias/debiasing, sequences, multimodal, evaluation, serving, data/feature engineering, and responsible constraints. The center of gravity; start at 01.
- π° Ads (lessons 09β10, 25, builds on 01β08) β turn a predicted click probability into a price. Auctions (GSP/VCG), bidding & pacing, and autobidding as multi-agent RL. A specialization on top of the recsys core; read 01β08 first.
All three share retrieval, ranking, embeddings, calibration, debiasing, and serving. Lessons 40β49 (Search) lean on
03 (ANN),
05 (losses),
07 (bias), and
08 (evaluation) rather than re-deriving them.
The mental model
First, the three product surfaces β if you're new here
This series covers three closely-related systems. A
recommender system suggests content a user may like with
no explicit query β YouTube Home, the TikTok feed, Amazon "you may also like" β and optimizes engagement.
Search ranks results against an
explicit query that states an intent the system is obligated to satisfy β web search, e-commerce search, marketplace search β and optimizes relevance.
Ads rank bid-backed candidates and add an
auction (lessons 09β10) that turns a predicted click probability into a price. All three share ~90% of the machinery (retrieval, ranking, embeddings, calibration, debiasing, serving); what differs is whether there is a query, whether the objective is engagement or relevance, and whether money changes hands. The Search track (40β49) teaches the query-specific half; the recsys track teaches the shared core; the ads lessons teach the auction layer.
Read each track as one chain of decisions, not a bag of model names. Every system answers the same question under different constraints: what should this user see next (given their query, if any), why, at what cost, and how do we know it helped?
product surface ββββ search? βββΊ query understanding (normalize, spell, expand, intent)
β β
βΌ βΌ
objective & labels βββΊ candidate generation βββΊ retrieval: inverted index (BM25) + ANN/dense + graph
β β β (search fuses lexical + dense)
βΌ βΌ βΌ
ranking model βββββ features / sequences / multimodal βββββ learning-to-rank
β
βΌ
rerank (cross-encoder), constraints, ads auction, diversity, exploration
β
βΌ
logs β debiasing β evaluation (NDCG / interleaving / AΒ·B) β retraining
β
βΌ
serving, monitoring, failover, responsible guardrails
What a strong reader can do afterward
| Skill | What good looks like | Lessons |
| Decompose the system |
Given "design YouTube Home" or "design Airbnb search", draw retrieve β rank β rerank, then name the objective, labels, latency budget, and failure modes. |
01, 11, 32 |
| Build a search engine |
Given "design web search" or "design product search", lay out query understanding β inverted index + dense/hybrid retrieval β learning-to-rank β semantic rerank β SERP; defend BM25 vs dense vs hybrid, size shards and the scatter-gather tail, and measure relevance with graded NDCG and interleaving. |
40-49 |
| Choose the right model family |
Know when CF/MF is enough, when two-tower retrieval is required, when DLRM/DCN-style rankers fit, and when sequence, graph, multimodal, or LLM-based methods earn their cost. |
02-04, 13-14, 24, 26 |
| Reason about objectives |
Translate product goals into labels, critique those labels for bias and delay, fuse multiple task heads, and calibrate probabilities when money or constrained optimization enters. |
05, 07, 12, 27 |
| Operate at scale |
Explain feature freshness, train-serve skew, billion-row embedding tables, index refresh, streaming lag, data quality, canaries, rollbacks, monitoring, graceful degradation, and $/query trade-offs. |
17-19, 28-30, 35-37 |
| Evaluate honestly |
Use offline metrics, replay, A/B tests, interleaving, short-video experience metrics, counterfactual estimators, causal/uplift thinking, and segment slices without confusing logged-data correlation for causal lift. |
08, 27, 31, 33-34 |
| Pass operational interviews |
Answer implementation questions about A/B randomization, feature lineage, Kafka/Flink pipelines, EDA, abuse filtering, cold-start graduation, privacy, compliance, and utility trade-offs. |
33-39 |
Track A Β· Search π β the query changes everything
The newest track, and the most self-contained. A query is a stated intent the system is obligated to satisfy, which changes the objective (relevance, not engagement), the candidate set (query-conditioned), and the failure modes (a hard recall floor). These ten lessons build the full search engine β query in, ranked results out β leaning on the shared retrieval/ranking/evaluation machinery from the recsys track rather than repeating it. Read 40β49 in order.
Foundations & query. What makes search different, and the first stage every engine runs on the raw query string.
40
Search vs. recommendation β the query changes everything
The relevance contract, query taxonomy (navigational/informational/transactional), the Zipfian query distribution, the search funnel, and how the objective and metrics differ from recsys.
41
Query understanding β raw string to structured intent
Normalization, tokenization, stemming, the noisy-channel spell model, query expansion (Rocchio, neural), segmentation, intent classification, NER, and attribute tagging β each as a recall/precision trade.
Retrieval. Shrink millions of documents to a candidate set β first lexically, then semantically, then both.
42
The inverted index & BM25 β lexical retrieval that still wins
Posting lists, compression, skip pointers, TF-IDF β the full BM25 formula with the engineering intent of kβ (saturation) and b (length norm), BM25F, and WAND/block-max top-k pruning.
43
Dense & hybrid retrieval β fixing lexical's blind spot
Vocabulary mismatch, bi-encoders + ANN (builds on 02/03), learned sparse (SPLADE/doc2query), and hybrid fusion β score normalization, linear combination, and Reciprocal Rank Fusion.
Ranking & reranking. Score the candidate set with rich query-document features, then spend an expensive model on the top few.
Surfaces, evaluation & serving. The keystroke surface, the e-commerce twist, how to measure relevance honestly, and the full system.
46
Autocomplete, suggestions & spelling at scale
Tries/FSTs, most-popular-completion + learned ranking, the per-keystroke QPS/latency reality and head-query caching, unseen-prefix coverage, and did-you-mean spelling at scale.
47
Personalized & e-commerce/marketplace search
When to personalize (and when not to), multi-objective blending (relevance Γ conversion Γ margin), facets & the post-filter recall problem, and marketplace two-sidedness and seller fairness.
48
Search relevance evaluation
Graded judgments/qrels and pooling, every offline metric computed (P@k, MRR, MAP, NDCG, ERR), the click-bias hazard, and online interleaving vs A/B β why interleaving needs far less traffic.
49
Search system design & serving
The query path and the indexing path, sharding & scatter-gather tail amplification, NRT freshness, result caching, capacity napkin math, and failure modes β the Search capstone.
Track B Β· Recommender systems π― β the shared core (Phases 1β9)
The center of gravity: no query, predict engagement. The phases below build the recommender end-to-end and contain the shared machinery the Search and Ads tracks both reuse. Track C Β· Ads π° is woven in as a specialization β lessons 09β10 (auctions, bidding & pacing) and 25 (autobidding as multi-agent RL) β and assumes Phases 1β4 first.
Phase 1 Β· Frame the production ranking problem
First learn the cascade. A production recommender is not "one model predicts a click"; it is a staged decision system with different latency, recall, precision, and business constraints at each stage.
01
The funnel β retrieve, rank, re-rank
Why production ranking is a cascade, why every stage optimizes a different proxy, and how recsys and ads share the same core machine.
11
System design walkthrough
The first full pass through the interview shape: requirements, cascade, objectives, latency budgets, metrics, operations, and follow-up probes.
Phase 2 Β· Retrieve candidates from a huge catalog
Once the surface is clear, shrink billions of items to hundreds or thousands. This phase teaches the historical path from collaborative filtering to neural retrieval, plus the embedding and index machinery that makes retrieval practical.
02
Candidate generation β from CF to two-tower
Collaborative filtering, matrix factorization, Funk-SVD/ALS, two-tower retrievers, multi-source recall, and why retrieval losses differ from ranking losses.
03
Embeddings & approximate nearest neighbour
Dot product, cosine, MIPS, HNSW, IVF, PQ, recall-latency-RAM trade-offs, sharding, updates, and when ANN is the wrong tool.
24
Graph neural networks for recommendation
The interaction matrix as a bipartite graph: GraphSAGE, PinSage, LightGCN, high-order connectivity, cold sparse nodes, and over-smoothing.
Phase 3 Β· Rank with deep models and better user understanding
Now score the candidate set with richer features. This is where sparse IDs, feature crosses, task heads, sequence behavior, and multimodal content become one ranking model.
04
The ranking model β LR to DLRM to DCN-v2
Sparse high-cardinality features, embedding tables, feature crosses, GBDT-to-deep evolution, DLRM/DCN/MaskNet, and what feature engineering still means.
12
Multi-task & multi-objective ranking
Shared-bottom, MMoE, PLE, ESMM, gradient conflict, click/watch/like/retention fusion, and why one score is never enough.
13
User-behavior sequence modeling
Implicit feedback, target attention, DIN/DIEN, short-term versus long-term interest, sessionization, and behavior features.
14
Multimodal recommendation
Text/image/video encoders, fusion strategies, CLIP-style alignment, content vectors for cold start, and the encoding cost bill.
Phase 4 Β· Train objectives without fooling yourself
A recommender learns from logs produced by the old recommender. This phase is the antidote to naive supervised learning: losses, calibration, sampling, position bias, off-policy correction, causal reasoning, and exploration.
05
Losses & calibration
Pointwise, pairwise, listwise learning-to-rank; Platt/isotonic/temperature calibration; ECE; and why ads require probabilities.
06
Negative sampling
In-batch negatives, sampled softmax and log-Q correction, uniform and hard negatives, false negatives, and sampling bias.
07
Position bias, selection bias, debiasing
Examination hypothesis, click models, IPS, doubly robust correction, intervention harvesting, and why logged data is not the world.
15
Cold start
User, item, and system cold start; content bridges; priors; cross-domain transfer; contextual bandits; UCB; Thompson sampling.
16
Reinforcement learning for recommendation
Feed as MDP, bandits as the one-step case, policy/value methods, off-policy learning from logs, and reward-design failure modes.
27
Causal inference & uplift modeling
Prediction versus intervention, potential outcomes, CATE, S/T/X-learners, causal forests, PSM, DID, IV, and synthetic control.
Phase 5 Β· Evaluate before and after launch
This phase answers "how do we know it helped?" Offline ranking metrics are useful, but production confidence comes from counterfactual care, online experiments, interleaving, segment slicing, and case-specific guardrails.
08
Evaluation β offline metrics & A/B tests
NDCG, MAP, AUC, log-loss, calibration error, replay, power/MDE, CUPED-style variance reduction, metric tests, bootstrap, and novelty effects.
31
User segmentation & profiling
User portraits, tags, RFM, K-means, embedding clusters, fast/slow profiles, segment-conditioned policy, and Simpson's paradox.
Phase 6 Β· Serve the system at scale
The model is only useful if it can run under an SLA with fresh features and safe rollouts. These lessons cover the engineering plane beneath the model.
17
Real-time & streaming recommendation
Offline, nearline, and online planes; logs and stream processors; exactly-once trade-offs; feature freshness; online learning; and latency budgets.
18
Deployment & serving
Export formats, serving runtimes, train-serve skew, shadow/canary/ramp/rollback, model versioning, hot updates, and monitoring.
19
Large-scale system optimization
Billion-row embedding tables, sharding, parameter servers, all-reduce, ANN at scale, quantization, distillation, caching, and $/query.
28
Feature engineering as a discipline
Categorical encoding, target leakage, numerical transforms, feature selection, streaming wrinkles, feature parity, and why embeddings do not remove craft.
29
Data engineering for recommendation
Batch versus stream, MapReduce/Spark, Lambda/Kappa, ETL, feature stores, point-in-time correctness, data quality, EDA, and skew/salting.
30
High availability & disaster recovery
Nines, error budgets, redundancy, load balancing, multi-region failover, RTO/RPO, circuit breakers, and graceful degradation.
Phase 7 Β· Add ads, responsibility, and frontier methods
These are specialization layers. Ads add auctions and advertiser control loops. Responsible AI adds constraints on privacy, fairness, explainability, and federated learning. Frontier lessons cover LLMs, generative recommendation, and multi-agent dynamics without pretending they replace the core stack.
09
The ad auction β GSP, VCG, quality score
First-price, second-price, GSP, VCG, quality score, reserve prices, ad load, externalities, and why calibrated pCTR matters.
10
Bidding & pacing
Autobidding, Lagrangian dual view, bid shading, daily budget pacing, control loops, and failure modes when optimizers interact.
20
Fairness & diversity
Filter bubbles, popularity bias, feedback loops, diversity metrics, MMR, DPP, two-sided fairness, and debiasing levers.
21
Explainable recommendation
Intrinsic and post-hoc explanations, feature attribution, attention caveats, templates, counterfactual explanations, trust, debugging, and compliance.
22
User privacy protection
Anonymization failure, k-anonymity, differential privacy, epsilon/noise/utility, DP-SGD, on-device inference, and regulation.
23
Federated learning for recommendation
FedAvg, communication/computation trade-offs, non-IID convergence, secure aggregation, DP, and the on-device item-table problem.
25
Multi-agent reinforcement learning
Non-stationarity, CTDE, MADDPG, QMIX, cooperative versus competitive settings, auto-bidders, and when MARL earns its complexity.
26
LLMs & generative AI in recommendation
LLM-as-judge, user simulators, semantic IDs, generative retrieval, small-set reranking, AIGC content, distillation, and the cost wall.
Phase 8 Β· Synthesize through cases
End by reading real systems with one reusable worksheet. The goal is to stop memorizing company names and start recognizing constraints.
Phase 9 Β· Pass the operational interview layer
The question-bank material adds a different kind of depth: not more model names, but the operational details interviewers use to tell a system builder from a paper reader. These lessons cover experiment design, short-video-specific metrics, feature lineage, streaming failures, data quality, advanced cold start, and privacy/compliance.
33
A/B testing deep dive
Decision metrics, guardrails, randomization units, stratified splits, MDE/power, ratio metrics, confounders, long-term holdouts, and launch rules.
34
Short-video metrics
Effective play, completion normalization, rewatch, fast-swipe, immersion-time density, continuous watch, retention, negative feedback, and ecosystem health.
35
Feature engineering deep dive
Feature lineage, entity clocks, high-cardinality encodings, dynamic normalization, time windows, user portraits, leakage, and feature importance.
36
Streaming pipeline ops
Kafka topic/partition design, Flink keyed state, watermarks, exactly-once semantics, backpressure diagnosis, feature-store writes, and fallback ladders.
37
Data quality, EDA, and anti-fraud
Schema and volume checks, missingness, outliers, long-tail distributions, bot/brush traffic, dirty-label detection, and training-data incident response.
38
Cold start advanced
Device/context priors, transfer learning, meta-learning, exploration budgets, graduation criteria, cold-start evaluation, and spam/security gates.
39
Privacy, compliance, and privacy computing
Purpose limitation, minimization, masking, anonymization limits, DP, federated learning, MPC/TEE/HE trade-offs, deletion, transfer, and utility measurement.
Suggested reading paths
| Goal | Read this path |
| Core ranking interview | 01 β 02 β 03 β 04 β 05 β 06 β 07 β 08 β 11 β 32 β 33 |
| Recsys production depth | 01-08 β 12-19 β 28-32 β 35-37 |
| Short-video / feed systems | 01-08 β 12 β 13 β 15 β 16 β 17 β 20 β 31 β 32 β 34 β 38 |
| Ads teams | 01-10 β 12 β 17-19 β 25 β 27 β 30 β 32 β 33 β 39 |
| Frontier / research-flavored | 13-16 β 20-27 β 31-32 β 38-39 |
| Question-bank cram | 33 β 34 β 35 β 36 β 37 β 38 β 39, after reading 01-08 |
| Search systems | 40 β 41 β 42 β 43 β 44 β 45 β 46 β 47 β 48 β 49 (self-contained; 01 helps but isn't required) |
How to study this
Read linearly once so the vocabulary compounds. After that, revisit by product surface: video feed, marketplace search, e-commerce, ads, or generative recommendation. For each surface, redraw the same chain: objective β retrieval β ranking β bias/evaluation β serving β failure modes β experiment/ops/compliance. That repeated chain is the point of the syllabus.
Prerequisites & difficulty. In the
recsys track, lessons
01β08 are the core and are best read in order β the vocabulary compounds. After 08 you can jump to any phase. A few hard dependencies: 12 (multi-task) and 31 (segmentation) lean on 13 (sequences); 17β19 and 35β37 assume the funnel and feature vocabulary from 01, 04, and 28. The frontier path (13β16, 24β27, 38β39) is
intermediate-to-advanced. The
ads track (09β10, 25) assumes 01β08 first. The
search track (40β49) reads start-to-finish on its own and is a good entry point even if you skip the recsys phases; it links back to 03 (ANN), 05 (losses), 07 (bias), and 08 (evaluation) exactly where it needs the shared machinery, so follow those links if a concept is new.