Asymmetric Learning for Graph Neural Network based Link Prediction
Link prediction is a fundamental problem in many graph based applications,
such as protein-protein interaction prediction. Graph neural network (GNN) has
recently been widely used for link prediction. However, existing GNN based link
prediction (GNN-LP) methods suffer from scalability problem during training for
large-scale graphs, which has received little attention by researchers. In this
paper, we first give computation complexity analysis of existing GNN-LP
methods, which reveals that the scalability problem stems from their symmetric
learning strategy adopting the same class of GNN models to learn representation
for both head and tail nodes. Then we propose a novel method, called asymmetric
learning (AML), for GNN-LP. The main idea of AML is to adopt a GNN model for
learning head node representation while using a multi-layer perceptron (MLP)
model for learning tail node representation. Furthermore, AML proposes a
row-wise sampling strategy to generate mini-batch for training, which is a
necessary component to make the asymmetric learning strategy work for training
speedup. To the best of our knowledge, AML is the first GNN-LP method adopting
an asymmetric learning strategy for node representation learning. Experiments
on three real large-scale datasets show that AML is 1.7X~7.3X faster in
training than baselines with a symmetric learning strategy, while having almost
no accuracy loss.
Kai-Lang Yao, Wu-Jun Li
# Asymmetric Learning for

###### Abstract

Link prediction is a fundamental problem in many graph based applications, such as protein-protein interaction prediction. Graph neural network (GNN) has recently been widely used for link prediction. However, existing GNN based link prediction (GNN-LP) methods suffer from scalability problem during training for large-scale graphs, which has received little attention by researchers. In this paper, we first give computation complexity analysis of existing GNN-LP methods, which reveals that the scalability problem stems from their symmetric learning strategy adopting the same class of GNN models to learn representation for both head and tail nodes. Then we propose a novel method, called asymmetric learning (AML), for GNN-LP. The main idea of AML is to adopt a GNN model for learning head node representation while using a multi-layer perceptron (MLP) model for learning tail node representation. Furthermore, AML proposes a row-wise sampling strategy to generate mini-batch for training, which is a necessary component to make the asymmetric learning strategy work for training speedup. To the best of our knowledge, AML is the first GNN-LP method adopting an asymmetric learning strategy for node representation learning. Experiments on three real large-scale datasets show that AML is 1.7\(\times\)\(\sim\)7.3\(\times\) faster in training than baselines with a symmetric learning strategy, while having almost no accuracy loss.

## 1 Introduction

Link prediction [10], a fundamental problem in many graph based applications, aims to predict the existence of a link that has not been observed. Link prediction problem widely exists in real applications, like drug response prediction [14], protein-protein interaction prediction [11], friendship prediction in social networks [1], knowledge graph completion [15, 16, 17] and product recommendation in recommender systems [18]. Its increased importance in real applications also promotes a great interest in research for link prediction algorithms in the machine learning community.

Link prediction algorithms have been studied for a long time [19, 18, 17], while learning based algorithms are one dominant class in the past decades. The main idea of learning based algorithms is to learn a deterministic model [13, 14, 15] or a probabilistic model [16, 18, 17] to fit the observed data. In most learning based algorithms, models learn or generate a representation for each node [16], which is used to generate a score or probability of link existence. Traditional learning based algorithms typically do not adopt graph neural network (GNN) for node representation learning. Although these non-GNN based learning algorithms have achieved much progress in many applications, they are less expressive than GNN in node representation learning.

Recently, graph neural network based link prediction (GNN-LP) methods have been proposed and become one of the most popular algorithms due to their superior performance in accuracy. The key to the success of GNN-LP methods is that they learn node representation from graph structure
and node features in a unified way with GNN, which is a major difference between them and traditional non-GNN based learning algorithms. Existing GNN-LP methods mainly include local methods [21, 17, 23, 24] and global methods [14, 15, 16, 17, 25]. Local methods apply GNN to subgraphs that capture local structural information. Specifically, they first extract an enclosed \(k\)-hop subgraph for each link and then use various labeling tricks [23] to capture the relative positions of nodes in the subgraph. After that, they learn node representation by applying a GNN model to the labeled subgraphs, and then they extract subgraph representation with a readout function [18] for prediction. Global methods learn node representation by directly applying a GNN model to the global graph and then make prediction based on head and tail node representation. Although there exists difference in local methods and global methods, all existing GNN-LP methods have a common characteristic that they adopt a symmetric learning strategy for node representation learning. In particular, they adopt the same class of GNN models to learn representation for both head and tail nodes. An illustration of existing representative GNN-LP methods is presented in Figure 1. Although existing GNN-LP methods have made much progress in learning expressive models, they suffer from scalability problem during training for large-scale graphs, which has attracted little attention by researchers.

In this paper, we propose a novel method, called asymmetric learning (AML), for GNN-LP. The contributions of this paper are listed as follows:

* We give computation complexity analysis of existing GNN-LP methods, which reveals that the scalability problem stems from their symmetric learning strategy adopting the same class of GNN models to learn representation for both head and tail nodes.
* AML is the first GNN-LP method adopting an asymmetric learning strategy for node representation learning.
* AML proposes a row-wise sampling strategy to generate mini-batch for training, which is a necessary component to make the asymmetric learning strategy work for training speedup.
* Experiments on three real large-scale datasets show that AML is 1.7\(\times\)\(\sim\)7.3\(\times\) faster in training than baselines with a symmetric learning strategy, while having almost no accuracy loss.

