Rethinking Graph Contrastive Learning through Relative Similarity Preservation

Zhiyuan Ning, Pengfei Wang, Ziyue Qiao, Pengyang Wang, Yuanchun Zhou · DOI

Abstract

Traditional Graph Contrastive Learning (GCL) methods often rely on "absolute similarity" paradigms borrowed from computer vision, which struggle with the discrete and sensitive nature of graph structures. This paper introduces RELGCL, a framework that leverages the inherent "relative similarity" patterns found in graphs. By observing that node label consistency systematically decays with structural distance—a phenomenon proven via Random Walk Theory—RELGCL replaces artificial augmentations with a collective similarity objective. Across 11 diverse datasets, RELGCL demonstrates state-of-the-art performance in node classification, clustering, and similarity search, offering a more robust and theoretically grounded approach to graph representation learning.

Introduction

In the realm of computer vision, contrastive learning has seen immense success by enforcing "absolute similarity" between different views of the same object. For instance, a rotated or cropped image of a cat remains a cat. However, this paradigm does not translate seamlessly to graph data. In a graph, discrete structural changes—such as removing a single edge—can fundamentally alter the identity or properties of a node, potentially turning a medicine into a toxin. Furthermore, while human intuition can easily verify the similarity between two image augmentations, judging the semantic similarity between abstract graph views is often impossible.

This paper argues that the current GCL reliance on artificial augmentations is fundamentally misaligned with the nature of graphs. Instead of inventing similarity through perturbations, the authors propose looking at how similarity is inherently encoded within the graph's own structure.

The Universal Decay of Label Consistency

To move away from artificial views, the authors first investigated how semantic similarity (label consistency) behaves naturally across graph structures. By analyzing 11 real-world datasets, they discovered a Universal Decay Law: the probability that two nodes share the same label systematically diminishes as the structural distance between them increases.

This pattern manifests in two primary ways:

  1. Homophily Graphs: In networks where similar nodes tend to connect (e.g., citation networks), label consistency decays smoothly as distance increases.
  2. Heterophily Graphs: In networks where dissimilar nodes connect (e.g., Wikipedia link networks), label consistency oscillates but maintains an overall downward trend over distance.

To ground these observations, the authors utilized Random Walk Theory to provide a theoretical guarantee. They proved that label distributions converge exponentially as a walker moves further from a starting node, providing a mathematical foundation for using structural proximity as a proxy for relative similarity.

The RELGCL Framework

The proposed RELGCL (RELative Graph Contrastive Learning) framework replaces the standard augmentation-based contrastive loss with a focus on these structural patterns.

Collective Similarity Objective

Unlike traditional methods that compare individual pairs of nodes, RELGCL employs a "sum-inside-the-log" contrastive loss. This allows the model to capture the statistical nature of similarity. It acknowledges that while closer nodes are collectively more likely to be similar, individual exceptions exist. This statistical approach makes the model significantly more robust to the "noise" inherent in graph structures.

Implementation Variants

The framework is implemented in two primary ways to capture different structural nuances:

  • RELGCL-Pairwise: This variant compares hops sequentially (e.g., 1-hop vs. 2-hop). It is particularly effective at capturing the fine-grained transitions and oscillatory patterns found in heterophily graphs.
  • RELGCL-Listwise: This variant compares a specific hop against all subsequent hops as a collective whole, providing a broader, more global view of the node's neighborhood.

Experimental Evaluation

The authors evaluated RELGCL against 20 existing approaches across 11 diverse datasets, ranging from citation networks (Cora, CiteSeer) to co-occurrence networks (Amazon Computers) and heterophily networks (Chameleon, Actor).

Key Results

  • Superior Performance: RELGCL consistently outperformed the baselines across all datasets. In node classification tasks, it achieved an average rank of 1.6, a substantial improvement over the best baseline rank of 5.3.
  • Versatility: Beyond classification, the method demonstrated superior performance in node clustering and similarity search, proving that the learned representations are high-quality and generalizable.
  • Efficiency: By eliminating the need to generate and process multiple augmented views, RELGCL is computationally efficient, often outperforming traditional GCL methods in terms of speed and resource usage.

Discussion and Limitations

While RELGCL represents a significant step forward, the authors note certain limitations. The effectiveness of the method is tied to the neighborhood range ($k$); performance typically stabilizes or declines beyond 4 hops as distant neighbors become too sparse to provide a meaningful signal. Additionally, the current theoretical framework relies on a simplified two-label model. Future work is needed to account for multi-label imbalances and the complexities of high-degree hubs.

Conclusion

RELGCL shifts the focus of graph contrastive learning from artificial augmentations to the preservation of inherent structural patterns. By recognizing that graphs encode similarity through relative proximity rather than absolute identity, this framework provides a more natural and effective way to learn node representations. The discovery of the universal decay law and its theoretical backing through Random Walk Theory suggests that relative similarity preservation is a powerful principle for future research in graph machine learning.

Summary updated

BibTeX
@inproceedings{ning2025rethinking,
  author = {Zhiyuan Ning and Pengfei Wang and Ziyue Qiao and Pengyang Wang and Yuanchun Zhou},
  title = {{Rethinking Graph Contrastive Learning through Relative Similarity Preservation}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.24963/ijcai.2025/358},
}
Figure