CF-GNNExplainer: Counterfactual Explanations for Graph Neural Networks

Ana Lucic, Maartje ter Hoeve, Gabriele Tolomei, Maarten de Rijke, Fabrizio Silvestri
2/5/2021
cs.LGcs.AI
gnn

Official code: a-lucic/cf-gnnexplainer (70 stars, Jupyter Notebook, MIT, last commit 2025-12-19).

Abstract

Given the increasing promise of graph neural networks (GNNs) in real-world applications, several methods have been developed for explaining their predictions. Existing methods for interpreting predictions from GNNs have primarily focused on generating subgraphs that are especially relevant for a particular prediction.

Show full abstract

However, such methods are not counterfactual (CF) in nature: given a prediction, we want to understand how the prediction can be changed in order to achieve an alternative outcome. In this work, we propose a method for generating CF explanations for GNNs: the minimal perturbation to the input (graph) data such that the prediction changes. Using only edge deletions, we find that our method, CF-GNNExplainer, can generate CF explanations for the majority of instances across three widely used datasets for GNN explanations, while removing less than 3 edges on average, with at least 94\% accuracy. This indicates that CF-GNNExplainer primarily removes edges that are crucial for the original predictions, resulting in minimal CF explanations.

View on arXivView PDF

Code Implementations(1)

MIT
7014Jupyter Notebook, PythonMay 6, 202111 months agoMIT

Similar Papers

Cite this paper

@article{lucic2021cfgnnexplainer,
  title  = {CF-GNNExplainer: Counterfactual Explanations for Graph Neural Networks},
  author = {Ana Lucic and Maartje ter Hoeve and Gabriele Tolomei and Maarten de Rijke and Fabrizio Silvestri},
  year   = {2021},
  eprint = {2102.03322},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2102.03322}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2102.03322.svg)](https://codeofpaper.com/paper/2102.03322)

Discussion