How Personalized Recommendation Algorithms Work: From Collaborative Filtering to Deep Learning
Summary: One story runs through personalized recommendation: collaborative filtering uses similarity to find people like you, matrix factorization compresses sparse behavior into latent vectors, and deep learning uses those vectors plus sequence models to model each person's interest directly.
What Personalized Recommendation Means
Personalized recommendation is the technical system that, at the same moment and in the same slot, ranks content differently for each user according to behavior, attributes and context. The problem it solves is not finding relevant items; it is deciding which one this particular person should see first among several million candidates that are all arguably relevant.
Its boundary with search is the presence of an explicit query. Search is people looking for information, where users state intent with keywords; recommendation is information finding people, where the system can only infer intent from historical behavior. Because both share relevance computation, index structures and ranking models underneath, they are usually built on one stack (Ecommerce Search and Recommendation in One System: From Data Unification to Joint Optimization). For the full system layering, see What Is a Recommendation System? The Three-Layer Architecture of Retrieval, Ranking and Reranking.
Three Shifts in the Objective Function
To understand how the algorithms evolved, start with what is being optimized:
- Rating prediction: predict what score a user would give an item, measured with RMSE and MAE. The problem is that deriving a ranking from predicted scores points error in a direction that does not match business return.
- Top-K ranking: optimize list order directly, measured with NDCG, MAP and Recall at K. This maps much better onto the real question of what to put into the top 20 slots of a homepage.
- Behavior probability and multi-objective: estimate click-through probability and conversion probability alongside watch time and GMV, then blend them by business weight. This is the mainstream shape in the deep learning era.
Every shift in the objective function retired a batch of algorithms, and it also defines how this article divides the generations.
Generation One: Collaborative Filtering
Collaborative filtering rests on a plain assumption: people whose past behavior was similar will want similar things in the future. It does not need to understand item content; it only depends on the user-item interaction matrix.
Google's official machine learning course defines collaborative filtering as recommending items that similar users liked, based on similarity between users, taking the user-item interaction matrix as input (Collaborative filtering basics).
Two basic forms
- User-based CF: find the neighbors closest to the target user's interests, then push items those neighbors liked and the target user has not seen. It suits stable interests, but the similarity computation explodes as the user base grows.
- Item-based CF: compute the item similarity table offline, then serve similar items online from the user's recent behavior. Its complexity is independent of user count and it can be fully precomputed offline, which made it the first scheme deployed at scale in industry.
How similarity is computed: cosine similarity and Pearson correlation are standard, and engineering always needs popularity punishment, because popular items look similar to almost everything and pollute the similarity table.
Three weaknesses you cannot avoid
- Sparsity: users interact with only a tiny number of items, so the interaction matrix is more than 99% empty and two users' behaviors barely overlap.
- Cold start: a new item has no interaction record and can never enter the recommendation list; the same applies to a new user.
- Popularity bias: similarity tilts naturally toward popular items, leaving long-tail items starved of exposure.
The magnitudes in the classic paper published in IEEE Internet Computing in 2003, written by authors from a global e-commerce company, are still representative today: large retailers typically serve tens of millions of customers and millions of items in stock, and recommendations must return in under one second, within 0.5 second (Item-to-Item Collaborative Filtering, 2003). A latency budget of 0.5 second is exactly why the algorithm has to finish almost all computation offline.
Generation Two: Matrix Factorization
Matrix factorization attacks sparsity. It decomposes the high-dimensional, sparse user-item interaction matrix into the product of two low-dimensional dense matrices: every user gets a latent vector, or embedding, every item gets one too, and the inner product of the two vectors is the predicted score.
Google's course files this family under collaborative filtering and notes that matrix factorization can compress the interaction matrix into a low-dimensional representation through techniques such as singular value decomposition, thereby capturing latent structure in users and items (Matrix factorization).
Why it beats traditional collaborative filtering
| Problem | Traditional collaborative filtering | Matrix factorization |
|---|---|---|
| Sparsity | Depends on behavior overlap; fails when the overlap is empty | Latent vectors come from a global fit, so similarity is computable with zero overlap |
| Generalization | Can only recommend items that co-occurred before | Latent vectors extrapolate to items that never co-occurred but share structure |
| Storage and compute | Similarity table grows with the square of item count | Only vectors of k dimensions to store, with k commonly set to 32–128 |
| Explainability | High, as in "people who bought A also bought B" | Low, because latent dimensions carry no semantics |
Mainstream methods: SVD and SVD++ for explicit feedback; ALS, or alternating least squares, and BPR, or Bayesian personalized ranking, for implicit feedback such as clicks, add-to-cart actions and views. Most industrial scenarios are implicit feedback, and the pairwise ranking loss of BPR tracks the real goal, which is ordering.
The weakness of matrix factorization is that it only does a linear inner product. It cannot model higher-order crosses and temporal relations, the case of a user who just viewed three pairs of running shoes and should now be shown sports socks, and it uses no side information such as item content or context.
Generation Three: Content-Based and Hybrid Recommendation
If behavior data is sparse, bring in information about the items themselves. Content-based filtering does not depend on what other users did; it matches item attributes against the attributes of items the user already consumed (Content-based filtering basics).
It delivers two direct benefits:
- Item cold start: a new product has no interactions, but it has a category, a price band, a title and image-text vectors, so it can be matched immediately.
- Explainability: "because you often look at commuting-style pieces" is far easier to justify to users and to merchandising than an inner product of latent vectors.
The cost is that recommendations collapse back into interests the user already has, so novelty and cross-category discovery are weak. Industry therefore never runs content filtering alone; it builds hybrids where content filtering guarantees cold-start coverage and diversity while collaborative methods carry precision.
How well the hybrid works depends heavily on the quality of the tag and attribute system: category granularity, attribute completion rate, synonym normalization and recency tags directly set the ceiling for content features (Building Fine-Grained User Profiles: A Design Guide to User Tag Systems). Cross-device identity resolution matters just as much: if one person's behavior across app, mini program and web cannot be merged, the behavior sequence is chopped up and no algorithm gets a complete input (OneID Cross-Platform Identity Resolution in Practice).
Generation Four: Deep Learning
Deep learning does not overturn the first three generations; it unifies them inside one differentiable framework: embeddings carry matrix factorization forward, neural networks carry feature crossing, and sequence models carry the timing of behavior.
4.1 Vector Retrieval: Two-Tower Models Plus Approximate Nearest Neighbor
A two-tower model feeds user-side features and item-side features into two separate neural networks, each emitting one vector, and the online path uses a vector search engine for approximate nearest neighbor lookup, such as HNSW or ScaNN, to take the top results.
The real gain over matrix factorization is that the item tower can take content features, so a new product gets a vector the moment it enters the catalog and the cold-start problem shrinks sharply at the retrieval layer. Google's course states plainly that a deep retrieval model can draw candidates from user features, item content, context and many other signals, then score them with one unified model (DNN recommendation: retrieval).
4.2 Feature Crossing: From Wide and Deep to DeepFM
The ranking layer must answer how to combine dozens of feature groups into an accurate probability estimate. Three generations of representative structures:
- Wide and Deep: the linear part memorizes frequent co-occurrence; the deep part generalizes to unseen combinations.
- DeepFM: factorization machines replace manual feature engineering and learn second-order crosses automatically, while keeping both low-order and high-order crossing.
- DCN and AutoInt: explicit higher-order crossing, with interpretable analysis of the crossing weights.
4.3 Sequence Modeling: From DIN to Transformer
User interest is not a static profile; it is a behavior sequence that keeps changing. Sequence models reweight history by how relevant each past behavior is to the target item:
- DIN, or Deep Interest Network: an attention mechanism weights historical behavior against the candidate item, so the same user reading running shoes and reading coffee machines activates different parts of their history.
- DIEN: models the evolution of interest explicitly on top of DIN.
- Transformer and SASRec-style structures: self-attention captures long-sequence dependencies, suiting long-cycle, multi-session behavior modeling, and is one of the current mainstream directions.
4.4 Multi-Objective Learning and Unified Scoring
Real businesses need more than clicks. Multi-objective structures such as ESMM, MMoE and PLE train click probability, conversion probability, dwell time and interaction rate jointly in one model, easing the mismatch where clicks are high but conversions are poor. Google's course stresses that using a single model to score every retrieval source uniformly is more comparable than each source quoting its own score, and makes it easier to bring in context (DNN recommendation: scoring).
The open-source ecosystem has standardized these structures, so engineering teams need not implement them from scratch (Microsoft Recommenders open-source algorithm library).
Four Generations Compared
| Generation | Representative algorithms | Core idea | Key problem solved | Main limitation | Typical scale |
|---|---|---|---|---|---|
| First | User-based and item-based CF | Similarity over crowd behavior | Recommend without understanding content | Sparsity, cold start, popularity bias | Catalogs below the hundred-thousand SKU level |
| Second | SVD, ALS, BPR | Interaction matrix into low-dimensional latent vectors | Sparsity and generalization | Linear modeling, no side information | Catalogs from one hundred thousand to one million SKUs |
| Third | Content filtering, hybrids | Match on item attributes and tags | Cold start and explainability | Weak novelty, trapped in interest bubbles | Any scale, as a supplementary route |
| Fourth | Two-tower, DeepFM, DIN, MMoE | Embedding plus crossing plus sequence plus multi-objective | Generalization, timing, multi-objective, immediacy | High compute and engineering cost, dedicated team required | Catalogs above one million SKUs with dense behavior |
Metrics and Rollout Path: Which Tier You Need
Each generation has its own metrics, and mixing them produces wrong conclusions:
| Stage | Core metrics | Frequent misread |
|---|---|---|
| Retrieval | Recall at K, coverage, response latency | Judging retrieval by ranking AUC hides coverage collapse |
| Ranking | AUC, GAUC, NDCG with position bias corrected | Skipping position-bias correction makes results drift further over time |
| Reranking | Diversity, dwell time per user, return rate, long-tail exposure share | Staring at single-item CTR homogenizes the list |
Suggested rollout ladder
- Below ten thousand SKUs with sparse behavior: itemCF plus a popularity or new-arrival rule as two retrieval routes, with logistic regression or gradient-boosted trees for ranking; secure coverage and stability first.
- From one hundred thousand to one million SKUs: move to two-tower vector retrieval plus DeepFM-style ranking, with rule-based diversification as the starting reranking.
- Above one million SKUs with dense behavior: multi-route retrieval fusion plus sequence modeling plus multi-objective ranking plus model-based reranking, backed by real-time features and an online experiment platform.
The only valid test for whether to upgrade is whether the current layer has become the bottleneck. When recall at K sits at only 60%, replacing the ranking model with a deeper one returns almost nothing; fixing retrieval coverage first is the highest-return move.
Case Study: Algorithm Evolution at a Cross-Border Apparel Store
Background: a cross-border apparel store with roughly 380,000 SKUs on sale and about 900,000 monthly active users, with recommendation slots on the homepage, product detail pages and cart page, running itemCF plus a popularity leaderboard.
Problems: new SKUs took an average of 21 days to enter recommendation lists; homepage recommendation click-through rate hovered at 2.1% for a long time; long-tail SKU exposure stayed under 8%, leaving slow-moving inventory piled up.
Approach: a three-phase evolution, each phase validated with A/B experiments before full rollout.
- Phase one, weeks 1–4: content features were wired in, adding a retrieval route for content-similar new arrivals plus regional bestseller rules, solving new SKU cold start; impression and add-to-cart tracking was completed.
- Phase two, weeks 5–10: two-tower vector retrieval replaced itemCF as the main route, the ranking layer moved from gradient-boosted trees to DeepFM, and price-band and style-tag cross features were introduced.
- Phase three, weeks 11–16: a DIN structure was added to the ranking layer to model in-session behavior sequences, and the reranking layer gained category and price-band diversification plus a long-tail exploration quota.
Results over 16 weeks, experiment group against control:
| Metric | Before | After | Change |
|---|---|---|---|
| Recommendation slot click-through rate | 2.1% | 3.4% | +62% |
| Time for a new SKU to enter recommendation | 21 days | 1.5 days | down 93% |
| Long-tail SKU exposure share | 7.8% | 18.6% | +10.8 points |
| Share of GMV contributed by recommendation | 14% | 23% | +9 points |
| P95 response latency | 420 ms | 350 ms | -70 ms |
Investment and return: two algorithm engineers and one data engineer over 16 weeks, with most cost in the real-time feature pipeline and the online experiment platform; incremental recommendation GMV covered the investment by month 3 after rollout.
FAQ
Q: What exactly is the relationship between collaborative filtering and matrix factorization?
A: Matrix factorization is one implementation of collaborative filtering. Both are collaborative methods that use only behavior data and do not try to understand item content; the difference is how similarity is computed. Traditional collaborative filtering computes explicit similarity between items or between users, while matrix factorization maps users and items into one low-dimensional vector space and expresses similarity implicitly as a vector inner product. That is why matrix factorization handles cases with zero behavior overlap and generalizes better, at the cost of weaker explainability.
Q: Does a small team need deep learning models?
A: Most do not. Deep learning pays off when behavior data is massive and features are rich. With fewer than ten thousand SKUs and sparse daily activity, itemCF plus rule-based retrieval with gradient-boosted tree ranking is usually already close to the achievable ceiling. The real upgrade signal is that retrieval coverage is fine but ranking metrics have stalled for a long time, or that cold-start long-tail problems cannot be solved with rules. Otherwise the added engineering complexity and compute cost outweigh the metric gain.
Q: Why did click-through rate fail to rise after switching to a deep model?
A: Three common reasons. First, the retrieval layer is the bottleneck: when recall at K is only 60%, even a perfect ranking model can only keep circling inside the remaining 40%. Second, position bias is uncorrected, so training samples are contaminated by display position and the model learns that things placed first get clicked. Third, feature or label quality has collapsed, for example inconsistent category granularity or missing impression tracking, so the model learns noise. Run an input-quality check first: lift retrieval coverage, unify category granularity and tracking, correct position bias, and only then blame the model.
Q: How are user cold start and content cold start solved separately?
A: Content cold start leans on side information: a new product gets an embedding computed from category, price band and image-text vectors the moment it enters the catalog, goes straight into two-tower retrieval, and is paired with a new-arrival pool and a fixed exploration quota. User cold start leans on context and coarse attributes: start with device, region, acquisition channel and landing-page terms for coarse recommendations, then converge quickly on the first few clicks within a session. Cross-device identity resolution lets new users reuse existing behavior and is the fastest win available.
Q: Why does recommendation narrow over time?
A: Because the feedback loop self-reinforces: whatever the model recommends is what users click, those clicks become positive samples for the next training round, and long-tail items lose exposure continuously. The fix sits in two places. At the reranking layer, diversify by category and price band and give low-exposure items a fixed exploration quota. At the data layer, apply inverse propensity weighting to training samples or inject randomized exposure traffic, keeping unbiased samples available for correction.
Q: Does personalization create privacy compliance risk?
A: It does, and it is a hard constraint. Personalization depends on behavioral data collection, so it must follow data minimization, explicit disclosure and revocable consent, and features must be de-identified. On the engineering side, store identifiers and behavioral features in separate layers so the model only consumes de-identified feature vectors, and keep a degrade path that switches personalization off, falling back to non-personalized policies such as popularity leaderboards.
Data Sources
- Google official machine learning course: collaborative filtering basics — the definition of collaborative filtering and its interaction-matrix input
- Google official machine learning course: matrix factorization — low-dimensional representation and the SVD decomposition approach
- Google official machine learning course: content-based filtering basics — content matching without crowd behavior
- Google official machine learning course: DNN recommendation, retrieval — multi-route candidate sources and vector retrieval
- Google official machine learning course: DNN recommendation, scoring — unified scoring in one model and position-bias correction
- Item-to-Item Collaborative Filtering, IEEE Internet Computing, 2003 — tens of millions of customers, millions of items and the 0.5 second response constraint
- MovieLens public datasets, GroupLens — the public benchmark data most recommendation algorithms are evaluated on
- Microsoft Recommenders open-source algorithm library — standardized implementations of mainstream deep recommendation algorithms
About Tengence
Recommendation algorithms are the key technology that turns public-traffic acquisition into private-domain conversion efficiency, and belong to the growth-technology field Tengence focuses on. Tengence is the enterprise growth engine for the AI era, dedicated to public-traffic acquisition and private-domain conversion.
Related Reading