## 2 Preliminary

In this section, we introduce notations and some related works for link prediction.

Figure 1: An illustration of existing representative GNN-LP methods. A circle denotes a node. \(\mathcal{G}\) denotes the input graph. \(\mathcal{G}_{1}\) denotes a subgraph extracted from \(\mathcal{G}\). The dashed line between the red and blue circles denotes the target link we want to predict. \(\mathbf{X}\) denotes the node feature matrix. The red and blue rectangles denote the representation of the red and blue circles, respectively. The gray rectangle denotes the subgraph representation of \(\mathcal{G}_{1}\) generated by applying a readout function on representation of the nodes within the subgraph.
Notations.We use a boldface uppercase letter, such as \(\mathbf{B}\), to denote a matrix. We use a boldface lowercase letter, such as \(\mathbf{b}\), to denote a vector. \(\mathbf{B}_{i*}\) and \(\mathbf{B}_{*j}\) denote the \(i\)th row and the \(j\)th column of \(\mathbf{B}\), respectively. \(\mathbf{X}\mathbf{\in}\mathbb{R}^{N\times u}\) denotes the node feature matrix, where \(u\) is the feature dimension and \(N\) is the number of nodes. \(\mathbf{A}\mathbf{\in}\{0,1\}^{N\times N}\) denotes the adjacency matrix of a graph \(\mathcal{G}\). \(A_{ij}\)=1 iff there is an edge from node \(i\) to node \(j\), otherwise \(A_{ij}\)=0. \(L\) denotes the number of layers for GNN models. \(\mathcal{E}\) denotes the set of links for training. For a link \((i,j)\), we call node \(i\) a _head node_ and call node \(j\) a _tail node_.

Graph Neural Network.GNN [14, 15, 16, 17, 18, 19] is a class of models for learning over graph data. In GNN, nodes can iteratively encode their first-order and high-order neighbor information in the graph through message passing between neighbor nodes [15]. Due to the iteratively dependent nature, the computation complexity for a node exponentially increases with iterations. Although some works [15, 16, 16, 17] propose solutions for the above problem of exponential complexity, the computation complexity of GNN is still much higher than that of a multi-layer perceptron (MLP).

Graph Neural Network based Link Prediction.Benefited from the powerful ability of GNN in modeling graph data, GNN-LP methods are more expressive than traditional non-GNN based learning algorithms in node representation learning. GNN-LP methods include two major classes, local methods and global methods. For local methods, different methods vary in the labeling tricks they use, which mainly include double radius node labeling (DRNL) [18], distance encoding (DE) [19], partial zero-one labeling trick [16] and zero-one labeling trick [16]. As shown in [16], local methods with DRNL and DE perform better than other methods. However, one bottleneck for DRNL and DE is that they need to compute the shortest path distance (SPD) between target nodes and other nodes in subgraphs, and computing SPD is time-consuming during the training process [16]. Although we can compute SPD in the preprocessing step, costly storage overhead for subgraphs occurs instead. For global methods [15, 17, 18, 19, 18], they mainly apply different GNN models on the global graphs to generate node representation. Almost all existing GNN-LP methods, including both local methods and global methods, adopt a symmetric learning strategy which utilizes the same class of GNN models to learn representation for both head and tail nodes.

Non-GNN based Methods.Besides GNN-LP methods, WLNM [18] and SUREL [16] also show competitive performance in accuracy. The main difference between them and GNN-LP methods is that they do not apply GNN to learn from graphs or subgraphs. For example, WLNM applies an MLP model to learn subgraph representation from the adjacency matrices of extracted subgraphs. SUREL proposes an alternative sampler for subgraph extraction and applies a sequential model, like recurrent neural networks (RNNs), to learn subgraph representation.

In general, GNN-LP methods have higher accuracy than non-GNN based methods [16], but suffer from scalability problem during training for large-scale graphs. Although global GNN-LP methods are more efficient than local GNN-LP methods, they still have high computation complexity in training due to the adopted symmetric learning strategy. This motivates our work in this paper.

## 3 Asymmetric Learning for GNN-LP

Like most deep learning methods, GNN-LP methods are typically trained in a mini-batch manner. Suppose the number of links in the training set is \(|\mathcal{E}|\). Then existing GNN-LP methods with symmetric learning need to perform \(2|\mathcal{E}|\) times of GNN computation within each epoch. In particular, \(|\mathcal{E}|\) times of GNN computation are for head nodes and another \(|\mathcal{E}|\) times of GNN computation are for tail nodes. It is easy to verify that \(|\mathcal{E}|\) times of GNN computation are inevitable for both head and tail node representation learning with a symmetric learning strategy. Since GNN is of exponential computation complexity and \(|\mathcal{E}|\) is of a considerably large value, existing GNN-LP methods incur a huge computation burden for large-scale graphs.

To solve the scalability problem caused by symmetric learning, we propose AML which is illustrated in Figure 2. The main idea of AML is to adopt a GNN model for learning head node representation while using a multi-layer perceptron (MLP) model for learning tail node representation. Meanwhile,
AML pre-encodes graph structure to avoid information loss for MLP. The following content of this section will present the details of AML.

### Node Representation Learning with AML

