Fast Graph Sharpness-Aware Minimization for Enhancing and Accelerating Few-Shot Node Classification

Yihong Luo, Yuhan Chen, Siya Qiu, Yiwei Wang, Chen Zhang, Yan Zhou, Xiaochun Cao, Jing Tang

Graph Neural Networks (GNNs) have demonstrated remarkable success in modeling structured data, yet they remain notoriously data-hungry. In the regime of Few-Shot Node Classification (FSNC), where models must generalize to unseen classes using only a handful of labeled examples, GNNs frequently suffer from severe overfitting. This phenomenon is often characterized by the model converging to "sharp" minima in the loss landscape—regions where minor perturbations in parameters or inputs lead to significant increases in error.

To address this, researchers presented Fast Graph Sharpness-Aware Minimization (FGSAM) at NeurIPS 2024. This novel training framework seeks out "flat" minima to improve generalization while simultaneously overcoming the prohibitive computational costs associated with traditional sharpness-aware methods.

The Challenge of Sharpness in Few-Shot Learning

Sharpness-Aware Minimization (SAM) is a known technique for improving generalization by minimizing both loss and loss sharpness. However, standard SAM requires two forward-backward passes per iteration, effectively doubling training time. For GNNs, which already face overhead from message-passing (MP) operations, this 2x cost is often unacceptable.

Visualizing the transition from sharp to flat minima in the loss landscape when using FGSAM.

As shown in the loss landscape visualizations, FSNC tasks typically exhibit highly irregular and sharp landscapes compared to standard node classification. FGSAM effectively smooths these landscapes, facilitating the discovery of flatter, more robust minima.

Methodology: FGSAM and FGSAM+

The authors introduce a hybrid strategy that decouples the graph's structural information from the optimization step. Their approach relies on the concept of a PeerMLP—a GNN architecture with its message-passing layers removed.

  1. FGSAM (The Hybrid Approach): The algorithm uses the full GNN for the perturbation step to identify the direction of maximum sharpness, ensuring the graph topology is accounted for. For the minimization step, it switches to the faster PeerMLP. To maintain structural integrity, the gradient from the perturbation step is reused, reintroducing graph information at zero extra cost.
  2. FGSAM+ (The Accelerator): This variant further optimizes speed by performing the full GNN-based perturbation only every $k$ steps, using fast approximations based on stored gradients in between.

Experimental Results

The researchers evaluated FGSAM across benchmarks like CoraFull, DBLP, and ogbn-arXiv, as well as heterophilic graph datasets. The results demonstrate a significant breakthrough: FGSAM+ can achieve higher accuracy than standard optimizers like Adam while actually reducing total training time.

Accuracy vs. training time for various GNN architectures. FGSAM+ (red star) consistently achieves higher accuracy than Adam (blue circle) while often requiring significantly less training time.

Key Findings:

  • Accuracy Improvements: FGSAM consistently outperformed Adam and standard SAM across architectures like Meta-GCN and GPN. For instance, on CoraFull (5-way 3-shot), FGSAM+ improved Meta-GCN accuracy from 70.25% to 71.54%.
  • Efficiency Gains: On the CoraFull dataset, FGSAM+ reduced training time from ~9.5 seconds (Adam) to ~6.5 seconds, whereas standard SAM required ~19 seconds.
  • Robustness: Models trained with FGSAM+ exhibited greater resilience to noise in node features and graph edges, suggesting that flat minima provide a fundamental advantage for robust graph learning.

Conclusion

FGSAM represents a significant step forward in making sharpness-aware training practical for graph-based tasks. By strategically utilizing MLPs to accelerate GNN optimization, the authors prove that seeking flat minima does not have to come at a computational premium. This "fast sharpness" approach opens new avenues for efficient and robust learning across a wide variety of graph-related applications.

Summary updated

BibTeX
@inproceedings{luo2024fast,
  author = {Yihong Luo and Yuhan Chen and Siya Qiu and Yiwei Wang and Chen Zhang and Yan Zhou and Xiaochun Cao and Jing Tang},
  title = {{Fast Graph Sharpness-Aware Minimization for Enhancing and Accelerating Few-Shot Node Classification}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=AF32GbuupC},
}
Figure