Encoding Concepts in Graph Neural Networks

Lucie Charlotte Magister, Pietro Barbiero, Dmitry Kazhdan, Federico Siciliano, Gabriele Ciravegna, Fabrizio Silvestri, Pietro Liò, Mateja JamnikarXiv 2022

Abstract

The opaque reasoning of Graph Neural Networks induces a lack of human trust. Existing graph network explainers attempt to address this issue by providing post-hoc explanations, however, they fail to make the model itself more interpretable. To fill this gap, we introduce the Concept Encoder Module, the first differentiable concept-discovery approach for graph networks. The proposed approach makes graph networks explainable by design by first discovering graph concepts and then using these to solve the task. Our results demonstrate that this approach allows graph networks to: (i) attain model accuracy comparable with their equivalent vanilla versions, (ii) discover meaningful concepts that achieve high concept completeness and purity scores, (iii) provide high-quality concept-based logic explanations for their prediction, and (iv) support effective interventions at test time: these can increase human trust as well as significantly improve model performance.

Introduction

Graph Neural Networks (GNNs) have become the gold standard for processing relational data, from drug discovery to social network analysis. However, their "black box" nature remains a significant hurdle for high-stakes applications. Most existing GNN explainability methods are post-hoc: they take a pre-trained, opaque model and attempt to identify which nodes or edges were most "important" for a decision. These explanations can be brittle and do not change the underlying opaque reasoning.

The authors propose a shift toward explainable-by-design architectures. By using high-level units of information (concepts) rather than raw features, they aim to bridge the gap between model performance and human interpretability.

The Concept Encoder Module (CEM)

The core contribution is the Concept Encoder Module (CEM), a differentiable approach that forces GNNs to discover high-level, human-understandable "concepts" before making a prediction.

The CEM architecture integrates concept discovery directly into the GNN pipeline, ensuring the model is explainable by design.

The workflow follows a specific pipeline:

  1. Message Passing: Standard GNN layers generate node embeddings.
  2. Concept Encoding: The CEM uses a differentiable clustering step (via a normalized softmax activation) to map node embeddings to "fuzzy" concept encodings.
  3. Booleanization: These encodings are converted into binary vectors, representing the presence or absence of specific structural motifs.
  4. Interpretable Predictor: A Logic Explained Network (LEN) uses these discovered concepts to solve the task, providing explanations as simple logic statements (e.g., "If Concept A OR Concept B is present, then the label is X").

Experimental Evaluation

The researchers evaluated Concept Graph Networks (CGNs) on synthetic benchmarks (BA-Shapes, Tree-Cycles, etc.) and real-world datasets like Mutagenicity (MUTAG) and Reddit-Binary.

A comparison of ground truth motifs versus the concepts extracted by the CEM across various datasets.

Key findings include:

  • Competitive Accuracy: CGNs achieve accuracy comparable to vanilla GNNs, and even outperformed them on the Tree-Cycle dataset by ~8%.
  • High Concept Purity: The discovered concepts are "pure," meaning the subgraphs associated with a single concept are structurally consistent.
  • Logic over Heatmaps: Instead of vague importance scores, the model provides logic rules. In BA-Shapes, it might explain a node's classification based on its specific role within a "house" motif.

Human-in-the-Loop Interventions

A significant advantage of this architecture is the ability for human experts to intervene. If a model misclassifies a graph due to a wrongly predicted concept (e.g., mistaking a circle for a grid), a user can manually "flip" the concept bit. This intervention immediately corrects the final prediction, significantly improving model performance and building user trust.

Conclusion

While the current CEM associates one primary concept per sample and can be computationally expensive to evaluate for purity, it represents a major step toward transparent GNNs. By making concept discovery an end-to-end differentiable part of the training process, the CEM ensures that the model's reasoning is grounded in human-understandable structural motifs without sacrificing predictive power.

Summary updated

BibTeX
@misc{magister2022encoding,
  author = {Lucie Charlotte Magister and Pietro Barbiero and Dmitry Kazhdan and Federico Siciliano and Gabriele Ciravegna and Fabrizio Silvestri and Pietro Liò and Mateja Jamnik},
  title = {{Encoding Concepts in Graph Neural Networks}},
  year = {2022},
  eprint = {2207.13586},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2207.13586},
}
Figure