We use \(\mathbf{U}{\in}\mathbb{R}^{N\times r}\) to denote the representation of all head nodes and use \(\mathbf{V}{\in}\mathbb{R}^{N\times r}\) to denote the representation of all tail nodes, where each row of \(\mathbf{U}\) and \(\mathbf{V}\) corresponds to a node. We apply a GNN model to learn representation for head nodes while using an MLP model to learn representation for tail nodes1.

Footnote 1: We can also apply a GNN model to learn representation for tail nodes while using an MLP model to learn representation for head nodes. For convenience, we only present the technical details of one case. The technical details for the reversed case are the same as the presented one.

We take SAGE [1], one of the most representative GNN models, as an example to describe the details. Note that other GNN models can also be used in AML. Let \(\hat{\mathbf{A}}\) denote the normalization of \(\mathbf{A}\), which can be row-normalization, column-normalization or symmetric normalization. Formulas for one layer in SAGE are as follows:

\[\mathbf{U}^{(\ell)}_{i*}=f\left(\hat{\mathbf{A}}_{i*}\mathbf{U}^{(\ell-1)} \mathbf{W}^{(\ell)}_{1}+\mathbf{U}^{(\ell-1)}_{i*}\mathbf{W}^{(\ell)}_{2} \right), \tag{1}\]

where \(\ell\) is layer number, \(f(\cdot)\) is an activation function, \(\mathbf{W}^{(\ell)}_{1}{\in}\mathbb{R}^{r\times r}\) and \(\mathbf{W}^{(\ell)}_{2}{\in}\mathbb{R}^{r\times r}\) are learnable parameters at layer \(\ell\). \(\mathbf{U}^{(\ell)}{\in}\mathbb{R}^{N\times r}\) is the node representation at layer \(\ell\) and \(\mathbf{U}^{(0)}{=}\mathbf{X}\). In (1), node \(i\) encodes neighbor information via \(\hat{\mathbf{A}}_{i*}\mathbf{U}^{(\ell-1)}\mathbf{W}^{(\ell)}_{1}\) and updates its own message together with \(\mathbf{U}^{(\ell-1)}_{i*}\mathbf{W}^{(\ell)}_{2}\).

Different from existing GNN-LP methods which adopt the same class of GNN models to learn representation for both head and tail nodes, AML applies an MLP model to learn representation for tail nodes. However, naively applying MLP for tail nodes will deteriorate the accuracy. Hence, as in [12, 13, 14], we first pre-encode graph structure information into node features in the preprocessing step. The pre-encoding step is as follows:

\[\tilde{\mathbf{V}}^{(0)}=\hat{\mathbf{A}}^{L}\mathbf{X}. \tag{2}\]

To further improve the representation learning for tail nodes, we propose to transfer knowledge from head nodes to tail nodes by sharing parameters. The formula is as follows:

\[\tilde{\mathbf{V}}^{(\ell)}=f\left(\tilde{\mathbf{V}}^{(\ell-1)}\mathbf{W}^{ (\ell)}_{1}+\tilde{\mathbf{V}}^{(\ell-1)}\mathbf{W}^{(\ell)}_{2}\right), \tag{3}\]

Figure 2: An illustration of AML. The MLP model \(\mathcal{M}_{1}\) is for transfering knowledge from head nodes to tail nodes by sharing parameters with the GNN model. The MLP model \(\mathcal{M}_{2}\) is for learning over the residual between \(\mathbf{A}^{L}\mathbf{X}\) and \(\mathbf{X}\). AML obtains the tail node representation, marked with the blue rectangle, by summing up the outcomes of \(\mathcal{M}_{1}\) and \(\mathcal{M}_{2}\). AML obtains the head node representation, marked with the red rectangle, by summing up the tail node representation and the outcomes of the GNN model. The predictor is for generating predictions according to the input vector representation.
where we perform knowledge transfer between head nodes and tail nodes by sharing \(\mathbf{W}_{1}^{(\ell)}\) and \(\mathbf{W}_{2}^{(\ell)}\). Since sharing parameters somewhat restricts the expressiveness of \(\tilde{\mathbf{V}}^{(L)}\), we propose to apply an MLP model to learn over the residual \(\Delta^{(0)}\). Adding the residual \(\Delta^{(L)}\) to \(\tilde{\mathbf{V}}^{(L)}\), we obtain the representation for tail nodes which is shown as follows:

\[\Delta^{(0)} =\mathbf{X}-\hat{\mathbf{A}}^{L}\mathbf{X}, \tag{4}\] \[\Delta^{(\ell)} =f\left(\Delta^{(\ell-1)}\mathbf{W}^{(\ell)}\right),\] (5) \[\mathbf{V}^{(L)} =\tilde{\mathbf{V}}^{(L)}+\Delta^{(L)}, \tag{6}\]

where \(\mathbf{W}^{(\ell)}\in\mathbb{R}^{r\times r}\) is a learnable parameter at layer \(\ell\).

Note that if BatchNorm [15] is applied to \(\mathbf{U}^{(\ell)}\) and \(\tilde{\mathbf{V}}^{(\ell)}\), we keep individual parameters of BatchNorm for \(\mathbf{U}^{(\ell)}\) and \(\tilde{\mathbf{V}}^{(\ell)}\). Since \(\mathbf{U}^{(\ell)}\) and \(\tilde{\mathbf{V}}^{(\ell)}\) have different scales and lie in different representation spaces, it is reasonable to keep individual parameters of BatchNorm for them. Here pre-encoding step only needs to be performed once and the resulting \(\hat{\mathbf{A}}^{L}\mathbf{X}\) in (2) can be saved for the entire training process.

