Accelerating Scalable Graph Neural Network Inference with Node-Adaptive
  Propagation
Graph neural networks (GNNs) have exhibited exceptional efficacy in a diverse
array of applications. However, the sheer size of large-scale graphs presents a
significant challenge to real-time inference with GNNs. Although existing
Scalable GNNs leverage linear propagation to preprocess the features and
accelerate the training and inference procedure, these methods still suffer
from scalability issues when making inferences on unseen nodes, as the feature
preprocessing requires the graph to be known and fixed. To further accelerate
Scalable GNNs inference in this inductive setting, we propose an online
propagation framework and two novel node-adaptive propagation methods that can
customize the optimal propagation depth for each node based on its topological
information and thereby avoid redundant feature propagation. The trade-off
between accuracy and latency can be flexibly managed through simple
hyper-parameters to accommodate various latency constraints. Moreover, to
compensate for the inference accuracy loss caused by the potential early
termination of propagation, we further propose Inception Distillation to
exploit the multi-scale receptive field information within graphs. The rigorous
and comprehensive experimental study on public datasets with varying scales and
characteristics demonstrates that the proposed inference acceleration framework
outperforms existing state-of-the-art graph inference acceleration methods in
terms of accuracy and efficiency. Particularly, the superiority of our approach
is notable on datasets with larger scales, yielding a 75x inference speedup on
the largest Ogbn-products dataset.
Xinyi Gao, Wentao Zhang, Junliang Yu, Yingxia Shao, Quoc Viet Hung Nguyen, Bin Cui, Hongzhi Yin
# Accelerating Scalable Graph Neural Network Inference with Node-Adaptive Propagation

###### Abstract

Graph neural networks (GNNs) have exhibited exceptional efficacy in a diverse array of applications. However, the sheer size of large-scale graphs presents a significant challenge to real-time inference with GNNs. Although existing Scalable GNNs leverage linear propagation to preprocess the features and accelerate the training and inference procedure, these methods still suffer from scalability issues when making inferences on unseen nodes, as the feature preprocessing requires the graph to be known and fixed. To further accelerate Scalable GNNs inference in this inductive setting, we propose an online propagation framework and two novel node-adaptive propagation methods that can customize the optimal propagation depth for each node based on its topological information and thereby avoid redundant feature propagation. The trade-off between accuracy and latency can be flexibly managed through simple hyper-parameters to accommodate various latency constraints. Moreover, to compensate for the inference accuracy loss caused by the potential early termination of propagation, we further propose Inception Distillation to exploit the multi-scale receptive field information within graphs. The rigorous and comprehensive experimental study on public datasets with varying scales and characteristics demonstrates that the proposed inference acceleration framework outperforms existing state-of-the-art graph inference acceleration methods in terms of accuracy and efficiency. Particularly, the superiority of our approach is notable on datasets with larger scales, yielding a \(75\times\) inference speedup on the largest Ogbn-products dataset.

 Graph condensation, graph neural network, inference acceleration, continual learning, label propagation.

## I Introduction

Developing a graph neural network (GNN) for very large graphs has drawn increasing attention due to the powerful expressiveness of GNNs and their enormous success in many industrial applications. While GNNs provide a universal framework to tackle various down-streaming tasks, their implementation on large-scale industrial graphs is impeded by heavy computational demands, which severely limits their application in latency-sensitive scenarios. For example, recommender systems designed for streaming sessions must completely perform real-time inference on user-item interaction graphs [1, 2, 3, 4]. The fraud and spam detection tasks require millisecond-level inference on the million-scale graph to identify the malicious users and prevent the loss of assets for legitimate users [5, 6, 7]. In some computer vision applications, GNNs are designed for processing 3D point cloud data and deployed in the automated driving system to perform object detection or semantic segmentation tasks [8, 9, 10]. In such scenarios, the real-time inference is of utmost importance.

The root cause for the heavy computation and high latency in GNNs is known as the _neighbor explosion problem_. GNNs [11, 12, 13, 14] typically adopt the message-passing pipeline and leverage the feature propagation and transformation processes to construct the model as shown in Figure 1 (a). Through executing \(k\) feature propagation processes, the propagated features at depth \(k\) can capture the node information from \(k\)-hop neighborhoods (also known as supporting nodes). This approach is of particular significance to large-scale and sparsely labeled graphs, where large propagation depths are needed to aggregate enough label information from distant neighbors [15, 16]. However, as the depth of propagation increases, the number of supporting nodes grows exponentially, incurring a substantial computational cost.

To mitigate the expensive computation resulting from feature propagation, several Scalable GNNs [17, 18, 19, 20, 21, 22], e.g., SGC, were proposed to remove the non-linear transformation layers among propagation layers and use the propagated feature for prediction. As shown in Figure 1 (b), the feature propagation of these methods can be pre-computed in the preprocessing procedure and only needs to be executed once. Instead of performing feature propagation during each training epoch, the training time complexity of Scalable GNNs is significantly reduced than other GNNs [24, 25], and the training of these models scales well with graph size (Figure 1 (c)). Due to their notable advantage in training speed, Scalable GNNs have gained considerable popularity in large-scale graph processing tasks. This is evident from the widespread adoption of Scalable GNNs as the primary choice in numerous methods participating in the Open Graph Benchmark challenge [26].

However, Scalable GNNs still struggle to do efficient inference on unseen nodes because the preprocessing of feature propagation is based on the transductive premise (i.e. the graph is known and fixed). In the majority of practical situations, inference encompasses unseen nodes, requiring online execution of feature propagation [27, 12], as depicted in Figure 1 (d). This condition significantly hinders real-world applications. In
addition, existing methods adopt a fixed propagation depth for all nodes, which restricts the flexibility of exploiting the multi-scale features and tends to over-smooth the high-degree nodes [28], thereby leading to redundant computation and performance degradation.

In this paper, we aim to reduce the redundant computation of feature propagation to further accelerate the inference of Scalable GNNs in the inductive setting. To this end, we propose a general online propagation framework: Node-Adaptive Inference (NAI), which introduces _personalized propagation depth_ to determine the optimal propagation depth for inference. Specifically, we provide two different node-adaptive propagation approaches within the NAI framework, which could evaluate the smoothing status of the propagated feature in an explicit and implicit manner, respectively, and thus can terminate the needless propagation in time. Particularly, the trade-off between inference latency and accuracy can be flexibly managed by tuning simple global hyper-parameters, which adaptively adjust the propagation depth for each node. This provides a variety of inference options for users with different latency constraints. Moreover, taking inspiration from the Inception Network [29], which is the cornerstone work in convolutional neural networks, we design a novel Inception Distillation method in NAI to exploit the multi-scale receptive field information and mitigate the performance degradation caused by the adaptive propagation. With a more powerful supervision signal, NAI could accelerate the inference speed with a negligible performance drop.

The main contributions of this paper are summarized as follows:

* graph-based inductive inference, where the ever-Scalable GNNs also struggle with heavy online computation of feature propagation.
* **New Methodology.** We propose an online propagation framework for Scalable GNNs and two novel node-adaptive propagation approaches that generate the personalized propagation depth for each node, thereby avoiding the redundant computation of feature propagation and mitigating the over-smoothing problem. To compensate for the potential inference accuracy loss, we further propose Inception Distillation to exploit the multi-scale receptive field information and improve the accuracy.
* **SOTA Performance.** Extensive experiments are conducted on three public datasets with different scales and characteristics, and the experimental results show that our proposed efficient inference framework NAI outperforms the state-of-the-art (SOTA) graph inference acceleration baselines in terms of both accuracy and efficiency. In particular, the advantage of our NAI is more significant on larger-scale datasets, and NAI achieves \(75\times\) inference speedup on the largest Ogbn-products dataset.

### _Problem Formulation_

Given a graph \(\mathcal{G}\) = (\(\mathcal{V}\), \(\mathcal{E}\)) with \(|\mathcal{V}|=n\) nodes and \(|\mathcal{E}|=m\) edges, its node adjacency matrix and degree matrix are denoted as \(\mathbf{A}\in\mathbb{R}^{n\times n}\) and \(\mathbf{D}=\mathrm{diag}(d_{1},d_{2},...,d_{n})\), where \(d_{i}=\sum_{v_{j}\in\mathcal{V}}\boldsymbol{A}_{i,j}\) is the degree of node \(v_{i}\in\mathcal{V}\). The adjacency matrix and degree matrix with self-loops are denoted as \(\widetilde{\mathbf{A}}\) and \(\widetilde{\mathbf{D}}\). The node feature matrix is \(\mathbf{X}=\{\boldsymbol{x}_{1},\boldsymbol{x}_{2},...,\boldsymbol{x}_{n}\}\) in which \(\boldsymbol{x}_{i}\in\mathbb{R}^{f}\) represents the node attribute vector of \(v_{i}\), and \(\mathbf{Y}=\{\boldsymbol{y}_{1},\boldsymbol{y}_{2},...,\boldsymbol{y}_{l}\}\) is the one-hot label matrix for node classification task. In the inductive setting, the entire node set \(\mathcal{V}\) is partitioned into training set \(\mathcal{V}_{train}\) (including labeled set \(\mathcal{V}_{l}\) and unlabeled set \(\mathcal{V}_{u}\)) and test set \(\mathcal{V}_{test}\). GNNs are trained on \(\mathcal{G}_{train}\) which only includes \(\mathcal{V}_{train}\) and all edges connected to \(v\in\mathcal{V}_{train}\). The evaluation is to test the performance of trained GNNs on \(\mathcal{V}_{test}\) in graph \(\mathcal{G}\).

