NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Bayesian Graph Contrastive Learning

Arman Hasanzadeh, Mohammadreza Armandpour, Ehsan Hajiramezanali, Mingyuan Zhou, Nick Duffield, Krishna NarayananarXiv 2021

Abstract

Graph Contrastive Learning (GCL) has emerged as a powerful self-supervised paradigm for graph-structured data. However, traditional GCL methods typically produce deterministic embeddings, lacking the ability to quantify uncertainty, and often require exhaustive hyperparameter tuning for augmentation strategies. This paper introduces Bayesian Graph Contrastive Learning (BGCL), a framework that treats graph augmentations as stochastic neural network encoders. By learning a distribution of node embeddings, BGCL enables robust uncertainty quantification and automates the selection of augmentation intensities through variational inference. Experimental results on benchmark datasets demonstrate that BGCL achieves state-of-the-art classification accuracy while providing reliable confidence measures.

Introduction

Self-supervised learning on graphs, particularly through contrastive methods, relies on creating multiple "views" of the same data. While effective, these methods map nodes to single points in a latent space, which is problematic in high-stakes domains where understanding model confidence is crucial. Furthermore, the effectiveness of GCL is highly sensitive to the choice and intensity of data augmentations, necessitating expensive grid searches. BGCL addresses these limitations by reframing GCL within a Bayesian lens, where augmentations are modeled as layer-wise stochastic perturbations, allowing the model to "know what it doesn't know."

Methodology

The core of BGCL is the Generalized Augmentation Model. Instead of traditional input-level corruption, BGCL applies random binary masks to the outputs of every GNN layer. This approach is mathematically equivalent to training a Variational Graph Auto-Encoder (VGAE) with stochastic encoders, effectively learning a distribution for node representations rather than fixed vectors.

Overview of the BGCL framework showing the generalized augmentation applied to GNN layers and the resulting embedding distributions.

To eliminate manual hyperparameter tuning, BGCL treats augmentation parameters as random variables. Using variational inference with Concrete relaxation for discrete masks, the model learns optimal drop rates end-to-end. This allows the model to automatically discover "hard" views that maximize contrastive loss while minimizing mutual information between views. For downstream tasks, uncertainty-aware predictions are generated by sampling from the learned distributions via Monte Carlo methods.

Experiments and Results

BGCL was evaluated on standard benchmarks including Cora, Citeseer, and Amazon-Photo. The model's performance was compared against various unsupervised baselines and a supervised GCN.

Comparison of node classification accuracy (%) across different datasets. BGCL consistently outperforms other unsupervised methods.

As shown in the results table, BGCL achieves competitive or superior accuracy compared to state-of-the-art methods like GRACE and DGI. For instance, on the Cora dataset, BGCL achieved 83.77% accuracy, surpassing the 83.3% of GRACE.

Beyond accuracy, BGCL excels in uncertainty quantification. Evaluated using the Patch Accuracy Vs Patch Uncertainty (PAVPU) metric, the self-supervised BGCL model matched or outperformed supervised Bayesian GCN baselines. The model also demonstrated sensitivity to out-of-distribution noise; injecting Gaussian noise into node features caused a significant spike in the average standard deviation of latent representations, indicating the model's ability to dynamically lower its confidence when fed corrupted data.

Key Insights and Conclusion

BGCL provides a theoretical bridge between data augmentation and network stochasticity, demonstrating that self-supervised models can achieve Bayesian interpretability. By mapping nodes to implicit distributions, the framework enables robust uncertainty quantification without sacrificing performance. While computationally intensive due to layer-wise masking, the use of block-based sampling makes the approach tractable. Future work may explore more expressive stochastic functions, such as neural processes, to further enhance the representational power of Bayesian graph models.

Summary updated

BibTeX
@misc{hasanzadeh2021bayesian,
  author = {Arman Hasanzadeh and Mohammadreza Armandpour and Ehsan Hajiramezanali and Mingyuan Zhou and Nick Duffield and Krishna Narayanan},
  title = {{Bayesian Graph Contrastive Learning}},
  year = {2021},
  eprint = {2112.07823},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2112.07823},
}
Figure