Teacher-Guided Graph Contrastive Learning

Jay Nandy, Arnab Kumar Mondal, Manohar Kaul, Prathosh ApTMLR 2024

Abstract

State-of-the-art self-supervised representation learning methods for Graphs are typically based on contrastive learning (CL) principles. These CL objective functions can be posed as a supervised discriminative task using 'hard' labels that consider any minor augmented pairs of graphs as 'equally positive'. However, such a notion of 'equal' pairs is incorrect for graphs as even a smaller 'discrete' perturbation may lead to large semantic changes that should be carefully encapsulated within the learned representations. This paper proposes a novel CL framework for GNNs, called Teacher-guided Graph Contrastive Learning (TGCL), that incorporates 'soft' pseudo-labels to facilitate a more regularized discrimination. In particular, we propose a teacher-student framework where the student learns the representation by distilling the teacher's perception. Our TGCL framework can be adapted to existing CL methods to enhance their performance. Our empirical findings validate these claims on both inductive and transductive settings across diverse downstream tasks, including molecular graphs and social networks. Our experiments on benchmark datasets demonstrate that our framework consistently improves the average AUROC scores for molecules' property prediction and social network link prediction.

Introduction: The Sensitivity of Graph Semantics

In Self-Supervised Learning (SSL), specifically Contrastive Learning (CL), models learn by trying to bring "positive pairs" (different views of the same data) closer together while pushing "negative pairs" (different data points) apart. In computer vision, this works effectively—rotating an image of a cat doesn't make it a dog.

Structural vs. Perceptual Distance in Graphs

However, graphs are discrete and highly sensitive. As shown in Figure 1, removing a single edge in a molecular graph can transform a life-saving drug into a toxic compound. Standard CL methods often treat these "minorly perturbed" graphs as identical (hard positives), ignoring the massive semantic shift that may have occurred. Conversely, structural measures like "edit distance" (counting how many changes were made) are computationally expensive and often fail to capture the actual "meaning" or chemical properties of the graph.

Methodology: The TGCL Framework

The authors propose a teacher-student framework where a pre-trained "teacher" model guides a "student" model through Knowledge Distillation (KD). This approach moves away from binary labels, instead using "soft" pseudo-labels derived from the teacher's perception.

Overview of the TGCL Teacher-Student Framework

Core Components

  1. Distilled Perceptual Distance ($D_{dp}$): Instead of counting edge changes, the framework passes graphs through a pre-trained teacher GNN. It extracts features from every layer, concatenates them, and calculates the distance between these feature vectors. This captures a "semantic" distance rather than just a structural one.
  2. Soft Pseudo-Labels: These distances are converted into "soft" labels. Instead of telling the student "these two graphs are 100% the same," the teacher says "these two are 85% similar."
  3. Task-Specific Adaptations: The framework includes TGCL-GraphCL for global tasks like graph classification (using a modified NT-Xent loss) and TGCL-DSLA for local tasks like link prediction (using a triplet-style margin loss).

Experimental Evaluation

The researchers evaluated TGCL across three distinct domains:

  • Molecular Chemistry: Pre-trained on ZINC15 (2 million unlabeled molecules) and fine-tuned on eight MoleculeNet benchmarks (e.g., BBBP, HIV, BACE).
  • Bio-informatics: Used the PPI (Protein-Protein Interaction) dataset to predict biological functions.
  • Social Networks: Evaluated on COLLAB and IMDB datasets for link prediction tasks.

Key Insights and Results

  • Semantics Over Structure: A pre-trained model—even an imperfect one—is a better judge of a graph's "meaning" than a mathematical formula like edit distance. The teacher captures the ripple effect that a small structural change has on the entire representation.
  • The "Imperfect Teacher" is Enough: Interestingly, the student model often ends up outperforming its own teacher. This suggests that the "soft" guidance acts as a powerful regularizer, helping the student generalize better than if it were learning from scratch or from rigid "hard" labels.
  • Performance Gains: TGCL consistently outperformed state-of-the-art baselines. It achieved an average AUROC boost of ~2.23% across MoleculeNet datasets and increased average precision by ~6% on social network link prediction tasks.

Conclusion

TGCL addresses a fundamental flaw in graph contrastive learning by replacing rigid structural assumptions with nuanced semantic perception. While the framework introduces some computational overhead and requires hyperparameter tuning, its ability to improve robustness across diverse domains—from chemistry to social networks—marks a significant step forward in graph representation learning. Future work will explore scaling TGCL for large-scale heterogeneous graphs and multi-modal data.

Summary updated

BibTeX
@article{nandy2024teacher,
  author = {Jay Nandy and Arnab Kumar Mondal and Manohar Kaul and Prathosh AP},
  title = {{Teacher-Guided Graph Contrastive Learning}},
  journal = {Accepted by TMLR},
  year = {2024},
  url = {https://openreview.net/forum?id=15tjpSHI15},
}
Figure