Toward a Better Understanding of Loss Functions for Collaborative Filtering

Seongmin Park, Mincheol Yoon, Jae-woong Lee, Hogun Park, Jongwuk Lee · DOI

Introduction

In the field of Collaborative Filtering (CF), research has traditionally focused on developing increasingly complex interaction encoders—the neural architectures, such as Graph Neural Networks (GNNs), that map users and items into a shared latent space. However, recent evidence suggests that the choice of loss function may be the primary driver of state-of-the-art performance. This research from Sungkyunkwan University provides a mathematical framework that links disparate loss types and introduces MAWU, a loss function designed to address the inherent biases and statistical heterogeneity of real-world datasets.

The Unified Theory of CF Loss Functions

A central contribution of this work is the mathematical proof that most popular CF loss functions are variations of Alignment and Uniformity (AU) optimization. By performing a rigorous analysis of the Sampled Softmax (SSM) loss, the authors demonstrate that it serves as a fundamental bridge between different methodologies.

As parameters such as temperature or the number of negative samples are adjusted, SSM effectively "morphs" into other well-known losses like Bayesian Personalized Ranking (BPR) or Collaborative Metric Learning (CML). Crucially, the authors show that SSM is asymptotically equivalent to optimizing for two geometric properties on a hypersphere:

  1. Alignment: Minimizing the distance between a user and the items they have interacted with.
  2. Uniformity: Ensuring that user and item embeddings are distributed evenly across the latent space to prevent representation collapse.

The MAWU Framework

Building on these theoretical insights, the authors propose MAWU (Margin-aware Alignment and Weighted Uniformity). This framework introduces two specific innovations to handle the "messy" nature of real-world data:

1. Margin-aware Alignment (MA)

Standard alignment losses often suffer from popularity bias, where "blockbuster" items dominate the latent space while niche items remain poorly represented. MAWU introduces an angular margin that is dynamically adjusted based on item popularity and user activity. By applying a larger margin for unpopular items and inactive users, the model is forced to learn more robust and discriminative representations for the long-tail of the data.

2. Weighted Uniformity (WU)

Most existing losses treat user and item distributions as equally important. However, datasets are rarely symmetrical; some exhibit high item diversity but uniform user behavior, while others are the opposite. MAWU utilizes hyperparameters ($\gamma_1, \gamma_2$) to balance user and item uniformity. The optimal weights for these parameters correlate with the dataset's Gini index, allowing the model to compensate for specific statistical skews.

Experimental Evaluation

The authors evaluated MAWU against ten baseline loss functions (including BPR, CCL, and DirectAU) across three benchmark datasets:

  • Amazon Beauty: A sparse dataset characterized by high item diversity.
  • Gowalla: A location-based social network dataset.
  • Yelp2018: A large-scale business review dataset.

Key Findings

  • Loss over Encoder: One of the most significant findings is that a simple Matrix Factorization (MF) model—often considered a baseline—can outperform complex GNNs simply by utilizing the MAWU loss function. This suggests that the optimization objective is frequently more critical than the model architecture.
  • SOTA Performance: When applied to a standard LightGCN backbone, MAWU-LightGCN outperformed eight state-of-the-art models, including specialized GNNs like LightGCL and SimGCL.
  • Resilience to Sparsity: The performance gains were most pronounced on the Amazon Beauty dataset, the sparsest of the three. MAWU improved NDCG@20 by over 7% compared to the best baseline loss function, confirming that the margin-aware approach effectively extracts signal from limited interactions.
  • Theoretical Validation: The paper reveals that DirectAU (a recent SOTA loss that avoids negative sampling) is mathematically equivalent to SSM with an infinite number of negative samples, further validating the authors' unified theory.

Conclusion

MAWU provides a principled way to "de-bias" collaborative filtering models during the training phase rather than through post-processing. While the framework introduces new hyperparameters for weighting uniformity, the authors demonstrate a clear relationship between these weights and the Gini index of the dataset. Future research may explore the use of AutoML to determine these weights automatically or investigate the behavior of MAWU in non-Euclidean latent spaces to better capture hierarchical data structures.

Summary updated

BibTeX
@inproceedings{park2023toward,
  author = {Seongmin Park and Mincheol Yoon and Jae-woong Lee and Hogun Park and Jongwuk Lee},
  title = {{Toward a Better Understanding of Loss Functions for Collaborative Filtering}},
  booktitle = {ACM International Conference on Information and Knowledge Management},
  year = {2023},
  url = {https://openreview.net/forum?id=SjZlbFjNMi},
}
Figure