Small Group Tutorials

Here to help students catch up, keep up, and move ahead. Book a consultation here.

How to Learn Recommender-System Algorithms: Collaborative Filtering, Matrix Factorization, Retrieval, Ranking and Evaluation

Wait, What?

A recommender system is not one algorithm. It is usually a sequence of algorithms that narrows millions of possibilities into a useful ranked list.

Recommendation begins with a deceptively simple question: which items should this user see now? Solving it well requires more than predicting ratings. Modern systems often combine candidate generation, representation learning, retrieval, scoring, ranking, re-ranking, constraints and feedback loops.

This article owns the recommender-system algorithm learning job. The existing Nearest-Neighbour Search article owns general similarity-search structures, the Numerical Linear Algebra article owns matrix factorizations as numerical machinery, and the PageRank article owns graph ranking. Here the learning target is personalised recommendation as a full algorithmic pipeline.

Quick Answer

Learn recommender systems through the route user–item interactions → popularity baseline → content features → nearest neighbours → collaborative filtering → latent factors → matrix factorization → implicit feedback → candidate generation → embeddings → approximate retrieval → ranking → negative sampling → calibration → diversity → cold start → offline metrics → online experiments → feedback loops → fairness and safety. A beginner should be able to build and explain a popularity, content-based and neighbourhood recommender. A professional should understand multi-stage retrieval and ranking, objective mismatch, implicit-feedback bias, scalable evaluation and the way deployed recommendations alter the data they later learn from.

1. Start With a Table, Not a Neural Network

Create a tiny user–item matrix with five learners and six books. Some entries are ratings, some are clicks and most are missing. Ask three questions: which books are globally popular, which users behave similarly, and which books appear similar from their interaction patterns?

This toy matrix reveals the three central problems: sparse evidence, personalization and uncertainty about what a missing entry means.

2. A Popularity Baseline Is Mandatory

Before using a sophisticated model, rank items by a simple popularity signal such as recent interactions, possibly with smoothing or time decay. A strong baseline tells you whether personalization actually adds value.

Beginners often assume a complex algorithm must outperform a simple one. Recommendation is a useful antidote: sparse data, cold start and changing behaviour can make a sensible baseline surprisingly competitive.

3. Content-Based Filtering Uses Item Features

Represent each item with features and represent a user’s interests from the features of items they liked. Similarity—often cosine similarity or a learned dot product—can then score candidate items.

Google’s current content-based filtering guide frames the method around item features, user preferences and similarity in a shared feature representation.

4. Neighbourhood Collaborative Filtering Uses Interaction Similarity

User-based collaborative filtering finds users with similar histories and recommends what their neighbours liked. Item-based collaborative filtering finds items consumed by similar user populations.

Teach both on a tiny matrix so learners can compute similarity by hand. Then discuss why sparse, high-dimensional interaction data makes naive all-pairs comparison expensive.

5. Missing Does Not Mean Disliked

In recommendation data, an absent interaction may mean the user disliked an item, never saw it, could not access it, or simply had no reason to click. Treating every zero as a negative label creates a strong and often unjustified assumption.

This distinction between exposure and preference is foundational. Professionals track where labels came from, not only their numeric value.

6. Matrix Factorization Learns Latent User and Item Vectors

Matrix factorization represents each user and each item with a lower-dimensional embedding. Their dot product estimates affinity. Instead of memorizing the full sparse matrix, the model learns a compact latent geometry.

Google’s current matrix-factorization guide explains weighted factorization and contrasts optimization approaches such as stochastic gradient descent and weighted alternating least squares.

7. Matrix Factorization Is Not the Same as Ordinary SVD on a Complete Matrix

Classroom explanations sometimes jump directly from SVD to recommender systems. Real recommendation matrices are sparse, feedback may be implicit and objectives often weight observed and unobserved entries differently.

Connect the geometry to Numerical Linear Algebra, but keep the statistical meaning of missingness and weighting explicit.

8. Explicit and Implicit Feedback Create Different Learning Problems

