Incorporating Bias-aware Margins into Contrastive Loss for Collaborative Filtering

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

Introduction

Collaborative filtering (CF) serves as the backbone of modern recommendation systems, yet it remains fundamentally limited by popularity bias. Because user-item interaction data is typically long-tailed, models naturally gravitate toward over-recommending a small subset of popular "head" items while neglecting the vast majority of "tail" items. Historically, addressing this bias has involved a zero-sum game: improving tail item performance usually comes at the expense of accuracy for head items. This paper introduces BC Loss (Bias-aware Contrastive Loss), a novel objective function designed to break this trade-off by incorporating adaptive angular margins into the representation learning process.

The Challenge: The Popularity Bias Trade-off

In standard CF models, the training signal is dominated by popular items. Existing debiasing strategies, such as sample re-weighting or causal inference-based adjustments, often attempt to "level the playing field" by reducing the influence of popular items. While these methods can improve the visibility of tail items, they frequently degrade the overall quality of user representations, leading to a significant drop in performance for head items.

BC Loss shifts the focus from merely adjusting weights to improving the geometric properties of the representation space. The authors argue that an ideal debiasing strategy should learn more discriminative features for all items, regardless of their popularity, rather than simply shifting the model's focus from one group to another.

Methodology: BC Loss

BC Loss builds upon the standard Softmax-based contrastive loss by introducing Adaptive Angular Margins. The methodology is executed in two primary phases:

1. Popularity Bias Extraction

The model first employs a simple auxiliary module to estimate the "bias degree" of each interaction. This module predicts user-item interactions using only popularity statistics (e.g., user activity levels and item popularity). If an interaction is easily predicted by these statistics alone, it is assigned a high bias degree. Conversely, if popularity cannot explain the interaction, it is considered a "hard" example that likely reflects a genuine, specific user preference.

2. Adaptive Angular Margins

Inspired by large-margin losses used in face recognition (such as ArcFace), BC Loss applies a variable margin ($M_{ui}$) to the loss function based on the extracted bias degree:

  • Low Bias (Tail/Hard Examples): For interactions that are not explained by popularity, the model imposes a larger margin. This forces the user and item embeddings to be significantly closer in the representation space, effectively "squeezing" the representations to ensure high similarity for these informative pairs.
  • High Bias (Head/Easy Examples): For interactions driven largely by popularity, the margin is reduced or removed. This prevents the model from being over-influenced by biased data while still maintaining the necessary associations.

This mechanism allows BC Loss to act as an implicit hard-example miner, focusing the model's learning capacity on the most preference-driven data points.

Experimental Evaluation

The authors evaluated BC Loss across eight diverse benchmark datasets to ensure robustness across different domains and data distributions:

  • General/Large-scale: Tencent, Amazon-Book, Alibaba-iFashion, and Yelp2018.
  • Temporal Dynamics: Douban Movie (using temporal splits to account for shifting popularity).
  • Unbiased/Fully-Observed: Yahoo!R3, Coat, and KuaiRec, which provide ground-truth preferences beyond simple click data.

Key Findings

Breaking the Performance Trade-off

The most significant result is that BC Loss consistently improved performance across all item subgroups—head, mid, and tail. Unlike previous methods, it does not sacrifice the head to save the tail. For example, on the Tencent dataset, BC Loss improved head item NDCG by 40% while simultaneously boosting tail item performance by a staggering 576% compared to the base model.

Superior Accuracy

BC Loss achieved state-of-the-art results, outperforming leading debiasing methods like IPS-CN and MACR by margins ranging from 12.1% to 58.4%. It proved effective in both highly biased (long-tail) and balanced (unbiased) test environments.

Geometric and Computational Efficiency

Theoretically and through hypersphere visualizations, the authors demonstrated that BC Loss creates a more compact and organized representation space. By clustering positive pairs more tightly, the model achieves better discriminative power. Furthermore, the implementation is highly efficient; it adds negligible computational overhead to standard backbone models like Matrix Factorization (MF) or LightGCN.

Conclusion and Future Directions

BC Loss represents a paradigm shift in recommendation debiasing, moving from simple weight adjustment to sophisticated, margin-based representation learning. By treating popularity bias as a geometric challenge, it successfully improves recommendations for all users and items.

Future research may explore more complex, non-linear functions for modeling the margin $M_{ui}$ or extend the bias-aware margin concept to other forms of bias, such as exposure or selection bias. Given its performance and simplicity, the authors suggest that BC Loss could serve as a new standard loss function for collaborative filtering tasks.

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