Latent Factor Models

CP4285 Modern Recommendation Systems — Week 02 QR code for the Week 02 slide deck Scan for the slides
soc-n.us/cp4285-t2610-w02

CP4285 Instruction Team

18 Aug 2026

01 Announcements and Context

WEEK 01 RECAP
Week 01 recap: User–Item Matrix, From a Score to a Useful List, Similarity I: Pearson Correlation, and From Neighbours to a Prediction

Pre-Flight Survey · Voices in the Room

Open responses · representative anonymous phrases — larger phrases indicate central themes, not frequency

“retrieval and ranking architectures” “more application based” “deployment and productionization” “TikTok / Instagram … real-world case studies” “YouTube and Spotify” “modern search alongside recommendation” “recommendation algorithms … real-world datasets” “end-to-end recommender … project” “Two Tower Model” “LLMs for recommendation … RAG or fine-tuning” “replicate papers” “create and deploy MCP server” “Heavy workload” “system design … production” “PyTorch … building and training” “latest research and progress” “form our own groups” “ethics … history and context”

Systems and concepts Building and deployment Expectations and concerns

Source: Canvas pre-flight survey, anonymous open responses. Phrases are abbreviated from representative excerpts for slide readability.

Essay 1: Micro Case Study: Designing a Production Recommender Surface

Focus
One approved user-facing recommendation surface.
Reason
One or two consequential Week 01–02 choices.
Defend
Evidence, limits, and a substantive suit lens.
  • ⚠️ (Short) 1,500 words · Due Mon, 24 Aug 2026, 23:59 SGT.
  • Use no more than two external sources; distinguish platform facts from your reasoned proposal.
  • Feature a card-suit lens in the technical design, objective, constraint, or evaluation criterion.
  • Include an AI-use declaration; AI may assist inquiry but you need to own the argument.

02 From Neighbours to Features to Latent Structure

Last Week Pre-Lecture Exercise
Look for Hidden Structure

Canvas discussion board · post before Mon, 23:59 SGT

Post a short, concrete response to this question; then reply constructively to one classmate.

Name one latent dimension that could explain several ratings—but is not an item metadata label.

Next week: turn this intuition into latent-factor representations of the user-item matrix.

Last Week Pre-Lecture Exercise · Canvas Voices
Latent dimensions students noticed
Anonymous Canvas participant avatar

“Quality: Unlike a metadata like price or like count, you can't really quantify quality from the item itself.”

Reply “Quality is also subjective and can potentially be influenced by trendiness.”

Quality
Anonymous Canvas participant avatar

“Nostalgia. It's a property of the relationship between a user and an item which is driven by the user's personal history …”

Reply “Could it be modelled by grouping users into distinct age groups?”

Nostalgia
Anonymous Canvas participant avatar

“Trust: It is not an item metadata label because it is an underlying, subjective perception that is not directly observable.”

Reply “The degree of trust cannot be readily quantified and it may vary widely …”

Trust
Anonymous Canvas participant avatar

“One latent dimension is how emotionally provocative an item is? Some items naturally stimulate our excitement, motivation or pleasure …”

Reply “Psychological emotions are subjective … and it is tough to quantify.”

Emotion

Sparse Neighbourhoods Can Fall Silent

Item A
Item B
Item C
Item D
User 1
5
4
User 2
5
4
User 3
4
5
Target user
5
?

Global Patterns Remain in the Matrix

Neighbourhood CF

  • Starts with local overlap.
  • Compares named rows or columns.
  • Can be silent when overlap is thin.

Latent-factor model

  • Learns shared coordinates from many interactions.
  • Uses global patterns to score a user–item pair.
  • Still inherits the limits of its evidence.

To think about

Does a learned representation make a missing interaction more trustworthy—or only make a prediction possible?

Factorisation Learns Shared Coordinates

\[ R \approx P Q^\top \]

Interaction matrix (R)
Observed user–item feedback with many blanks.
User matrix (P)
One learned vector per user.
×
Item matrix (Q)
One learned vector per item.

A small number of learned coordinates can capture recurring interaction patterns more compactly than the full sparse matrix.

Factors Are Patterns, Not Personal Facts

Tempting shortcut Better statement
“Dimension 3 is this user’s identity.” Dimension 3 is a learned coordinate associated with interaction patterns.
“The factor is a hidden genre tag.” A factor may correlate with metadata, but it is inferred rather than recorded.
“The factor explains the person.” The factor helps the model score candidates under particular data and objectives.

A Dot Product Turns Embeddings into a Score

\[ \hat r_{ui} = p_u^\top q_i \]

User vector

\[p_u=[p_{u1},p_{u2},\ldots,p_{uk}]\]

Captures a learned location in the model’s coordinate system.

Item vector

