Session-Based Recommendation
Plenty of visitors arrive with no identity worth using — no login, no trustworthy cookie, nothing but the handful of clicks they have made in the last four minutes. Session-based recommendation takes that short, anonymous sequence as the entire input and predicts what comes next.
The session replaces the user
Classic collaborative filtering needs a persistent row in the interaction matrix; here there is none. The model conditions instead on the order of events inside one visit. Order carries real information: a shopper who viewed a camera, then a lens, then a tripod is in a different state from one who viewed the same three in reverse. GRU4Rec framed this with a recurrent network over the session; SASRec and BERT4Rec swapped recurrence for self-attention, which copes better with long sessions and irrelevant detours.
What the framing buys
- It is the only workable approach for the hardest cold-start case — a brand-new anonymous visitor with no history to learn from.
- It captures intent that a long-term profile smears out, such as a habitual novel-buyer shopping for a child's birthday today.
- Training data is free: every logged session is an example, and the model depends on co-occurrence within sessions rather than on accumulated per-user history.
Evaluation and deployment
Splits must be made by session and by time — a random split leaks later clicks from the same session back into training and inflates every number. Hit rate and MRR at a small cutoff are the standard measures. In production the session model usually runs as a candidate generator inside retrieve-then-rank, leaving the ranker free to add profile features whenever a returning user is actually recognised.
Session-based recommendation predicts a user's next interaction from the ordered events of the current visit alone, with no long-term profile. Treating the session rather than the user as the unit makes it the standard answer for anonymous or first-time visitors, and for short-lived intent a persistent profile would blur. Sequence models such as GRU4Rec and BERT4Rec are trained on logged sessions and typically serve as candidate generators.
Imagine walking into a shop where nobody knows your name. The assistant cannot look up what you bought last year. All they have is what you have picked up and put down in the last few minutes — and that is often enough to work out what you are after.
Session-based recommendation works the same way. It sets aside who you are and watches only this visit: the three videos you skipped, the two jackets you lingered on. That short trail is surprisingly revealing. It is how a site can be useful to a complete stranger, and how it notices when you are clearly shopping for someone else rather than yourself.