Beyond Collaborative Filtering
Collaborative filtering asks: given who you are and what you've rated, what else would you like? The real world asks harder questions — what if you're a first-time visitor, or your taste depends on whether it's Saturday night, or the order of your clicks matters more than which ones? This closing chapter maps four families beyond the URM: context-aware (tensor factorisation), session-based, knowledge-based, and sequence-aware (RNN/Transformer).
The big idea
The URM is only the beginning. Real recommenders must handle context (the user’s situation changes relevance), sessions (anonymous users with a handful of recent clicks), domain knowledge (rules about what goes with what), and sequences (the order of interactions encodes intent). Each extension changes the data representation: matrix → tensor (context), profile → short sequence (session), ratings → knowledge graph (knowledge-based), set → ordered stream (sequence-aware). The core insight: the model is secondary; the data representation is primary.
01 · Situation matters
Context-Aware Recommender Systems
The relevance of a recommendation changes with circumstances: device, location, activity, company.
A context-aware recommendation takes the context of the interaction into account. Context is side information of the event, not a property of the user or the item:
- Device — smartphone, PC, smart TV.
- Location — at home, at the office, at the park.
- Activity — resting, working, exercising.
- Company — with friends, children, a partner.
The data representation shifts from a matrix () to a tensor (), where is the set of context conditions — and the sparsity worsens, since each context dimension splits the data thinner. Tensor factorization generalises MF to three (or more) dimensions:
Each dimension — user, item, context — gets its own latent factor matrix, and a rating is the sum of triple products over factors. Context can also be handled by Factorization Machines (Ch. 12), which treat it as extra one-hot columns — unifying context-aware CF with the FM framework.
FM (Ch. 12) revisited
A context-aware FM extends the collaborative feature vector with context bits . The factorised interactions then capture user–context and item–context pairs without a full 3-D tensor — the practical bridge between Ch. 12 and this chapter.
02 · No user, just a session
Session-Based Recommender Systems
What if you don’t know who the user is? Guess their intent from a handful of recent clicks.
Session-based recommendation deals with anonymous users — no past history, no user ID. The only signal is the small set of interactions in the current session (often 5–20 clicks), and the goal is to optimise short-term preferences — items that fit the user’s immediate intent, not a long-term taste profile. If past sessions of the same user are known, the problem becomes session-aware recommendation, where long-term preferences can also be optimised by linking sessions. Either way, the core challenge is guessing intent from limited data.
Intent is fragile
A user who usually browses electronics suddenly looks at baby products — the session model must pivot immediately, ignoring the long-term history. This is the opposite of collaborative filtering, which assumes stable taste. Session models treat the current clicks as the only signal that matters.
03 · Rules over ratings
Knowledge-Based Recommender Systems
Explicitly encode what goes with what — no learning required, but knowledge engineering is hard.
Knowledge-based recommendation encodes explicit domain knowledge — usually as a knowledge base or graph — and may involve no learning at all: recommendations come from logical inference over the rules. It shines in three settings:
- Conversational recommendation — chatbots that ask clarifying questions and narrow choices with rules.
- High-stakes domains — financial or medical recommendations, where a wrong collaborative guess is unacceptable and explicit constraints must hold.
- Cold-start items — a brand-new camera with no ratings can still be recommended if the knowledge base says it is compatible with the user’s existing gear.
The cost is knowledge engineering
Someone must encode the rules — “this memory card fits DSLR cameras”, “this film is a sequel to that one.” That is expensive and brittle: rules break when the domain shifts. Knowledge graphs plus graph neural networks (Ch. 13) offer a middle ground — structured knowledge as edges, learned embeddings on nodes.
04 · Order encodes intent
Sequence-Aware Recommender Systems
When the sequence of interactions carries information that the set does not.
Sequence-aware recommendation treats the order of interactions as the primary signal — the next track should match the mood of the last few; the next episode follows the one just watched; a memory card follows a new camera; the next place to visit depends on the last. The URM is no longer adequate: it treats interactions as a set, losing all order. Instead the input is a sequence of items per session and the target is the next item. Three families of approach:
- Co-occurrence / Markov chains — simple transition probabilities: if users often buy B after A, recommend B.
- Nearest neighbours — find past sessions similar to the current one and recommend from them.
- Sequence learning — RNNs and attention/Transformer models that learn a hidden state summarising the sequence so far.
The RNN approach learns item embeddings and maintains a hidden state that remembers past inputs:
The hidden state summarises , and the output predicts the next item . Training runs step by step: given predict , then extend the session with the true and predict , and so on — the model learns transition patterns across sessions.
05 · Exam intel
What the exam tests
Name the four families and why the URM is insufficient for each; write the tensor-factorisation equation; distinguish session-based vs session-aware vs collaborative; explain when knowledge-based is preferred (cold-start, high-stakes); and write the RNN hidden-state equation for next-item prediction.
Worked question — recommend the next song
A music service wants to recommend the next song. (a) Why is collaborative filtering insufficient? (b) Session-based or sequence-aware? (c) Write the RNN update. (d) How does training differ from MF?
- (a) CF treats songs as a set and ignores order; the transition from one song to the next carries intent that the set does not.
- (b) Sequence-aware — the order within a listening session matters. Session-based alone (a set of songs in the session) still misses the transition information.
- (c) , : is the song embedding at position , the hidden state summarising , the predicted next song.
- (d) MF trains on all pairs at once; the RNN trains step by step — feed , predict ; feed the true , predict ; the session is extended with ground truth at each step.
Traps: confusing session-based (anonymous, short-term) with CF (profiles, long-term — the difference is whether a user ID exists); assuming context always needs a tensor (FM handles it with extra columns); forgetting knowledge-based may involve no learning; and treating sequence-aware as “CF with timestamps” — it is the order within a session, not the timestamp of each interaction.
06 · Exam · past papers
Past-paper questions
Where this chapter is examined
No standalone past-paper question targets Chapter 15 directly. Its most exam-relevant idea — context-aware recommendation — is examined as sub-questions inside the Factorization Machines chapter (Ch. 12), where context appears as extra one-hot feature columns. To rehearse this material, revisit the FM exam cards, or open the AI tutor and ask it to quiz you on this chapter.
07 · Self-check
Three questions before you move on
How does tensor factorisation for context-aware recommendation differ from matrix factorisation (Ch. 8)?
A 'session-based' recommender differs from collaborative filtering primarily because:
The RNN hidden-state equation h_t = f(x_t W_x + h_{t-1} W_h + b_h) for sequence-aware recommendation encodes:
08 · Recap
One-screen summary
Chapter 15 — four families to remember
- Context-aware: URM → tensor . Tensor factorisation , or FM with extra context columns (Ch. 12).
- Session-based: anonymous users, only the current session. Guess short-term intent from limited data; session-aware if past sessions are known.
- Knowledge-based: explicit domain rules, often no learning. Good for cold-start, conversational, and high-stakes domains. Cost: knowledge engineering.
- Sequence-aware: order matters. RNN predicts the next item , trained step by step over sessions.