Why two-tower beats matrix factorisation

Matrix factorisation learns a vector for every user and every item. That gets you cosine similarity for retrieval and nothing else. The two-tower model is a generalisation: same vectors, but each one is a learned function of the inputs you give it.

Two towers, one shared space

The query tower maps a customer plus context into an embedding. The item tower maps an article plus content features into an embedding in the same space.

Customer behaviour shifts with the calendar. People buy coats in November and swimwear in June. If the query tower can condition on the month, the same customer projects to different points at different times. The recommender now surfaces seasonally appropriate items without being told to.

The training objective is contrastive: pull the embedding of a real (customer, article) pair together, push the customer embedding away from random articles. TensorFlow Recommenders gives you this as a single line: tfrs.tasks.Retrieval with FactorizedTopK over the item dataset.

Quiz: Quiz

Loading practice…

AI prompt: Try it: hard negatives

Loading practice…