\[q_i=[q_{i1},q_{i2},\ldots,q_{ik}]\]

Captures how the item aligns with those learned patterns.

The dot product is high when the vectors align along dimensions the model has learned to reward.

Worked Calculation: Two Items, One Current Score

\[ p_u=[0.8,0.2], \qquad q_A=[0.9,0.1], \qquad q_B=[0.4,0.8] \]

Item A

\[ \hat r_{uA}=0.8(0.9)+0.2(0.1)=\mathbf{0.74} \]

Item B

\[ \hat r_{uB}=0.8(0.4)+0.2(0.8)=\mathbf{0.48} \]

Current model verdict: Item A is higher scoring.

Still unresolved: diversity, constraints, exposure, uncertainty, and the rest of the candidate list.

Training Adjusts Both Sides of the Match

Observed interaction
User watches, clicks, rates, or purchases.
Model score
Apply (p_u^q_i).
Loss and update
Move both user and item vectors.
  • Explicit feedback: a rating can support a prediction-error loss.
  • Implicit feedback: a positive interaction can be compared against sampled alternatives.
  • Repeated updates create embeddings that reflect the selected learning signal.

Regularisation Limits Convenient Stories

\[ \begin{aligned} \min_{P,Q}\; \mathcal{L} &= \sum_{(u,i)\in\Omega}(r_{ui}-p_u^\top q_i)^2 \\ &\quad + \lambda\left(\lVert P\rVert_F^2+\lVert Q\rVert_F^2\right) \end{aligned} \]

  • The first term fits observed interactions.
  • The regularisation term discourages overly flexible parameter values.
  • The design question is not “fit or regularise”; it is how to generalise beyond the interactions already seen.

Worked RecBole Example: BPR on MovieLens 100K

# test.yaml
USER_ID_FIELD: user_id
ITEM_ID_FIELD: item_id
load_col:
  inter: [user_id, item_id]
embedding_size: 64
epochs: 500
metrics: ['Recall', 'MRR', 'NDCG']
topk: 10

# run.py
from recbole.quick_start import run_recbole
run_recbole(model='BPR', dataset='ml-100k',
            config_file_list=['test.yaml'])

What is happening?

  • BPR is a matrix-factorisation model trained pairwise for personalised ranking.
  • RecBole loads user–item interaction columns, learns user/item embeddings, and evaluates a ranked list.
  • embedding_size selects the dimension of both learned vectors.

Read the RecBole Output as a Design Claim

Output artefact What it can support What it cannot establish alone
Training loss Whether the stated loss changes during optimisation. Real-world user value or fairness.
Recall@10 / NDCG@10 A ranking comparison under the declared held-out protocol. A production outcome without further evaluation.
Top-k candidates A concrete prompt for inspection and error analysis. A causal explanation of a user’s preference.
Learned embeddings A representation used by the model. A human identity or a verified metadata field.

03 Objectives, Continuity, Novelty, and Consequences

Prediction Rewards Accurate Numbers

Question

How close is (r_{ui}) to an observed rating or score?

Typical evidence

An explicit rating, a known score, or another numeric target.

A prediction objective is useful when a numeric estimate itself drives a decision. Error measures such as RMSE summarise how close estimates are to observed values.

Ranking Rewards Useful Order

Question

Do useful items appear above less useful alternatives in the visible list?

Typical evidence

Implicit interactions, held-out positives, and candidate ordering.

Ranking measures, such as NDCG@10, reward useful items placed nearer the top of a displayed list.

🎰 Bandit Time: What should the home screen optimise?

A home screen must order ten candidate items for immediate display. Which measure most directly tests whether useful items appear near the top?

A. RMSE over predicted ratings.
B. NDCG@10.
C. The number of metadata tags per item.
D. The age of the user account.

Answer: B. NDCG@10 is position-sensitive; it tests the ordering of useful candidates in the displayed top-k.

👥 Activity 1: Choose an Objective, Then Defend It

Work in pairs. Choose one case. Write a single line: task → objective → metric → one assumption.

Restaurant rating

Predict a score after a meal. What is the target? What would count as a close estimate?

Personalised feed

Order a visible list now. What does “near the top” mean?

Job retrieval

Surface plausible jobs from a large candidate set. Whose relevance definition is being used?
Produce: one defensible objective/metric pair and one assumption you would want to test. Be ready to compare it with a pair using a different case.

♠ Spades: Stable Preferences Need More Than One Tag

  • A loyal, metadata-oriented user may return to durable interests: familiar creators, formats, categories, or constraints.
  • One static tag is too coarse: it misses interaction history, combinations of features, and changing context.
  • A latent-factor model can represent stable patterns, while metadata helps make an explanation or constraint legible.

To think about

How could a system preserve continuity without treating last year’s interaction history as a permanent identity?