### _Graph Neural Networks_

GNNs aim to learn node representation by using topological information and node attributes. The existing GNNs adopt the message-passing pipeline and construct models utilizing two processes: feature propagation and transformation. By stacking multiple layers, the \(k\)-th layer feature matrix \(\mathbf{X}^{(k)}\) can be formulated as:

\[\mathbf{X}^{(k)}=\delta\left(\hat{\mathbf{A}}\mathbf{X}^{(k-1)} \mathbf{W}^{(k)}\right), \tag{1}\] \[\hat{\mathbf{A}}=\widetilde{\mathbf{D}}^{\gamma-1}\widetilde{ \mathbf{A}}\widetilde{\mathbf{D}}^{-\gamma},\]

Fig. 1: The comparison of GNN and Scalable GNN in the training and inference procedures. (a) The training and transductive/inductive inference procedure of GNNs, such as GCN [11]. The propagation and transformation process are integrated as a single GNN layer. (b) The feature preprocessing approach of Scalable GNNs, illustrated by SGC [17]. The transformation processes are removed, and non-parametric propagation processes are conducted as the preprocessing. (c) The training/transductive inference procedure of Scalable GNNs. The classifier training or transductive inference is based on preprocessed features directly. (d) The inductive inference procedure of Scalable GNNs, where propagation has to be executed online.
where \(\mathbf{W}^{(k)}\) is the layer-specific trainable weights at layer \(k\) and \(\delta\left(\cdot\right)\) is the activation function, such as ReLU function. \(\mathbf{\widetilde{D}}\) is the diagonal node degree matrix used to normalize \(\mathbf{\widetilde{A}}\). \(\mathbf{X}^{(k-1)}\) is the input of \(k\)-th layer and \(\mathbf{X}^{(0)}=\mathbf{X}\). In each layer, \(\mathbf{\widetilde{A}}\) propagates the information among neighbors, and \(\mathbf{W}^{(k)}\) transforms the propagated features. Through executing \(k\) times feature propagation processes, the propagated features at depth \(k\) can capture the node information from \(k\)-hop neighborhoods. However, as the depth of propagation increases, the number of supporting nodes grows exponentially, incurring a substantial computational cost. Note that, \(\gamma\in[0,1]\) is the convolution coefficient and could generalize Eq. (1) to various existing models. By setting \(\gamma=1\), 0.5 and 0, the convolution matrix \(\mathbf{\tilde{A}}\) represents the transition probability matrix \(\mathbf{\widetilde{A}}\mathbf{\widetilde{D}}^{-1}\)[12, 27, 30], the symmetric normalization adjacency matrix \(\mathbf{\widetilde{D}}^{-\frac{1}{2}}\mathbf{\widetilde{A}}\mathbf{ \widetilde{D}}^{-\frac{1}{2}}\)[11, 31] and the reverse transition probability matrix \(\mathbf{\widetilde{D}}^{-1}\mathbf{\widetilde{A}}\)[32], respectively.

Employing the propagated feature \(\mathbf{X}^{(k)}\), the evaluation of node classification task is accomplished by executing the softmax function and optimizing the cross-entropy loss across all labeled nodes.

### _Scalable Graph Neural Networks_

Although GNNs achieve excellent performance by executing multiple feature propagation and transformation processes, it was found that the aggregation of neighbor features (i.e., feature propagation) makes a major contribution to the performance of GNNs and plays a more important role [17]. Based on this finding, to improve the scalability of GNNs, SGC [17] was proposed to decompose the two processes and remove feature transformations in the middle layers. It propagates the node features for \(k\) times as:

\[\mathbf{X}^{(k)}=\mathbf{\hat{A}}^{k}\mathbf{X}, \tag{2}\]

where \(\mathbf{\hat{A}}\) is defined as Eq. (1). Then, \(\mathbf{X}^{(k)}\), the propagated feature at depth \(k\), is fed to a linear model for classification. Benefiting from the linear propagation of Eq. (2), SGC removes the trainable parameters between feature propagation and allows for offline precomputation of the feature matrix as shown in Figure 1 (b). As a result, SGC effectively reduces training time by avoiding the computationally intensive feature propagation process in each training epoch, since the feature propagation is performed only once before the classifier training.

Following SGC, more powerful Scalable GNNs are designed by exploring the precomputed features \(\{\mathbf{X}^{(0)},\mathbf{X}^{(1)},...,\mathbf{X}^{(k)}\}\) in Eq. (2), with \(\mathbf{X}^{(0)}\) representing \(\mathbf{X}\) for consistent notation. For example, SIGN [18] proposes to transform propagated features at different depths by linear transformations, then concatenates them together to enhance the feature representation. The predicted objective can be represented as:

\[\mathbf{X}^{(k)}_{SIGN}=\mathbf{X}^{(0)}\mathbf{W}^{(0)}\left|\right|\mathbf{ X}^{(1)}\mathbf{W}^{(1)}\left|\right|...\left|\right|\mathbf{X}^{(k)}\mathbf{W}^{( k)}, \tag{3}\]

where \(\left|\right|\) denotes concatenation operations and \(\mathbf{W}^{(k)}\) are transformation matrices. \(\mathrm{S}^{2}\mathrm{GC}\)[22] averages propagated features at different depths to construct a simple spectral graph convolution:

\[\mathbf{X}^{(k)}_{S^{2}GC}=\frac{1}{k}{\sum_{l=0}^{k}}\mathbf{X}^{(l)}. \tag{4}\]

GAMLP [23] combines propagated features at different depths by measuring the feature information gain and constructing the node-wise attention mechanism:

\[\mathbf{X}^{(k)}_{GAMLP}={\sum_{l=0}^{k}}T^{(l)}\mathbf{X}^{(l)}, \tag{5}\]

where \(T^{(l)}\) are diagonal node-wise attention matrices. The propagated features \(\{\mathbf{X}^{(0)},\mathbf{X}^{(1)},...,\mathbf{X}^{(k)}\}\) used in these methods are all pre-computed in advance, successfully speeding up the training procedure and transductive inference procedure.

However, these Scalable GNNs still suffer from scalability issues when making inferences on the unseen nodes that are not encountered during model training. In such an inductive inference scenario (Figure 1 (d)), the feature propagation of unseen nodes has to be executed online, and this time-consuming process directly leads to high inference latency.

## II Methodology

To mitigate the scalability problem of **Scalable GNNs** in the **inductive** inference setting, we propose an online propagation framework, i.e., Node-Adaptive Inference (NAI), as shown in Figure 2. In the inductive inference procedure, the personalized propagation depth is generated online for each test node by referring to its stationary state, and the nodes with low personalized propagation depth are inferred in advance during the propagation procedure. Within the framework, two optional modules (Distance/Gate-based Node-Adaptive Propagation) are designed to compare the propagated features with the stationary states and customize the personalized propagation depth. In the training procedure of multiple classifiers, NAI leverage the Inception Distillation to enhance the classifiers at lower depths. We construct a more powerful teacher to capture multi-scale information of different-sized receptive fields and updates both teacher and students simultaneously with the target of higher prediction accuracy.

In the following sections, we first present the two propagation modules and the inference algorithm in Section II-A. Subsequently, we discuss the computational complexity of inference in Section II-B. Finally, we delve into the details of training classifiers for each layer and introduce Inception Distillation in Section II-C.

### _Node-Adaptive Propagation_

The key component of the NAI framework is generating the personalized propagation depth in the inference procedure. To this end, we introduce two optional Node-Adaptive Propagation (NAP) modules by referring to the stationary feature state, and the NAP is plugged into the propagation process directly to control the propagation depth for each node.

Specifically, Scalable GNNs propagate the information within \(k\)-hops neighbors by multiplying the \(k\)-th order normalized adjacency matrix by the feature matrix as Eq. (2).
This operation gradually smooths the node feature by neighbor features, and with the growth of \(k\), the propagated node features within the same connected component will reach a stationary state [28]. When \(k\rightarrow\infty\), the features are propagated for infinite times and reach the stationary feature state \(\mathbf{X}^{(\infty)}\), which be calculated as:

\[\mathbf{X}^{(\infty)}=\hat{\mathbf{A}}^{(\infty)}\mathbf{X}, \tag{6}\]

