When Sparsity Meets Contrastive Models: Less Graph Data Can Bring Better Class-Balanced Representations

Chunhui Zhang, Chao Huang, Yijun Tian, Qianlong Wen, Zhongyu Ouyang, Youhuan Li, Yanfang Ye, Chuxu ZhangICML 2023

Graph Neural Networks (GNNs) are powerful tools for modeling non-Euclidean data, but their training is notoriously resource-intensive. This is largely due to two major hurdles: massive computational overhead caused by irregular data density, and severe class imbalance.

Traditional solutions to these problems often work at cross-purposes. For instance, generating synthetic data (oversampling) to fix class imbalance inherently increases the computational load. Conversely, pruning models to save compute often disproportionately degrades performance on minority classes—a phenomenon known as "forgetting."

To resolve this tension, researchers introduce Data Decantation (DataDec), a unified framework that simultaneously prunes both the GNN model and the training dataset. By dynamically identifying and "recycling" the most informative data samples, DataDec achieves state-of-the-art performance on class-imbalanced tasks while using only half the data and model weights.

The DataDec Framework

DataDec leverages the concept of dynamic sparsity, operating on the principle that not all data points are equally useful at every stage of training. The framework consists of four core mechanisms:

  1. Dynamic Sparse Graph Contrastive Learning: DataDec employs a self-supervised approach. It creates two augmented views of a graph and processes them through two branches: a full GNN and a dynamically pruned "sparse" GNN.
  2. Gradient-Based Ranking: Instead of relying on scarce labels, the framework ranks samples based on the $L_2$ norm of their gradients. Samples that produce larger gradients are deemed "informative" or "difficult" and are prioritized for the next training epoch.
  3. Cosine Annealing: To ensure smooth training, the sizes of both the sparse model and the active data subset are gradually reduced following a cosine curve.
  4. Data Recycling: To prevent the model from overfitting to a static subset, a small percentage of previously discarded samples is randomly reintroduced into the training set. This "safety valve" catches samples that may become critical later in the training process.

Key Insights and Theoretical Grounding

  • The Filter Effect of Sparse Models: One of the paper's most surprising findings is that a pruned, sparse GNN is actually better at identifying informative samples than a full model. Because the sparse model has less capacity, it struggles more with minority class samples. This struggle results in much larger gradients for those specific samples, making the sparse model an excellent filter for finding the data that matters most.
  • Dynamic vs. Static Sparsity: Previous "data diet" methods often select a subset of data at the start of training and stick with it. DataDec demonstrates that the informative subset is a moving target; a sample that is redundant in epoch 10 might become the key to unlocking better representations in epoch 50.
  • Theoretical Guarantee: The approach is backed by a theoretical proof (Theorem 1) demonstrating that the training effectiveness of a subset can approximate the full dataset, provided the "gradient distance" between the two is minimized.

Empirical Results

DataDec was rigorously evaluated across graph classification, node classification (using long-tailed datasets like Cora-LT and Amazon-Photo), and image generalization tasks.

  • Superior Efficiency and Performance: On the NCI1 graph classification task, DataDec achieved an F1-macro score of 65.73, significantly outperforming the best baseline (G2GNN at 64.78). Remarkably, it consistently beat state-of-the-art methods like GraphENS and GraphSMOTE while utilizing only 50% of the data and 50% of the model weights.
  • Faster Training: Because the massive reduction in processed data more than offsets the overhead of calculating gradients, DataDec often trains faster than vanilla Graph Convolutional Networks (GCNs).
  • Cross-Domain Generalization: Proving its versatility beyond graphs, DataDec was tested on the CIFAR-10 image dataset. It reached 95.66% accuracy at 50% data sparsity, outperforming specialized image data-pruning techniques like "Forget Score."

Limitations and Future Directions

While DataDec performs exceptionally well, the authors note that very large graphs (such as the D&D dataset) require more specialized augmentation strategies to reach their full potential.

Looking ahead, this paper opens exciting avenues for applying dynamic sparsity to other resource-intensive domains. For example, the computational cost of training Large Language Models (LLMs) on massive corpora is becoming unsustainable, making dynamic data pruning highly relevant. Additionally, the success of the "recycling" mechanism suggests that reinforcement-learning-based data selection policies could be a fruitful next step in refining how models choose what to learn.

Summary updated

BibTeX
@inproceedings{zhang2023when,
  author = {Chunhui Zhang and Chao Huang and Yijun Tian and Qianlong Wen and Zhongyu Ouyang and Youhuan Li and Yanfang Ye and Chuxu Zhang},
  title = {{When Sparsity Meets Contrastive Models: Less Graph Data Can Bring Better Class-Balanced Representations}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=1AMe0xiGmv},
}
Figure