The problem & the landscape

Before any algorithm, let's frame what we're solving and map the families of solutions so every later chapter has a place on the map.

The problem, precisely

We have users, items, and a log of interactions between them. For a given user, produce a short ranked list (top-k) of items they haven't seen yet and are most likely to want next.

Two things make this hard:

  1. Scale. Millions of users × millions of items. We can't score every item for every user in real time (that's where the ANN books come in).
  2. Sparsity & ambiguity. Each user has touched a tiny fraction of the catalog, and a non-interaction usually means "never saw it", not "disliked it". We're predicting from very incomplete, noisy signals.

The two big families

Almost every recommender is one of these two ideas, or a blend (a hybrid):

1. Content-based filtering

"Recommend items similar to what this user already liked, based on the items' content."

It uses features of the items (text, genre, embeddings). If you read three articles about space, it recommends more space articles. It needs item features but not other users' data — so it works for a brand-new item, and even for a user with a short history. Covered in Chapter 5.

2. Collaborative filtering (CF)

"Recommend items that people similar to this user liked — using the interaction patterns alone, ignoring item content."

It learns from the crowd: "users who interacted with X also interacted with Y." It needs no item features and often gives better, more surprising results — but it struggles with brand-new users/items (no interactions yet = the cold-start problem). CF splits into:

  • Neighborhood methods — direct similarity between users or items (Chapter 6).
  • Model-based methods — learn compact latent vectors that explain the interactions: matrix factorization (Chapter 7), learning-to-rank (Chapter 8), and neural models (Chapter 9).

Comparison

Content-basedCollaborative filtering
Usesitem featuresinteraction patterns
New item with no interactions✅ works❌ cold start
New user with no history⚠️ needs a little history❌ cold start
Surprising / cross-topic recs❌ stays "on topic"✅ finds hidden links
Needs item features✅ yes❌ no

Neither dominates — production systems combine them (and add popularity for cold start). That blend is a hybrid.

The modern architecture: two stages

At scale you can't run a fancy model over millions of items per request. So real systems split the job in two (Chapter 9):

   millions of items
          │
   ┌──────▼───────┐   CANDIDATE GENERATION (retrieval)
   │  cheap & fast │   cut millions -> a few hundred candidates
   │  e.g. ANN kNN │   (content/CF embeddings + nearest-neighbor search)
   └──────┬───────┘
          │  ~hundreds
   ┌──────▼───────┐   RANKING
   │ rich & slow   │   score the few hundred with a heavy model
   │ many features │   using lots of features, pick the top-k
   └──────┬───────┘
          │
        top-k  ──►  shown to the user
  • Candidate generation is about recall — don't miss good items — and must be fast. Embeddings + nearest-neighbor search (the HNSW/IVF-PQ books) live here.
  • Ranking is about precision — order the survivors well — and can afford a heavy model because it only scores a few hundred items.

Keep this picture in mind: most chapters are building a candidate generator or a ranker.

How we'll proceed

Data → how to measure success → simple baselines → the algorithms (simplest to most powerful) → cold start → serving → best practices. We start with the data, because the kind of feedback you have changes everything. 👉