Multimodal Transformer for Content-Based Recommendations

Dmitry (qwertyforce)29 Mar 2024

Problem

Collaborative recommenders such as matrix factorization depend on unique user and item IDs. A new listing has no interactions, so the model cannot score it, and every model has to be retrained as items and interactions change. At Cian, where items are property listings, this limits both the freshness of recommendations and how far back training data can reach. The team wanted a model that works from item content and handles new items and new users without retraining.

Example from the article: a rental listing is described by a handful of tabular attributes (type such as dailyFlatRent, numbers, booleans), not by a text description.

Solution in brief

Represent each item as a set of its attributes and each user as the concatenated attributes of the items they interacted with. One Longformer encoder embeds both, trained with a contrastive loss so the user embedding lands near the next item. Recommendations are the k nearest item embeddings. Adding photo embeddings and click metadata lifted offline recall@30 from 0.28 (production first-level model) to 0.34.

Questions this case answers
  • How to recommend new items to users when ID-based collaborative models need retraining and cannot score items without interactions
  • How to build a sequential recommender over items described by mixed tabular attributes and images instead of text
  • How to recommend items that have no interactions yet, without retraining an ID-based model?
  • How to build user recommendations from item attributes when item data is tabular rather than text?

Tools and methods

  • Longformer — transformer encoder for item and user attribute sequences
  • InfoNCE contrastive loss — pulls the user embedding toward the next item, away from negatives
  • EVA-02 ViT B/16 — image embeddings fed into the encoder
  • kNN retrieval — recommendations are the k nearest item embeddings to the user embedding
Continue reading — it's free

Google or a one-time email code. No password.