Session-based product recommendations with two-tower and Transformer models
A recommendation row that updates as a shopper browses: popularity and co-occurrence baselines, two-tower retrieval and a session Transformer, compared on what shoppers did next.
Background
A "recommended for you" row should change as a shopper browses. Simple rankings like bestsellers or "viewed together" are cheap and often hard to beat. Learned models can use the order of what a shopper looked at, but they cost more to build and run.
This project compares them on what shoppers actually did next.
How it works
- Baselines. Bestsellers, repurchases and items often viewed together.
- Two-tower retrieval. A PyTorch model that learns embeddings for sessions and products, so the nearest products become candidates.
- Session Transformer. A sequence model that reads the session in order and predicts the next item.
- New products. Image embeddings give products with little history a starting point.
Evaluation
Models train on earlier sessions and are scored on later ones by recall and NDCG at K, with separate results for new products and short sessions.
Demo
Replay a session step by step and watch each model's row update, with the item the shopper chose next highlighted.