Efficient Link Prediction via GNN Layers Induced by Negative Sampling
Abstract
Graph neural networks (GNNs) for link prediction can loosely be divided into two broad categories. First, node-wise architectures pre-compute individual embeddings for each node that are later combined by a simple decoder to make predictions. While extremely efficient at inference time, model expressiveness is limited such that isomorphic nodes contributing to candidate edges may not be distinguishable, compromising accuracy. In contrast, edge-wise methods rely on the formation of edge-specific subgraph embeddings to enrich the representation of pair-wise relationships, disambiguating isomorphic nodes to improve accuracy, but with increased model complexity. To better navigate this trade-off, we propose a novel GNN architecture whereby the forward pass explicitly depends on both positive (as is typical) and negative (unique to our approach) edges to inform more flexible, yet still cheap node-wise embeddings. This is achieved by recasting the embeddings themselves as minimizers of a forward-pass-specific energy function that favors separation of positive and negative samples. Notably, this energy is distinct from the actual training loss shared by most existing link prediction models, where contrastive pairs only influence the backward pass. As demonstrated by extensive empirical evaluations, the resulting architecture retains the inference speed of node-wise models, while producing competitive accuracy with edge-wise alternatives. We released our code at https://github.com/yxzwang/SubmissionverOfYinYanGNN.
Benchmark Results
Tested on 4 datasets 7 baseline values reported too low
Tables show presented results in global context (best 3 papers + GCN + MLP).
OGB
| # | Model | Hits@50 ↑ | Paper |
|---|---|---|---|
| 1 | PROXI | 0.7650
±0.0027 | |
| 2 | OGB Leader | 0.7129
±0.0018 | |
| 3 | GIDN | 0.7096
±0.0055 | |
| 9 | GCN | 0.6621
±0.0033 best reported | best at pub: GNNBenchmark (JMLR 2023) best today: On the Impact of Feature Heterophily on Link Prediction with Graph Neural Networks (NeurIPS 2024) |
| 10 | Neo-GNN | 0.6613
±0.0061 best reported | best at pub: Neo-GNNs: Neighborhood Overlap-aware Graph Neural Networks for Link Prediction (NeurIPS 2022) best today: PROXI: Challenging the GNNs for Link Prediction (TMLR 2024) |
| 11 | YinYanGNN | 0.6610
±0.0020 | This paper |
| 14 | BUDDY | 0.6594
±0.0058 | This paper |
| 20 | SEAL | 0.6474
±0.0043 | This paper |
| 23 | AA | 0.6435 | prev best: Labeling Trick: A Theory of Using Graph Neural Networks for Multi-Node Representation Learning (NeurIPS 2020) |
| 25 | SUREL | 0.6410
±0.0106 | This paper |
| 26 | RA | 0.6400 | This paper |
| 27 | CN | 0.6137 best reported | best at pub: Labeling Trick: A Theory of Using Graph Neural Networks for Multi-Node Representation Learning (NeurIPS 2020) best today: Weak Models Can be Good Teachers: A Case Study on Link Prediction with MLPs (2025) |
| 28 | SAGE | 0.5944
±0.0137 best reported | best at pub: Pairwise Learning for Neural Link Prediction (2021) best today: PROXI: Challenging the GNNs for Link Prediction (TMLR 2024) |
| 37 | GDGNN | 0.5474
±0.0048 | This paper |
| 41 | GraphSAGE | 0.5463
±0.0112 | |
| 46 | ComplEx | 0.5391
±0.0050 | This paper |
| 58 | DistMult | 0.5100
±0.0054 | This paper |
| 68 | Node2Vec | 0.4929
±0.0064 best reported | best at pub: Asymmetric Learning for Graph Neural Network based Link Prediction (2023) Difference within reported uncertainty; not counted as underperformance. |
| 94 | MLP | 0.4438
±0.0347 best reported | best at pub: GNNBenchmark (JMLR 2023) best today: Weak Models Can be Good Teachers: A Case Study on Link Prediction with MLPs (2025) |
| 98 | MF | 0.4181
±0.0167 best reported | best at pub: Formatting Instructions for ICLR 2021 Conference Submissions (2020) best today: PROXI: Challenging the GNNs for Link Prediction (TMLR 2024) |
| 109 | TransE | 0.2940
±0.0115 | This paper |
| # | Model | Hits@100 ↑ | Paper |
|---|---|---|---|
| 1 | OGB Leader | 0.6524
±0.0150 | |
| 2 | PRB | 0.6347
±0.0175 | |
| 3 | LPFormer | 0.6332
±0.0063 | |
| 7 | YinYanGNN | 0.5464
±0.0049 | This paper |
| 8 | SUREL | 0.5432
±0.0044 | This paper |
| 9 | RA | 0.5324 best reported | best at pub: Pairwise Learning for Neural Link Prediction (2021) |
| 14 | SAGE | 0.5013
±0.0055 best reported | best at pub: Asymmetric Learning for Graph Neural Network based Link Prediction (2023) |
| 15 | BUDDY | 0.4985
±0.0020 | This paper |
| 18 | Neo-GNN | 0.4913
±0.0060 | This paper |
| 19 | SEAL | 0.4880
±0.0316 | This paper |
| 23 | MLP | 0.4600 | This paper |
| 26 | GDGNN | 0.4592
±0.0214 | This paper |
| 39 | AA | 0.3245 | This paper |
| 42 | MF | 0.3230
±0.0090 best reported | best at pub: Formatting Instructions for ICLR 2021 Conference Submissions (2020) Difference within reported uncertainty; not counted as underperformance. |
| 45 | GCN | 0.3084
±0.0178 best reported | best at pub: Revisiting Link Prediction: a data perspective (ICLR 2023) best today: Link Prediction with Untrained Message Passing Layers (2024) |
| 48 | DistMult | 0.2861
±0.0147 | This paper |
| 49 | CN | 0.2765 | This paper |
| 53 | ComplEx | 0.2742
±0.0049 | This paper |
| 56 | TransE | 0.2269
±0.0049 | This paper |
| 57 | Node2Vec | 0.2230
±0.0080 best reported | best at pub: Formatting Instructions for ICLR 2021 Conference Submissions (2020) Difference within reported uncertainty; not counted as underperformance. |
| 63 | GraphSAGE | 0.1655
±0.0240 |
| # | Model | MRR ↑ | Paper |
|---|---|---|---|
| 1 | CFG | 0.8997
±0.0015 | |
| 2 | SIEG | 0.8987
±0.0018 | |
| 3 | LPFormer | 0.8981
±0.0013 | |
| 4 | SUREL | 0.8974
±0.0018 | This paper |
| 8 | SEAL | 0.8767
±0.0032 | This paper |
| 9 | BUDDY | 0.8756
±0.0011 | This paper |
| 11 | Neo-GNN | 0.8726
±0.0084 | This paper |
| 12 | GCN | 0.8705
±0.0004 best reported | best at pub: Neo-GNNs: Neighborhood Overlap-aware Graph Neural Networks for Link Prediction (NeurIPS 2022) best today: On the Impact of Feature Heterophily on Link Prediction with Graph Neural Networks (NeurIPS 2024) |
| 13 | GDGNN | 0.8696
±0.0028 | This paper |
| 15 | YinYanGNN | 0.8621
±0.0009 | This paper |
| 30 | SAGE | 0.8292
±0.0022 best reported | best at pub: Pairwise Learning for Neural Link Prediction (2021) best today: Weak Models Can be Good Teachers: A Case Study on Link Prediction with MLPs (2025) Difference within reported uncertainty; not counted as underperformance. |
| 32 | GraphSAGE | 0.8264
±0.0001 | |
| 47 | TransE | 0.7644
±0.0018 | This paper |
| 51 | RA | 0.7604 best reported | best at pub: Graph Neural Networks for Link Prediction with Subgraph Sketching (ICLR 2022) best today: Weak Models Can be Good Teachers: A Case Study on Link Prediction with MLPs (2025) |
| 52 | AA | 0.7596 best reported | best at pub: Labeling Trick: A Theory of Using Graph Neural Networks for Multi-Node Representation Learning (NeurIPS 2020) best today: Weak Models Can be Good Teachers: A Case Study on Link Prediction with MLPs (2025) |
| 54 | CN | 0.7430 best reported | best at pub: Labeling Trick: A Theory of Using Graph Neural Networks for Multi-Node Representation Learning (NeurIPS 2020) best today: Weak Models Can be Good Teachers: A Case Study on Link Prediction with MLPs (2025) |
| 55 | ComplEx | 0.7283
±0.0038 | This paper |
| 57 | DistMult | 0.6695
±0.0040 | This paper |
| 59 | Node2Vec | 0.6141
±0.0011 | This paper |
| 62 | MF | 0.5186
±0.0443 | This paper |
| 71 | MLP | 0.3917
±0.0044 best reported | best at pub: Labeling Trick: A Theory of Using Graph Neural Networks for Multi-Node Representation Learning (NeurIPS 2020) best today: Weak Models Can be Good Teachers: A Case Study on Link Prediction with MLPs (2025) |
