A class-aware representation refinement framework for graph classification

Jiaxing Xu, Jinjie Ni, Yiping Ke · OpenReview

Abstract

Graph Neural Networks (GNNs) are widely used for graph representation learning. Despite its prevalence, GNN suffers from two drawbacks in the graph classification task: the neglect of graph-level relationships and the generalization issue. Each graph is treated separately in GNN message passing/graph pooling, and existing methods to address overfitting operate on each individual graph. This makes the graph representations learned less effective in downstream classification. In this paper, we propose a Class-Aware Representation rEfinement (CARE) framework for the task of graph classification. CARE computes simple yet powerful class representations and injects them to steer the learning of graph representations towards better class separability. CARE is a plug-and-play framework that is highly flexible and able to incorporate arbitrary GNN backbones without significantly increasing the computational cost. We also theoretically prove that CARE has a better generalization upper bound than its GNN backbone through Vapnik-Chervonenkis (VC) dimension analysis. Our extensive experiments with 10 well-known GNN backbones on 9 benchmark datasets validate the superiority and effectiveness of CARE over its GNN counterparts.

Introduction

Standard Graph Neural Networks (GNNs) for graph classification often suffer from a form of "tunnel vision." During the message-passing and pooling phases, these models focus entirely on the internal structure of a single graph, treating every instance in a dataset as an isolated entity. This approach completely ignores the potential relationships between different graphs belonging to the same class.

This isolation leads to two major challenges. First, there is a neglect of graph-level relationships. In domains such as drug discovery, molecules within the same category often share specific functional groups or substructures. If a model does not explicitly learn these shared "class signatures," its representations become less effective at separating different categories. Second, GNNs face significant generalization issues. They are prone to overfitting as they increase in depth or width. Because they operate on individual instances, they can easily memorize noise specific to certain graphs rather than learning the underlying patterns of the class.

The CARE Framework

To address these limitations, we propose CARE (Class-Aware Representation rEfinement), a "plug-and-play" framework designed to wrap around almost any existing GNN backbone. The architecture introduces a global perspective to the learning process through four main components:

  1. Graph Encoder & Subgraph Selector: These components generate initial embeddings and identify the most informative substructures within a graph using techniques like SAGPool.
  2. Class-Aware Refiner: This is the core innovation. It maintains a "bag" of subgraph representations for each class, aggregating them to create a class representation—a prototype of the class's defining features. This prototype is then used to refine the individual graph's embedding via a transformation function.
  3. Pseudo-Labeling for Inference: Since ground-truth labels are unavailable during testing, CARE predicts a "pseudo-label" by comparing a new graph to the learned class prototypes using cosine similarity, ensuring the refinement process remains effective at test time.
  4. Class Loss ($\mathcal{L}_{class}$): A specialized loss function encourages intra-class similarity (pulling graphs of the same class together) and inter-class discrepancy (pushing different classes apart).
The CARE framework architecture, illustrating the flow from input graph to refined representation through the Class-Aware Refiner.

Theoretical Foundation

Beyond empirical results, we provide a rigorous mathematical foundation for CARE using Vapnik-Chervonenkis (VC) dimension analysis. We theoretically prove that the CARE framework possesses a lower generalization error bound than its underlying GNN backbones. By injecting class-specific information back into individual graph representations, the model learns to prioritize "class signatures" and ignore individual outliers, effectively "steering" the learning process toward better separability and reducing the risk of overfitting.

Experimental Evaluation

We evaluated CARE on 9 benchmark datasets across various domains, including bioinformatics (D&D, PROTEINS, MUTAG, ENZYMES, Tox21, OGBG-MOLHIV) and social/small molecule networks (NCI1, NCI109, FRANKENSTEIN). The framework was tested against 11 different GNN backbones, ranging from popular models like GCN and GAT to advanced pooling methods like DiffPool.

Comparison of training and testing accuracy over epochs for CARE-GCN versus a standard GCN, demonstrating improved generalization and stability.

Key Results

  • Broad Superiority: CARE outperformed standalone GNN backbones in 84 out of 88 tested pairs (backbone x dataset).
  • Significant Gains: We observed up to an 11.48% absolute improvement in accuracy (e.g., GraphSAGE on the FRANKENSTEIN dataset).
  • Efficiency: Despite the additional refinement step, CARE-augmented models often converge in fewer epochs because the class-aware information helps the model find optimal representations more quickly.
  • Better Separability: t-SNE visualizations confirm that CARE produces much tighter, more distinct clusters of graph representations compared to standard GNNs.

Conclusion and Future Work

CARE provides a flexible, effective method for enhancing graph classification by incorporating class-level relationships. While the framework is highly adaptable, we acknowledge that performance can be sensitive to the tuning of trade-off parameters in the loss function. Future work will focus on automating hyperparameter selection and exploring more sophisticated memory management for extremely diverse datasets with large numbers of classes. Nonetheless, CARE represents a significant step toward more robust and generalizable graph representation learning.

Summary updated

BibTeX
@article{xu2022class,
  author = {Jiaxing Xu and Jinjie Ni and Yiping Ke},
  title = {{A class-aware representation refinement framework for graph classification}},
  journal = {Information Sciences},
  year = {2022},
  url = {https://openreview.net/forum?id=2f2Moh2qlE},
}
Figure