Enhancing Graph Contrastive Learning with Node Similarity

Hongliang Chi, Yao MaarXiv 2022 · DOI

Introduction

Graph Contrastive Learning (GCL) has emerged as a cornerstone of self-supervised representation learning for Graph Neural Networks (GNNs). By optimizing an objective that pulls semantically similar "positive" pairs together while pushing dissimilar "negative" pairs apart, GCL enables the training of robust models without the need for extensive manual labeling. Most contemporary GCL frameworks rely on the InfoNCE loss, which typically defines positive pairs through stochastic data augmentations of a single anchor node.

However, this standard approach suffers from two fundamental limitations. First, the Single Positive Problem: by only considering an augmented version of the anchor as a positive sample, the model ignores other nodes in the graph that share the same semantic properties. Second, the False Negative Problem: negative samples are usually drawn via uniform random sampling from the remaining nodes. In many graph datasets, there is a high probability that a randomly selected "negative" node actually belongs to the same class as the anchor, leading the model to push away valid semantic neighbors and degrading the resulting embeddings.

The Enhanced Objective Framework

To address these issues, this research proposes an Enhanced Objective for GCL. The core idea is to move away from binary positive/negative labels toward a continuous similarity-based weighting scheme that approximates an "ideal" contrastive loss. In this ideal scenario, the numerator would contain all true positives, and the denominator would exclude all false negatives.

Node Similarity Fusion

The framework calculates node similarity by fusing two distinct sources of information:

  1. Graph Structure: Utilizing Personalized PageRank (PPR), the model captures higher-order structural proximity. PPR provides a more nuanced view of "reachability" than simple adjacency matrices, allowing the model to identify semantically related nodes that may not be immediate neighbors.
  2. Node Features: Cosine Similarity is applied to the raw input features to identify nodes with similar attributes, regardless of their position in the graph topology.

These two metrics are combined using a scaling factor ($\gamma$) and a balancing hyperparameter ($\beta$), creating a unified similarity score. This score is then transformed via temperature-controlled exponential functions ($\tau_p, \tau_n$) to determine the relative weight of each node in the contrastive loss.

Scalable Importance Sampling

Calculating similarity across all node pairs in a large graph is computationally prohibitive. To maintain efficiency, the authors implement an importance sampling strategy. This allows the model to estimate the expectations of the ideal objective using a manageable subset of nodes, ensuring the method scales to larger benchmarks.

Experimental Evaluation

The proposed enhanced objective was evaluated across eight diverse graph benchmarks, including citation networks (Cora, Citeseer, Pubmed, DBLP), co-purchase/co-authorship networks (Amazon Computers, Amazon Photo, Co-author CS), and reference networks (Wiki-CS). The objective was integrated as a drop-in replacement for the loss functions in established GCL frameworks like GRACE and GCA, as well as the non-message-passing Graph-MLP.

Key Results and Insights

The integration of the enhanced objective consistently improved performance across all tested architectures and datasets.

Figure 1: Node classification results of GRACE and GRACE+ with various training ratios across four datasets.

As shown in Figure 1, the "plus" versions of the models (e.g., GRACE+) consistently outperform their base counterparts across a wide range of training ratios. For instance, on the Wiki-CS dataset, GCA+ improved classification accuracy from 76.46% to 78.64%. The "soft" weighting approach proved more robust than hard-filtering negatives, as it allows the model to gracefully handle noise in the similarity estimates.

Label Efficiency and Few-Shot Learning

One of the most significant advantages of the enhanced objective is its performance in label-scarce environments. By providing a stronger, similarity-informed signal during the self-supervised phase, the model builds a more discriminative embedding space that requires fewer labels to fine-tune.

Figure 2: Node classification results of Graph-MLP and Graph-MLP+ with limited training samples (1 to 9 samples per class).

Figure 2 highlights this effect for Graph-MLP+. In scenarios with as few as one training sample per class, the enhanced objective provides a substantial performance boost over the standard Graph-MLP. On the Citeseer dataset, the base Graph-MLP achieved 72.99% accuracy, while Graph-MLP+ reached 74.03%, demonstrating that better contrastive signals can effectively compensate for a lack of human-annotated data.

Conclusion

By leveraging node similarity to refine the contrastive objective, this work successfully mitigates the single positive and false negative problems inherent in standard GCL. The resulting framework is versatile, scalable, and particularly effective in low-label regimes. Future research may explore learning the similarity metrics directly or applying these principles to even larger-scale industrial graphs.

Summary updated

BibTeX
@misc{chi2022enhancing,
  author = {Hongliang Chi and Yao Ma},
  title = {{Enhancing Graph Contrastive Learning with Node Similarity}},
  year = {2022},
  eprint = {2208.06743},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2208.06743},
}
Figure