where \(\mathbf{\hat{A}}^{(\infty)}\) is the adjacency matrix propagated for infinite times. The element in \(\mathbf{\hat{A}}^{(\infty)}\) is calculated as:

\[\mathbf{\hat{A}}^{(\infty)}_{i,j}=\frac{\left(d_{i}+1\right)^{\gamma}\left(d_ {j}+1\right)^{1-\gamma}}{2m+n}, \tag{7}\]

where \(\mathbf{\hat{A}}^{(\infty)}_{i,j}\) is the weight between nodes \(v_{i}\) and \(v_{j}\), i.e., the element of \(i\)-th row and \(j\)-th column in \(\mathbf{\hat{A}}^{(\infty)}\). \(d_{i}\) and \(d_{j}\) are node degrees for \(v_{i}\) and \(v_{j}\). \(m\) and \(n\) are the numbers of edges and nodes. \(\gamma\) is the convolution coefficient in Eq. (1). Since \(\mathbf{\hat{A}}^{(\infty)}_{i,j}\) is only related to the degree of source node \(v_{i}\) and target node \(v_{j}\), topology information is lost after the infinite number of propagation and the final features will be over-smoothed. For example, when \(\gamma=0\), \(\mathbf{\hat{A}}^{(\infty)}_{i,j}\) is only determined by the degree of target node \(v_{j}\) and target nodes with equal degrees have the same weight value.

Considering the different degree distributions of the nodes, the smoothness of the node features varies at the same propagation depth and should be evaluated to avoid the over-smoothing problem. Moreover, the node features with proper smoothness can be inferred in advance to reduce the redundant computation. To this end, we propose two different NAP approaches to generate the personalized propagation depth in the explicit and implicit manner respectively: Distance-based NAP (\(\mathrm{NAP_{d}}\)) and Gate-based NAP (\(\mathrm{NAP_{g}}\)).

#### Iii-B1 **Distance-based NAP**

\(\mathrm{NAP_{d}}\) uses the distance between the propagated feature at depth \(l\) (i.e., \(\mathbf{X}^{(l)}_{i}\)) and stationary feature (i.e., \(\mathbf{X}^{(\infty)}_{i}\)) to measure the feature smoothness of node \(v_{i}\) explicitly, and the distance \(\Delta^{(l)}_{i}\) is defined as Eq. (8):

\[\Delta^{(l)}_{i}=\left.\left\|\mathbf{X}^{(l)}_{i}-\mathbf{X}^{(\infty)}_{i} \right\|,\right. \tag{8}\]

where \(\left\|\cdot\right\|\) means \(l_{2}\) norm. A small distance indicates a strong smoothing effect and a higher risk of over-smoothing.

To control the smoothness and generate a proper propagation depth for inference, we introduce a global hyper-parameter \(T_{s}\) as a threshold for all distances in the graph. The personalized propagation depth \(L(v_{i},T_{s})\) for the node \(v_{i}\) is:

\[L(v_{i},T_{s})=\operatorname*{arg\,min}_{l}(\Delta^{(l)}_{i}<T_{s}). \tag{9}\]

The personalized propagation depth satisfies the union upperbound [28] as:

\[L(v_{i},T_{s})\leq\min\Big{\{}\log_{\lambda_{2}}(T_{s}\sqrt{\frac{d_{i}+1}{2m +n}}),\max\{L(v_{j},T_{s}),v_{j}\in N_{v_{i}}\}+1\Big{\}}, \tag{10}\]

where \(\lambda_{2}\leq 1\) is the second largest eigenvalue of \(\mathbf{\hat{A}}\) and \(N_{v_{i}}\) is the neighbor node set of \(v_{i}\).

The first term of upper-bound shows that the personalized propagation depth of \(v_{i}\) is positively correlated with the scale of the graph (i.e., the number of edges \(m\) and the number of nodes \(n\)), the sparsity of the graph (small \(\lambda_{2}\) means strong connection and low sparsity, and vice versa), and negatively correlated with its node degree \(d_{i}\). Moreover, the second term indicates that the difference between two neighboring nodes' personalized propagation depth is no more than 1, and the neighbors of high-degree nodes will also have a low personalized propagation depth. In summary, nodes located in

Fig. 2: The inference procedure and classifier training procedure for NAI. In the inference procedure (left), the propagation depth is adaptively controlled by gates or by comparing the propagated feature with the stationary state. The propagated features with low propagation depth are predicted by corresponding classifier in advance. The training procedure (right) includes feature propagation, base classifier training, and Inception Distillation. The classifier \(f^{(k)}\) is initially trained by cross-entropy (CE) loss, and set as the teacher for Single-Scale Distillation. Subsequently, enhanced classifiers at higher depths are employed to construct the ensemble teacher, which serves to distill multi-scale receptive field information into lower depth classifiers.
sparse local areas and possessing smaller degrees should have higher personalized propagation depths, and vice versa.

By referring to the distance explicitly, \(\mathrm{NAP}_{\mathrm{d}}\) takes both the node feature and topological information into account and can generate the personalized propagation depth during the propagation process. With the personalized propagation depth \(L(v_{i},T_{s})\), the propagated feature \(\mathbf{X}_{i}^{(L(v_{i},T_{s}))}\) will be predicted by classifier \(f^{(L(v_{i},T_{s}))}\) (refer to Section II-C for details) in advance.

#### Iii-B2 **Gate-based NAP**

\(\mathrm{NAP}_{\mathrm{g}}\) leverages a series of gates at different depths to control the propagation process and dynamically decide whether the propagation of each node should be stopped. Nonetheless, the gate structure and the training of a series of gates encounter several challenges.

* The propagated feature should be compared with the stationary feature in each gate.
* Each node should possess a distinct and suitable propagation depth, signifying that it should be chosen by a single gate exclusively.
* Gates at varying depths exhibit dependency, as the decisions made by higher-depth gates are influenced by preceding ones. As a result, gates should be trained concurrently to effectively learn this dependency.
* Gates must be designed to be lightweight, guaranteeing that no heavy computation operations are incorporated.

Considering above challenges, we design gates for Scalable GNNs and simultaneously train these gates end-to-end as show in Figure 3 by leveraging the well-trained classifiers (refer to Section II-C for details). Here we take the propagation depth \(l\) as an example.

During the gate training procedure, the gate \(g^{(l)}\) at depth \(l\) takes the propagated feature \(\mathbf{X}_{i}^{(l)}\) and \(\hat{\mathbf{X}}_{i}^{(l)}\) from the previous depth as inputs, subsequently generating a one-hot mask \(\mathbf{m}_{i}^{(l)}\) as output according to Eq. (11). The initial value of \(\hat{\mathbf{X}}_{i}^{(l)}\) is established as the stationary feature to input the gate \(g^{(1)}\), i.e., \(\hat{\mathbf{X}}_{i}^{(1)}=\mathbf{X}_{i}^{(\infty)}\).

\[\begin{split}&\mathbb{X}_{i}^{(l)}=\mathbf{X}_{i}^{(l)}\,|| \,\hat{\mathbf{X}}_{i}^{(l)},\\ &\mathbf{e}_{i}^{(l)}=\mathrm{softmax}\left(\mathbb{X}_{i}^{(l)} \mathbf{W}^{(l)}\right),\\ &\mathbf{m}_{i}^{(l)}=\mathrm{GS}\left(\mathbf{e}_{i}^{(l)}-\mathbf{ \Theta}_{i}^{(l)}\right),\end{split} \tag{11}\]

where \(1\leq l<k\). \(\mathbf{W}^{(l)}\in\mathbb{R}^{2f\times 2}\) is the trainable weight vector. \(\mathbf{e}_{i}^{(l)}\in\mathbb{R}^{2}\) is the probability which indicates the preference of \(\mathbf{X}_{i}^{(l)}\) and \(\hat{\mathbf{X}}_{i}^{(l)}\). \(\mathrm{GS}\) is the Gumbel softmax [33] which used to generate two dimensional one-hot mask \(\mathbf{m}_{i}^{(l)}=[m_{i,1}^{(l)},m_{i,2}^{(l)}]\).

To prevent a node from being chosen by multiple gates or all nodes employing the propagated feature at the highest depth, we introduce the penalty term \(\mathbf{\Theta}_{i}^{(l)}\). This term ensures that each node is selected by the gates only once. Specifically, \(\mathbf{\Theta}_{i}^{(l)}=[\theta_{i,1}^{(l)},0]\) is generated based on the masks from previous depths and operates exclusively along the first dimension. \(\theta_{i,1}^{(l)}=\sum_{j=1}^{l-1}\mu\mathrm{sigmoid}(\varphi(m_{i,1}^{(j)}- 0.5))\) in our implementation1. For \(1\leq j\leq l-1\), if \(m_{i,1}^{(j)}>0.5\) exists, the propagated feature of node \(v_{i}\) has already been selected by previous depth \(j\) and a large penalty will be added to \(\theta_{i,1}^{(l)}\). Consequently, the mask will maintain \(m_{i,1}^{(l)}<m_{i,2}^{(l)}\) for all higher depths \(l\leq j<k\). Conversely, if this condition is not met, \(\theta_{i,1}^{(l)}\) will remain at a low value, approximating zero.

