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 source | Example | Common encoding |
|---|---|---|
| Categorical metadata | Genre, brand, category | One-hot or multi-hot vectors |
| Free text | Descriptions, reviews, articles | TF-IDF or sentence embeddings |
| Images | Product photos, posters | Vision model embeddings |
| Audio | Music tracks, podcasts | Spectrogram-based embeddings |
| Numeric attributes | Price, duration, year | Normalized or bucketed values |
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.
| Measure | Best suited to | Caveat |
|---|---|---|
| Cosine similarity | Sparse text vectors and embeddings | Ignores vector magnitude |
| Dot product | Learned embeddings with meaningful norms | Favors items with large norms |
| Jaccard index | Sets of tags or categories | Loses weighting information |
| Euclidean distance | Dense, normalized numeric features | Weak in high dimensions |
| Learned classifier score | Rich mixed features per user | Needs enough history per user |
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.
| Property | Content-based filtering | Collaborative filtering |
|---|---|---|
| Data required | Item features and user history | Interactions from many users |
| New item cold start | Handled well | Poor until interactions accumulate |
| New user cold start | Poor without initial history | Poor without initial history |
| Serendipity | Low, stays near known tastes | Higher, finds cross-genre links |
| Explainability | High, based on shared features | Moderate, based on similar users |
| Feature engineering effort | High | Low |
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.
| Situation | Recommended approach | Reason |
|---|---|---|
| Fast-changing catalog such as news | Content-based as primary signal | Items expire before ratings accumulate |
| Small user base | Content-based with metadata | Too few users for collaborative patterns |
| Mature platform with heavy traffic | Hybrid with content features | Combines coverage and discovery |
| Regulated domain needing explanations | Content-based or explainable hybrid | Feature overlap is easy to justify |
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.