Localized Graph Contrastive Learning

Hengrui Zhang, Qitian Wu, Yu Wang, Shaofeng Zhang, Junchi Yan, Philip S. Yu

TL;DR

Localized Graph Contrastive Learning (LOCAL-GCL) eliminates the need for ad-hoc graph augmentations by directly treating a node’s first-order neighbors as positive contrastive pairs. To overcome the quadratic memory and runtime bottleneck of standard InfoNCE loss, it introduces a kernelized approximation using Structured Orthogonal Random Features (SORF), enabling full-graph self-supervised training with linear time and memory complexity.

What Problem Does This Paper Address?

Graph contrastive learning typically adapts visual self-supervised techniques (like SimCLR or MoCo) using the InfoNCE objective. However, applying this framework to graphs hits two major roadblocks:

  1. Augmentation Ambiguity: Vision augmentations (crops, rotations) preserve core semantics, but perturbing graph structures (e.g., random edge drops or feature masking) can fundamentally destroy graph topology and semantic meaning.
  2. The Quadratic Scalability Curse: The InfoNCE denominator contrasts an anchor against all negative nodes. This incurs an $O(|V|^2)$ time and space complexity with respect to the number of nodes $|V|$. Because partitioning graphs into mini-batches discards neighborhood structure, full-graph training is strongly preferred, but standard contrastive methods quickly run out of GPU memory (OOM) on graphs with tens of thousands of nodes.

Methods

LOCAL-GCL tackles both issues through two core design choices within a clean, single-branch architecture:

  • Topology-Anchored Positive Pairs: Rather than perturbing the graph to create two synthetic views, LOCAL-GCL relies on graph topology directly. Every first-order neighbor $j \in \mathcal{N}(i)$ serves as an explicit positive pair for node $i$.
  • Kernelized Linear-Complexity Negative Loss: Because node embeddings are $\ell_2$-normalized, pairwise dot-product similarities in the InfoNCE loss correspond directly to a Gaussian (RBF) kernel: $$\exp(z_i^\top z_j / \tau) = e \cdot \kappa^G(z_i, z_j; \sqrt{\tau})$$ LOCAL-GCL approximates this kernel via explicit randomized feature maps ($\psi(z)$). This allows the all-pairs denominator sum to be rewritten as a dot product between the anchor’s projection and the pre-computed sum of all projected node representations: $$\sum_{j \in \mathcal{V}} \psi(z_i)^\top \psi(z_j) = \psi(z_i)^\top \left( \sum_{j \in \mathcal{V}} \psi(z_j) \right)$$
  • Log-Order Projection with SORF: To avoid large random projection matrices, the authors utilize Structured Orthogonal Random Features (SORF) using fast Walsh-Hadamard transformations. This reduces projection time from $O(|V| d D)$ to $O(|V| D \log d)$, achieving linear runtime and memory overall.
  • Minimalist Architecture: The model requires no second Siamese branch, no momentum encoder, no stop-gradient tricks, and no multilayer projection/prediction heads.

Datasets

The authors evaluated the method across three regimes:

  • Standard Homophilic Citation & Co-authorship Graphs: Cora, Citeseer, Pubmed, Coauthor-CS, and Coauthor-Physics.
  • Co-purchase Networks: Amazon-Computer and Amazon-Photo.
  • Large-Scale Graph: ogbn-arxiv (~169k nodes, ~2.3M edges).
  • Heterophilic Graphs (low edge homophily): Chameleon, Squirrel, and Actor.

Key Insights and Ideas

  • Theoretical Bound via Spectral Graph Theory: Connecting the localized contrastive loss to matrix factorization (Eckart–Young–Mirsky theorem), the authors prove that linear classification error on learned representations is bounded by $(1 - \phi) / \lambda_{d+1}$, where $\phi$ is the graph homophily ratio and $\lambda_{d+1}$ is the $(d+1)$-th smallest Laplacian eigenvalue. Increasing embedding dimension $d$ directly lowers this theoretical error bound.
  • Surprising Efficacy on Heterophilic Graphs: One might expect neighbor-based positives to fail when adjacent nodes have different classes ($\phi < 0.3$). Counterintuitively, LOCAL-GCL outperformed existing baselines on Chameleon (68.74%), Squirrel (52.94%), and Actor (33.91%). The authors hypothesize that graph augmentations smooth away high-frequency signals needed for heterophily, whereas LOCAL-GCL’s edge-wise objectives force the encoder to learn local neighborhood pattern discriminators.
  • Global Negatives Beat Subsampling: While sub-sampling negative samples fits standard InfoNCE into GPU memory, empirical results show that reducing negative count severely degrades downstream accuracy. Approximating all negatives with random features preserves performance while executing significantly faster.

Key Results

  • Downstream Accuracy: On 6 of the 7 standard benchmark datasets, LOCAL-GCL outperformed existing self-supervised models (e.g., reaching 84.5% on Cora and 96.33% on Coauthor-Physics).
  • Memory & Efficiency: Heavyweight InfoNCE methods like GRACE and GCA triggered OOM errors on Coauthor-Physics (34k nodes) and ogbn-arxiv (169k nodes) on a 16GB GPU. LOCAL-GCL trained seamlessly on full graphs, running in ~18 minutes on ogbn-arxiv (71.34% test accuracy), significantly faster than scalable alternatives like BGRL (~100 mins).
  • Plug-and-Play Neighborhood Positives: Replacing synthetic augmentations with LOCAL-GCL’s 1st-order neighborhood positives in other architectures (BGRL-Local, CCA-SSG-Local) boosted their accuracy and reduced training runtime by roughly 40%.

Limitations and Future Work

  • Edge Noise Sensitivity: Because every connected edge generates a positive pair, missing, spurious, or adversarial edges could introduce false positive signals.
  • Uniform Neighbor Weighting: While an attention-weighted ablation was tested, the default model weights all first-order neighbors uniformly to avoid extra computational overhead.
  • Task Scope: The paper focuses strictly on transductive/inductive node-level representation learning; scaling the approach to graph-level tasks (graph classification) remains unaddressed.

Summary updated

BibTeX
@inproceedings{zhang2023localized,
  author = {Hengrui Zhang and Qitian Wu and Yu Wang and Shaofeng Zhang and Junchi Yan and Philip S. Yu},
  title = {{Localized Graph Contrastive Learning}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=dSYkYNNZkV},
}
Figure