Footnote 1: \(\mu\) and \(\varphi\) are large and arbitrary constants. In our experiments, we set \(\varphi\) and \(\mu\) equal to 1000.

With the mask \(\mathbf{m}_{i}^{(l)}\), the gate input at depth \(l+1\) is constructed as Eq. (12):

\[\hat{\mathbf{X}}_{i}^{(l+1)}=\mathbf{m}_{i}^{(l)}[\mathbf{X}_{i}^{(l)};\hat{ \mathbf{X}}_{i}^{(l)}]. \tag{12}\]

* If \(m_{i,1}^{(l)}>m_{i,2}^{(l)}\), \(\mathbf{X}_{i}^{(l)}\) will be selected by the mask and used as the input of the next depth gate. Owing to the penalty term, the mask for \(v_{i}\) at higher depths will be maintained as \(m_{i,1}^{(l)}<m_{i,2}^{(l)}\), which enables the propagated feature at depth \(l\) to be predicted in the end.
* If \(m_{i,1}^{(l)}<m_{i,2}^{(l)}\), \(\hat{\mathbf{X}}_{i}^{(l)}\) will be chosen by the mask to retain the same value from previous depths. Notice that \(\mathbf{X}_{i}^{(\infty)}\) is input in the first gate as \(\hat{\mathbf{X}}_{i}^{(1)}\) and the value of \(\hat{\mathbf{X}}_{i}^{(l)}\) will be preserved as \(\mathbf{X}_{i}^{(\infty)}\) if the node has never been selected by any previous gate.

Ultimately, if \(\hat{\mathbf{X}}_{i}^{(k)}=\mathbf{X}_{i}^{(\infty)}\), \(\hat{\mathbf{X}}_{i}^{(k)}\) will be replaced with \(\mathbf{X}_{i}^{(k)}\). Nodes selected by different gates will be predicted by the classifiers at their corresponding depths. Employing well-trained classifiers and cross-entropy loss, the gates at various depths are trained concurrently, while classifier parameters remain unaltered during the gate training process.

During the inference procedure, gates will dynamically generate discrete masks according to the propagated feature and stationary feature. The personalized propagation depth for the node \(v_{i}\) is:

\[L(v_{i})=\operatorname*{arg\,min}_{l}(m_{i,1}^{(l)}=1). \tag{13}\]

Given the personalized propagation depth \(L(v_{i})\), the propagated feature \(\mathbf{X}_{i}^{(L(v_{i}))}\) will be predicted in advance by classifier \(f^{(L(v_{i}))}\).

#### Iii-B3 **Inference Algorithm**

To unify both \(\mathrm{NAP}_{\mathrm{d}}\) and \(\mathrm{NAP}_{\mathrm{g}}\) into our proposed NAI framework and adapt them to different latency constraints and application scenarios, we introduce two more global hyper-parameters in the inference algorithm, i.e., \(T_{min}\) and \(T_{max}\), which indicates the minimum and the maximum propagation depth, respectively. The inference procedure is shown in Algorithm 1.

In line 2, \(\mathbf{X}^{(\infty)}\) for batch \(\mathcal{V}_{b}\) is calculated according the entire graph by Eq. (6). In line 3, the supporting nodes are derived according to \(\mathcal{V}_{b}\) and \(T_{max}\), where \(1\leq T_{max}\leq k\). Then, the node features will be propagated \(T_{min}\) times, where \(1\leq T_{min}\leq T_{max}\) (line 5). After \(T_{min}\) times propagation, features are compared with \(\mathbf{X}^{(\infty)}\) (or input \(g^{(l)}\) together with \(\mathbf{X}^{(\infty)}\)) and inferred by the classifier if the distances are smaller than \(T_{s}\) (or mask is \([1,0]\)) (line 9-12). Until \(l=T_{max}\), all left
nodes will be classified by \(f^{(T_{max})}\) and the prediction results for \(\mathcal{V}_{b}\) are output (line 17-18).

Once the model is deployed on the device, users can choose the hyper-parameters by using validation set that align with the latency requirements and provide the highest validation accuracy for the inference process.

### _Computational Complexity Analysis_

Table I compares the inference computational complexity of four Scalable GNNs and their complexity after deploying NAI in the inductive setting. All computations include feature processing and classification, and we show the basic version of GAMLP which utilizes the attention mechanism in feature propagation.

NAI could reduce the computation of feature propagation by decreasing the propagation depth \(k\). Suppose \(q\) is the average propagation depth over all nodes when adopting NAI, the complexity for feature propagation in SGC is decreased to \(\mathcal{O}(qmf)\). This means that NAI can achieve stronger acceleration effects for graphs with large-scale edges and high feature dimensions under the same \(q\). The classification complexity is \(\mathcal{O}(nf^{2})\), which is the same as vanilla SGC. The additional computational complexity for the stationary state and distance calculation (or gate) is \(\mathcal{O}(n^{2}f)\) and \(\mathcal{O}(qnf)\), respectively. Similar results can be observed in \(\mathrm{S}^{2}\mathrm{GC}\) and GAMLP. For SIGN, it concatenates propagated features at different depths before the classification procedure, leading to the increase of feature dimension. As a result, the classification computation also decreases from \(\mathcal{O}(kPnf^{2})\) to \(\mathcal{O}(qPnf^{2})\) when applying NAI to SIGN.

### _Enhance Classifiers by Inception Distillation_

Although the NAP module generates the personalized propagation depth according to topological information and reduces the computational redundancies of feature propagation, the plain classifiers restrict the classification performances. To compensate for the potential inference accuracy loss, we utilize multiple classifiers for the propagated features at different depths and further propose Inception Distillation to exploit the multi-scale receptive field information. The well trained classifiers can directly used in Algorithm 1. Inception Distillation includes two stages: Single-Scale and Multi-Scale Distillation.

#### Iv-B1 **Single-Scale Distillation**

For a Scalable GNN with the highest propagation depth \(k\), the classifier \(f^{(k)}\) is trained firstly with \(\mathbf{X}^{(k)}\) by using cross-entropy loss and is designated as the teacher. The outputs of students \(f^{(l)}\) (\(1\leq l<k\)) and the

Fig. 3: The end-to-end training procedure of gates for Scalable GNNs with the highest depth \(k\). The propagated features are compared with the stationary feature in each gate and the decisions of gates at higher depths are influenced by previous gates. The propagated features are predicted by corresponding classifiers, and the gates are optimized by using cross-entropy (CE) loss.
teacher \(f^{(k)}\) are processed for knowledge distillation as Eq. (14):

\[\begin{split}\mathbf{z}_{i}^{(l)}&=f^{(l)}(\mathbf{X} _{i}^{(l)}),\\ \mathbf{z}_{i}^{(k)}&=f^{(k)}(\mathbf{X}_{i}^{(k)}), \\ \tilde{\mathbf{p}}_{i}^{(l)}&=\mathrm{softmax}(\mathbf{z} _{i}^{(l)}/T),\\ \tilde{\mathbf{p}}_{i}^{(k)}&=\mathrm{softmax}(\mathbf{z} _{i}^{(k)}/T),\end{split} \tag{14}\]

where \(T\) is the temperature, which controls how much to rely on the teacher's soft predictions [34]. Then, the knowledge of \(f^{(k)}\) is distilled to other student classifiers at lower depths \(f^{(l)}\) separately as Eq. (15). We follow the conventional knowledge distillation [34] and penalize the cross-entropy loss between the student's softmax outputs and the teacher's softmax outputs.

\[\mathcal{L}_{d}^{(l)}=\frac{1}{|\mathcal{V}_{train}|}\sum_{v_{i}\in\mathcal{V }_{train}}\ell(\tilde{\mathbf{p}}_{i}^{(l)},\tilde{\mathbf{p}}_{i}^{(k)}), \tag{15}\]

where \(\ell(\cdot,\cdot)\) is the cross-entropy loss and \(\mathcal{V}_{train}\) is the training set. \(|\cdot|\) denotes the set size. Besides \(\mathcal{L}_{d}^{(l)}\), the node label provides another supervision signal for the students:

\[\begin{split}\mathcal{L}_{c}^{(l)}&=\frac{1}{| \mathcal{V}_{i}|}\sum_{v_{i}\in\mathcal{V}_{i}}\ell(\tilde{\mathbf{y}}_{i}^{(l)}, \mathbf{y}_{i}),\\ \tilde{\mathbf{y}}_{i}^{(l)}&=\mathrm{softmax}(\mathbf{ z}_{i}^{(l)}),\end{split} \tag{16}\]

where \(\mathbf{z}_{i}^{(l)}\) is derived from Eq. (14) and \(\mathbf{y}_{i}\) is the one-hot label. \(\mathcal{V}_{l}\) is the labeled set.

