TL;DR
NeCo (Neighbor Contrastive Representation Learning) is a novel framework that eliminates the need for rigid data augmentation in graph learning. By using parameterized neighbor sampling to simultaneously filter out "noisy" heterophilous edges and identify positive contrastive samples, it solves the long-standing homophily problem in Graph Neural Networks (GNNs) while producing state-of-the-art node representations.
The Dual Challenge: Data Augmentation and Homophily
Graph Contrastive Learning (GCL) has become a powerhouse for self-supervised representation learning. However, it typically relies on a rigid "one-to-one" sampling strategy. To create different "views" of a graph for contrastive tasks, researchers usually resort to random data augmentations—like dropping edges or masking features. The authors argue this is inherently problematic: random perturbations can easily destroy the underlying semantic meaning of a graph, especially since graph labels are often abstract and domain-dependent.
Furthermore, traditional GNNs struggle with the homophily problem. Most GNNs operate on the assumption that "birds of a feather flock together"—meaning connected nodes share the same label. In "heterophilous" graphs, where connected nodes frequently belong to different classes, standard message passing mixes information from disparate classes. This introduces "noise" that severely degrades performance.
This paper asks a compelling question: Can we use contrastive learning to identify which neighbors are actually similar, thereby solving both the sampling bottleneck and the homophily problem simultaneously?
Introducing NeCo: Neighbor Contrastive Representation Learning
To address these issues, the authors introduce NeCo. Its architecture shifts away from random augmentations and instead leverages the graph's intrinsic neighborhood structure.
The framework is built on three main pillars:
- Parameterized Neighbor Sampling: Instead of random augmentation, NeCo treats a node's neighborhood as a pool of potential positive samples. It uses a trainable module to assign a probability to each edge, determining if the neighbor is "homophilous" (shares the same class) and should be sampled.
- The Gumbel-Max Trick: To make the discrete choice of "sampling vs. not sampling" an edge differentiable, the authors employ the Gumbel-Max trick. This allows the model to iteratively update the graph's topology during training, effectively learning to prune noisy edges.
- Group Discrimination Pretext Task: Most GCL methods use "instance discrimination" (trying to tell one node apart from every other node). NeCo shifts this to "group discrimination," where the goal is to make embeddings within a learned "group" (the sampled homophilous neighborhood) consistent while keeping different groups distinct.
By doing this, the model essentially learns to "prune" the graph, keeping edges that help the contrastive objective and discarding those that introduce heterophilous noise.
Key Insights: The "Two Birds" Synergy
The core theoretical contribution of the paper is the realization that the criteria for a "good" positive sample in contrastive learning (nodes that should have the same label) is identical to the criteria for "good" message passing in a GNN (homophilous neighbors). By solving one, the model naturally solves the other.
The authors theoretically link homophily rates to the Information Bottleneck theory. They prove that by increasing the homophily of the learned structure, they are effectively maximizing the lower bound of mutual information for downstream tasks. Moving away from the rigid one-to-one view matching of previous GCL methods allows the model to capture much richer semantic relationships within local neighborhoods.
Experimental Results
The researchers evaluated NeCo on nine established benchmarks, spanning both homophily datasets (like Cora, Citeseer, Pubmed) and heterophily datasets (like Cornell, Texas, Wisconsin). NeCo demonstrated significant performance gains, particularly on challenging heterophilous graphs:
- Superior Accuracy: NeCo outperformed state-of-the-art self-supervised baselines (like DGI, GRACE, and BGRL) across almost all datasets. On the "Cornell" heterophily dataset, NeCo achieved 59.36% accuracy, a massive jump over GRACE's 53.15%.
- Boosting GNNs: The authors showed that the "cleaned" topology learned by NeCo can be used to improve other models. For instance, running GraphSAGE on a NeCo-optimized graph improved its performance on the Cornell dataset from 70.84% to 75.38%.
- Hyperparameter Stability: Unlike many GCL methods that are hypersensitive to the "temperature" ($\tau$) hyperparameter, NeCo showed remarkable stability across different temperature settings, making it much easier to deploy in practice.
Limitations and Future Work
While NeCo effectively addresses heterophily, the authors note that the extreme imbalance between graph data and labels remains a broader challenge in the field. The current iteration relies on a regularization term to prevent the model from collapsing (e.g., dropping all edges or keeping all edges), and fine-tuning this balance is key.
Future work could involve extending this "group discrimination" logic to even larger-scale graphs or exploring how these learned homophilous structures can be used for other tasks like link prediction or community detection.
Reference: He, D., et al. (2023). Contrastive Learning Meets Homophily: Two Birds with One Stone. Proceedings of the 40th International Conference on Machine Learning (ICML).
Summary updated