TreeX: Generating Global Graphical GNN Explanations via Critical Subtree Extraction

Shengyao Lu, Jiuding Yang, Baochun Li, Di Niu · DOI

Introduction

As Graph Neural Networks (GNNs) are increasingly deployed in high-stakes fields like drug discovery and financial modeling, the "black box" nature of their decision-making becomes a significant hurdle. While most existing research focuses on local explanations—identifying influential nodes or edges for a single prediction—there is a growing need for global explanations. Users require a comprehensive understanding of the general rules a GNN has learned across an entire dataset.

However, current global explainers often produce non-graphical outputs (such as complex Boolean logic or abstract embeddings) that are difficult for humans to interpret. Furthermore, searching for common subgraphs across a dataset is computationally prohibitive due to the NP-hard nature of subgraph matching. TreeX (subTree-based eXplainer) addresses these challenges by extracting intuitive, dataset-level graphical rules without the massive computational overhead.

Methodology: The TreeX Pipeline

TreeX aligns its explanation strategy with the fundamental mechanics of Message-Passing GNNs (MPGNNs). Instead of searching the vast space of all possible subgraphs, TreeX focuses on the $L$-hop subtrees rooted at each node, which are naturally generated during the GNN's $L$-layer message-passing process.

The TreeX pipeline: from local subtree extraction to global concept clustering and rule generation.

The framework follows a multi-step process:

  1. Subtree Extraction: For each node in a graph, TreeX identifies the $L$-hop rooted subtree. This reduces the search space from $N!$ (for subgraphs) to $N$ (for subtrees).
  2. Representation Learning: TreeX leverages the GNN's own node embeddings. For expressive MPGNNs like GIN, the final-layer root node embedding serves as a perfect structural representation of its corresponding $L$-hop subtree.
  3. Concept Clustering: These embeddings are clustered locally within individual graphs and then globally across the entire dataset using k-means to identify "global concepts."
  4. Rule Generation: A simple classifier is trained on these global concepts to learn a weighted sum, revealing how specific concepts influence the GNN's predictions for different classes.

Key Insights

  • Subtrees as the Natural Language of GNNs: By utilizing the $L$-hop message-passing structure, TreeX bypasses the computational bottleneck of subgraph matching.
  • Embeddings as Free Structural Descriptors: If a GNN is sufficiently expressive (e.g., equivalent to the 1-Weisfeiler-Lehman test), its internal node embeddings already encode the necessary structural information, eliminating the need for auxiliary models.
  • Model Debugging via Negative Weights: The weighted global rules allow for direct model debugging. By examining misclassified instances, TreeX can pinpoint the specific subgraph concepts that misled the GNN.

Experimental Results

The authors evaluated TreeX on synthetic datasets (BA-2Motifs, BAMultiShapes) and real-world chemical datasets (Mutagenicity, NCI1).

Qualitative Superiority

TreeX successfully extracts clean, recognizable motifs that align with ground truth, such as the "house" shape in synthetic data or the mutagenic $-NO_2$ group in chemical data. In contrast, baseline methods like GLGExplainer and GCNeuron often produce confusing logic rules or messy graph structures that are difficult to interpret.

Qualitative comparison of TreeX's graphical explanations against baselines on BA-2Motifs and Mutagenicity datasets.

Performance and Efficiency

  • High Fidelity: TreeX achieved near-perfect prediction accuracy fidelity (1.00) on most datasets, matching or outperforming state-of-the-art local explainers like SubgraphX.
  • Computational Speedup: TreeX is significantly faster than traditional methods. On the Mutagenicity dataset, it required only 0.14 seconds per instance to extract concepts, compared to 419.8 seconds for SubgraphX—a massive improvement in efficiency.

Conclusion

TreeX provides a scalable and interpretable framework for generating global GNN explanations. By leveraging the inherent subtree structure of message-passing and the representational power of node embeddings, it offers a path toward more transparent and debuggable graph-based models. Future work may involve using TreeX's insights to actively refine GNN architectures and pooling mechanisms.

Summary updated

BibTeX
@misc{lu2025treex,
  author = {Shengyao Lu and Jiuding Yang and Baochun Li and Di Niu},
  title = {{TreeX: Generating Global Graphical GNN Explanations via Critical Subtree Extraction}},
  year = {2025},
  eprint = {2503.09051},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2503.09051},
}
Figure