Explicit feedback includes ratings or stated preferences. Implicit feedback includes clicks, views, dwell time, purchases or skips. Implicit signals are abundant but confounded by exposure and interface position.

A click is evidence that a user both saw and chose an item under a particular interface. It is not a pure measurement of preference.

9. Recommendation Often Begins With Candidate Generation

When the corpus contains millions of items, a ranking model cannot score everything. Candidate generation first reduces the corpus to hundreds or thousands of plausible items.

TensorFlow Recommenders describes the common two-stage pattern explicitly: retrieval selects thousands of candidates from millions, and ranking then scores a much smaller set. Its current ranking task documentation is a practical reference.

10. Two-Tower Models Separate Query and Item Representations

A common retrieval architecture learns one network for the user or query context and another for items. Both produce vectors in the same space. Candidate retrieval then becomes a nearest-neighbour search problem.

This is where the Nearest-Neighbour Search article becomes relevant: representation learning and vector retrieval are distinct jobs that meet at the embedding interface.

11. Candidate Recall Sets an Upper Bound on Later Ranking

If the correct or useful item never enters the candidate set, no ranking model can recover it. Therefore candidate-generation recall is a separate evaluation target from ranking quality.

This teaches a general systems lesson: the quality of a later stage is bounded by what an earlier stage preserves.

12. Ranking Converts Candidates Into an Ordered List

A ranker may combine user features, item features, context, cross-features, freshness and learned representations. It can predict click probability, watch time, purchase probability, utility or a weighted multi-objective score.

Do not let learners confuse “score” with “truth.” A ranking score is the output of a chosen objective under chosen data and assumptions.

13. Pointwise, Pairwise and Listwise Objectives Ask Different Questions

Pointwise training predicts a label for each item. Pairwise training prefers one item over another. Listwise training optimizes properties of an ordered set. The right objective depends on what the final ranking should accomplish.

14. Negative Sampling Is an Algorithmic Choice, Not a Plumbing Detail

When positives are sparse and the corpus is huge, training often samples “negative” items. Uniform negatives, popularity-weighted negatives and hard negatives create different learning signals.

A hard negative may be highly informative because the model currently confuses it with a positive. But incorrectly sampled negatives can punish items a user never had a chance to see.

15. Approximate Retrieval Trades Exactness for Scale

Exact nearest-neighbour search may be too slow for large embedding collections. Approximate methods such as HNSW, product quantization or hashing sacrifice some recall for lower latency and memory cost.

Professionals therefore evaluate the recommendation model and the retrieval index jointly. A perfect embedding model can still deliver poor recommendations if the index misses the right candidates.

16. Cold Start Has Several Forms

New users have little behavioural history. New items have few interactions. New regions or contexts may have different distributions. Content features, onboarding signals, exploration and priors can reduce cold-start failure, but each introduces its own assumptions.

17. Diversity and Novelty Are Not the Same as Relevance

A list of ten nearly identical items may score highly on predicted relevance but be a poor user experience. Re-ranking can trade some raw score for category diversity, novelty, coverage, freshness or creator exposure.

Teach learners to compare a top-10 list before and after a simple maximal-marginal-relevance style diversity penalty.

18. Calibration Asks Whether the List Matches the User’s Broader Taste Distribution

If a user reads 60% science, 30% history and 10% fiction, a list containing only science may be individually relevant yet poorly calibrated to their overall preference distribution.

This is another reason not to reduce recommendation quality to one scalar accuracy metric.

19. Offline Metrics Measure Different Parts of Quality

Precision@k asks what fraction of recommended items are relevant. Recall@k asks how much of the relevant set was retrieved. Mean reciprocal rank emphasizes the first relevant result. NDCG weights relevance by rank position. Coverage, novelty and calibration capture other dimensions.

Current RecSys 2026 tutorials explicitly connect offline metrics such as MRR, NDCG and Recall with online and business outcomes. The educational lesson is that metric choice should follow the decision being evaluated.

20. Random Train/Test Splits Can Leak the Future

Recommendation data are temporal. Randomly mixing future and past interactions can let a model learn from evidence that would not have existed at recommendation time.

