NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Sharpness-Aware Graph Collaborative Filtering

Huiyuan Chen, Chin-Chia Michael Yeh, Yujie Fan, Yan Zheng, Junpeng Wang, Vivian Lai, Mahashweta Das, Hao Yang

Abstract

Graph Neural Networks (GNNs) have become a cornerstone of modern recommender systems due to their ability to model complex, higher-order user-item interactions. However, these models often suffer from poor generalization, particularly when dealing with the long-tail distributions characteristic of real-world interaction data. This paper introduces gSAM (Graph-based Sharpness-Aware Minimization), a novel training schema designed to improve model robustness by smoothing the loss landscape. By formulating the training process as a bi-level optimization problem, gSAM guides GNNs toward "flat" minima, which are empirically associated with superior generalization. Our evaluation across multiple benchmarks demonstrates that gSAM significantly enhances the performance and stability of state-of-the-art collaborative filtering models.

Introduction

In Collaborative Filtering (CF), GNNs are highly effective because they leverage the graph structure of user-item interactions. Despite their success, these models are highly parameterized and prone to overfitting. Standard optimization techniques like Adam or SGD often converge to "sharp minima"—regions of the loss landscape where the training error is low, but the loss increases dramatically with even minor perturbations in model parameters or data distribution. This sensitivity leads to poor performance on unseen test data.

This generalization gap is exacerbated by the power-law distribution of recommendation graphs. A small number of popular items dominate the interactions, while the vast majority of items (the "long tail") have sparse data. Standard GNNs tend to memorize these high-degree nodes while failing to learn meaningful representations for the long tail. To address this, we propose gSAM, a method that forces the model to seek out "flat minima," ensuring that the learned parameters are robust to the inherent noise and sparsity of graph data.

Methodology: The gSAM Framework

The core objective of gSAM is to optimize for a loss that is low not just at a single point in the parameter space, but within a surrounding neighborhood. While Sharpness-Aware Minimization (SAM) has been successful in computer vision, it often fails when applied to graph data. Standard SAM relies on a one-step gradient ascent to find the worst-case loss, which proves unstable for the non-independent and identically distributed (non-i.i.d.) nature of graph structures.

Bi-Level Optimization

To overcome these stability issues, gSAM treats the search for flatter minima as a bi-level optimization problem:

  1. The Inner Problem: The model identifies a perturbation (a small shift in weights) that maximizes the loss within a defined radius $\rho$. This step identifies the "sharpest" direction in the local landscape.
  2. The Outer Problem: The model updates its actual parameters to minimize this worst-case neighborhood loss.

Efficient Computation

Directly solving bi-level optimization problems is computationally expensive, often requiring the calculation of the inverse Hessian matrix. To make gSAM scalable to large-scale recommendation graphs with millions of parameters, the authors utilize the Cauchy Implicit Function theorem and the Neumann series to approximate the hypergradients. This mathematical approach allows the model to achieve the benefits of second-order optimization with the efficiency required for production-scale datasets.

Experimental Setup

The effectiveness of gSAM was evaluated on three standard benchmark datasets for implicit recommendation:

  • Amazon-Book
  • Gowalla
  • Yelp-2018

The data was split into training, validation, and test sets using an 8:1:1 ratio. Performance was measured using standard Top-$K$ metrics, specifically Recall@20 and Normalized Discounted Cumulative Gain (NDCG@20).

Key Insights and Results

Smoothing the Loss Landscape

Visualization of the 3D loss landscapes for vanilla GNNs (such as LightGCN and NGCF) reveals highly jagged and sharp surfaces. When gSAM is applied, these landscapes are visibly transformed into smooth, bowl-like surfaces. This empirical evidence confirms that gSAM successfully steers the optimization process toward flatter, more stable regions.

Performance Gains and Stability

Applying gSAM to the baseline LightGCN model yielded an average improvement of 9.34% in Recall@20 and 8.85% in NDCG@20 across all datasets. Furthermore, gSAM demonstrated remarkable stability. In tests across 30 independent training runs, gSAM exhibited significantly lower variance in performance compared to both vanilla baselines and standard SAM, proving that the implicit differentiation approach is mathematically more robust for graph data.

Synergy with Contrastive Learning

One of the most significant findings is that gSAM provides orthogonal benefits to existing data augmentation techniques. When integrated with state-of-the-art contrastive learning frameworks like SimGCL and MixGCF, gSAM provided an additional 8-12% boost in NDCG. This suggests that smoothing the loss landscape addresses a different fundamental challenge than data-level augmentation.

Rescuing the Long Tail

GNNs typically struggle with low-degree items. However, gSAM consistently improved performance on these "unpopular" items. By seeking flatter minima, the model avoids simply memorizing high-frequency patterns and instead learns more generalizable collaborative signals that benefit the entire item distribution.

Conclusion and Limitations

gSAM represents a significant step forward in making Graph Collaborative Filtering more robust and generalizable. By shifting the focus from simple loss minimization to landscape smoothing, it addresses the fundamental problem of sharp minima in GNNs.

While highly effective, gSAM introduces the hyperparameter $\rho$ (the neighborhood radius), which requires tuning for specific datasets (e.g., $\rho \approx 0.5$ for Amazon-Book). Additionally, while the Neumann series approximation is efficient, the calculation of hypergradients still carries a higher computational cost than standard first-order methods. Future research could explore the application of this bi-level optimization framework to other graph-based tasks, such as node classification and link prediction in non-recommender contexts.

Summary updated

BibTeX
@inproceedings{chen2023sharpness,
  author = {Huiyuan Chen and Chin-Chia Michael Yeh and Yujie Fan and Yan Zheng and Junpeng Wang and Vivian Lai and Mahashweta Das and Hao Yang},
  title = {{Sharpness-Aware Graph Collaborative Filtering}},
  booktitle = {International ACM SIGIR Conference on Research and Development in Information Retrieval},
  year = {2023},
}
Figure