Problem
A recommender's retrieval stage must pick a few thousand candidate items per user out of millions, cheaply. A basic two-tower model feeds each tower only an ID, so it ignores everything else the product knows: item genre and length, user age, time of the request. The author tests how much added context helps even on a dataset that is already dense.
Example from the article: on MovieLens-1M (1 million ratings, about 6000 movies) the model must place a movie the user rated in its top 100. The benchmark to beat is the official TensorFlow Recommenders (TFRS) tutorial model (user ID, timestamp, movie title and title text).
Solution in brief
Train a two-tower retrieval model in which each tower concatenates the embeddings of several features, not only the ID. Add features step by step and compare top-100 validation accuracy. On MovieLens-1M every added item feature (title text, genres, movie length) raised accuracy, and the full set beat the tutorial benchmark by about 0.015.
Questions this case answers
- How to raise the accuracy of an embedding-based candidate retrieval model that currently uses only entity identifiers, by adding side features to both encoders
- How to improve the retrieval stage of a recommender when the model sees only user and item IDs?
- How to add item and user context features to a two-tower retrieval model?
- How to compare feature sets for a retrieval model on a validation split?
Tools and methods
- Two-tower model — one tower encodes the query (user and context), the other encodes the item; affinity is the cosine similarity of the two embeddings.
- In-batch negatives — other items in the same batch serve as negatives, so each batch holds only positive pairs.
- TensorFlow Recommenders (TFRS) — handles training; you write only
compute_loss. - Plotly — line chart of validation top-100 accuracy per feature set.
Google or a one-time email code. No password.