SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Jun Yin*
Central South University  
yinjun2000@csu.edu.cn
Chaozhuo Li*
Microsoft Research Asia  
cli@microsoft.com
Hao Yan
Central South University CSUyh1999@csu.edu.cn
Jianxun Lian
Microsoft Research Asia jianxun.lian@microsoft.com
Senzhang Wang†
Central South University szwang@csu.edu.cn
Intrinsic interpretable graph neural networks aim to provide transparent predictions by identifying the influential fraction of the input graph that guides the model prediction, i.e., the explanatory subgraph. However, current interpretable GNNs mostly are dataset-specific and hard to generalize to different graphs. A more generalizable GNN interpretation model which can effectively distill the universal structural patterns of different graphs is until-now unexplored. Motivated by the great success of recent pre-training techniques, we for the first time propose the Pre-training Interpretable Graph Neural Network  $(\pi -\mathbf{G}\mathbf{N}\mathbf{N}^{3})$  to distill the universal interpretability of GNNs by pre-training over synthetic graphs with ground-truth explanations. Specifically, we introduce a structural pattern learning module to extract diverse universal structure patterns and integrate them together to comprehensively represent the graphs of different types. Next, a hypergraph refining module is proposed to identify the explanatory subgraph by incorporating the universal structure patterns with local edge interactions. Finally, the task-specific predictor is cascaded with the pre-trained  $\pi$ -GNN model and fine-tuned over downstream tasks. Extensive experiments demonstrate that  $\pi$ -GNN significantly surpasses the leading interpretable GNN baselines with up to  $9.98\%$  interpretation improvement and  $16.06\%$  classification accuracy improvement. Meanwhile,  $\pi$ -GNN pre-trained on graph classification task also achieves the top-tier interpretation performance on node classification task, which further verifies its promising generalization performance among different downstream tasks.
Although graph neural networks (GNNs) [1, 2, 3, 4, 5] have achieved remarkable success in various applications [6, 7, 8, 9], their black-box nature prevents humans from understanding the inner decision-making mechanism [10, 11]. This issue calls for the development of intrinsic interpretable GNNs [12, 13, 14], which can reveal the mystery of "Which fraction of the input graph is the most vital and leads to the model prediction?" Intrinsic interpretable GNNs aim to identify an influential subgraph of the input graph, i.e., the explanation, and make final predictions under the guidance of the explanatory subgraph [12, 13, 14]. Constructing interpretable GNNs makes it possible to investigate
3Our code and datasets are available at https://anonymous.4open.science/r/PI-GNN-F86C
the decision-making mechanism and justify model predictions, which is critically important to develop trustworthy artificial intelligence.
However, a major issue of the existing interpretable GNNs [12, 13, 14] is that they are mostly dataset-specific, which means an interpretable GNN model trained on a certain graph dataset (e.g., the semantic networks [15, 16, 17]) usually does not work well on another graph dataset (e.g., the molecular graphs [18]). It is also difficult for an interpretable GNN trained on a certain task (e.g., graph classification [7]) to generalize to another task (e.g., node classification [6]). Compared to the text or image data [19, 20], graphs with non-Euclidean structure are often associated with substantial node features of various domains, making the pre-training method in NLP and CV hard to be directly applied [21]. Recently graph representation learning based pre-training methods have been investigated [22, 21, 23, 24], however, they target at downstream prediction tasks but ignore the interpretability of the GNNs. It is widely acknowledged that the topological structure of various graphs generally follows some universal structural patterns or properties which are transferable [22], such as the scale-free property [25], the motif distribution [26], and the core-periphery structure [27]. Therefore, in this paper we argue that the intrinsic GNN interpretation contains some universal structural patterns, which are independent of the downstream tasks and generalizable to different types of graphs. Motivated by the great success of pre-training technique [19, 20, 22, 21], we for the first time study: whether we can and how to construct a pre-training interpretable GNN that is general enough to work well on different types of graphs and downstream tasks?
The challenges of designing a pre-training interpretable GNN are three-fold. First, labeling ground-truth explanation in the real-world graphs is extremely resource- and time-consuming [28]. The lacking of ground-truth explanation makes it hard to distill the universal interpretability in the pretraining phase. Second, multiple structural patterns usually co-exist in one graph dataset, such as the scale-free pattern and the motif distribution pattern in chemical molecule graphs [29]. How to extract and integrate multiple structural patterns for a more comprehensive and general graph representation during pre-training is also challenging. Third, the local structural interactions such as the neighbor edges interaction [30] should be considered when identifying explanations. However, due to the structural diversity of different local neighborhoods, it is non-trivial to incorporate the global structural patterns with the local structural interactions.
In this papaer, we propose a Pre-training Interpretable Graph Neural Network model ( $\pi$ -GNN for short), which is first pre-trained over a large synthetic graph dataset with ground-truth explanations and then fine-tuned on different downstream datasets and tasks. Specifically, we first construct a synthetic graph dataset named PT-Motifs that contains various structural patterns and ground truth explanations, over which the  $\pi$ -GNN model is pre-trained. Considering the co-existence of multiple structural patterns, a structural pattern learning module is introduced to extract and integrate multiple structural patterns to make them generalizable to diverse graph datasets. To better identify the explanatory subgraph, a hypergraph refining module is also proposed to capture the local structural interaction and incorporate it with the universal structural patterns. It is also proved the structural representation ability of  $\pi$ -GNN can approach the theoretical upper bound through the hypergraph refining process. Our main contributions are summarized as follows.
- We for the first time propose a pre-training interpretable GNN model  $\pi$ -GNN, which can be generalized to different graph datasets and diverse downstream tasks.
- To extract the universal interpretability of  $\pi$ -GNN, we construct a synthetic graph classification dataset PT-Motifs with ground-truth explanations for pre-training.
- Two innovative modules, i.e., the structural pattern learning module and the hypergraph refining module, are designed and integrated into  $\pi$ -GNN. The former captures and integrates multiple universal structural patterns for generalizable graph representation. The latter incorporates the universal patterns with local structural interactions to identify the explanation.
- Compared with the SOTA baselines,  $\pi$ -GNN achieves up to  $9.98\%$  ROC-AUC improvement in interpretation and  $16.06\%$  accuracy improvement in prediction. Moreover,  $\pi$ -GNN pre-trained on graph classification dataset is able to achieve comparable performance with the leading baselines on the node classification task.
In this section, we briefly introduce the graph neural networks and the GNN explanation methods<sup>4</sup>. The key notations are summarized in Appendix A for clarity.
Graph Neural Networks. Graph structure data can be denoted as  $G = (\mathcal{V}, \mathcal{E})$  with the node set  $\mathcal{V}$  and the edge set  $\mathcal{E}$ . The node features are represented as the matrix  $\mathbf{X} \in \mathbb{R}^{|\mathcal{V}| \times d}$  and the edge features (if exist) are represented as  $\mathbf{X}_E \in \mathbb{R}^{|\mathcal{E}| \times d_E}$ . The topological structure is usually represented as an adjacency matrix  $\mathbf{A} \in \mathbb{R}^{|\mathcal{V}| \times |\mathcal{V}|}$ , where the element  $A_{ij} = 1$  indicates the edge  $(i,j)$  exists and  $A_{ij} = 0$  otherwise. Graph neural networks (GNNs) aim to learn expressive representation on graphs for the downstream tasks [1, 2, 3, 4, 32, 33], such as graph classification [7], node classification [6, 34], and link prediction [35, 36]. Typically, to learn the representation of node  $v_i$ , GNNs aggregate the information from its neighborhood  $\mathcal{N}(v_i)$  and then combine it with  $v_i$ 's own features. For example, the operation of the  $k$ -th GCNs layer can be formulated as follows [1],
$$
\mathbf {X} _ {\mathbf {k} + 1} = F \left(\mathbf {D} ^ {- \frac {1}{2}} \hat {\mathbf {A}} \mathbf {D} ^ {- \frac {1}{2}} \mathbf {X} _ {\mathbf {k}} \mathbf {W} _ {\mathbf {k}}\right), \tag {1}
$$
where  $\mathbf{X}_{\mathbf{k}}$  and  $\mathbf{X}_{\mathbf{k + 1}}$  are the input and output of the  $k$ -th layer,  $\hat{\mathbf{A}} = \mathbf{A} + \mathbf{I}$  is the adjacent matrix with self-loops, and  $\mathbf{D}$  is a diagonal matrix whose element  $D_{i,i}$  represents the degree of  $v_{i}$ .  $\mathbf{W}_{\mathbf{k}}$  is a trainable matrix and  $F(\cdot)$  is a non-linear activation function.
GNN Explanation Methods. GNN explanation methods can be catogrized into the post-hoc explanation methods [10, 11, 37, 38, 39] and the intrinsic interpretable methods [3, 40, 12, 13, 14]. The post-hoc methods target at explaining the black-box models which are fixed or unaccessible. The interpretable methods devote to making transparent prediction from scratch, including not only the predicted label but also the influential subgraph that guides the prediction [14]. In both the post-hoc [10, 11, 37, 39] and the interpretable methods [12, 13, 14], the GNN explainer learns a contribution function  $h$  which maps each feature of the input graph into the contribution score to the predicted label. One insight in GNN explanation methods is that, the edge contribution function is more essential to GNN explanation compared with that of the node [11, 13, 14]. For example, when some nodes are selected, it is non-trivial to identify the explanatory subgraph. On the contrary, when the important edges are selected, the correlated endpoints are naturally selected as well. We can naturally identify the explanatory subgraph or further explore the important subset of node features. In this work, we follow the previous works [11, 39, 13, 14, 3, 40] and focus on the contribution of structure features (i.e., edges). Formally, we learn the contribution function  $h$  in terms of each edge in graph  $G = (\mathcal{V}, \mathcal{E})$  as follows,
$$
\hat {\rho} = h (G), \tag {2}
$$
where  $\hat{\rho} \in \mathbb{R}^{|\mathcal{E}|}$  and each element in  $\hat{\rho}$  is the contribution score of the edge to the task label. Next, a selection module  $\mathcal{S}$  as follows is employed to select the edges of the explanatory subgraph  $g$ , such as the top- $k$  selector [11, 13], the threshold selector [10], and the probabilistic selector [30, 14],
$$
g = \mathcal {S} (G, \hat {\rho}). \tag {3}
$$
The framework of the proposed  $\pi$ -GNN is shown in Figure 1, which contains an explainer pre-training phase and a conjoint fine-tuning phase. In the explainer pre-training phase, we pre-train the  $\pi$ -GNN explainer over the synthetic dataset PT-Motifs with ground-truth explanations, by taking the binary edge classification as the pretext task. Afterwards, the pre-trained  $\pi$ -GNN explainer is incorporated with task-specific predictor to identify explanatory subgraphs and provide transparent predictions on different tasks. During the fine-tuning phase, the explainer and the predictor are jointly optimized. Next, we introduce the  $\pi$ -GNN model in detail.
3.1 Explainer Pre-training Phase
Due to the lack of ground-truth explanation in real-world graph datasets, we first construct a large synthetic dataset with ground-truth explanation called PT-Motifs to support the explainer pre-training.
4 In what follows, we use the term explainer and interpreter interchangeably [31].
Figure 1: Framework of the  $\pi$ -GNN model. In the explainer pre-training phase, we use the synthetic graphs with ground-truth explanations to pretrain the  $\pi$ -GNN explainer. In the fine-tuning phase towards downstream tasks in real-world graphs, the pre-trained explainer and the task-specific predictor are conjointly fine-tuned for transparent and accurate predictions.
Following previous works on generating synthetic graphs [10, 11, 13], each graph  $G$  in PT-Motifs dataset consists of one base subgraph  $G_{b}$  and one explanation subgraph  $G_{e}$  (also known as the motif) and the ground-truth task label  $y$  which is determined by  $G_{e}$  solely [10, 13]. The shapes of the explanatory subgraphs in PT-Motifs include Diamond, House, Crane, Cycle, and Star and the basic shapes are Clique, Tree, Wheel, Ladder, and the Barabási-Albert Net [25]. Each combination of base and motif has the same number of samples in PT-Motifs. As shown in Figure 4(e) of Appendix B.2, the degree distribution of PT-Motifs follows the power law function  $y = 10^{6} \times x^{-1.501}$ . See Appendix B.2 for more detailed structural patterns of PT-Motifs. The proposed  $\pi$ -GNN model distills interpretability from the PT-Motifs dataset during the pre-training phase.
Structural Pattern Learning Module. To capture the multiple structural patterns, we propose to parallelize multi-thread of basic pattern-learner  $\mathcal{B} = \{B_i|i = 1,2,\dots ,N\}$ . Then, an integrated pattern-learner aggregates them for a more comprehensive and general representation of various graph structural patterns. Specifically, each basic learner  $B_{i}$  identifies a vectorized representation of the structural patterns (such as the degree distribution) and the integrated learner  $\Phi$  provides a combination of each individual representation. We formally define the basic pattern-learner as follows.
Definition 1 (Basic Pattern-Learner). Consider a graph  $G$  with  $n$  nodes, whose adjacency matrix is  $\mathbf{A} \in \mathbb{R}^{n \times n}$ . The basic pattern-learner  $B_i$  projects the adjacency matrix  $\mathbf{A}$  into a low-dimensional pattern matrix  $\mathbf{Z}_i \in \mathbb{R}^{n \times d}$ ,  $d < n$ , as follows,
$$
\mathbf {Z} _ {i} = B _ {i} (\mathbf {A}). \tag {4}
$$
The basic pattern-learner  $B_{i}$  approaches the low-dimensional pattern matrix  $\mathbf{Z}_{i}$  by maximizing the likelihood of preserving the graph topological structure.
As a widely adopted technique which provides global views of a graph [41, 42], node embedding can serve as a simple yet effective basic pattern-learner. Inspired by the multi-head attention mechanism for improving the expressive power [43], we parallelize  $N$ -thread basic pattern-learners to achieve the structural pattern tensor  $\mathcal{Z} = [\mathbf{Z}_1,\mathbf{Z}_2,\dots ,\mathbf{Z}_N]\in \mathbb{R}^{N\times v\times d}$  which contains multiple universal structural patterns. For each basic pattern-learner, the adjacency matrix  $\mathbf{A}$  is randomly permuted [42, 44]. Afterwards, the integrated learner  $\Phi$  defined as follows aggregates the pattern tensor  $\mathcal{Z}$  for a more expressive and generalizable pattern representation  $\mathbf{Z}_{\mathrm{Int}}$  [45].
Definition 2 (Integrated Pattern-Learner). Given the structural pattern tensor  $\mathcal{Z} \in \mathbb{R}^{N \times v \times d}$ , the integrated pattern-learner  $\Phi$  moves forward to a convex combination  $\mathbf{Z}_{\mathrm{Int}} \in \mathbb{R}^{v \times d_{\mathrm{Int}}}$  of each
Figure 2: An example of the graph-hypergraph transformation. Considering the 3-degree node  $A$  in graph  $G$ , its corresponding hyper-view is the hyperedge  $A$  which connects the hypernodes  $\{1,4,5\}$ .
individual pattern matrix  $\mathbf{Z}_i$  as
$$
\mathbf {Z} _ {\text {I n t}} = \Phi (\mathcal {Z}) = \sum_ {i = 1} ^ {N} \omega_ {i} \mathbf {Z} _ {i}, \tag {5}
$$
where  $\Phi$  is an integration function to comprise appropriate structural patterns for diverse graphs.
Subsequently,  $\mathbf{Z}_{\mathrm{Int}}$  is fed into the hypergraph refining module for computing the edge contribution score and exploring explanatory subgraph.
Hypergraph Refining Module. With the universal structural patterns extracted from the graphs, we next incorporate it with the edge interactions to identify the explanatory subgraph. Specifically, we first learn the edge structural representation  $\mathbf{Z}_E$  from the integrated pattern matrix  $\mathbf{Z}_{\mathrm{Int}}$ . Taking the edge  $e = (i,j)$  as an example, the corresponding structural representation  $\mathbf{Z}_E^e$  can be approached from the endpoint representations in  $\mathbf{Z}_{\mathrm{Int}}$  as follows,
$$
\mathbf {Z} _ {E} ^ {e} = f ^ {(2)} \left(\mathbf {Z} _ {\mathrm {I n t}} ^ {i}, \mathbf {Z} _ {\mathrm {I n t}} ^ {j}\right), \tag {6}
$$
where  $f^{(2)}$  is a 2-variable function and  $\mathbf{Z}_{\mathrm{Int}}^i, \mathbf{Z}_{\mathrm{Int}}^j$  are the representations of nodes  $v_{i}, v_{j}$ , respectively. Since the edge representation  $\mathbf{Z}_E$  directly determines the edge contribution score in the explanation, it should express as much information as possible. Theoretically, the expressive power of  $\mathbf{Z}_E$  is guaranteed by the following Theorem 1.
Theorem 1. Let  $\Sigma_{n}$  be the set of all adjacency matrix  $\mathbf{A}$  with  $n$  nodes. Given a graph  $G = (\mathcal{V},\mathcal{E})\in \Sigma_{n},n\geq 2$ , let  $\Gamma^{*}(S,\mathbf{A})$  be a most-expressive structural representation of nodes set  $S\subseteq \mathcal{V}$  in  $G$ .  $\forall \mathbf{A}\in \Sigma_{n}$ , there exists a most-expressive node representation  $\mathbf{Z}^{\ast}|\mathbf{A}$  satisfies the relationship as follows,
$$
\Gamma^ {*} (S, \mathbf {A}) = \mathbb {E} _ {\mathbf {Z} ^ {*}} [ f ^ {(| S |)} ((\mathbf {Z} _ {v} ^ {*}) _ {v \in S}) | \mathbf {A} ], \forall S \subseteq \mathcal {V}, \tag {7}
$$
for an appropriate  $k$ -variable function  $f^{(k)}(\cdot)$ .
Theorem 1 defines the upper bound of  $\mathbf{Z}_E$  representation ability [44]. The upper bound can be approached according to the Theorem 2 as follows.
Theorem 2. The structural representation of edge  $e = (v_i, v_j)$  can be learnt by simply approaching a function  $f^{(2)}$  which satisfies  $\Gamma(e, \mathbf{A}) = f^{(2)}(\mathbb{E}[(\mathbf{Z}_v)_{v \in \{i,j\}} | \mathbf{A}])$ .
In the hypergraph refining module, we adopt the integrated pattern matrix  $\mathbf{Z}_{\mathrm{Agg}}$  as an approximation of the expectation embedding matrix  $\mathbb{E}[(\mathbf{Z}_v)_{v\in \{i,j\}}|\mathbf{A}]$  and a 2-layer MLP to fit the transition function  $f^{(2)}$  during pre-training phase [44]. See Appendix G for the proofs of Theorems 1 and 2.
Based on the edge structural representation  $\mathbf{Z}_E$ , a straightforward way is to directly estimate the contribution score of each individual edge [13, 14]. However, such procedure ignores the incorporation of universal patterns with local structural interactions, leading to the missing of the dependencies among the edges. The edges in the explanation are supposed to interact with each other [46], form the coalition, and guide the downstream prediction task better than individuals. We next introduce how to capture the local edge interactions and incorporate them with the universal structural patterns.
Given the graph  $G = (\mathcal{V}, \mathcal{E})$ , we define its corresponding hypergraph as  $G_h = (\mathcal{V}_h, \mathcal{E}_h)$ . For a  $k$ -degree node  $v \in \mathcal{V}$ , the corresponding hyper-view is a hyperedge connecting  $k$  hypernodes.
Similarly, the edge  $e \in \mathcal{E}$  becomes a hypernode in the corresponding hypergraph. An example of graph-hypergraph transformation is shown in Figure 2. See Appendix H for the detailed algorithm of graph-hypergraph transformation. During the graph-hypergraph transformation, the edge structural representation is naturally converted to the hypernode structural representation. Therefore, we can capture the local structural interaction by conducting hyperedge message passing. In our implementation, a 2-layer hypergraph convolutional network is employed to capture the edge interaction information and further map the edge structural representations to the edge contribution scores  $\hat{\rho}$ . Finally, the hypergraph refining is formally represented as,
$$
\mathbf {Z} _ {E} ^ {(1)} = \operatorname {T a n h} \left(\operatorname {H y p e r C o n v} \left(\mathbf {Z} _ {E}\right)\right), \tag {8}
$$
$$
\hat {\rho} = \sigma \left(\operatorname {H y p e r C o n v} \left(\mathbf {Z} _ {E} ^ {(1)}\right)\right), \tag {9}
$$
where the  $\mathrm{Tanh}(\cdot)$  function is used for a zero-mean activate value and the  $\sigma(\cdot)$  function normalizes the output to a probability value within the range of [0, 1]. The normalized contribution score in  $\hat{\rho}$  measures the probability of each edge belongs to the explanatory subgraph.
Under the supervision of the ground-truth explanation in PT-Motifs,  $\pi$ -GNN distills the universal interpretability during the pre-training phase. Specifically, for each synthetic graph  $G = (\mathcal{V}, \mathcal{E})$ , the edges in  $\mathcal{E}_P$  that belong to the explanation subgraph are assigned with positive labels and the complementary part  $\mathcal{E}_N$  receives a negative label [10, 11]. We denote the ground-truth explanation as  $\rho \in \{0, 1\}^{|\mathcal{E}|}$ .  $\pi$ -GNN takes  $G$  as input and outputs the predicted explanation  $\hat{\rho} \in [0, 1]^{|\mathcal{E}|}$ , which is optimized by the binary cross-entropy loss as follows,
$$
L (\hat {\rho}, \rho) = - \sum_ {i = 1} ^ {| \mathcal {E} |} \left[ \rho_ {i} \cdot \log \hat {\rho} _ {i} + (1 - \rho_ {i}) \cdot \log (1 - \hat {\rho} _ {i}) \right]. \tag {10}
$$
3.2 Conjoint Fine-tuning Phase
During the conjoint fine-tuning phase, we combine the pre-trained  $\pi$ -GNN explainer with task-specific predictors to identify the explanatory subgraph and make final prediction simultaneously for real-world datasets. Note that the pre-trained  $\pi$ -GNN explainer is orthogonal to the post-positional predictor. That is, we can implement a predictor with arbitrary architecture as long as it can deal with the graph structure data. Even though the pre-training dataset PT-Motifs belongs to graph classification task, the pre-trained  $\pi$ -GNN model can be easily generalized to other tasks, such as model classification, by simply implementing a node classifier.
Following existing works [11, 13, 14], given the input graph  $G$  and the corresponding task label  $y$ , we introduce a probabilistic sampler  $S$  to comprise the explanatory subgraph  $g$  according to the predicted edge probability  $\hat{\rho}$  as follows,
$$
g = \mathcal {S} (G, \hat {\rho}). \tag {11}
$$
Going beyond the probabilistic sampling procedure, the post-positionsal predictor takes the explanatory subgraph  $g$  as input and fits the mapping function to the predicted label  $\hat{y}$ , by optimizing a task-specific loss function  $L_{\mathrm{task}}(\hat{y}, y)$ . In addition, we introduce an entropy regularizer [11, 14] in the fine-tuning phase to amplify the gap of each value in  $\hat{\rho}$  for sparser explanations as follows,
$$
L (\hat {\rho}) = - \sum_ {i = 1} ^ {| \mathcal {E} |} \left[ \hat {\rho} _ {i} \cdot \log \hat {\rho} _ {i} + (1 - \hat {\rho} _ {i}) \cdot \log (1 - \hat {\rho} _ {i}) \right] + | | \hat {\rho} | | _ {1}. \tag {12}
$$
The overall objective of the fine-tuning phase is to jointly optimize the task-specific term and the entropy regularizer as follows,
$$
L (\hat {y}, \hat {\rho}, y) = L _ {\text {t a s k}} (\hat {y}, y) + L (\hat {\rho}). \tag {13}
$$
In this section, we conduct extensive experiments to evaluate the performance of  $\pi$ -GNN by answering the following two questions.