GNNShap: Fast and Accurate GNN Explanations using Shapley Values

Selahattin Akkas, Ariful Azad · DOI

Abstract

Graph Neural Networks (GNNs) are powerful tools for network data analysis but often operate as "black boxes." While Shapley values offer a theoretically grounded approach to model interpretability, their exponential computational complexity limits their practical application. We present GNNShap, a framework that optimizes Shapley value estimation through graph pruning, balanced coalition sampling, and GPU-accelerated parallelization. Our evaluation demonstrates that GNNShap provides high-fidelity explanations with up to a 100x speedup over state-of-the-art baselines, scaling effectively to massive real-world graphs.

Introduction

Graph Neural Networks (GNNs) have become the gold standard for analyzing data structured as networks, from social media connections to molecular structures. However, understanding why a GNN predicted a specific label for a node is crucial for building trust, especially in scientific or high-stakes business applications.

One of the most robust ways to explain model predictions is through Shapley values, a concept from cooperative game theory. In this context, each edge in a graph is a "player," and the prediction is the "payout." Calculating exact Shapley values requires evaluating an exponential number of edge combinations (coalitions), which is computationally impossible for even medium-sized graphs. Existing approximations often cut corners by only looking at very small or very large groups of edges, leading to "low-fidelity" explanations that miss the nuanced structural patterns GNNs actually use.

Methods

GNNShap optimizes the explanation process through four key innovations:

  1. Pruning the Computational Graph: GNNs suffer from the "neighborhood explosion" problem. GNNShap identifies and removes redundant edges—those that don't contribute to the message-passing path of the target node—reducing the number of "players" by over 50% on average.
  2. Balanced Coalition Sampling: Unlike previous methods that ignore middle-sized coalitions, GNNShap samples across all coalition sizes. This ensures that the surrogate model captures a more complete picture of the graph's structure.
  3. GPU-Accelerated Parallelization: By moving the sampling and prediction steps to the GPU and batching thousands of perturbed graph samples into a single block-diagonal matrix, GNNShap runs model predictions in parallel rather than sequentially.
  4. Weighted Least Squares: Finally, the framework uses the Kernel SHAP approach to solve for the Shapley values, treating it as a regression problem where the importance of each edge is learned from the sampled coalitions.
The GNNShap pipeline: from graph pruning and sampling to GPU-accelerated model predictions and Shapley computation.

Results and Discussion

The researchers evaluated GNNShap on a diverse set of real-world benchmarks, including citation networks (Cora, CiteSeer, PubMed), co-authorship graphs, and large-scale social networks like Reddit and ogbn-products.

Accuracy and Fidelity

GNNShap consistently outperformed baselines like GNNExplainer and GraphSVX in fidelity metrics. When the "least important" edges identified by GNNShap were removed, the model's prediction remained stable; when the "most important" were removed, the prediction changed drastically, proving the explanation accurately reflected the model's logic.

Fidelity curves across six datasets demonstrating GNNShap's superior accuracy compared to state-of-the-art explainers.

Speed and Scalability

GNNShap is roughly 100x faster than previous state-of-the-art methods like GraphSVX. On the Cora dataset, GNNShap generated 100 explanations in under 22 seconds, while GraphSVX required over 900 seconds. Furthermore, GNNShap is one of the few Shapley-based explainers capable of handling the massive scale of the Reddit dataset (over 114 million edges), where competitors often timed out or ran out of memory.

Conclusion

GNNShap demonstrates that sampling middle-sized coalitions and leveraging GPU batching can make high-fidelity Shapley explanations practical for large-scale GNN analysis. Future work aims to refine the sampling algorithms to provide formal theoretical convergence guarantees and explore using these explanations to improve model performance by identifying negative-contribution edges.

Summary updated

BibTeX
@inproceedings{akkas2023gnnshap,
  author = {Selahattin Akkas and Ariful Azad},
  title = {{GNNShap: Fast and Accurate GNN Explanations using Shapley Values}},
  booktitle = {TheWebConf24},
  year = {2023},
  doi = {10.1145/3589334.3645599},
}
Figure