♠ Observed Metadata Meets Learned Continuity

Layer What it contains Appropriate use
Observed metadata Creator, category, format, duration, or an explicit constraint. Interpretability, filtering, feature-based comparison.
Latent embedding Inferred coordinates from interaction patterns. Candidate scoring and learned associations.
Case design A deliberate combination of both. Preserve meaningful continuity while monitoring drift and blind spots.

Guardrail: latent metadata is a teaching bridge for the case—not a claim that an embedding coordinate is a recorded field.

♦ Diamonds: Novelty Should Be Relevant, Not Random

  • Feature-based novelty identifies candidates that differ in meaningful, declared attributes from the familiar set.
  • The objective is not surprise for its own sake; it is a credible opportunity for discovery.
  • A novelty mechanism needs a definition of difference, an exposure policy, and an evaluation consequence.

♠ + ♦ Re-rank With a Familiar Anchor

Latent score
Generate plausible candidates from interaction patterns.
Spades anchor
Keep credible continuity for the user’s stable context.
Diamonds re-rank
Reserve selected positions for feature-different discovery.

Possible checks: top-k relevance, feature coverage, long-tail exposure, repeat engagement, and who is not receiving discovery.

📶 AI Voice Mode: Whose Discovery Is Missing?

Live prompt for the voice agent

A recommender’s interaction logs are dominated by popular titles. Independent and long-tail items had far less initial exposure, so they have fewer observed interactions. The system adds feature-based novelty for some users. Explain why low interaction may not mean low preference; identify one risk if exposure history is treated as preference; and propose one measurement that could test whether the novelty mechanism broadens meaningful discovery rather than merely lowering relevance.

Listen for: assumptions about exposure, missing stakeholders, and a measurable distinction between opportunity and preference.

👥 Activity 2: Audit the Agent’s Explanation

Small groups. Audit the voice-agent response instead of accepting its fluency.

One assumption

What did the agent assume about interaction logs, users, or items?

One omission

Which stakeholder or under-exposed group could be harmed or overlooked?

One measurement

What observable quantity would help separate exposure from preference?
Produce: one three-part audit. Be ready to state why the proposed measurement changes the design decision.

🔑 Historical Behaviour Becomes Model Geometry

Historical process Model consequence Design question
Uneven exposure Sparse or distorted interaction evidence Who had a genuine chance to interact?
Popularity reinforcement Well-exposed items gain stronger learned signals Who receives repeated visibility?
Feature-based novelty A re-ranking decision changes what becomes observable next Who receives credible discovery—and who does not?

🤞 Use history as evidence with limits, not as a neutral record of preference.

04 From Model to Case Study

From Interaction Data to a Ranked Candidate List

Collect & inspect
Understand feedback, missingness, and exposure.
Learn & score
Train embeddings under an explicit objective.
Re-rank & evaluate
Apply continuity, novelty, and responsible checks.

A production recommender is a chain of technical and product decisions—not just a latent-factor score.

E1 Bridge: Choose the Consequential Decision

For one approved recommendation surface, make a focused argument around a choice such as:

Choice Example question
Representation Why use an embedding-based model rather than only local neighbourhood evidence?
Objective Why should the surface optimise top-k order rather than numeric prediction?
Continuity How should observed metadata and learned preferences support a Spades-oriented need?
Novelty Which feature-based difference should create Diamonds-style discovery, and how will it be evaluated?
Risk How could historical exposure bias distort the evidence used by the model?

🔑 Representation Enables; Objectives and Constraints Decide

  • Latent factors make distributed interaction patterns usable when local overlap is weak.
  • Objectives decide what the model is rewarded for predicting or ranking.
  • Spades and Diamonds make continuity and discovery explicit design choices.
  • Ethical scrutiny asks how past exposure shaped the evidence in the first place.

🔑 A better score is not automatically a better recommendation.

Next Week Pre-Lecture Exercise
When two lists predict similarly, what should decide?
<p>Suppose two ranked lists have similar rating-prediction error, but one concentrates attention on already popular items while the other broadens credible discovery.</p>
<p style="margin-top:.7em;font-weight:bold;color:#003D7C;">Post one metric or diagnostic you would use, explain what it reveals, and reply constructively to one classmate.</p>

Summary

🔑 Latent Factors Learn Structure; Responsible Systems Learn Limits

Week 01: neighbourhood CF Week 02: latent-factor models
Uses observed local overlap Learns global user/item representations
Similarity is specified directly Representation is learned from interaction patterns
Thin overlap can make neighbours unreliable Distributed patterns can support a score—but not create ground truth
Main question: who counts as a neighbour? Main questions: what is optimised, who receives continuity or novelty, and how did history shape the evidence?

Next week: evaluate ranked lists with realistic offline protocols, position-sensitive metrics, and careful assumptions.