DEV Community

Igor Shalamov
Igor Shalamov

Posted on Originally published at igorshalamov.com

Collaborative filtering vs content based filtering: when to use each

A new song is uploaded and nobody has played it yet. One kind of recommender will never show it; the other will recommend it in the first minute and then keep showing more of the same. These are collaborative filtering and content based filtering. The video version of this note is linked at the end.

Content based filtering

It describes each item by its features (genre, tempo, instruments, text, tags, images), builds a taste profile from the items a user liked and recommends the nearest items. Its strength is that a new item needs no history. Its weakness is repetition: it finds more of the same, the filter bubble.

Collaborative filtering

It ignores what the item is and looks only at who interacted with what. If two users' histories overlap, items one of them liked become candidates for the other. Modern systems learn this with matrix factorisation or neural embeddings. Its strength is discovery: other people bridge the gap to things a user would never search for. Its weakness is cold start: a new item or a new user with no interactions is invisible.

Four questions for choosing

  • Little interaction history but rich item data, as in a new marketplace: start content based.
  • Millions of interactions: collaborative filtering usually wins.
  • Discovery outside the user's usual taste matters: collaborative again.
  • New items every day, as in news or video: you need both.

How production systems combine them

Collaborative filtering supplies candidates from interaction history, content based retrieval fills the gap for new items and new users, and a ranking model scores all candidates using both kinds of signal. Another option is one model: a two-tower model with content features in the item tower.

Measure coverage next to accuracy

Catalogue coverage, the share of items that get recommended at all, shows the difference that recall hides. Report it next to recall, on a train and test split by time. A random split leaks the future and flatters collaborative filtering.

Three common mistakes

  1. Popularity bias in collaborative filtering: penalise popularity and watch coverage.
  2. Thin item features in content based filtering: a title and a category are not enough; use learned embeddings of text, audio or images.
  3. A random train and test split instead of a split by time.

The same choice appears in referral systems: whom to invite comes from what similar users did (collaborative) plus profile features (content).

Watch the episode

https://youtu.be/M-zMOlCA648

Related research

I describe the architecture and efficiency of neural personalization systems in my article “Personalization of news content using AI: architecture and efficiency of neural network systems” (European Journal of Technical and Natural Sciences, No. 4–5, 2025, DOI 10.29013/EJTNS-25-4.5-18-29): https://igorshalamov.com/research/news-personalization-ai/?utm_source=devto&utm_medium=guest_post&utm_campaign=yt008&utm_content=paper


Originally published on igorshalamov.com: https://igorshalamov.com/writing/collaborative-vs-content-based-filtering/?utm_source=devto&utm_medium=guest_post&utm_campaign=yt008&utm_content=footer. Watch the full episode: https://youtu.be/M-zMOlCA648

Igor Shalamov is an AI systems architect who designs AI growth systems: referral and recommendation systems, AI-driven communication automation, semantic search and classification.

Top comments (0)