Finally, the Single-Scale Distillation loss \(\mathcal{L}_{single}^{(l)}\) is constructed by jointly optimizing \(\mathcal{L}_{c}^{(l)}\) and \(\mathcal{L}_{d}^{(l)}\):

\[\mathcal{L}_{single}^{(l)}=(1-\lambda)\mathcal{L}_{c}^{(l)}+\lambda T^{2} \mathcal{L}_{d}^{(l)}, \tag{17}\]

where \(T^{2}\) is used to adjust the magnitudes of the gradients produced by knowledge distillation [34] and \(\lambda\in[0,1]\) is the hyper-parameter that balances the importance of two losses.

#### Ii-C2 **Multi-Scale Distillation**

Single-Scale Distillation can enhance the classifiers according to single-scale receptive field information. In order to further enhance the model's representational capacity, an ensemble teacher is constructed to retain multi-scale receptive field information. It is voted by \(r\) classifiers at higher depths and their predictions \(\tilde{\mathbf{y}}_{i}^{(l)}\) are combined as:

\[\begin{split}\bar{\mathbf{z}}_{i}&=\mathrm{softmax }(\sum_{l=k-r+1}^{k}w_{i}^{(l)}\tilde{\mathbf{y}}_{i}^{(l)}),\\ w_{i}^{(l)}&=\frac{exp(q_{i}^{(l)})}{\sum_{l=k-r+1 }^{k}exp(q_{i}^{(l)})},\\ q_{i}^{(l)}&=\delta(\tilde{\mathbf{y}}_{i}^{(l)}\mathbf{ s}^{(l)}),\end{split} \tag{18}\]

where \(\bar{\mathbf{z}}_{i}\) is the ensemble teacher prediction for node \(v_{i}\). \(\delta\left(\cdot\right)\) is the activation function, and we employ the sigmoid function. \(\mathbf{s}^{(l)}\in\mathbb{R}^{f\times 1}\) is the weight vector which projects the logits into a same subspace to measure self-attention scores. Scalars \(q_{i}^{(l)}\) are normalized to weight the predictions \(\tilde{\mathbf{y}}_{i}^{(l)}\).

Subsequently, the teacher's knowledge is transferred to student classifiers by optimizing the Multi-Scale Distillation loss \(\mathcal{L}_{multi}^{(l)}\):

\[\mathcal{L}_{multi}^{(l)}=\mathcal{L}_{t}+(1-\lambda)\mathcal{L}_{c}^{(l)}+ \lambda T^{2}\mathcal{L}_{e}^{(l)}, \tag{19}\]

where \(1\leq l<k\) and \(\mathcal{L}_{multi}^{(l)}\) consists of three components: \(\mathcal{L}_{t}\), \(\mathcal{L}_{c}^{(l)}\) and \(\mathcal{L}_{e}^{(l)}\). \(\mathcal{L}_{t}\) represents the constraint for the ensemble teacher as Eq. (20):

\[\mathcal{L}_{t}=\frac{1}{|\mathcal{V}_{l}|}\sum_{v_{i}\in\mathcal{V}_{l}}\ell( \bar{\mathbf{z}}_{i},\mathbf{y}_{i}). \tag{20}\]

\(\mathcal{L}_{c}^{(l)}\) is the hard label supervision signal defined in Eq. (16). \(\mathcal{L}_{e}^{(l)}\) distills the knowledge from the ensemble teacher to other student classifiers as Eq. (21):

\[\begin{split}\mathcal{L}_{e}^{(l)}&=\frac{1}{| \mathcal{V}_{train}|}\sum_{v_{i}\in\mathcal{V}_{train}}\ell(\tilde{\mathbf{p}}_{i}^ {(l)},\bar{\mathbf{p}}_{i}),\\ \tilde{\mathbf{p}}_{i}&=\mathrm{softmax}(\bar{\mathbf{z }}_{i}/T),\end{split} \tag{21}\]

where \(\tilde{\mathbf{p}}_{i}^{(l)}\) is derived from Eq. (14).

Notice that not only the student classifiers but also the weight vector \(\mathbf{s}^{(l)}\) and the ensemble teacher prediction \(\bar{\mathbf{z}}_{i}\) will be updated simultaneously by optimizing \(\mathcal{L}_{multi}^{(l)}\), which provides a trainable regularization term [35] with the target of the higher student performance. Leveraging the enhanced classifiers obtained through Single-Scale Distillation, Inception Distillation can further capture comprehensive knowledge within multi-scale receptive fields, thereby improving the performance of classifiers at different depths.

## III Experiments

We test NAI on real-world graphs with different scales to verify the effectiveness and aim to answer the following six questions. **Q1**: Compared with other state-of-the-art inference acceleration baselines, can NAI achieve better performance? **Q2**: How does each component (e.g., \(\mathrm{NAP_{d}}\), \(\mathrm{NAP_{g}}\), and Inception Distillation) in NAI affect the model performance? **Q3**: What is the difference between the performance of \(\mathrm{NAP_{d}}\) and \(\mathrm{NAP_{g}}\)? **Q4**: Can NAI generalize well to different Scalable GNN models? **Q5**: How about the acceleration performance of NAI under different batch sizes? **Q6**: How do hyper-parameters affect NAI?

\begin{table}
\begin{tabular}{l|l l l l} \hline  & SGC & SIGN & S\({}^{2}\)GC & GamLP \\ \hline Vanilla & \(\mathcal{O}(kmf+nf^{2})\) & \(\mathcal{O}(kmf+kPnf^{2})\) & \(\mathcal{O}(kmf+knf+nf^{2})\) & \(\mathcal{O}(kmf+Pnf^{2})\) \\ NAI & \(\mathcal{O}(qmf+nf^{2}+n^{2}f)\) & \(\mathcal{O}(qmf+qPnf^{2}+n^{2}f)\) & \(\mathcal{O}(qmf+qnf+nf^{2}+n^{2}f)\) & \(\mathcal{O}(qmf+Pnf^{2}+n^{2}f)\) \\ \hline \end{tabular}
\end{table} TABLE I: The inference computational complexities of Scalable GNNs in the inductive setting. \(n\), \(m\) and \(f\) are the number of nodes, edges, and feature dimensions, respectively. \(k\) denotes the propagation depth and \(P\) is the number of layers in classifiers. \(q\) is the averaged propagation depth when adopting NAL
### _Experimental Settings_

**Baselines and Datasets**. We compare our proposed distance-based NAI (\(\mathrm{NAI_{d}}\)) and gate-based NAI (\(\mathrm{NAI_{g}}\)) with the state-of-the-art methods designed for **GNN inference acceleration**, which include: (1) TinyGNN [36]. Distill the knowledge from a deep GNN teacher to a single-layer GNN while exploiting the local structure information within peer nodes. (2) GLNN [37]. Distill the knowledge from a deep GNN teacher to a simple MLP to eliminate the neighbor-fetching latency in GNN inference. Note that GLNN completely abandons the feature propagation to speed up the inference and can be seen as the extremely simplified case of NAI. (3) NOSMOG [38]. Enhance GLNN by encoding the graph structural information explicitly and utilizing the adversarial feature augmentation to ensure stable learning against noises. (4) Quantization [39]. Quantize model parameters from FP32 to INT8.

We evaluate our proposed method on three datasets with different scales and characteristics, including: a citation network (Ogbn-arxiv) [40], an image network (Flickr) [27] and a product co-purchasing network (Ogbn-products) [40]. In citation network, papers from different topics are considered as nodes and the edges are citations among the papers. The node attributes are word embedding vectors and each paper's topic is regarded as a node class. Flickr contains descriptions and properties of images and the node class is the image category. In Ogbn-products, the nodes representing products, and edges between two products indicate that the products are purchased together. Node features are generated from the product descriptions and the task is to predict the category of a product. The detailed descriptions of the datasets are provided in Table II.2

Footnote 2: The dataset split in GLNN [37] and NOSMOG [38] are different from ours since they further evaluate the method in the transductive setting.

**Evaluation metrics**. The performance of each baseline is evaluated by five criteria, including the accuracy of the test set (ACC), averaged multiplication-and-accumulation operations per node (MACs), averaged feature processing MACs per node (FP MACs), averaged inference time per node (Time) and averaged feature processing time per node (FP time).

Specifically, MACs for NAI evaluates 4 procedures, including stationary state computation, feature propagation, distance computation (or gate) and classification. Besides these procedures, the Time for NAI further contains the time of supporting node sampling. FP MACs and FP Time for NAI evaluate the feature propagation and distance computation (or gate) procedure.