### Learning Objective of AML

According to the definitions in (1) and (6), modeling links with \(\mathbf{U}^{(L)}\) and \(\mathbf{V}^{(L)}\) can capture directed relations while being a little difficult to capture undirected relations. Our solutions are twofold. Firstly, we formulate each undirected link by two directed ones with opposite directions. Secondly, motivated by the work in [11], in AML we propose to model both _homophily_ and _stochastic equivalence_[10]. As a result, the formulas for the prediction of a pair \((i,j)\) are as follows:

\[\mathbf{U}=\mathbf{U}^{(L)}+\mathbf{V}^{(L)},\quad\mathbf{V}= \mathbf{V}^{(L)}, \tag{7}\] \[S_{ij}=f_{\mathbf{\Theta}}\left(\mathbf{U}_{i*}\odot\mathbf{V}_ {j*}\right), \tag{8}\]

where \(\mathbf{U}\) and \(\mathbf{V}\) are representation for head and tail nodes, respectively. \(\mathbf{V}^{(L)}\) in \(\mathbf{U}\) is included to model the _homophily_ feature in graph data. \(S_{ij}\) is the prediction for the pair \((i,j)\). \(\odot\) denotes element-wise multiplication. \(f_{\mathbf{\Theta}}(\cdot)\) is an MLP model with parameter \(\mathbf{\Theta}\).

Given node representation \(\mathbf{U}\) and \(\mathbf{V}\), the learning objective of link prediction is as follows:

\[\min_{\mathcal{W}}\frac{1}{|\mathcal{E}|}\sum_{(i,j)\in\mathcal{E}}f_{loss}(S_ {ij},Y_{ij})+\frac{\lambda}{2}\sum_{\mathbf{W}\in\mathcal{W}}\|\mathbf{W}\|_{ F}^{2}, \tag{9}\]

where \(\mathcal{E}\) denotes the training set. \(\mathcal{W}\) is the set of all learnable parameters. \(Y_{ij}\) is the ground-truth label for the pair \((i,j)\). \(f_{loss}(\cdot,\cdot)\) is a loss function, such as cross-entropy loss. \(\lambda\) is a coefficient for the regularization term of \(\mathcal{W}\). \(\|\cdot\|_{F}\) denotes the Frobenius norm of a matrix.

### Row-wise Sampling for Generating Mini-Batch

Like most deep learning methods, existing GNN-LP methods are typically trained in a mini-batch manner. But existing GNN-LP methods adopt an edge-wise sampling strategy to generate mini-batch for training. In particular, they first randomly sample a mini-batch of edges \(\mathcal{E}_{\Omega}\) from \(\mathcal{E}\) at each iteration and then optimize the objective function based on \(\mathcal{E}_{\Omega}\). For example, if we adopt the edge-wise sampling strategy for the objective function of AML in (9), the corresponding learning objective at each iteration will be as follows:

\[\min_{\mathcal{W}}\frac{1}{|\mathcal{E}_{\Omega}|}\sum_{(i,j)\in\mathcal{E}_{ \Omega}}f_{loss}(S_{ij},Y_{ij})+\frac{\lambda}{2}\sum_{\mathbf{W}\in\mathcal{W} }\|\mathbf{W}\|_{F}^{2}. \tag{10}\]

Suppose \(\mathcal{E}_{\Omega}\)=\(\{(i_{1},j_{1}),\cdots,(i_{B},j_{B})\}\) with \(B\) as the mini-batch size. We respectively use \(C\) and \(M\) to denote the computation complexity for generating a node representation by GNN and MLP. Since \(\mathcal{E}_{\Omega}\) is edge-wise randomly sampled from \(\mathcal{E}\) and \(N\) is of a large value for large-scale graphs, \((i_{1},\cdots,i_{B})\) will have a relative small number of repeated nodes. Then the edge-wise sampling strategy for AML has a computation complexity of \(\mathcal{O}(|\mathcal{E}|\cdot(C+M))\) for each epoch, which has the same order of magnitude in computation complexity as existing GNN-LP methods and hence is undesirable.
```
0:\(N\) (number of nodes in the input graph), \(L\) (number of model layers), \(\mathcal{E}\) (the training set), \(B\) (mini-batch size), \(T\) (maximum number of epoches).
0:\(\mathcal{W}\) (model parameters).
1:Pre-encoding graph structure by (2);
2:\(\tilde{B}=B/(|\mathcal{E}|/N)\);
3:for\(t=1:T\)do
4:for\(q=1:(N/\tilde{B})\)do
5: Sample \(\mathcal{V}_{\Omega}\) of \(\tilde{B}\) head nodes from \(\{1,\cdots,N\}\);
6: Generate \(\mathcal{E}_{\Omega}\) with \(\mathcal{V}_{\Omega}\) by (11);
7: Compute \(\mathbf{U}_{i*}^{(L)}\) for each node \(i\) in \(\mathcal{V}_{\Omega}\) by (1);
8: Compute \(\mathbf{V}_{j*}^{(L)}\) for each node \(j\) in \(\mathcal{E}_{\Omega}\) by (3)-(6);
9: Compute \(\mathbf{U}_{i*}\) and \(\mathbf{V}_{j*}\) for each \((i,j)\) in \(\mathcal{E}_{\Omega}\) by (7);
10: Compute \(S_{ij}\) for each \((i,j)\) in \(\mathcal{E}_{\Omega}\) by (8);
11: Update model parameters \(\mathcal{W}\) by optimizing (10); /*Note that the objective function of row-wise sampling is the same as that of edge-wise sampling in (10).*/
12:endfor
13:endfor
```

