Skip to content
Tutorials Center
My learning

Topics

Lesson 13 of 38 ยท Content-based Filtering

Limits of Content-based Filtering

See where content-based recommenders fail: overspecialization and filter bubbles. Measure diversity, re-rank with MMR, and add dense embeddings via SVD for meaning beyond words.

Content-based filtering has real strengths: it needs no other users, handles new items, and explains itself. It also has predictable weaknesses. This lesson names them, measures one (lack of variety) and fixes it with a standard re-ranking trick, then shows how dense embeddings capture meaning that raw words miss.

The classic weaknesses

  • Overspecialization: you recommend only items like those already liked, so the user never sees anything new. This is the "filter bubble" in its simplest form.
  • Feature dependence: quality is capped by the quality of the item data. Poor descriptions, missing tags and untagged media give weak vectors.
  • No social signal: a track everyone loves but whose text looks plain will never surface.
  • Cold-start users: with no history there is no profile. (New items are fine.)
  • Synonyms and meaning: "car" and "automobile" share no words, so TF-IDF sees no link.

Measuring variety: intra-list diversity

A recommendation list is diverse if its items are unlike each other. Intra-list diversity is the average pairwise distance (1 - similarity) between the k items. A list of five near-identical sequels scores near 0.

Python Intra-list diversity

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The plain top four are all variations on one space-action idea, and the list scores only about 0.75 (1.0 would mean no shared words at all).

Re-ranking with MMR

Maximal Marginal Relevance builds the list greedily. At each step pick the item that maximizes

ฮป ยท relevance - (1 - ฮป) ยท max similarity to items already chosen

ฮป = 1 is plain ranking; smaller values trade relevance for variety. It runs after scoring, so it works with any model, not just content-based ones.

Python MMR re-ranking

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

At ฮป = 0.7 the list is unchanged; at ฮป = 0.4 diversity rises from about 0.75 to 0.90 because near-duplicates are replaced by items from other genres. The right ฮป depends on the product: a music app might prefer more variety than a "buy it again" shelf.

Dense embeddings with SVD (LSA)

TF-IDF vectors are huge and sparse. Latent semantic analysis compresses them with truncated SVD into a few dozen dense dimensions where words that appear in similar contexts end up close. It is a small step toward the neural embeddings used in production, and it runs in scikit-learn.

Python LSA: words that co-occur become neighbors

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Real systems use pretrained text or image encoders (BERT-style sentence embeddings, CLIP) for the same purpose. The pipeline is unchanged: encode each item to a vector, build a profile, score by cosine. This is also the idea behind the two-tower models in Deep and Hybrid Models.

Content-based: pros and cons

New items Score from content alone
Explainable Show the shared features
Private Needs only one user's data

Strengths.

1 / 2

When to choose content-based

Pick it when items arrive faster than interactions (news, jobs, listings), when privacy limits shared data, or when you need explanations. Combine it with collaborative filtering when you have both content and enough behavior data.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What is overspecialization?

    The system narrows the user's exposure, creating a filter bubble.
  2. 2. What does intra-list diversity measure?

    Higher average pairwise distance means a more varied list.
  3. 3. In MMR, what does lowering lambda do?

    Lambda blends relevance and the penalty for similarity to already chosen items; smaller lambda favors variety.
  4. 4. Why can LSA find that 'car' and 'automobile' documents are related?

    Truncated SVD captures co-occurrence patterns, so synonyms used in similar documents get similar dense vectors.

Summary

  • Content-based filtering handles new items and explains itself but overspecializes and depends on feature quality.
  • Measure variety with intra-list diversity and improve it with MMR re-ranking.
  • Dense embeddings (LSA now, neural encoders later) capture meaning that raw words miss.
  • Combine content signals with behavior when both exist.

Next: User-based Collaborative Filtering