Abstract
Prior works on formalizing explanations of a graph neural network (GNN) focus on a single use case - to preserve the prediction results through identifying important edges and nodes. In this paper, we develop a multi-purpose interpretation framework by acquiring a mask that indicates topology perturbations of the input graphs. We pack the framework into an interactive visualization system (GNNViz) which can fulfill multiple purposes: Preserve, Promote, or Attack GNN's predictions. We illustrate our approach's novelty and effectiveness with three case studies: First, GNNViz can assist non-expert users to easily explore the relationship between graph topology and GNN's decision (Preserve), or to manipulate the prediction (Promote or Attack) for an image classification task on MS-COCO; Second, on the Pokec social network dataset, our framework can uncover unfairness and demographic biases; Lastly, it compares with state-of-the-art GNN explainer baseline on a synthetic dataset.
Introduction
Graph Neural Networks (GNNs) are powerful models for relational data, yet they often operate as "black boxes." While interpretability tools for standard image classifiers are common, explaining GNNs is inherently more complex because their features are defined by discrete connections—the graph topology. Existing explainers typically focus on a single task: identifying which nodes or edges were most important for a specific prediction, a mode we define as Preserve.
However, real-world users often require more than just a static explanation. They may need to understand how to correct an erroneous prediction (Promote) or identify vulnerabilities to adversarial manipulation (Attack). To address these needs, we introduce GNNViz, a unified framework that utilizes topology perturbation to provide multi-purpose explanations.
Methodology: Topology Perturbation
Our framework treats graph topology as a set of dynamic variables. Instead of analyzing static inputs, the model learns a "mask" for edge additions and removals to achieve specific objectives.
Mathematical Formulation
To handle the discrete nature of graph edges, we relax the problem into a continuous space $[0, 1]$. We employ sparsity-promoting optimization ($L_1$ regularization) to ensure that the resulting explanations are concise and involve the minimal number of edge changes necessary to satisfy the objective.
Operational Modes
- Preserve: Identifies the essential subgraph by minimizing the difference between the original and perturbed predictions.
- Promote: Uses a C&W-type objective function to find the minimal edge additions or removals required to flip an incorrect prediction to a correct one.
- Attack: Reveals model vulnerabilities by finding the minimal changes needed to flip a correct prediction to an incorrect one.
The GNNViz system integrates these modes into an interactive interface, allowing users to navigate datasets and manually toggle suggested edges to observe real-time prediction updates.
Case Study: MS-COCO Image Classification
In the MS-COCO dataset, GNNs model correlations between object labels (e.g., the presence of a "person" often correlates with a "motorcycle"). GNNViz allows users to explore and manipulate these dependencies.
As shown in the figure, the Promote mode can suggest adding edges to correct a missing label, while the Attack mode identifies which label correlations are most fragile. In our experiments, the Preserve mode maintained 95.67% of original accuracy using only a fraction of edges, and the Promote mode successfully corrected GNN errors, reaching a mean Average Precision (mAP) of 90.36% on target labels.
Uncovering Social Bias in Pokec
We applied GNNViz to the Pokec social network dataset to detect demographic biases. Our analysis revealed that the GNN relied heavily on "intra-group" edges (connections between similar individuals), which can reinforce echo chambers. By using the Promote mode to suggest "inter-group" edges, we were able to reduce the fairness loss (Equalized Odds) from 0.103 to 0.052—a nearly 50% improvement in demographic parity.
Benchmarking and Performance
On synthetic benchmarks (BA-Shapes, Tree-Cycles, Tree-Grid), our framework achieved explanation accuracy (AUC) comparable to state-of-the-art tools like GNNExplainer (e.g., 0.921 vs 0.948 on Tree-Cycles). While GNNExplainer is optimized solely for subgraph identification, GNNViz provides significantly broader functionality without substantial loss in precision.
Conclusion
GNNViz shifts the paradigm of GNN explanation from static subgraph identification to dynamic topology intervention. By enabling users to Preserve, Promote, and Attack predictions, the system serves as a powerful debugging and auditing tool. Future work will focus on scaling these interventions to larger graphs and integrating them into the training process to build inherently fairer and more robust models.
Summary updated