Learning to Explain Graph Neural Networks

Giuseppe Serra, Mathias NiepertarXiv 2022 · DOI

Abstract

Graph Neural Networks (GNNs) have demonstrated remarkable success in various domains, yet their "black-box" nature remains a significant barrier to adoption in high-stakes fields like medicine and chemistry. Existing post-hoc explanation methods often suffer from unfaithfulness, providing justifications that do not accurately reflect the model's internal decision-making process. This paper introduces L2xGNN, a framework designed to be "faithful by construction." By forcing the model to select a sparse subgraph (motif) and using only that motif for prediction, L2xGNN ensures that the explanation is exactly what the model relied upon. Utilizing Implicit Maximum-Likelihood Estimation (I-MLE) to handle non-differentiable discrete selections, the framework provides human-interpretable explanations without sacrificing predictive accuracy.

Introduction

Standard GNNs aggregate information across an entire graph, making it difficult to discern which specific structures drove a particular prediction. While post-hoc explainers like GNN-Explainer attempt to identify important edges after training, they are often unfaithful—highlighting edges the original model may not have prioritized. Furthermore, these methods frequently treat edges as independent entities, resulting in disjointed explanations that lack the structural coherence (e.g., functional groups in molecules) required for domain-specific utility. L2xGNN addresses these issues by integrating the explanation process directly into the model architecture.

The L2xGNN Framework

L2xGNN shifts the paradigm from post-hoc interpretation to intrinsic interpretability. The architecture is composed of three primary stages:

  1. The Upstream Selector: This component processes the input graph to generate node embeddings ($h_v$) and subsequently assigns importance weights ($\theta$) to every edge.
  2. The Optimization Layer ($opt$): A combinatorial solver selects a subgraph $z$ based on the weights $\theta$. To ensure human-readability, the model can be constrained to select the $k$ highest-weighted edges or, more effectively, the $k$ highest-weighted edges that form a connected subgraph.
  3. The Downstream Predictor: A standard GNN ($f_u$) receives only the selected subgraph $z$ to produce the final prediction $\hat{y}$.
The L2xGNN architecture pipeline, illustrating the flow from input graph through the optimization-based selection to the final prediction.

Overcoming Non-Differentiability

A core technical challenge in this architecture is that selecting a discrete subgraph is a non-differentiable operation, which typically prevents end-to-end training via backpropagation. L2xGNN overcomes this by employing Implicit Maximum-Likelihood Estimation (I-MLE). This technique allows the model to estimate gradients through the discrete optimization step by perturbing the weights with noise ($\epsilon$), effectively training the upstream selector to identify motifs that maximize downstream predictive performance.

Experimental Evaluation

The authors evaluated L2xGNN against standard GNN baselines (GCN, GIN, GraphSAGE) and state-of-the-art explainers across several benchmarks:

  • Real-world Datasets: MUTAG, PROTEINS, YEAST, DD, and social networks (IMDB-BINARY/MULTI).
  • Synthetic Benchmarks: MUTAG$_0$ and BA2Motifs, which contain known ground-truth motifs (e.g., benzene rings or "house" shapes).

Key Results

  • Predictive Parity: Contrary to the "no-free-lunch" myth that interpretability requires a performance trade-off, L2xGNN achieved classification accuracies statistically indistinguishable from models using the full, noisy graph. In some cases, by filtering out irrelevant graph noise, L2xGNN even improved performance.
  • Superior Explanation Accuracy: On synthetic datasets, L2xGNN matched or outperformed post-hoc explainers. For instance, on BA2Motifs, it achieved a Recall of ~94.7%, significantly higher than many unfaithful baselines.
  • Structural Coherence: By enforcing connectivity constraints during the optimization step, the model produced explanations that aligned significantly better with human domain knowledge compared to methods that select disconnected edges.

Conclusion

L2xGNN demonstrates that GNNs can be both high-performing and inherently interpretable. By making the explanation the actual input to the predictor, the framework guarantees faithfulness. While the inclusion of a combinatorial solver increases training time, the resulting model offers near-instantaneous inference and a powerful tool for debugging "shortcut learning" in graph-based tasks. Future work may explore more complex solvers to capture a wider array of graph properties beyond simple connectivity.

Summary updated

BibTeX
@misc{serra2022learning,
  author = {Giuseppe Serra and Mathias Niepert},
  title = {{Learning to Explain Graph Neural Networks}},
  year = {2022},
  eprint = {2209.14402},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2209.14402},
}
Figure