**Implementation and Settings**. Without loss of generality, we use the symmetric normalization adjacency matrix \(\widetilde{\mathbf{D}}^{-\frac{1}{2}}\widetilde{\mathbf{A}}\widetilde{\mathbf{D }}^{-\frac{1}{2}}\) in all base models. We set all student classifiers to be the same as the teacher GNNs except for GLNN on dataset Ogbn-arxiv and Ogbn-products. We follow GLNN paper and set the hidden embedding size as 4-times and 8-times wider than the teacher GNN on Ogbn-arxiv and Ogbn-products to achieve higher accuracy. Moreover, for a fair comparison, we re-implement the position feature aggregation in NOSMOG by the matrix multiplication to show NOSMOG's real inference performance in the inductive setting.3

Footnote 3: In the released codes of NOSMOG, the aggregation of position features is calculated node-by-node, which is inefficient and time-consuming in real inference scenarios.

For each method, the hyper-parameters used in experiments are searched by the grid search method on the validation set or following the original papers. We use the ADAM optimization algorithm to train all the models. The best propagation depth \(k\) for each dataset and base model is searched together with learning rate, weight decay, and dropout to get the highest performance. Specifically, the values for \(k\), learning rate and weight decay are searched from [2, 10] with step 1, {0.6, 0.3, 0.1, 0.01, 0.001} and {0, 1e-3, 1e-4, 1e-5}. Dropout, \(T\) and \(\lambda\) are searching from [0, 0.7], [1, 2] and [0, 1] with step 0.1, respectively. The hyper-parameters of NAI under base model SGC are shown in Table III. Table IV shows the hyper-parameters for the NAI under other different base models.

To eliminate randomness, we repeat each method three times and report the mean performance. If not specified otherwise, the inference time is evaluated on the CPU with batch size 500. The codes are written in Python 3.9 and the operating system is Ubuntu 16.0. We use Pytorch 1.11.0 on CUDA 11.7 to train models on GPU. All experiments are conducted on a machine with Intel(R) Xeon(R) CPUs (Gold

\begin{table}
\begin{tabular}{l|c c c c c} \hline \hline Dataset & \(n\) & \(m\) & \(f\) & \(c\) & \(\pi\)Train/Val/Test \\ \hline Flickr & 89,250 & 899,756 & 500 & 7 & 44k/22k/22k \\ Ogbn-arxiv & 169,343 & 1,166,243 & 128 & 40 & 91k/30k/48k \\ Ogbn-products & 2,449,029 & 123,718,280 & 100 & 47 & 196k/39k/2,213k \\ \hline \hline \end{tabular}
\end{table} TABLE II: Datasets properties. \(n\), \(m\), \(f\) and \(c\) are the number of nodes, edges, feature dimensions and classes, respectively.

\begin{table}
\begin{tabular}{l|c c c} \hline \hline  & \(\mathrm{S}^{2}\mathrm{GC}\) & \(\mathrm{SIGN}\) & \(\mathrm{GAMLP}\) \\ \hline k & 10 & 5 & 5 \\ learning rate & 0.001 & 0.01 & 0.001 \\ weight decay & 1e-4 & 1e-5 & 1e-3 \\ dropout & 0.2 & 0.1 & 0.1 \\ \(T_{single}\) & 1 & 2 & 1.6 \\ \(\lambda_{single}\) & 0.1 & 0.9 & 0.9 \\ \(T_{multi}\) & 1.9 & 1.8 & 1.8 \\ \(\lambda_{multi}\) & 0.6 & 0.9 & 0.8 \\ \hline \hline \end{tabular}
\end{table} TABLE IV: The hyper-parameters for NAI under different models. \(*_{single}\) and \(*_{multi}\) mean the hyper-parameters for Single-Scale and Multi-Scale Distillation, respectively.

\begin{table}
\begin{tabular}{l|c c c} \hline \hline  & Flickr & Ogbn-arxiv & Ogbn-products \\ \hline k & 7 & 5 & 5 \\ learning rate & 0.001 & 0.001 & 0.01 \\ weight decay & 0 & 0 & 1e-4 \\ dropout & 0.3 & 0.3 & 0.1 \\ \(T_{single}\) & 1.2 & 1 & 1.1 \\ \(\lambda_{single}\) & 0.6 & 0.1 & 0.2 \\ \(T_{multi}\) & 1.9 & 1.5 & 1 \\ \(\lambda_{multi}\) & 0.8 & 0.1 & 0.1 \\ \hline \hline \end{tabular}
\end{table} TABLE III: The hyper-parameters for NAI under base model SGC. \(*_{single}\) and \(*_{multi}\) mean the hyper-parameters for Single-Scale and Multi-Scale Distillation, respectively.
5120 @ 2.20GHz) and NVIDIA TITAN RTX GPUs with 24GB GPU memory.

### _Performance Comparison_

To answer **Q1**, we compare \(\rm NAI_{d}\) and \(\rm NAI_{g}\) with other baselines under the base model: SGC. For NAIs, we select the hyper-parameters that prioritize the inference speed.

From Table V, we observe that both \(\rm NAI_{d}\) and \(\rm NAI_{g}\) achieve great balances between accuracy and inference speed. As for ACC, NAIs outperform the Quantization method and achieve the least ACC loss compared to vanilla SGC. Although Quantization also shows great accuracy, it only saves the classification computation and could not help to reduce the computation from feature processing. Benefiting from removing the feature propagation in the inference procedure, GLNN has the smallest MACs and the fastest inference speed. However, for the same reason, GLNN could not generalize well for inductive settings as analyzed in their paper. Even with the increased embedding size, the accuracies on Ogbn-arxiv and Ogbn-products decrease significantly. This indicates that ignoring topological information severely impairs the prediction of unseen nodes. Although NOSMOG imitates this problem by using Deepwalk and explicitly encoding the position information, it still has accuracy gaps compared with the base model. Compared to the single-layer GNN, NAIs outperform TinyGNN on all datasets. Although TinyGNN saves a part of the computation of feature propagation, the self-attention mechanism and linear transformation used in its peer-aware module cause a large number of extra computations. Especially in the dataset with high feature dimension, e.g., Flickr, the MACs are much more than vanilla SGC.

\(\rm NAI_{g}\) obtains better accuracy than \(\rm NAI_{d}\), which comes at the cost of more computations from gates. Compared with other baselines, \(\rm NAI_{d}\) and \(\rm NAI_{g}\) accelerate inference significantly by controlling the FP MACs, and \(\rm NAI_{d}\) achieves the 75\(\times\) Time speedup and 86\(\times\) FP Time speedup on Ogbn-products. Although the highest propagation depth is 5 on Ogbn-products, \(\rm NAI_{d}\) and \(\rm NAI_{g}\) both achieve nonlinear acceleration ratios since the number of supporting nodes and the adjacency matrix size grow at an exponential rate with the propagation depth. This verifies the effectiveness of generating personalized propagation depth by using the NAI framework.

Besides the speed-first results in Table V, the NAI framework allows users to choose more accurate results based on the latency constraints.

Figure 4 shows the trade-off between accuracy and inference time in different hyper-parameter settings. We select 3 typical settings for each dataset and method, which are denoted as "\(\rm NAI_{s}^{1}\)", "\(\rm NAI_{s}^{2}\)" and "\(\rm NAI_{s}^{3}\)", respectively. Note that "\(\rm NAI_{s}^{1}\)" is the speed-first setting in Table V. From Figure 4, NAIs achieve the highest classification accuracy and are even superior to vanilla SGC. This is due to that NAP mitigates the over-smoothing problem and Inception Distillation enhances the classifiers (Table VII and VIII in the next subsection evaluate their impacts). For example, on Flickr, \(\rm NAI_{d}^{3}\) and

