Generating counterfactual hard negative samples for graph contrastive learning

Haoran YANG, Hongxu CHEN, Sixiao ZHANG, Xiangguo SUN, Qian LI, Xiangyu ZHAO, Guandong XU

Research output: Chapter in Book/Report/Conference proceedingChapters

2 Citations (Scopus)


Graph contrastive learning has emerged as a powerful unsupervised graph representation learning tool. The key to the success of graph contrastive learning is to acquire high-quality positive and negative samples as contrasting pairs to learn the underlying structural semantics of the input graph. Recent works usually sample negative samples from the same training batch with the positive samples or from an external irrelevant graph. However, a significant limitation lies in such strategies: the unavoidable problem of sampling false negative samples. In this paper, we propose a novel method to utilize Counterfactual mechanism to generate artificial hard negative samples for Graph Contrastive learning, namely CGC. We utilize a counterfactual mechanism to produce hard negative samples, ensuring that the generated samples are similar but have labels that differ from the positive sample. The proposed method achieves satisfying results on several datasets. It outperforms some traditional unsupervised graph learning methods and some SOTA graph contrastive learning methods. We also conducted some supplementary experiments to illustrate the proposed method, including the performances of CGC with different hard negative samples and evaluations for hard negative samples generated with different similarity measurements. The implementation code is available online to ease reproducibility1. Copyright © 2023 held by the owner/author(s). Publication rights licensed to ACM.

Original languageEnglish
Title of host publicationProceedings of the ACM Web Conference 2023
Place of PublicationNew York
PublisherAssociation for Computing Machinery
ISBN (Electronic)9781450394161
Publication statusPublished - Apr 2023


Yang, H., Chen, H., Zhang, S., Sun, X., Li, Q., Zhao, X., & Xu, G. (2023). Generating counterfactual hard negative samples for graph contrastive learning. In Proceedings of the ACM Web Conference 2023 (pp. 621-629). Association for Computing Machinery.


  • Graph contrastive learning
  • Hard negative sample
  • Counterfactual


Dive into the research topics of 'Generating counterfactual hard negative samples for graph contrastive learning'. Together they form a unique fingerprint.