**Algorithm 1** Learning Algorithm for AML

To solve this high computation complexity problem of edge-wise sampling strategy adopted by existing GNN-LP methods, in AML we propose a row-wise sampling strategy for generating mini-batch. More specifically, we first sample a number of row indices \(\mathcal{V}_{\Omega}\) (head nodes) from \(\{1,2,\cdots,N\}\) for each mini-batch iteration. Then we construct the mini-batch \(\mathcal{E}_{\Omega}\) as follows:

\[\mathcal{E}_{\Omega}=\{(i,j)|i\in\mathcal{V}_{\Omega}\wedge(i,j)\in\mathcal{E}\}. \tag{11}\]

By using this row-wise sampling strategy, AML has a computation complexity of \(\mathcal{O}(|\mathcal{V}_{\Omega}|\cdot C+(|\mathcal{V}_{\Omega}|/N)|\mathcal{ E}|\cdot M)\) for each mini-batch iteration. Since \(\mathcal{V}_{\Omega}\) iterates over \(\{1,\cdots,N\}\) for \(N/|\mathcal{V}_{\Omega}|\) times to go through the whole training set, this row-wise sampling strategy for AML has a computation complexity of \(\mathcal{O}(N\cdot C+|\mathcal{E}|\cdot M)\) for each epoch. Therefore, the row-wise sampling strategy enables AML to decouple the factor of \(|\mathcal{E}|\) from the computation complexity of GNN, leading to a complexity reduction by orders of magnitude compared to the edge-wise sampling strategy.

Algorithm 1 summarizes the whole learning algorithm for AML.

### Complexity Analysis

The computation complexity for different methods are summarized in Table 1. For large-scale graphs, we often have \(s^{L}{<}N\) and \(s^{k}{<}N\). Typically, \(s^{L}r^{2}\) has the same order of magnitude as \(Ls^{k}r^{2}\). According to (1), GNN has a computation complexity of \(C{=}\mathcal{O}\left(s^{L}\cdot r^{2}\right)\) to generate a node representation while the corresponding computation complexity of MLP is \(M{=}\mathcal{O}\left(L\cdot r^{2}\right)\) according to (3)-(6). It is easy to

\begin{table}
\begin{tabular}{l c} \hline Method & Computation complexity \\ \hline Local GNN-LP & \(\mathcal{O}\left(2Ls^{k}r^{2}\cdot|\mathcal{E}|\right)\) \\ Local GNN-LP (w/ RWS) & \(\mathcal{O}\left(2Ls^{k}r^{2}\cdot|\mathcal{E}|\right)\) \\ Global GNN-LP & \(\mathcal{O}\left(2s^{L}r^{2}\cdot|\mathcal{E}|\right)\) \\ Global GNN-LP (w/ RWS) & \(\mathcal{O}\left(s^{L}r^{2}\cdot(|\mathcal{E}|+N)\right)\) \\ \hline AML (w/o RWS) & \(\mathcal{O}\left(\left(s^{L}r^{2}+Lr^{2}\right)\cdot|\mathcal{E}|\right)\) \\ AML & \(\mathcal{O}\left(s^{L}r^{2}\cdot N+Lr^{2}\cdot|\mathcal{E}|\right)\) \\ \hline \end{tabular}
\end{table}
Table 1: Complexity analysis. \(L\) is the number of model layers. \(s{=}\|\mathbf{A}\|_{0}/N\) is the average number of neighbors for a node in \(\mathcal{G}\). \(r\) is the dimension of node representation. \(|\mathcal{E}|\) is the number of links in the training set \(\mathcal{E}\). \(N\) is the number of nodes in graph \(\mathcal{G}\). \(k\) in local GNN-LP is the number of hops for the enclosed subgraphs. “RWS” denotes row-wise sampling. “w/ RWS” in local GNN-LP and global GNN-LP means generating mini-batch with RWS. “w/o RWS” in AML means generating mini-batch without RWS but with an edge-wise sampling strategy.
verify that \(M{\ll}C\). Although many works [17, 19, 20, 21] have proposed solutions to reduce \(C\), \(C\) is still much larger than \(M\). Here we suppose all methods are trained in a mini-batch manner which has been adopted by almost all deep learning models including GNN.

From Table 1, we can get the following results. Firstly, AML has a computation complexity of \(\mathcal{O}(N{\cdot}C{+}|\mathcal{E}{\cdot}M)\), which is much lower than \(\mathcal{O}(2|\mathcal{E}{\cdot}C)\) of existing GNN-LP methods. Secondly, even with our proposed row-wise sampling strategy, existing GNN-LP methods still have a computation complexity of \(\mathcal{O}((|\mathcal{E}{+}N){\cdot}C)\), without change in the order of magnitude. The reason is that they still need to perform \(|\mathcal{E}|\) times of GNN computation for tail nodes within each epoch.

## 4 Experiments

In this section, we evaluate AML and baselines on three real datasets. All methods are implemented with Pytorch [19] and Pytorch-Geometric Library [18]. All experiments are run on an NVIDIA RTX A6000 GPU server with 48 GB of graphics memory.

