Probing Negative Sampling Strategies to Learn GraphRepresentations via Unsupervised Contrastive Learning

Shiyi Chen, Ziao Wang, Xinni Zhang, Xiaofeng Zhang, Dan PengarXiv 2021

Abstract

Unsupervised contrastive learning has become a cornerstone of graph representation learning, yet it remains plagued by two significant issues: class collision and density bias. This paper introduces a node-wise contrastive learning framework designed to mitigate these pitfalls. By employing distribution fitting to filter false negatives and Determinantal Point Processes (DPP) to ensure negative sample diversity, the proposed method achieves state-of-the-art results on standard node classification benchmarks, frequently outperforming supervised Graph Neural Networks (GNNs).

Introduction: The Challenges of Contrastive Learning

Graph representation learning is vital for downstream tasks such as node classification and link prediction. While supervised GNNs are effective, they are often limited by the high cost of expert-labeled data. Unsupervised contrastive learning offers an alternative by training models to minimize the distance between "positive" pairs (semantically similar nodes) and maximize the distance between "negative" pairs (dissimilar nodes) in a latent feature space.

Contrastive learning setup: mapping graph nodes to an embedding space with positive and negative samples.

However, current contrastive strategies face two critical flaws:

  1. Class Collision: Without labels, random negative sampling often selects "false negatives"—nodes that actually belong to the same class as the target node. Pushing these nodes away degrades the quality of the learned embeddings.
  2. Density Bias: If negative samples are unevenly distributed and clustered in specific regions of the feature space, the contrastive loss exerts a disproportionate repulsive force, distorting the embedding space regardless of actual semantic similarity.

Methodology

The authors propose a three-pronged approach to address these issues:

1. Resolving Class Collision via Distribution Fitting

To identify false negatives, the framework utilizes two independent neural networks to estimate the probability distributions of positive ($p_i^+$) and negative ($p_i^-$) samples. A "soft-margin" ratio $\alpha$ is used to filter nodes: if a sampled negative node has a high probability of belonging to the positive distribution relative to the negative one, it is either discarded or treated as a positive instance.

Visualization of distribution fitting and the soft-margin ratio alpha used to filter false negatives.

2. Diverse Negative Sampling with DPP

To counteract density bias, the authors replace simple random sampling with a Determinantal Point Process (DPP). DPP selects a subset of negative instances that are diverse and well-spread across the feature space. This ensures that the repulsive forces are balanced, preventing the model from being unfairly biased by dense clusters of similar negative points.

3. Weighted Contrastive Loss

The framework incorporates a weighted loss function where "hard" negatives—those closer to the target node in the feature space—are assigned higher weights. This focuses the model's learning on the most informative boundaries between classes.

Experimental Results

The model was evaluated on three standard citation network benchmarks: Cora, Citeseer, and Pubmed.

Key Findings

  • State-of-the-Art Performance: On the Pubmed dataset, the proposed model achieved 81.5% accuracy, surpassing previous unsupervised state-of-the-art models (e.g., Mvgrl) and even exceeding the performance of supervised GCN and GAT models.
  • Ablation Studies: Removing either the DPP sampling or the soft-margin filtering led to significant performance drops. For instance, on Citeseer, accuracy fell from 73.5% to 69.3% without these components, confirming their necessity.
  • Embedding Quality: T-SNE visualizations of the Pubmed dataset revealed that the proposed method produces clearer clusters with superior class separation compared to baseline self-supervised methods.

Discussion and Future Work

While the proposed framework offers significant improvements in embedding quality, it introduces additional computational overhead due to the DPP sampling and the dual-network distribution fitting. Future research could focus on optimizing the weighting function and exploring the scalability of DPP sampling for massive graphs with millions of nodes, where the determinant calculation may become a bottleneck.

Summary updated

BibTeX
@misc{chen2021probing,
  author = {Shiyi Chen and Ziao Wang and Xinni Zhang and Xiaofeng Zhang and Dan Peng},
  title = {{Probing Negative Sampling Strategies to Learn GraphRepresentations via Unsupervised Contrastive Learning}},
  year = {2021},
  eprint = {2104.06317},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2104.06317},
}
Figure