Unsupervised Node Clustering via Contrastive Hard Sampling

Hang Cui, Tarek F. Abdelzaher

Introduction

Node clustering—the process of grouping graph nodes into disjoint sets without the aid of labels—is a fundamental task in graph machine learning. It serves as a cornerstone for applications ranging from community detection in social networks to anomaly identification in security contexts. However, current unsupervised methods frequently encounter two significant hurdles: feature myopia and weak contrastive sampling.

Feature myopia occurs when models focus exclusively on a narrow set of features that exhibit obvious clustering patterns, thereby ignoring the broader "class-invariant" context that could provide valuable structural information. Meanwhile, standard contrastive learning often relies on "coarse" augmentations, such as random edge dropping. These methods typically select "negative" examples that are distant in the graph, making them "easy" for the model to distinguish. Consequently, the model fails to learn the subtle, fine-grained boundaries that define distinct clusters.

The MeCoLe Framework

To address these limitations, this paper introduces MeCoLe (Unsupervised node clustering via contrastive hard sampling). MeCoLe is designed to find the "hardest" negative examples—nodes that appear similar but belong to different groups—to force the model to learn sharper cluster boundaries. The framework operates through three integrated modules:

1. Feature Decoupling

MeCoLe separates node embeddings into two distinct components: class-dependent features ($H_d$), which correlate directly with cluster labels, and class-invariant features ($H_o$), which represent general node characteristics regardless of group membership. This is achieved through a joint training objective that minimizes reconstruction loss while maximizing the discrepancy between the two feature sets.

2. Fine-grained Counterfactual Augmentation

The core innovation of MeCoLe is its use of counterfactual reasoning to synthesize "hard" negative samples. To create a hard negative for an anchor node, the model generates a virtual node. This virtual node inherits the anchor's class-invariant features (the "context") but adopts the class-dependent features of a node from a different cluster.

3. Contrastive Learning Loop

The model then enters a contrastive learning phase where actual neighbors are treated as positive pairs and the synthesized virtual nodes are treated as "hard" negative pairs. Because the virtual node is minimally changed from the anchor, the model must work significantly harder to distinguish them, leading to more robust and well-defined cluster representations.

Experimental Setup and Datasets

The researchers evaluated MeCoLe against nine state-of-the-art baselines, including DMoN, GRACE, and InfoGCL. The evaluation spanned eight datasets:

  • Public Social Networks: Wikipedia, IMDB, Covid, and Protest.
  • Citation Networks: Cora and Citeseer.
  • Real-world Twitter Benchmarks: The authors introduced two new datasets—2020 Presidential Election and Police Shooting. These are specifically designed to simulate real-world noise by including a substantial number of "irrelevant" nodes.

Key Results and Insights

MeCoLe outperformed all baselines across every dataset tested. Key findings include:

  • Superior Accuracy: On the Wikipedia dataset, MeCoLe achieved 86.8% accuracy, a significant improvement over the best baseline (InfoGCL at 78.9%).
  • Robustness to Noise: On the "Presidential Election" dataset, MeCoLe maintained 90.7% accuracy, whereas most baselines struggled to reach 80% due to the presence of irrelevant nodes.
  • Resilience in Sparse Graphs: The model showed greater performance stability when edges were removed, outperforming message-passing-heavy models that rely on dense connectivity.

These results suggest that hard negatives are more valuable than random negatives. By asking "what would this node look like if its class changed but its context stayed the same?", MeCoLe effectively isolates the specific signals that define a cluster boundary. Furthermore, the study demonstrates that class-invariant features are not "useless"; they provide the necessary background that allows the model to isolate the cluster-defining signal.

Limitations and Future Directions

While MeCoLe represents a significant step forward, its performance can be sensitive to the initial clustering quality used for feature decoupling. Additionally, while the synthesis of virtual nodes is parameter-free, the iterative nature of the augmentation and decoupling process may introduce computational overhead on extremely large-scale graphs. Future research may explore extending this fine-grained augmentation approach to other self-supervised tasks, such as link prediction or node classification in imbalanced graphs.

Summary updated

BibTeX
@inproceedings{cui2024unsupervised,
  author = {Hang Cui and Tarek F. Abdelzaher},
  title = {{Unsupervised Node Clustering via Contrastive Hard Sampling}},
  booktitle = {DASFAA},
  year = {2024},
  doi = {10.1007/978-981-97-5572-1\_18},
}
Figure