Logical Distillation of Graph Neural Networks

Alexander Pluska, Pascal Welke, Thomas Gärtner, Sagar Malhotra · DOI

Abstract

Graph Neural Networks (GNNs) have achieved state-of-the-art performance across various graph-structured domains, yet their decision-making processes remain largely opaque. This paper introduces a novel framework for "logical distillation," which translates the internal representations of GNNs into human-readable logical formulas. By utilizing a new structure called Iterated Decision Trees (IDTs), the researchers bridge the gap between the continuous vector spaces of neural networks and the symbolic nature of first-order logic. Our findings demonstrate that these distilled models not only achieve high fidelity to the original GNNs but can also uncover simple, global rules that traditional explanation methods often overlook.

Introduction

Graph Neural Networks (GNNs) are the standard for learning on relational data, powering advancements in molecular property prediction, social network analysis, and transport optimization. Despite their efficacy, GNNs are fundamentally "black boxes." Their internal message-passing mechanisms involve high-dimensional vector transformations that are difficult for humans to scrutinize. This lack of transparency is a significant barrier in safety-critical fields like drug discovery and financial risk assessment.

Theoretical research has established a formal connection between GNNs and a fragment of first-order logic known as $C^2$ (two-variable logic with counting). While this proves that GNNs can express certain logical properties, it does not provide a mechanism to extract that logic. This work addresses this gap by introducing an algorithm to distill GNNs into symbolic, logical classifiers using Iterated Decision Trees (IDTs).

Methodology

Iterated Decision Trees (IDTs)

The core innovation of this research is the Iterated Decision Tree (IDT). Standard decision trees are ill-suited for graph data because they cannot natively represent structural relationships, such as the number of neighbors a node possesses. IDTs overcome this by employing a sequence of trees where each tree corresponds to a specific layer in the GNN.

The Distillation Process

Rather than training the IDT solely on the final output labels, the distillation algorithm uses the intermediate node representations of a pre-trained GNN as a guide. By learning to mimic the GNN's internal logic layer-by-layer, the IDT captures the hierarchical features the neural network has developed.

Logical Formalisms: $EMLC$ and $EMLC\%$

The researchers utilize a modal logic called $EMLC$, which is equivalent in expressive power to $C^2$. To better capture common GNN operations like mean aggregation, they introduced an extension called $EMLC\%$. This allows the model to represent relative properties—for example, "more than 50% of a node's neighbors possess property X." To maintain readability, the authors employ agglomerative clustering to group similar predictions into manageable "leaf sets," preventing a combinatorial explosion of logical rules.

Experimental Evaluation

The approach was evaluated across three distinct categories of datasets:

  1. Real-World Benchmarks: AIDS (molecular compounds), BZR (ligands), and PROTEINS (enzymes).
  2. Synthetic Logic ($\psi_0, \psi_1, \psi_2$): Datasets where the ground truth is defined by specific logical formulas of increasing complexity.
  3. BAMultiShapes: A dataset where classification depends on the presence of specific motifs (e.g., houses, wheels, or grids).

Key Findings

  • Inductive Bias and Accuracy: On synthetic datasets where the underlying truth was purely logical, the IDTs frequently outperformed the GNNs. This suggests that the symbolic inductive bias of an IDT can be more effective than the continuous vector space of a neural network for logic-heavy tasks.
  • Hidden Simplicity: In the AIDS dataset, the distillation process revealed a surprisingly simple rule: a graph could be classified with over 99% accuracy based almost entirely on whether it contained more than 12 nodes. This global insight had not been identified by previous local explanation methods.
  • High Fidelity: The IDTs demonstrated high fidelity to their teacher GNNs, indicating that the distilled rules accurately reflect the neural network's internal decision logic rather than just approximating the final output.

Discussion and Future Work

While the results are promising, the researchers identified several challenges. As datasets increase in complexity (such as BZR or PROTEINS), the resulting IDTs can grow to 10 or more layers, making them difficult for humans to interpret at a glance. Future work will focus on regularization techniques to encourage smaller, more concise trees.

Additionally, the current framework is limited to simple undirected graphs. Expanding the logic to support directed edges, multi-edges, and edge labels is a priority. Ultimately, the strong performance of IDTs when trained directly on data suggests they could serve as a standalone, inherently interpretable architecture for graph learning, potentially replacing GNNs in domains where transparency is paramount.

Summary updated

BibTeX
@inproceedings{pluska2024logical,
  author = {Alexander Pluska and Pascal Welke and Thomas Gärtner and Sagar Malhotra},
  title = {{Logical Distillation of Graph Neural Networks}},
  booktitle = {KR},
  year = {2024},
  doi = {10.24963/kr.2024/86},
}
Figure