Improving Graph Representation Learning by Contrastive Regularization

Kaili Ma, Haochen Yang, Han Yang, Tatiana Jin, Pengfei Chen, Yongqiang Chen, Barakeel Fanseu Kamhoua, James Cheng · OpenReview

Abstract

Graph representation learning is an important task with applications in various areas such as online social networks, e-commerce networks, WWW, and semantic webs. For unsupervised graph representation learning, many algorithms such as Node2Vec and Graph-SAGE make use of "negative sampling" and/or noise contrastive estimation loss. This bears similar ideas to contrastive learning, which "contrasts" the node representation similarities of semantically similar (positive) pairs against those of negative pairs. However, despite the success of contrastive learning, we found that directly applying this technique to graph representation learning models (e.g., graph convolutional networks) does not always work. We theoretically analyze the generalization performance and propose a light-weight regularization term that avoids the high scales of node representations' norms and the high variance among them to improve the generalization performance. Our experimental results further validate that this regularization term significantly improves the representation quality across different node similarity definitions and outperforms the state-of-the-art methods.

Introduction

In Graph Contrastive Learning (GCL), models are trained to maximize the similarity between "positive" node pairs and minimize it for "negative" pairs. In the absence of labels, these pairs are typically defined via heuristics, such as graph proximity. However, these heuristics often introduce noise—nodes that are structurally close might belong to different semantic classes. This paper identifies a critical "mis-alignment" issue: as models minimize the contrastive loss, they often learn spurious features that do not generalize to downstream tasks.

The Confidence Trap and Mis-calibration

The authors observe a phenomenon termed the "confidence trap." As training progresses, the standard Noise Contrastive Estimation (NCE) loss continues to decrease, and the model's predicted similarity for positive pairs increases. However, the alignment with ground-truth labels (measured by positive sampling accuracy $q^+$) often degrades, while the Expected Calibration Error (ECE)—adapted here for unsupervised graph settings—rises. This indicates that the model becomes increasingly overconfident in its predictions even as they become less accurate relative to the true underlying classes.

Mis-calibration in GCL: As NCELoss decreases (left), the model becomes more confident, but ECE increases while positive sampling accuracy $q^+$ decreases (right).

Contrast-Reg: A Lightweight Solution

To address this mis-calibration, the authors propose Contrast-Reg, a plug-in regularization term. Contrast-Reg introduces a random anchor vector $r$ and encourages node embeddings to remain close to $r$ while ensuring that "noisy" versions of these nodes (with shuffled features) are pushed away.

Mathematically, this term constrains the norms of the node representations and reduces their variance. The authors provide a theoretical foundation for this approach using Rademacher complexity, proving that bounding the embedding norms leads to a tighter generalization bound for the downstream classification error.

Empirical Validation

The impact of Contrast-Reg is clearly visible when comparing training dynamics with and without the regularizer. As shown in the figures below, Contrast-Reg effectively suppresses the rise in ECE and maintains higher positive sampling accuracy. Furthermore, it prevents the "explosion" of embedding norms and the spectral radius of the feature matrix, which are key drivers of poor generalization.

Impact of Contrast-Reg: The regularizer (solid lines) maintains lower ECE and higher $q^+$ (left/middle) while effectively constraining embedding norms and spectral radius (right) compared to the unregularized baseline (dotted lines).

Experimental Results

The researchers evaluated Contrast-Reg across 10 diverse datasets, including citation networks (Cora, Pubmed) and large-scale social graphs (ogbn-products). Key findings include:

  • Performance Boost: Adding Contrast-Reg to existing GCL frameworks like GCA allowed them to outperform even supervised GCN baselines on datasets like Pubmed (87.06% accuracy).
  • Link Prediction: On the Wiki dataset, accuracy improved from ~87% to 96.28%.
  • Robustness: Contrast-Reg consistently outperformed standard regularization techniques like weight decay and $\ell_2$-normalization, demonstrating that specifically targeting contrastive mis-calibration is essential.

Conclusion

Contrast-Reg offers a simple, backbone-agnostic way to improve the generalization of graph contrastive learning. By addressing the mis-calibration between unsupervised objectives and downstream tasks through norm-constrained regularization, it enables GNNs to learn more robust and semantically meaningful representations. Future work may extend these calibration techniques to other architectures like Graph Autoencoders.

Summary updated

BibTeX
@misc{ma2021improving,
  author = {Kaili Ma and Haochen Yang and Han Yang and Tatiana Jin and Pengfei Chen and Yongqiang Chen and Barakeel Fanseu Kamhoua and James Cheng},
  title = {{Improving Graph Representation Learning by Contrastive Regularization}},
  year = {2021},
  eprint = {2101.11525},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2101.11525},
}

Loading related content...

Figure