Time-aware splits, leave-one-out protocols and user-level holdouts answer different questions. State the evaluation protocol as clearly as the model architecture.

21. Online Experiments Test Behaviour Under Deployment

An offline gain does not guarantee an online gain. A/B tests can measure engagement, satisfaction, retention, conversion or other product outcomes under real exposure. They also introduce ethical and operational responsibilities.

Professionals use guardrail metrics so a gain in one objective cannot quietly hide degradation elsewhere.

22. The Recommender Changes the Data It Later Learns From

Recommended items receive more exposure, which produces more interactions, which makes those items look even more attractive in future training data. This creates feedback loops, popularity amplification and position bias.

Recommendation is therefore a closed-loop system, not a static prediction task.

23. Fairness and Exposure Need Explicit Measurement

A system can be accurate on average while systematically under-exposing certain creators, categories or user groups. Fairness in recommendation is complicated because users, providers and platforms may have different legitimate interests.

Professional evaluation should therefore separate user utility, provider exposure, catalogue coverage and distributional effects rather than assuming one metric captures all stakeholders.

24. Common Learning Failure States

  • Skipping a popularity baseline.
  • Treating missing interactions as explicit dislikes.
  • Calling every recommender “collaborative filtering.”
  • Using matrix factorization without understanding its objective and weighting.
  • Ignoring candidate-generation recall.
  • Training with negatives that are actually unseen positives.
  • Optimizing ranking accuracy while ignoring diversity and calibration.
  • Using random splits that leak future evidence.
  • Reporting offline metrics as proof of online benefit.
  • Ignoring feedback loops created by the deployed recommender.

25. A Beginner-to-Professional Learning Ladder

  • Level 1: build a popularity recommender.
  • Level 2: compute content and user/item similarities by hand.
  • Level 3: implement neighbourhood collaborative filtering.
  • Level 4: train a basic matrix-factorization model.
  • Level 5: distinguish explicit from implicit feedback objectives.
  • Level 6: build a two-stage candidate-generation and ranking pipeline.
  • Level 7: evaluate Recall@k, Precision@k, MRR and NDCG under time-aware splits.
  • Level 8: add approximate nearest-neighbour retrieval and measure lost recall.
  • Level 9: design diversity, calibration and cold-start strategies.
  • Level 10: reason about online experiments, exposure bias, feedback loops and multi-stakeholder effects.

26. Teach the Pipeline With Progressive Disclosure

Begin with a 5×6 interaction matrix and one complete worked example. Then remove one calculation at a time: first similarity, then candidate choice, then scoring, then metric calculation. This faded-worked-example sequence keeps attention on the changing algorithmic decision rather than blank-page syntax.

27. PRIMM Fits Recommender-System Learning Naturally

The current Raspberry Pi Foundation PRIMM course recommends Predict, Run, Investigate, Modify and Make. For a recommender, ask learners to predict the top three items, run the scoring code, investigate why one item won, modify one similarity or weight, then build a new recommendation rule.

The CS2023 Computer Science Foundations guidance identifies algorithms, data structures, complexity and problem-solving as essential application-level knowledge. Recommender systems make these foundations concrete because they connect data representation, similarity, optimization, indexing and evaluation inside one visible pipeline.

28. Build Evaluation Before Scale

Before moving from 100 items to a million, require a reproducible evaluator with a baseline, time-aware holdout, multiple metrics and error inspection. Scaling an unevaluated recommender only produces uncertainty faster.

29. Professional Direction

Advanced study includes weighted implicit matrix factorization, Bayesian personalized ranking, factorization machines, two-tower retrieval, sequence-aware recommendation, transformers, graph recommenders, learning-to-rank, counterfactual evaluation, inverse propensity scoring, contextual bandits, slate optimization, multi-objective ranking, fairness-aware recommendation, privacy-preserving recommendation and causal approaches to exposure bias.

Algorithm-learning rule: never ask only whether the recommended list “looks good.” Ask how candidates entered the list, what missing data meant, what objective produced the score, which items were never exposed, whether evaluation respected time, and how deployment will change tomorrow’s training data.