### Settings

DatasetsDatasets for evaluation include ogbl-collab2, ogbl-ppa and ogbl-citation23. The first two are medium-scale datasets with hundreds of thousands of nodes. The last one is a large-scale dataset with millions of nodes. For ogbl-ppa, since the provided node features are uninformative, we apply matrix factorization [17] to generate new features for nodes. The first two datasets are for undirected link prediction, while the last one is for directed link prediction. The statistics of datasets are summarized in Table 2. Since most GNN-LP methods adopt the evaluation metrics provided by [19], we also follow these evaluation settings.

Footnote 2: In ogbl-collab, there are data leakage issues in the provided graph adjacency matrix \(\mathbf{A}\). We remove those positive links in the validation and testing set from \(\mathbf{A}\).

Footnote 3: [https://ogb.stanford.edu/docs/linkprop/](https://ogb.stanford.edu/docs/linkprop/)

BaselinesAML is actually a global GNN-LP method. We first compare AML with existing global GNN-LP baselines by adopting the same GNN for both AML and baselines. Since almost all existing global GNN-LP methods are developed based on the graph autoencoder framework proposed in [16], we mainly adopt the GNNs under the graph autoencoder framework. In particular, we adopt SAGE [17] and GAT [20] as the GNNs for both AML and baselines, because SAGE and GAT are respectively representative non-attention based and attention based GNN models under the graph autoencoder framework.

Then we compare AML with non-GNN baselines and local GNN-LP baselines. Non-GNN baselines include common neighbors (CN) [14], Adamic-Adar (AA) [1], Node2vec [19] and matrix factorization (MF) [18]. Local GNN-LP baselines inlcude DE-GNN [17] and SEAL [19, 20]. For local GNN-LP methods, we extract enclosed subgraphs in an online way to simulate large-scale settings by following the original work [20].

Hyper-parameter SettingsHyper-parameters include \(L\) (layer number), \(r\) (hidden dimension), \(\lambda\) (coefficient for the regularization of parameters), \(T\) (maximum number of epoches), \(\eta\) (learning rate) and \(B\) (mini-batch size). On ogbl-collab, \(L\)=3, \(r\)=256, \(\lambda\)=0, \(T\)=400, \(\eta\)=0.001 and \(B\)=65,536.

\begin{table}
\begin{tabular}{l c c c} \hline \hline Datasets & ogbl-collab & ogbl-ppa & ogbl-citation2 \\ \hline \#Nodes & 235,868 & 576,289 & 2,927,963 \\ \#Edges & 1,285,465 & 30,326,273 & 30,561,187 \\ Features/Node & 128 & 128 & 128 \\ \#Training links & 1,179,052 & 21,231,931 & 30,387,995 \\ \#Validation links & 160,084 & 9,062,562 & 86,682,596 \\ \#Test links & 146,329 & 6,031,780 & 86,682,596 \\ Metric & Hits@50 & Hits@100 & MRR \\ \hline \hline \end{tabular}
\end{table}
Table 2: Statistics of datasets.
On ogbl-ppa, \(L\)=3, \(r\)=256, \(\lambda\)=0, \(T\)=50, \(\eta\)=0.01 and \(B\)=65, 536. On ogbl-citation2, \(L\)=3, \(r\)=256, \(\lambda\)=0, \(T\)=50, \(\eta\)=0.005 and \(B\)=65, 536. We use Adam [1] as the optimizer. We use GraphNorm [1] to accelerate the training. We adopt BNS [13] as the neighbor sampling strategy for large-scale training. In BNS, there are three hyper-parameters, including \(\tilde{s}_{0}\), \(\tilde{s}_{1}\) and \(\delta\). \(\tilde{s}_{0}\) denotes the number of sampled neighbors for nodes at output layer. \(\tilde{s}_{1}\) denotes the number of sampled neighbors for nodes at other layers. \(\delta\) denotes the ratio of blocked neighbors. On ogbl-collab, \(\tilde{s}_{0}\)=7, \(\tilde{s}_{1}\)=2, \(\delta\)=1/2. On ogbl-ppa, \(\tilde{s}_{0}\) equals the number of all neighbors, \(\tilde{s}_{1}\)=4, \(\delta\)=5/6. On ogbl-citation2, \(\tilde{s}_{0}\)=7, \(\tilde{s}_{1}\)=2, \(\delta\)=1/2. We run each setting for 5 times and report the mean with standard deviation.

### Comparison with Global GNN-LP Baselines

Comparison with global GNN-LP baselines is shown in Table 3 and Figure 3. According to the results, we can draw the following conclusions. Firstly, AML has almost no accuracy loss in all cases compared to baselines4. For example, AML's accuracy is within the standard deviation of baselines' accuracy on ogbl-ppa and ogbl-citation2. Instead, AML achieves an accuracy gain of 1.17%\(\sim\)2.69% on ogbl-collab compared to baselines. Secondly, AML is about 1.7\(\times\)\(\sim\)7.3\(\times\) faster in training than baselines when achieving almost no accuracy loss. For example, AML is 1.7\(\times\) faster than baselines on ogbl-collab, 3.1\(\times\) faster on ogbl-ppa, and 7.3\(\times\) faster on ogbl-citation2. In particular, baselines need about 5.8 days and 4.2 days to get the mean of results while AML only needs 1.7 days and 0.6 days to get the mean of results, on ogbl-ppa and ogbl-citation2 respectively. Thirdly, the speedup of AML relative to baselines increases with the size of graphs. For example, the number of nodes in ogbl-collab, ogbl-ppa and ogbl-citation2 increases in an ascending order, and the speedup of AML relative to baselines increases in a consistent order on these three graph datasets. Finally, AML has a better accuracy-time trade-off than baselines, which can be concluded from Figure 3. For example, we can find that AML is faster than baselines when achieving the same accuracy.

\begin{table}

\end{table}
Table 3: Comparison with global GNN-LP baselines. “Time” denotes the whole time to complete training. “Gap” denotes the accuracy of AML minus that of baselines.
### Comparison with non-GNN and Local GNN-LP Baselines

Comparison with non-GNN and local GNN-LP baselines is shown in Table 4. According to the results, we can draw the following conclusions. Firstly, AML is comparable with state-of-the-art local GNN-LP methods in accuracy. For example, AML has almost no accuracy loss compared to the best baseline DE-GNN on obgl-collab. On ogbl-ppa, AML achieves an accuracy gain of 3.43% compared to the best baseline SEAL. On ogbl-citation2, AML gets an accuracy loss less than 1% compared to the best baseline SEAL. Secondly, AML is about 13\(\times\sim\)110\(\times\) faster than local GNN-LP baselines. For example, AML is about 13\(\times\) faster than DE-GNN and SEAL on ogbl-collab, about 66\(\times\) faster on ogbl-ppa, and about 110\(\times\) faster on ogbl-citation2. In particular, DE-GNN and SEAL need 3.5 days to get the mean accuracy on ogbl-collab which is a relatively small-scale dataset. By contrast, AML only needs 1.2 hours to get the mean accuracy. Finally, GNN-LP methods can achieve better accuracy than non-GNN methods. For example, DE-GNN improves by 13% in accuracy over MF on ogbl-ppa and improves by 17% over Node2vec on ogbl-citation2. AML improves by 17% in accuracy over MF on ogbl-ppa and improves by 16% over Node2vec on ogbl-citation2.

\begin{table}
\begin{tabular}{l l l c c c c} \hline \hline \multirow{2}{*}{Category} & \multirow{2}{*}{Methods} & \multicolumn{2}{c}{ogbl-collab} & \multicolumn{2}{c}{ogbl-ppa} & \multicolumn{2}{c}{ogbl-citation2} \\ \cline{3-8}  & & Hits@50(\%)\(\uparrow\) & Time(s)\(\downarrow\) & Hits@100(\%)\(\uparrow\) & Time(s)\(\downarrow\) & MRR(\%)\(\uparrow\) & Time(s)\(\downarrow\) \\ \hline \multirow{4}{*}{Non-GNN} & CN & 49.96\(\pm\)0.00\({}^{\bullet}\) & - & 27.60\(\pm\)0.00 & - & 51.47\(\pm\)0.00 & - \\  & AA & 56.49\(\pm\)0.00\({}^{\bullet}\) & - & 32.45\(\pm\)0.00 & - & 51.89\(\pm\)0.00 & - \\  & Node2vec & 49.29\(\pm\)0.64\({}^{\bullet}\) & - & 22.26\(\pm\)0.88 & - & 61.41\(\pm\)0.11 & - \\  & MF & 37.93\(\pm\)0.76\({}^{\bullet}\) & - & 32.29\(\pm\)0.94 & - & 51.86\(\pm\)4.43 & - \\ \hline \multirow{2}{*}{Local GNN-LP} & DE-GNN & **57.87\(\pm\)0.79\({}^{\bullet}\)** & \(6.1\times 10^{4}\) & 45.70\(\pm\)3.46 & \(2.0\times 10^{6}\) & 78.85\(\pm\)0.17 & \(1.1\times 10^{6}\) \\  & SEAL & 57.55\(\pm\)0.72\({}^{\bullet}\) & \(6.5\times 10^{4}\) & 48.80\(\pm\)3.16 & \(2.0\times 10^{6}\) & **87.67\(\pm\)0.32** & \(1.1\times 10^{6}\) \\ \hline \multirow{2}{*}{Global GNN-LP} & AML (S) & 57.26\(\pm\)1.25 & **4.4 \(\times\) 10\({}^{\bf 8}\)** & 49.73\(\pm\)0.89 & **3.0 \(\times\) 10\({}^{\bf 4}\)** & 86.55\(\pm\)0.06 & **1.0 \(\times\) 10\({}^{\bf 4}\)** \\  & AML (G) & 57.60\(\pm\)0.71 & 4.5 \(\times\) 10\({}^{\bf 3}\) & **50.23\(\pm\)0.78** & \(3.2\times\) 10\({}^{\bf 4}\) & 86.70\(\pm\)0.05 & **1.0 \(\times\) 10\({}^{\bf 4}\)** \\ \hline \hline \end{tabular}
\end{table}
Table 4: Comparison with non-GNN and local GNN-LP baselines. “(S)” in AML means using SAGE as the GNN model, and “(G)” in AML means using GAT as the GNN model. Accuracy of non-GNN and local GNN-LP baselines on ogbl-ppa and ogbl-citation2 is from [ZLX\({}^{+}\)21]. “**” denotes the results achieved by rerunning the authors’ code on the clean ogbl-collab.

Figure 3: Test accuracy-time curves of AML and global GNN-LP baselines.
### Necessity of GNN in AML

Here we perform experiment to verify the necessity of GNN in AML. We design a method called symmetric MLP (SMLP) which applies MLP with pre-encoding to learn representation for both head nodes and tail nodes. More specifically, SMLP adopts the techniques for learning tail node representation in AML, i.e., (2) and (3), to learn representation for both head and tail nodes.

Results are shown in Table 5. We can find that SMLP is much worse than AML on all datasets. This shows that training a GNN model for node representation learning is necessary to achieve high accuracy.

### Reversed Asymmetric Learning

In above experiments, AML learns representation for head nodes with a GNN model while learning representation for tail nodes with an MLP model. Here we verify whether the reversed case can also behave well. We denote the reversed case as AML-R, which learns representation for head nodes with an MLP model while learning representation for tail nodes with a GNN model. Results are shown in Table 6. Results show that AML and AML-R have similar accuracy.

### Ablation Study

In this subsection, we study the effectiveness of different components in AML, including knowledge transfer, residual term \(\Delta^{(L)}\), pre-encoding graph structure and modeling the homophily. Results are shown in Table 7. We can find the following phenomenons. Firstly, knowledge transfer between head and tail nodes effectively improves the accuracy of AML. For example, knowledge transfer can improve the accuracy of AML by 3.00% on ogbl-collab, by 2.85% on ogbl-ppa and by 0.42% on ogbl-citation2. Secondly, \(\Delta^{(L)}\) is beneficial for AML. For example, including \(\Delta^{(L)}\) in AML can improve accuracy by 3.04% on ogbl-collab, by 3.19% on ogbl-ppa and by 0.40% on ogbl-citation2. Thirdly, modeling homophily is helpful for AML. For example, modeling homophily in AML can improve accuracy by 1.87% on ogbl-collab, by 2.37% on ogbl-ppa and by 0.87% on ogbl-citation2. Finally, pre-encoding graph structure plays a crucial role in AML. For example, AML has an accuracy loss of about 13% on ogbl-collab, 47% on ogbl-ppa and 25% on ogbl-citation2 without pre-encoding graph structure.

\begin{table}
\begin{tabular}{l c c c} \hline \hline \multirow{2}{*}{Methods} & ogbl-collab & ogbl-ppa & ogbl-citation2 \\ \cline{2-4}  & Hits@50 (\%) \(\uparrow\) & Hits@100 (\%) \(\uparrow\) & MRR (\%) \(\uparrow\) \\ \hline AML-R (S) & 57.15 \(\pm\) 0.32 & 49.73 \(\pm\) 0.45 & 85.70 \(\pm\) 0.10 \\ AML (S) & 57.26 \(\pm\) 1.25 & 49.73 \(\pm\) 0.89 & 86.55 \(\pm\) 0.06 \\ AML-R (G) & 57.08 \(\pm\) 1.19 & **50.30 \(\pm\) 0.61** & 85.91 \(\pm\) 0.04 \\ AML (G) & **57.60 \(\pm\) 0.71** & 50.23 \(\pm\) 0.78 & **86.70 \(\pm\) 0.05** \\ \hline \hline \end{tabular}
\end{table}
Table 6: Reversed asymmetric learning. AML-R denotes the reversed case of AML, which learns representation for head nodes with an MLP model while learning representation for tail nodes with a GNN model. “(S)” means using SAGE as the GNN model, and “(G)” means using GAT as the GNN model.

\begin{table}
\begin{tabular}{l c c c c c c} \hline \hline \multirow{2}{*}{Methods} & \multicolumn{2}{c}{ogbl-collab} & \multicolumn{2}{c}{ogbl-ppa} & \multicolumn{2}{c}{ogbl-citation2} \\ \cline{2-7}  & Hits@50 (\%) \(\uparrow\) & Gap & Hits@100 (\%) \(\uparrow\) & Gap & MRR (\%) \(\uparrow\) & Gap \\ \hline SMLP & 47.25 \(\pm\) 0.89 & - & 47.42 \(\pm\) 1.37 & - & 69.82 \(\pm\) 0.05 & - \\ \hline AML (S) & 57.26 \(\pm\) 1.25 & +10.01 & 49.73 \(\pm\) 0.89 & +2.31 & 86.55 \(\pm\) 0.06 & +16.73 \\ AML (G) & **57.60 \(\pm\) 0.71** & +10.35 & **50.23 \(\pm\) 0.78** & +2.81 & **86.70 \(\pm\) 0.05** & +16.88 \\ \hline \hline \end{tabular}
\end{table}
Table 5: Experiment to verify the necessity of GNN in AML. SMLP applies MLP with pre-encoding to learn representation for both head nodes and tail nodes. “Gap” denotes the accuracy of AML minus that of SMLP.
## 5 Conclusions

Graph neural network based link prediction (GNN-LP) methods have achieved better accuracy than non-GNN based link prediction methods, but suffer from scalability problem for large-scale graphs. Our computation complexity analysis reveals that the scalability problem of existing GNN-LP methods stems from their symmetric learning strategy for node representation learning. Motivated by this finding, we propose a novel method called AML for GNN-LP. To the best of our knowledge, AML is the first GNN-LP method adopting an asymmetric learning strategy for node representation learning. Extensive experiments show that AML is significantly faster than baselines with a symmetric learning strategy while having almost no accuracy loss.
