LogQ correction is a bias correction technique used in recommendation systems to account for non-uniform sampling during training. When negative samples are not drawn uniformly at random (in case of popularity-based sampling, in-batch sampling), the model learns a biased representation that favors frequently sampled items.
LogQ correction adjusts the training objective by subtracting the log probability of sampling each item as a negative:
Original Loss (Contrastive):
Corrected Loss:
Where:
- is the similarity score between user and item
- is the probability of sampling item as a negative
LogQ correction effectively “discounts” the similarity scores of frequently sampled items. If an item is sampled with high probability , then is less negative, making smaller and reducing the item’s influence in the loss.
For uniform sampling: for all items, so is constant and cancels out.
For popularity-based sampling: , so popular items get larger corrections.
Computing Q(j)
In-batch Sampling: If using other items in the batch as negatives:
Popularity-based Sampling: If sampling negatives proportional to popularity: