Abstract
Graph neural networks (GNNs) learn node features by aggregating and combining neighbor information, achieving promising performance on many graph tasks. However, GNNs are mostly treated as black-boxes and lack human-intelligible explanations. In this work, we propose a novel approach, known as XGNN, to interpret GNNs at the model-level. Our approach provides high-level insights and a generic understanding of how GNNs work by training a graph generator to produce patterns that maximize a specific prediction of the model. We formulate graph generation as a reinforcement learning task, where for each step, the graph generator predicts how to add an edge into the current graph. The generator is trained via a policy gradient method based on information from the trained GNNs, incorporating graph rules to ensure validity. Experimental results on synthetic and real-world datasets show that XGNN helps verify trained GNNs and provides guidance for model improvement.
Introduction
As Graph Neural Networks (GNNs) are increasingly deployed in critical domains like drug discovery and social network analysis, the need for transparency becomes paramount. Most existing explanation methods, such as GNNExplainer, are example-level, meaning they identify which parts of a specific input graph led to a particular prediction. While useful, these methods fail to provide a global understanding of what the model has learned across the entire dataset.
XGNN addresses this gap by providing model-level explanations. Inspired by input optimization in computer vision—where images are generated to maximize a specific class score—XGNN generates abstract graph patterns that represent a GNN's general concept of a class. Because graph structures are discrete and non-differentiable, XGNN utilizes reinforcement learning to iteratively build explanatory motifs.
Methodology
XGNN frames the generation of explanations as a Reinforcement Learning (RL) problem. The framework consists of a graph generator that builds a graph step-by-step to maximize the target GNN's confidence in a specific class.
The RL Environment
- State: The current partially generated graph.
- Action: The generator can either add a new edge between existing nodes or introduce a new node from a candidate set and connect it to the existing structure.
- Policy: A neural network employing Graph Convolutional Networks (GCNs) and Multi-Layer Perceptrons (MLPs) predicts the probability distribution of the next action.
- Reward Function: The core of XGNN is its dual-component reward. First, it uses Model Feedback, where the confidence score from the pre-trained GNN serves as a reward (using rollouts for intermediate steps). Second, it incorporates Graph Rules to penalize violations of domain-specific constraints, such as chemical valency limits, ensuring the generated explanations are physically or logically valid.
Experimental Evaluation
The authors evaluated XGNN on two primary datasets:
- Is_Acyclic (Synthetic): A dataset where graphs are labeled based on the presence of cycles. This serves as a ground-truth sanity check.
- MUTAG (Real-world): A benchmark of chemical compounds labeled by their mutagenic effect on bacteria. Nodes represent atom types like Carbon, Nitrogen, and Oxygen.
Results and Discussion
Synthetic Sanity Check
On the Is_Acyclic dataset, XGNN successfully generated graphs that isolated the core logic of the GNN. For the "cyclic" class, the generator produced circular structures and cliques. For the "acyclic" class, it consistently generated trees and line graphs. These motifs achieved high confidence scores ($p > 0.99$) from the target GNN, confirming that the generator accurately captured the model's learned structural features.
Real-World Chemical Insights
In the MUTAG experiments, XGNN provided significant domain-aligned insights. When explaining the "mutagenic" class, the generator frequently produced carbon rings and $NO_2$ groups, which are well-known mutagenic indicators in chemistry. This verified that the GNN had learned valid chemical principles.
Furthermore, XGNN served as a debugging tool. For the "non-mutagenic" class, the generator often produced graphs dominated by Chlorine atoms. This suggested that the GNN might be relying on Chlorine as a "shortcut" feature for negative predictions, revealing a potential bias in the training data or model architecture.
Conclusion
XGNN provides a robust framework for model-level GNN interpretation. By bridging the gap between discrete graph structures and optimization via reinforcement learning, it allows researchers to verify model logic, extract domain knowledge, and identify spurious biases. Future work may involve refining the graph rules to generate even more complex and stable structures, further enhancing the utility of these explanations for scientific discovery.
Summary updated