Motif-Driven Contrastive Learning of Graph Representations

Shichang Zhang, Ziniu Hu, Arjun Subramonian, Yizhou Sun

TL;DR

MICRO-Graph is a self-supervised pre-training framework for Graph Neural Networks (GNNs) that learns to identify semantically meaningful "motifs"—frequently occurring subgraph patterns like functional groups in molecules. By using these learned motifs to guide subgraph sampling for contrastive learning, the model captures global structural information far more effectively than traditional node-level or random-walk methods, leading to state-of-the-art performance on molecular property prediction tasks.

What Problem Does This Paper Address?

Contrastive learning has become a powerhouse for pre-training models without human labels. In the graph domain, this usually involves creating two "views" of a graph and forcing the model to recognize they belong to the same instance. However, most existing methods rely on local node-level views or heuristic subgraph sampling (like random walks).

The problem? Random walks often produce "meaningless" snippets—like a random chain of carbon atoms—that don't represent the actual underlying logic of the graph (e.g., a benzene ring in a molecule). Without semantically meaningful views, GNNs struggle to capture the global structural and semantic properties necessary for complex downstream tasks. The authors aim to bridge this gap by learning to extract motifs—the building blocks of graphs—and using them as the basis for contrastive learning.

Methods

The authors introduce MICRO-Graph (MotIf-driven Contrastive leaRning Of Graph representations). The framework operates through two mutually reinforcing modules:

  1. Differentiable Motif Learning: Instead of using hard-coded rules to find motifs, MICRO-Graph treats motif learning as a differentiable clustering problem. It maintains a Motif Embedding Table (see Figure 1) that stores prototypical embeddings of motifs. Using an Expectation-Maximization (EM) style approach, the model groups similar subgraphs into motifs. To avoid the "degenerate solution" where every node is assigned to the same motif, they employ a Sinkhorn-Knopp algorithm to ensure balanced assignments.
  2. Motif-Guided Contrastive Learning: Once motifs are learned, they act as a guide for sampling. The model partitions a graph into subgraphs that have a high probability of belonging to specific motifs. It then performs graph-to-subgraph contrastive learning: the embedding of the whole graph is pushed to be closer to its own motif-like subgraphs (positive pairs) and further from subgraphs sampled from other graphs (negative pairs).
Figure 1: Given a graph dataset, we learn a motif embedding table storing prototypical embeddings of motifs. For a pair of input graphs G1 and G2, we leverage learned motifs to gen- erate motif-like subgraphs and conduct graph-to-subgraph contrastive learning.

To ensure these subgraphs are structurally sound, the authors include a spectral clustering-based regularization term that penalizes the assignment of disconnected nodes to the same motif.

Datasets

  • Pre-training: The model was pre-trained on the ogbg-molhiv dataset from the Open Graph Benchmark (OGB), containing roughly 40,000 molecules.
  • Downstream Evaluation: The pre-trained GNN was fine-tuned on seven chemical property prediction benchmarks: bace, bbbp, clintox, hiv, sider, tox21, and toxcast. These represent a variety of tasks, from predicting blood-brain barrier penetration to toxicity.

Key Insights and Ideas

  • Semantics Over Heuristics: Traditional sampling (random walks) ignores node features and global context. By learning motifs, the model focuses on the "objects" within the graph that actually drive its properties.
  • Contextualized Subgraphs: A key "aha" moment is that even if two subgraphs are structurally identical, their embeddings should be different if they appear in different contexts. MICRO-Graph uses contextualized node embeddings to ensure that a benzene ring in Molecule A is distinct from a benzene ring in Molecule B, preventing false negatives during contrastive learning.
  • Emergent Chemistry: Without any prior chemical knowledge, the model successfully "discovered" real-world functional groups. As shown in Figure 4, the learned motifs correspond to structures like benzene rings and acetate groups.
Figure 4: Five frequently occurred motifs learned by MICRO- Graph, represented by their closest subgraphs.

Key Results

  • Performance Boost: MICRO-Graph achieved a 2.04% average ROC-AUC improvement over non-pretrained GNNs across all benchmarks.
  • Outperforming SOTA: It consistently outperformed other state-of-the-art self-supervised methods, including InfoGraph, GraphCL, and GROVER.
  • Superior Feature Extraction: In a "frozen encoder" setting (where the GNN is not fine-tuned, only a linear classifier is trained on top), MICRO-Graph outperformed the strongest baseline, GraphCL, by 2.9%.
  • Architecture Agnostic: The authors demonstrated that the performance gains hold across different GNN backbones, including GCN, GIN, and DeeperGCN (see Figure 3).
Figure 3: Average fine-tune result over three GNN architec- tures.

Limitations and Future Work

  • False Negatives in Partitioning: The authors acknowledge that their current partitioning method might still produce false negatives if two different graphs share very similar subgraph structures. They suggest that adding more randomness to the motif composition could help.
  • Explicit Hierarchy: While the model learns motifs of different sizes, it doesn't explicitly model the hierarchical relationship between them (e.g., how small motifs combine to form larger ones). The authors identify hierarchical motif modeling as a promising future direction.
  • Computational Complexity: While the Sinkhorn-Knopp algorithm is efficient, the overall EM-style joint training is more complex than simple random-walk-based contrastive methods.

Summary updated

Abstract

Pre-training Graph Neural Networks (GNN) via self-supervised contrastive learning has recently drawn lots of attention. However, most existing works focus on node-level contrastive learning, which cannot capture global graph structure. The key challenge to conducting subgraph-level contrastive learning is to sample informative subgraphs that are semantically meaningful. To solve it, we propose to learn graph motifs, which are frequently-occurring subgraph patterns (e.g. functional groups of molecules), for better subgraph sampling. Our framework MotIf-driven Contrastive leaRning Of Graph representations (MICRO-Graph) can: 1) use GNNs to extract motifs from large graph datasets; 2) leverage learned motifs to sample informative subgraphs for contrastive learning of GNN. We formulate motif learning as a differentiable clustering problem, and adopt EM-clustering to group similar and significant subgraphs into several motifs. Guided by these learned motifs, a sampler is trained to generate more informative subgraphs, and these subgraphs are used to train GNNs through graph-to-subgraph contrastive learning. By pre-training on the ogbg-molhiv dataset with MICRO-Graph, the pre-trained GNN achieves 2.04% ROC-AUC average performance enhancement on various downstream benchmark datasets, which is significantly higher than other state-of-the-art self-supervised learning baselines.
BibTeX
@article{zhang2020motif,
  author = {Shichang Zhang and Ziniu Hu and Arjun Subramonian and Yizhou Sun},
  title = {{Motif-Driven Contrastive Learning of Graph Representations}},
  journal = {IEEE Trans. Knowl. Data Eng.},
  year = {2020},
  doi = {10.1109/tkde.2024.3364059},
}
Figure