Correct Sampling Bias for Recommender Systems

Thao Vu1 Oct 2023

Problem

Training a two-tower retrieval model with other batch items as negatives creates a skew. Popular items appear in the log far more often, so they are picked as negatives more often and get pushed too far from queries. Items with little or no feedback almost never appear in training, so the model cannot place them. Retrieval quality drops for the whole ranking pipeline.

Example from the article: on YouTube a few videos have billions of views while most have a few hundred, so top videos dominate the in-batch negatives and are over-penalized.

Solution in brief

Keep cheap in-batch negatives, but divide each item's term in the softmax normalizer by a weight proportional to its sampling probability, so the batch mimics uniform sampling. For streaming data, estimate that probability from how often an item recurs across steps. To cover items without feedback, add uniformly sampled corpus items as extra negatives.

Questions this case answers
  • How to train an embedding-based retrieval model with in-batch negatives when item frequencies are heavily skewed and the item set keeps changing
  • How to teach a retrieval model to rank items that never received feedback when training data contains only logged interactions
  • How to stop popular items from being over-penalized as in-batch negatives when training a two-tower retrieval model?
  • How to correct the item sampling distribution when training on streaming data without a fixed item vocabulary?

Tools and methods

  • Two-tower model — encodes queries and items separately for retrieval.
  • In-batch negatives — other batch items serve as negatives.
  • Importance-sampling correction (sampled softmax) — reweights in-batch items to match uniform sampling over the corpus.
  • Streaming frequency estimation — item sampling probability from the gap between batches containing it.
  • Mixed negative sampling — adds uniformly sampled corpus items as negatives.
Continue reading — it's free

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