\begin{table}
\begin{tabular}{l|l l l l l|l l l l l l|l
\(\mathrm{NAI}_{\mathrm{g}}^{3}\) achieve more accurate results while spending a similar inference time with SGC. \(\mathrm{NAI}_{\mathrm{g}}^{2}\) speed up \(\mathrm{NAI}_{\mathrm{g}}^{3}\) by 1.8\(\times\), and \(\mathrm{NAI}_{\mathrm{d}}^{2}\) accelerates \(\mathrm{NAI}_{\mathrm{d}}^{3}\) by 2.1\(\times\) with little accuracy drop. More detailed comparisons between \(\mathrm{NAI}_{\mathrm{g}}\) and \(\mathrm{NAI}_{\mathrm{d}}\) can be found in Section III-C.

Table VI shows the detailed test node distributions selected from a single run, i.e., the number of nodes at different propagation depths, for different datasets and hyper-parameter settings. The depth increases from 1 (left) to \(k\) (right). From Table VI, we observe that most of the nodes of \(\mathrm{NAI}_{\mathrm{d}}^{2}\) on Flickr adopt the propagated features at depth 4. This successfully reduces the number of supporting nodes and saves the computation of the feature propagation. To get the best accuracy, \(\mathrm{NAI}_{\mathrm{d}}^{3}\) makes full use of each classifier, and the propagation depths of tested nodes are various. As for the \(\mathrm{NAI}_{\mathrm{d}}^{1}\) on Ogbn-products, all nodes adopt the propagated features at depth 2 to trade off the inference speed and accuracy. It demonstrates the flexibility of the \(\mathrm{NAI}\) framework, and the fixed propagation depth used in classic GNNs is the special case of our proposed method.

### _Ablation Study_

To thoroughly evaluate our method and answer **Q2-3**, we provide ablation studies on: (1) Node-Adaptive Propagation; (2) Inception Distillation.

Table VII shows the performance of \(\mathrm{NAI}_{\mathrm{d}}\), \(\mathrm{NAI}_{\mathrm{g}}\) and NAI without NAP under different hyper-parameter settings on Ogbn-arxiv and Ogbn-products. ACC and Time values are averaged over 3 runs and the node distributions are selected from a single run. Their maximum propagation depths \(k=5\), and \(T_{max}=1\) is omitted due to the same inference accuracy. Note that the accuracies of "NAI w/o NAP" do not grow monotonically with \(T_{max}\) because the Inception Distillation enhances the classifiers independently. Comparing \(\mathrm{NAI}_{\mathrm{d}}\) with "NAI w/o NAP" under the same \(T_{max}\), accuracies are all improved with less inference latency. To achieve a fast inference speed under the same \(T_{max}\), tested nodes adopt various propagation depths, contributing to both accuracy improvement and computation saving. \(\mathrm{NAI}_{\mathrm{g}}\) achieves much better accuracy than \(\mathrm{NAI}_{\mathrm{d}}\). This improvement comes from the powerful representation ability of gates and at the cost of the computation and inference time. For example, when \(T_{max}=3\), the inference time of \(\mathrm{NAI}_{\mathrm{g}}\) on Ogbn-arxiv is larger than both \(\mathrm{NAI}_{\mathrm{d}}\) and "NAI w/o NAP". However, when more nodes adopt lower propagation depths, \(\mathrm{NAI}_{\mathrm{g}}\) can perform better. When \(T_{max}=4\), \(\mathrm{NAI}_{\mathrm{g}}\) is more efficient and effective than \(\mathrm{NAI}_{\mathrm{d}}\).

Besides NAP, Inception Distillation is designed to explore multi-scale knowledge and improve the inference accuracy. We evaluate the accuracy of \(f^{(1)}\), which has the worst performance among classifiers, to show the effectiveness of each component in Inception Distillation. Table VIII displays the results of NAI without Inception Distillation ("w/o ID"), NAI without Single-Scale Distillation ("w/o SS"), NAI without Multi-Scale Distillation ("w/o MS") and NAI. First, the Multi-Scale Distillation explores multi-scale receptive fields and constructs a more powerful teacher via self-attention mechanism, contributing to improvements on all datasets when comparing NAI with NAI w/o MS. For example, when ignoring the Multi-Scale Distillation, the accuracy of NAI will drop 0.44% on Flickr. Besides, Single-Scale Distillation provides a solid foundation for Multi-Scale Distillation. With more accurate classifiers, the ensemble teacher will be more expressive and powerful, which could provide higher-quality supervision signals. The classification results will decrease on all datasets when Single-Scale Distillation is removed. With the help of Single-Scale Distillation, the accuracy of Multi-Scale Distillation has a 2.04% increase on the dataset Flickr. These results indicate that Single-Scale and Multi-Scale Distillation are essential to NAI.

### _Generalization_

In addition to SGC, our proposed NAI framework can be applied to any Scalable GNNs. To answer **Q3**, we test the generalization ability of \(\mathrm{NAI}_{\mathrm{d}}\) and \(\mathrm{NAI}_{\mathrm{g}}\) by deploying them on SIGN, \(\mathrm{S}^{2}\mathrm{GC}\) and GAMLP. The hyper-parameters,

\begin{table}
\begin{tabular}{c|c c c} \hline \hline  & & Flickr & Ogbn-arxiv & Ogbn-products \\ \hline NAI w/o ID & 40.86 & 65.54 & 70.17 \\ NAI w/o MS & 44.41 & 65.91 & 70.28 \\ NAI w/o SS & 42.81 & 66.08 & 70.37 \\ NAI & 44.85 & 66.10 & 70.49 \\ \hline \hline \end{tabular}
\end{table} TABLE VIII: The ablation study on the Inception Distillation. Accuracy (%) is averaged over 3 runs.

\begin{table}
\begin{tabular}{c|c|c c c|c c c} \hline \hline  & & \multicolumn{4}{c|}{Ogbn-arxiv} & \multicolumn{4}{c}{Ogbn-products} \\ \hline \(T_{max}\) & Method & ACC (\%) & Time (ms) & Node distribution & ACC (\%) & Time (ms) & Node distribution \\ \hline \multirow{3}{*}{2} & NAI w/o NAP & 69.16 & 202.7 & [0, 48603, 0, 0, 0] & 73.70 & 923.2 & [0, 2213091, 0, 0, 0] \\  & \(\mathrm{NAI}_{\mathrm{d}}\) & 69.25 & 128.4 & [184967454, 0, 0, 0] & 73.70 & 923.2 & [0, 2213091, 0, 0, 0] \\  & \(\mathrm{NAI}_{\mathrm{g}}\) & 69.34 & 195.5 & [20524 e551, 0, 0] & 73.89 & 1088.3 & [452412, 210757, 0, 0, 0] \\ \cline{1-1} \cline{2-7}  & NAI w/o NAP & 69.38 & 454.2 & [0, 48603, 0, 0] & 73.95 & 17121.5 & [0, 0, 2213091, 0, 0] \\  & \(\mathrm{NAI}_{\mathrm{d}}\) & 69.48 & 427.4 & [0, 20528, 2075, 0, 0] & 73.97 & 16914.3 & [0, 1086, 2212050, 0, 0] \\  & \(\mathrm{NAI}_{\mathrm{g}}\) & 69.53 & 455.7 & [0, 16420, 23183, 0, 0] & 74.03 & 16223.9 & [0, 1369671, 8, 34420, 0] \\ \hline \multirow{3}{*}{4} & NAI w/o NAP & 69.26 & 889.3 & [0, 0, 48603, 0] & 74.57 & 422322.2 & [0, 0, 0, 2213091, 0] \\  & \(\mathrm{NAI}_{\mathrm{d}}\) & 69.52 & 816.6 & [0, 30303, 5898, 12402, 0] & 74.58 & 39474.8 & [0, 1384, 239, 2211468, 0] \\ \cline{1-1}  & \(\mathrm{NAI}_{\mathrm{d}}\) & 69.66 & 806.4 & [0, 31519, 11344, 5740, 0] & 74.66 & 37662.0 & [0, 0, 095524, 307567, 0] \\ \hline \multirow{3}{*}{5} & NAI w/o NAP & 69.36 & 1296.4 & [0, 0, 0, 48603] & 74.24 & 68938.8 & [0, 0, 0, 2213091] \\ \cline{1-1}  & \(\mathrm{NAI}_{\mathrm{d}}\) & 69.82 & 1198.9 & [0, 16503, 12221, 1077, 18802] & 74.58 & 67523.2 & [0, 0, 2213068, 23] \\ \cline{1-1}  & \(\mathrm{NAI}_{\mathrm{g}}\) & 69.90 & 1224.7 & [0, 0, 13215, 3864, 31524] & 74.69 & 68087.0 & [0, 4, 488514, 3105162, 423015] \\ \hline \hline \end{tabular}
\end{table} TABLE VII: The ablation study on NAPs under different \(T_{max}\). The propagation depth of node distribution increases from 1 to \(k=5\).
including the classifier structure, are searched to get the best performance for each base model. The detailed hyper-parameters are listed in Table IV.

The accuracy and inference time results of SIGN, \(\mathrm{S^{2}GC}\) and GAMLP are shown in Table IX, X and XI, respectively. NAIs consistently outperform the other baselines when considering both accuracy and inference speedup. Compared to GLNN, \(\mathrm{NAI_{d}}\) can improve the accuracy for 4.18%, 2.35% and 3.90% on SIGN, \(\mathrm{S^{2}GC}\), and GAMLP, respectively. Although the attention mechanism used in TinyGNN requires a large number of MACs, the feature propagation is more time-consuming and the acceleration ratios for different base models are ranging from 1.2\(\times\) to 2.9\(\times\) compared with vanilla GNNs. Quantization achieves the smallest accuracy loss but the acceleration ratio is limited. When applying \(\mathrm{NAI_{d}}\) to SIGN, \(\mathrm{S^{2}GC}\) and GAMLP, the FP Time can be accelerated by \(20\times\), \(43\times\) and \(12\times\). Considering the other computations, i.e., the computation of stationary state and classification, the corresponding inference time are accelerated by \(10\times\), \(26\times\) and \(8\times\). The best acceleration result of \(\mathrm{NAI_{g}}\) is shown in \(\mathrm{S^{2}GC}\). It achieves \(24\times\) and \(27\times\) speedup for inference time and MACs, respectively.

### _Effect of Batch Size_

The inference of GNNs is related to the batch size because the number of supporting nodes grows with the increase of the batch size. To answer **Q4**, we evaluate different methods and report the averaged MACs and inference time in different batch sizes on Flickr. The batch size changes from 100 to 2000, and all other settings and accuracy performances are the same as Table V.

The detailed results are shown in Figure 5. For the base model SGC, both MACs and inference time keep at the same magnitude with the growth of batch size. Specifically, when the batch size changes from 100 to 2000, the MACs increase from 2282.8 to 2613.0, and the inference time increases from 2396.0 ms to 2701.1 ms. The Quantization has the same performance trend as the base model in both MACs and inference time. However, TinyGNN shows a strong positive correlation with the batch size and the inference time exceeds SGC when the batch size is 1000. When the batch size grows to 2000, the number of MACs reaches 16917.9 and the inference time is 8725.0 ms. This performance degradation of TinyGNN comes from the heavy computations of the attention mechanism used in its peer-aware module. Benefiting from the extremely simplified MLP model, the number of MACs of GLNN is kept around 100, and the inference time is around 10 ms. For NOSMOG, the position feature aggregation for unseen nodes causes the MACs and inference time overhead compared with GLNN. For our proposed \(\mathrm{NAI_{d}}\) and \(\mathrm{NAI_{g}}\), the number of MACs increases with the growth of batch size. This is due to that NAI requires the extra calculation of the stationary feature state \(\mathbf{X}^{(\infty)}\) and distances (or gates) for all target nodes in the batch. However, these procedures can be fast calculated by matrix multiplication and subtraction, resulting in stable inference time performances in different batch sizes.

### _Parameter Sensitivity Analysis_

Temperature \(T\) and weight \(\lambda\) are two influential hyper-parameters for Inception Distillation. Moreover, the ensemble number \(r\) controls the teacher quality in Multi-Scale Distilla

\begin{table}
\begin{tabular}{l|c c c c c} \hline  & ACC & \#mMACs & \#FP mMACs & Time & FP Time \\ \hline \(\mathrm{S^{2}GC}\) & 50.08 & 3897.8 & 3889.2 & 3959.5 & 3717.6 \\ GLNN & 46.59 & 8.6 & 0 & 9.5 & 0 \\ NOSMOG & 48.19 & 9.0 & 0.1 & 31.6 & 17.3 \\ TinyGNN & 46.89 & 8855.1 & 8846.5 & 1366.7 & 1355.0 \\ Quantization & 49.10 & 3897.8 & 3889.2 & 3946.9 & 3714.6 \\ \hline \(\mathrm{NAI_{d}}\) & 48.94 & 120.1 (32) & 89.0 (44) & 149.9 (26) & 86.3 (43) \\ \(\mathrm{NAI_{g}}\) & 49.66 & 142.1 (27) & 97.7 (40) & 165.6 (24) & 88.0 (42) \\ \hline \end{tabular}
\end{table} TABLE X: Inference comparison under base model \(\mathrm{S^{2}GC}\) on Flickr. ACC is evaluated in percentage. Time and FP Time are evaluated in millisecond. Acceleration ratios between NAI and vanilla GNNs are shown in brackets.

\begin{table}
\begin{tabular}{l|c c c c c} \hline  & ACC & \#mMACs & \#FP mMACs & Time & FP Time \\ \hline SIGN & 51.00 & 1574.8 & 1526.8 & 1667.1 & 1569.0 \\ GLNN & 46.84 & 8.1 & 0 & 7.8 & 0 \\ NOSMOG & 48.24 & 8.5 & 0.1 & 32.8 & 17.2 \\ TinyGNN & 47.21 & 8862.2 & 8846.1 & 1356.1 & 1345.9 \\ Quantization & 45.87 & 1574.9 & 1526.8 & 1654.3 & 1565.0 \\ \hline \(\mathrm{NAI_{d}}\) & 51.02 & 135.0 (12) & 112.5 (14) & 170.4 (10) & 78.7 (20) \\ \(\mathrm{NAI_{g}}\) & 50.93 & 135.2 (12) & 112.8 (14) & 181.3 (9) & 86.6 (18) \\ \hline \end{tabular}
\end{table} TABLE IX: Inference comparison under base model SIGN on Flickr. ACC is evaluated in percentage. Time and FP Time are evaluated in millisecond. Acceleration ratios between NAI and vanilla GNNs are shown in brackets.

Fig. 5: The number of MACs and inference time comparison among different methods and batch sizes on the dataset Flickr.
tion. To analyze the influence of these hyper-parameters and answer **Q5**, we conduct the experiment on Flickr and the base model is SGC. The classification performances of \(f^{(1)}\) in terms of hyper-parameters are shown in Figure 6. Firstly, \(\lambda\) is quite important which could significantly affect the classification result. For example, \(\lambda\) for Multi-Scale Distillation should be controlled between 0.8 and 1 to get better performance. This indicates that the supervision provided by the ensemble teacher is more important than the hard label. In contrast, \(\lambda\) for Single-Scale Distillation should be selected carefully to balance two losses. Following the increase of \(T\), the performance of Multi-Scale Distillation decreases first and then increases. Thus, limiting \(T\) to a larger value and using softer labels works best. The Single-Scale Distillation results in terms of \(T\) show that decreasing temperature could help enhance the classification performance. \(T\) should be controlled in the range of [1, 1.2]. Finally, the results in terms of \(r\) show that increasing the number of combined predictions could help enhance the classification performance. But it also introduces more unreliable labels in model training. Especially when introducing the low-quality labels from \(f^{(1)}\), the classification result drops rapidly.

To sum up, Inception Distillation gets stable and high classification performances when \(\lambda\) ranges from 0.5 to 1. Softer labels and an appropriate ensemble number should be applied to Multi-Scale Distillation for better performance.

## IV Related Works

To deploy the model on large-scale graphs, researchers propose various techniques to accelerate training and inference, which can be categorized into the model perspective and the algorithm perspective.

**Acceleration models.** From the model perspective, the acceleration model mainly contain sampling-based and scalable models. Besides the models studied in this paper, sampling-base models can be divided into three categories according to sampling methods: node-wise [12, 24, 41]/ layer-wise [42, 43, 44]/ graph-wise [27, 30] sampling. Although sampling-based GNNs mitigate the neighbor explosion problem by restricting the number of neighbors, they are greatly influenced by sampling quality and suffer from the high variance problem when applied to inference. As a result, the inference procedure typically adheres to conventional GNNs. A distinct sampling method for GNNs acceleration is PPRGo [24]. PPRGo utilizes the personalized PageRank to replace the hierarchical feature propagation and then proposes an approximate method to select top-k neighbor nodes and speed up the PageRank matrix calculation. Compared with our NAI, PPRGo focuses on the different GNN framework which conducts the propagation process after the transformation process [25] to solve the over-smoothing problem. This makes PPRGo must be trained end-to-end and could not be generalized to Scalable GNNs studied in this paper. Instead of using neighbor sampling or matrix approximate calculation, NAI can adaptively generate personalized propagation depth for each node and achieves great generalization ability.

**Acceleration algorithms**. From the algorithm perspective, acceleration methods include pruning, quantization and knowledge distillation (KD). Pruning methods designed for GNNs [45, 46, 47] reduce the dimension of embeddings in each hidden layer to save the computation. Quantization [48] uses low-precision integer arithmetic during inference to speed up the computation. However, these two kinds of methods concentrate on reducing the computation of feature transformation and classification, and raw features are preserved to avoid performance degradation. This limits the acceleration performance considering that feature propagation accounts for the most proportion of runtime. KD aims to train a lightweight model which has a similar performance to the teacher model, thus has been exploited in recent inference acceleration researches. Most KD methods for GNNs try to enhance the student performance by introducing high-order structural information because the receptive field is bound to the number of GNNs layers [49, 50, 51, 52]. Besides, GraphAKD [53] leverages adversarial training to decrease the discrepancy between teacher and student. ROD [54] uses multiple receptive field information to provide richer supervision signals for sparsely labeled graphs. RDD [55] defines the node and edge reliability to make better use of high-quality data. Different from the above works which concentrate on improving the performance of a single classifier, the Inception Distillation in NAI focuses on multi-scale knowledge transfer and boosts the performance for multiple students.

## V Conclusion

We present Node-Adaptive Inference (NAI), a general inference acceleration framework for Scalable GNNs. NAI can successfully reduce the redundancy computation in feature propagation and achieve adaptive node inference with personalized propagation depths. With the help of Inception Distillation, NAI exploits multi-scale receptive field knowledge and compensates for the potential inference accuracy loss. Extensive experiments on large-scale graph datasets verified that NAI has high acceleration performance, good generalization ability, and flexibility for different latency constraints. NAI drives the industrial applications of Scalable GNNs, especially in streaming and real-time inference scenarios.

Fig. 6: Parameter sensitivity results of NAIs under the base model SGC on Flickr.