Incorporating Bias-aware Margins into Contrastive Loss for Collaborative Filtering

An Zhang, Wenchang Ma, Xiang Wang, Tat-Seng Chua

TL;DR

Most recommendation systems struggle with popularity bias, often sacrificing accuracy on popular "head" items to improve performance on "tail" items. This paper introduces BC Loss, a contrastive loss variant that uses a bias-aware angular margin to learn high-quality representations for all items simultaneously, effectively breaking the traditional trade-off between head and tail performance.

The Problem: Popularity Bias and the Trade-off Game

Collaborative Filtering (CF) models are the backbone of modern recommendation engines, but they are notoriously sensitive to popularity bias. Because a few "head" items have the vast majority of interactions, models tend to over-recommend them, even when they don't match a user’s true preferences.

Existing debiasing strategies—such as re-weighting samples or applying causal inference—usually treat this as a zero-sum game: to help the "tail" (unpopular items), you must accept a performance hit on the "head." This leads to suboptimal overall accuracy. The authors argue that the real issue isn't just the data distribution, but the discriminative power of the learned representations. Standard losses fail to separate positive and negative items clearly in the embedding space, especially for tail items.

The Solution: Bias-aware Contrastive (BC) Loss

The authors propose BC Loss (Bias-aware Contrastive Loss) to address this fundamental representation issue. The core innovation is a two-step process:

  1. Popularity Bias Extractor: Before training the main recommendation model, the authors train a small module that attempts to predict user-item interactions using only popularity statistics (how active a user is and how popular an item is). This provides a "bias degree" for every interaction. If an interaction is easily predicted by popularity alone, it has a high bias degree.
  2. Bias-aware Angular Margin: They incorporate this bias degree into a Softmax-based contrastive loss. In the embedding space (visualized as a hypersphere), they add an angular margin ($M_{ui}$) to the positive user-item pairs.
Geometric interpretation of Softmax Loss vs. BC Loss in 2D and 3D spaces.
  • Low Bias (Hard Samples): If an interaction cannot be explained by popularity, the model imposes a larger margin. This forces the model to "squeeze" the user and item representations closer together, learning deeper features beyond simple popularity.
  • High Bias (Easy Samples): If the interaction is likely driven by popularity, the margin is smaller or zero, preventing the model from over-fitting to biased signals.

This approach is inspired by "ArcFace" in computer vision but adapted specifically to handle the unique challenges of long-tailed interaction data in CF.

Key Insights: Geometry and "Difficulty"

  • Breaking the Trade-off: The most significant "aha moment" of the paper is that debiasing doesn't have to be a compromise. By improving the geometric properties of the embedding space—making clusters tighter and separations wider—you can improve tail recommendations without hurting head performance.
  • Popularity as a "Difficulty" Metric: Instead of just trying to remove popularity, the authors use it as a proxy for sample difficulty. This allows the model to focus its "learning effort" (via the margin) on interactions that actually reveal true user preferences.
  • Geometric Compactness: The paper provides a theoretical proof showing that BC Loss simultaneously minimizes the entropy of positive pairs (compactness) and maximizes the entropy of the overall representation space (dispersion). This leads to a "locally clustered and globally separated" distribution.

Experimental Results

The authors evaluated BC Loss across eight benchmark datasets, ensuring a mix of densities and domains (including Tencent, Amazon-Book, Alibaba-iFashion, and Yelp2018). They tested these on various configurations, including balanced vs. imbalanced test sets and specific head/mid/tail subgroup evaluations.

Performance breakdown across Tail, Mid, and Head items.
  • Universal Improvement: Unlike previous methods that saw head performance drop by as much as 60% to achieve tail gains, BC Loss improved performance across all subgroups (Head, Mid, and Tail). For example, on the Tencent dataset, it improved tail performance by 576% while also increasing head performance by 40%.
  • Consistent Gains: BC Loss outperformed state-of-the-art debiasing methods (like IPS-CN and MACR) across all datasets, with relative improvements in Recall and NDCG ranging from 12.1% to 58.4%.
  • Efficiency: The method is "plug-and-play." It only requires changing a few lines of code in the loss function and adds negligible computational overhead during training.

Limitations and Future Work

While highly effective, the current work focuses primarily on popularity bias. The authors acknowledge that other biases, such as exposure bias (users only see what the system shows them) and selection bias, are not yet accounted for. Additionally, the function used to map the bias degree to the angular margin is relatively simple; more sophisticated, non-linear mapping functions could further refine performance.

Ultimately, considering its theoretical guarantees and empirical success, the authors advocate for BC Loss to be used as a standard loss function in CF—not just a debiasing tool. More extensive testing against a wider variety of non-CF recommendation architectures (like Transformers or Sequential models) is a logical next step.

Summary updated

BibTeX
@inproceedings{zhang2022incorporating,
  author = {An Zhang and Wenchang Ma and Xiang Wang and Tat-Seng Chua},
  title = {{Incorporating Bias-aware Margins into Contrastive Loss for Collaborative Filtering}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=apC354ZsGwK},
}
Figure