Content-based filtering

On this page 7

Content-based filtering is a recommendation technique that suggests items similar in their attributes to items a user has already liked, by comparing item features with a profile of that user’s preferences. In recommender systems, it is one of the two classic families of methods, alongside collaborative filtering, and it relies on what items are rather than on what other people did with them.

Because it needs only the item catalog and one user’s own history, content-based filtering handles new items without any interaction data and produces recommendations that are easy to explain. Its main weakness is a tendency toward narrow, predictable suggestions that rarely surprise the user.

How content-based filtering matches items to users

Content-based filtering works in three steps: it represents every item as a feature vector, builds a user profile in the same feature space, and ranks candidate items by their similarity to that profile. The highest-scoring items that the user has not yet seen become the recommendations.

Item features come from structured metadata such as genre, author, brand, price band or tags, and from unstructured content such as text, images or audio. Classic systems turned text into TF-IDF vectors; modern systems use dense embeddings produced by language or vision models, which capture meaning beyond exact word overlap.

The user profile is usually a weighted average of the vectors of items the user interacted with, where weights reflect explicit ratings or implicit feedback such as clicks, purchases or watch time. Alternatively, a per-user classifier, for example logistic regression or a gradient-boosted model, learns to predict whether that user will like an item from its features.

The table below shows typical feature sources and how they are encoded.

Feature sourceExampleCommon encoding
Categorical metadataGenre, brand, categoryOne-hot or multi-hot vectors
Free textDescriptions, reviews, articlesTF-IDF or sentence embeddings
ImagesProduct photos, postersVision model embeddings
AudioMusic tracks, podcastsSpectrogram-based embeddings
Numeric attributesPrice, duration, yearNormalized or bucketed values
Typical item feature sources and encodings

Similarity measures and scoring

The scoring step depends on a similarity function that compares the user profile with each candidate item. The choice matters because feature vectors differ in length, sparsity and scale, and a poor measure can favor long descriptions or popular tags over genuinely relevant items.

MeasureBest suited toCaveat
Cosine similaritySparse text vectors and embeddingsIgnores vector magnitude
Dot productLearned embeddings with meaningful normsFavors items with large norms
Jaccard indexSets of tags or categoriesLoses weighting information
Euclidean distanceDense, normalized numeric featuresWeak in high dimensions
Learned classifier scoreRich mixed features per userNeeds enough history per user
Common similarity measures in content-based filtering

At catalog scale, exhaustive comparison is too slow, so systems store item vectors in an approximate nearest neighbor index and retrieve the closest candidates in milliseconds. This retrieval stage often feeds a later multi-stage ranking pipeline rather than producing the final list directly.

Feature weighting also shapes the result. When a catalog mixes text embeddings with categorical tags, the relative weight of each feature group decides whether recommendations follow topic, brand or price. Teams usually tune these weights against held-out interactions instead of setting them by intuition, and they normalize every vector before comparison so that no single feature group dominates the score.

Content-based filtering compared with collaborative filtering

The two families differ in their source of evidence. Content-based filtering reasons from item attributes and one user’s history; collaborative filtering reasons from the patterns of many users in the user-item matrix, with no need to understand item content.

PropertyContent-based filteringCollaborative filtering
Data requiredItem features and user historyInteractions from many users
New item cold startHandled wellPoor until interactions accumulate
New user cold startPoor without initial historyPoor without initial history
SerendipityLow, stays near known tastesHigher, finds cross-genre links
ExplainabilityHigh, based on shared featuresModerate, based on similar users
Feature engineering effortHighLow
Content-based and collaborative filtering side by side

Because their strengths are complementary, most production systems are hybrid recommender systems. A two-tower model, for example, can feed item content features into the item tower so that new items receive meaningful embeddings while interaction data refines them over time.

Where content-based filtering fits best

Content-based filtering is the preferred choice when item content is rich and interaction data is scarce. News, job listings, scientific literature, real estate and long-tail product catalogs all have many new or rarely viewed items that collaborative methods cannot yet place.

SituationRecommended approachReason
Fast-changing catalog such as newsContent-based as primary signalItems expire before ratings accumulate
Small user baseContent-based with metadataToo few users for collaborative patterns
Mature platform with heavy trafficHybrid with content featuresCombines coverage and discovery
Regulated domain needing explanationsContent-based or explainable hybridFeature overlap is easy to justify
Situations and recommended use

Limitations and common mistakes

The best-known weakness is overspecialization: the system keeps recommending items that closely resemble past choices, which reduces recommendation diversity and can contribute to a filter bubble. Practitioners counter it with diversity re-ranking, exploration slots and controlled randomness.

  • Shallow features: sparse or inconsistent metadata limits what similarity can capture.
  • Stale user profiles: without time decay, old interests outweigh current ones.
  • Ignoring quality: similar items are not necessarily good items, so popularity or rating signals still matter.
  • Feature leakage of bias: attributes that correlate with sensitive traits can create unfair recommendations.

Evaluation should therefore go beyond accuracy and include beyond-accuracy metrics such as diversity, novelty and catalog coverage, measured offline and confirmed in online experiments.

Explained without jargon

Content-based filtering recommends things by looking at what the things themselves are like. If you enjoyed two space adventure novels, it notices their topic, style and author, and suggests other books with similar traits.

It works like a bookseller who remembers what you bought and recommends similar titles, without asking other customers anything. That makes it good at suggesting brand-new items, but it can keep showing you more of the same.

A typical use case

A regional job board lists about 40,000 vacancies, and most of them stay online for only two to three weeks, so few listings ever collect enough clicks for collaborative filtering. The team encodes each vacancy with sentence embeddings of the description, plus location, salary band and required skills.

For each job seeker, the system builds a profile from the vacancies they saved or applied to, with older interactions down-weighted after 30 days. Every morning it retrieves the 200 nearest vacancies from an approximate nearest neighbor index, removes positions outside the commuting radius and re-ranks them to include a few roles from adjacent fields.

New vacancies appear in recommendations within minutes of being posted, and applications that start from the recommendation email rise noticeably compared with the earlier list sorted only by date.