Labeling Trick: A Theory of Using Graph Neural Networks for Multi-Node Representation Learning
Abstract
In this paper, we provide a theory of using graph neural networks (GNNs) for multi-node representation learning (where we are interested in learning a representation for a set of more than one node, such as link). We know that GNN is designed to learn single-node representations. When we want to learn a node set representation involving multiple nodes, a common practice in previous works is to directly aggregate the single-node representations obtained by a GNN into a joint node set representation. In this paper, we show a fundamental constraint of such an approach, namely the inability to capture the dependence between nodes in the node set, and argue that directly aggregating individual node representations does not lead to an effective joint representation for multiple nodes. Then, we notice that a few previous successful works for multi-node representation learning, including SEAL, Distance Encoding, and ID-GNN, all used node labeling. These methods first label nodes in the graph according to their relationships with the target node set before applying a GNN. Then, the node representations obtained in the labeled graph are aggregated into a node set representation. By investigating their inner mechanisms, we unify these node labeling techniques into a single and most general form---labeling trick. We prove that with labeling trick a sufficiently expressive GNN learns the most expressive node set representations, thus in principle solves any joint learning tasks over node sets. Experiments on one important two-node representation learning task, link prediction, verified our theory. Our work explains the superior performance of previous node-labeling-based methods, and establishes a theoretical foundation of using GNNs for multi-node representation learning.
Benchmark Results
Tested on 4 datasets 1 baseline value 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 | |
| 20 | SEAL | 0.6474
±0.0043 | This paper |
| 21 | GCN+DE | 0.6444
±0.0029 | This paper |
| 22 | GCN+DRNL | 0.6440
±0.0045 | This paper |
| 23 | AA | 0.6435 best reported | best today: On the Impact of Feature Heterophily on Link Prediction with Graph Neural Networks (NeurIPS 2024) |
| 27 | CN | 0.6137 | This paper |
| 54 | GCN+LRGA | 0.5221
±0.0072 | This paper |
| 68 | Node2Vec | 0.4929
±0.0064 best reported | best at pub: Formatting Instructions for ICLR 2021 Conference Submissions (2020) best today: 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: OGB (NeurIPS 2020) 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) |
| # | Model | Hits@20 ↑ | Paper |
|---|---|---|---|
| 1 | ELGNN | 0.9777
±0.0037 | |
| 2 | GIDN | 0.9542 | |
| 3 | AGDN | 0.9538
±0.0094 | |
| 20 | SAGE | 0.6719
±0.0118 | |
| 27 | GCN+LRGA | 0.6230
±0.0912 | This paper |
| 31 | MF | 0.5950
±0.0168 best reported | best at pub: Formatting Instructions for ICLR 2021 Conference Submissions (2020) best today: Link Prediction with Untrained Message Passing Layers (2024) |
| 43 | SEAL | 0.4974
±0.0239 best reported | best today: Link Prediction with Untrained Message Passing Layers (2024) |
| 50 | AA | 0.3975 best reported | best today: Link Prediction with Untrained Message Passing Layers (2024) |
| 51 | CN | 0.3869 best reported | best today: Link Prediction with Untrained Message Passing Layers (2024) |
| 64 | GCN+DE | 0.2663
±0.0682 | This paper |
| 70 | GCN+DRNL | 0.2281
±0.0493 | 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 | |
| 14 | SAGE | 0.5013
±0.0055 | |
| 19 | SEAL | 0.4880
±0.0316 | This paper |
| 23 | MLP | 0.4600 best reported | best at pub: OGB (NeurIPS 2020) best today: Efficient Link Prediction via GNN Layers Induced by Negative Sampling (2023) |
| 28 | GCN+DRNL | 0.4524
±0.0395 | This paper |
| 35 | GCN+DE | 0.3648
±0.0378 | 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: Formatting Instructions for ICLR 2021 Conference Submissions (2020) best today: Link Prediction with Untrained Message Passing Layers (2024) |
| 49 | CN | 0.2765 best reported | best today: Using Random Noise Equivariantly to Boost Graph Neural Networks Universally (2025) |
| 55 | GCN+LRGA | 0.2612
±0.0235 | 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 | This paper |
| # | Model | MRR ↑ | Paper |
|---|---|---|---|
| 1 | CFG | 0.8997
±0.0015 | |
| 2 | SIEG | 0.8987
±0.0018 | |
| 3 | LPFormer | 0.8981
±0.0013 | |
| 8 | SEAL | 0.8767
±0.0032 | This paper |
| 12 | GCN | 0.8705
±0.0004 best reported | best at pub: OGB (NeurIPS 2020) best today: On the Impact of Feature Heterophily on Link Prediction with Graph Neural Networks (NeurIPS 2024) |
| 30 | SAGE | 0.8292
±0.0022 | |
| 32 | GraphSAGE | 0.8264
±0.0001 best reported | best at pub: OGB (NeurIPS 2020) best today: Neo-GNNs: Neighborhood Overlap-aware Graph Neural Networks for Link Prediction (NeurIPS 2022) Difference within reported uncertainty; not counted as underperformance. |
| 39 | GCN+DRNL | 0.8127
±0.0031 | This paper |
| 52 | AA | 0.7596 best reported | best today: Weak Models Can be Good Teachers: A Case Study on Link Prediction with MLPs (2025) |
| 54 | CN | 0.7430 best reported | best today: Weak Models Can be Good Teachers: A Case Study on Link Prediction with MLPs (2025) |
| 58 | GCN+LRGA | 0.6649
±0.0159 | This paper |
| 59 | Node2Vec | 0.6141
±0.0011 | This paper |
| 60 | GCN+DE | 0.6030
±0.0061 | This paper |
| 62 | MF | 0.5186
±0.0443 | This paper |
| 71 | MLP | 0.2906
±0.0016 | prev best: OGB (NeurIPS 2020) best today: Weak Models Can be Good Teachers: A Case Study on Link Prediction with MLPs (2025) Improvement within reported uncertainty; not highlighted. |
