Advancing Loss Functions in Recommender Systems: A Comparative Study with a Rényi Divergence-Based Solution

Shengjia Zhang, Jiawei Chen, Changdong Li, Sheng Zhou, Qihao Shi, Yan Feng, Chun Chen, Can Wang · DOI

Abstract

Recommender systems (RS) rely on loss functions to learn user preferences by distinguishing between positive and negative items. While Softmax Loss (SL) and Cosine Contrastive Loss (CCL) have become industry standards due to their high performance, they possess inherent flaws: SL is overly sensitive to noisy data (false negatives), and CCL suffers from poor data utilization due to aggressive truncation. This paper introduces Distributional Robust Rényi Loss (DrRL), a novel loss function that unifies SL and CCL under the framework of Distributionally Robust Optimization (DRO). By employing Rényi divergence, DrRL provides a polynomial weighting scheme that mitigates noise sensitivity and a personalized, learnable truncation mechanism that maximizes data efficiency. Evaluated on four real-world benchmarks, DrRL demonstrates state-of-the-art accuracy and significant robustness to distribution shifts and label noise.

The Problem: Inherent Flaws in SL and CCL

In modern recommendation tasks, the loss function is the primary driver for model learning. Recently, Softmax Loss (SL) and Cosine Contrastive Loss (CCL) have dominated the field, significantly outperforming traditional methods like Bayesian Personalized Ranking (BPR) or Mean Squared Error (MSE).

Performance comparison of state-of-the-art loss functions (SL and CCL) against traditional baselines on Amazon datasets.

Despite their success, both methods have critical limitations:

  1. SL and Noise Sensitivity: RS datasets are rife with "false negatives"—items users would like but haven't encountered. SL's exponential weighting accidentally amplifies the importance of these items, leading the model to penalize correct predictions aggressively.
  2. CCL and Data Waste: CCL employs a hard truncation threshold, ignoring negative items with low scores. The authors found that CCL often discards over 90% of negative examples, losing valuable learning signals and requiring extensive manual hyperparameter tuning.

Methods: A Unified DRO Framework

The authors provide a theoretical breakthrough by proving that both SL and CCL are instances of Distributionally Robust Optimization (DRO). DRO trains models on a "worst-case" perturbed version of the data to ensure robustness against distribution shifts. The primary difference lies in the divergence metric used: SL utilizes KL-divergence, while CCL uses worst-case regret-divergence.

To address their respective flaws, the authors propose Distributional Robust Rényi Loss (DrRL). Built on the Rényi divergence family—which encompasses the metrics of both SL and CCL—DrRL offers two key advantages:

  • Polynomial Weighting: Unlike SL's explosive exponential weights, DrRL uses a polynomial scheme that reduces the impact of noisy false negatives.
  • Personalized Truncation: Instead of a global, manually-tuned cutoff, DrRL introduces a learnable parameter ($\beta$) for each individual user, allowing the model to adapt to varying rating behaviors and retain more training data.

Key Results and Insights

The researchers evaluated DrRL across four benchmarks: Gowalla, AmazonKitchen, AmazonElectronics, and AmazonBeauty. The model was tested against standard splits, Out-Of-Distribution (OOD) temporal shifts, and artificial noise injection.

Superior Accuracy and Robustness

DrRL consistently outperformed eight baseline loss functions across multiple architectures (MF, LightGCN, XSimGCL). On the Gowalla dataset, it achieved a 6.9% improvement in Recall@20. Notably, DrRL maintained high performance even with a 25% noise ratio, whereas CCL's performance collapsed due to its reliance on a narrow set of potentially noisy data.

Enhanced Data Efficiency

A core strength of DrRL is its ability to utilize a larger portion of the training set compared to CCL. By softening the truncation mechanism, DrRL retains approximately 10% more negative instances, providing a denser learning signal.

Density plots of truncation rates for CCL vs. DrRL, showing that DrRL retains significantly more training data by avoiding the extreme spikes seen in CCL.

Conclusion

By unifying existing loss functions under the DRO framework and introducing Rényi divergence, DrRL provides a theoretically grounded and empirically superior solution for recommender systems. It eliminates the need for tedious manual tuning of truncation thresholds while offering unprecedented robustness to the noise and distribution shifts inherent in real-world user data. Future work will explore extending this framework to sequential recommendation and click-through rate prediction tasks.

Summary updated

BibTeX
@inproceedings{zhang2025advancing,
  author = {Shengjia Zhang and Jiawei Chen and Changdong Li and Sheng Zhou and Qihao Shi and Yan Feng and Chun Chen and Can Wang},
  title = {{Advancing Loss Functions in Recommender Systems: A Comparative Study with a Rényi Divergence-Based Solution}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i12.33450},
}
Figure