Paper · 2021-08-13 · cs.AI, cs.CL
Knowledge Graph Reasoning with Relational Digraph
RED-GNN answers knowledge-graph queries (e_q, r_q, ?) by encoding r-digraphs, the overlapping relational paths from the query entity, with a dynamic-programming recursion over shared edges and query-dependent sigmoid attention. Author-reported: highest MRR on all 12 inductive splits and all 5 transductive datasets.
Knowledge graph reasoningKnowledge graph completionGraph neural networkAttention mechanismknowledge-graphlink-predictioninductive-reasoninginterpretability
arXivPDFCodeMarkdown17 min read
AI-compiled by claude-haiku-5-5 on 2026-11-06, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.
In plain words
A knowledge graph stores facts as triples, such as (Sam, directed, Spider-2). To answer a question like "what does Sam direct?", one simple method follows chains of relations from the entity you start with. Such chains are easy to read, but they miss the wider local picture, because many chains overlap and the way they overlap carries information.
This paper groups the overlapping chains that start at the query entity into one small layered graph, which it calls an r-digraph. Building and scoring each candidate answer's graph on its own is slow. RED-GNN instead walks outward from the query entity once per layer, reuses the work that overlapping graphs share, and lets the query's relation decide which edges matter, through attention. It outputs one score per candidate entity, and the attention weights can be read as the edges the score relied on.
TL;DR
RED-GNN scores every candidate answer to a query (e_q, r_q, ?) by encoding r-digraphs, which are unions of overlapping relational paths. A dynamic-programming recursion shares the computation across all candidate answers, and a query-dependent sigmoid attention picks the edges that matter. The authors report the highest MRR on all 12 inductive splits and on all five transductive datasets. The official code differs from the paper in several places, including a GRU across layers, so read the Paper vs code section before reimplementing.
Problem
Knowledge-graph reasoning infers missing facts from existing ones §1. Relational paths capture sequential evidence and give interpretable, transferable rules, but they cannot represent richer local structure §1, §3. Subgraph and GNN methods capture more structure, yet the authors argue that they are costly or that their attention is hard to interpret. GraIL's enclosing subgraph is the example given: it loses the order of relations and is not interpretable §1, app. B. The paper targets queries of the form (subject entity, relation, ?) §1. The inductive setting assumes test-time entities are unseen during training but the relations are shared §5.1. Triples whose answer lies more than L hops from the query get no signal from an L-layer model §5.5.
Method
Setting, from §3: after augmenting every triple with a reverse and an identity relation, the r-digraph G_{e_q,e_a|L} is a layered st-graph (one source, one sink, edges only between consecutive layers) [def. 2]. It contains every relational path of length L from e_q to e_a and is empty if no such path exists [def. 3]. fig. 1 gives an example for (Sam, directed, Spider-2).
RED-GNN never builds one r-digraph per candidate. It runs one layer-wise recursion for the query and reads out a state for every entity:
- Start with only the query entity visible, with a zero state alg. 2, line 1.
- For layer l = 1..L, collect the facts whose subject is visible after layer l-1, and let the visible set be their objects alg. 2, line 2. These edges are shared by every candidate answer: the set of layer-l edges from e_q equals the union of the layer-l edges of all r-digraphs from e_q [prop. 1; eq. 2 is the recursion over G_{e_q,e_o|l}].
- For each visible entity o, update its state with message passing over its incoming edges eq. 3. Each message is the previous state of the subject plus a layer-l relation embedding, scaled by an attention weight.
- Return the layer-L state for every entity. Entities not visible at layer L get a zero representation alg. 2.
Equations from the paper (in the paper's notation):
Recursive r-digraph construction eq. 2:
\mathcal G_{e_q, e_o|\ell} = \cup_{(e_s, r, e_o) \in \hat{\mathcal E}_{e_q}^\ell} \mathcal G_{e_q, e_s|\ell-1} \otimes \left\lbrace (e_s, r, e_o) \right\rbrace
Message passing with query-dependent attention eq. 3:
\bm{h}_{e_o}^{\ell}(e_q, r_q) = \delta\Big(\bm W^\ell \cdot \sum\nolimits_{(e_s, r, e_o)\in\hat{\mathcal E}_{e_q}^{\ell}} \alpha^{\ell}_{e_s,r,e_o|r_q} \big(\bm{h}_{e_s}^{\ell-1}(e_q, r_q) + \bm{h}_r^{\ell} \big) \Big)
Attention, with a sigmoid rather than a softmax so that several edges can be selected in one neighbourhood eq. 4 and the sentence after it. The paper gives w in R^{d_alpha}, W_alpha in R^{d_alpha x 3d}, and writes the concatenation as a set of three inputs:
\alpha^{\ell}_{e_s,r,e_o|r_q} = \sigma\Big( (\bm w^{\ell}_\alpha)^\top \mathrm{ReLU}\big( \bm W^{\ell}_\alpha \cdot ( \bm h^{\ell-1}_{e_s}(e_q, r_q) \oplus \bm h^{\ell}_r \oplus \bm h^{\ell}_{r_q} ) \big) \Big)
Scoring and training eq. 5 and eq. 6:
f(e_q, r_q, e_a) = \bm w^\top \bm h^{L}_{e_a}(e_q, r_q), \qquad \bm w \in \mathbb R^{d}
\sum_{(e_q, r_q, e_a) \in \mathcal T_{\text{tra}}} \Big( - f(e_q, r_q, e_a) + \log \sum_{e \in \mathcal V} e^{f(e_q, r_q, e)} \Big)
Parameters Theta are the W^l, w_alpha^l, W_alpha^l, relation embeddings h_r^l and w, all randomly initialised. The initialisation scheme is not stated §4.2.
The model below follows the paper's equations. It is not the official code (see Paper vs code):
# RED-GNN: recursive r-digraph encoding [alg. 2]
# Input: query (e_q, r_q, ?), depth L, facts F, entities V
# Output: one score per entity in V [eq. 5]
def red_gnn_scores(e_q, r_q, facts, entities, L):
# Only e_q is visible at layer 0, with a zero state [alg. 2, line 1]
visible = {e_q}
previous = {e_q: zeros(d)} # (d,) per entity
for layer in range(1, L + 1):
# Facts whose subject was visible at layer - 1 [alg. 2, line 2]
# Shared by all candidate answers [prop. 1]
edges = [(s, r, o) for (s, r, o) in facts if s in visible]
visible = {o for (s, r, o) in edges}
# Fresh buffer, so layer - 1 states are not overwritten [alg. 2]
current = {}
for o in visible:
# Incoming edges of o at this layer [alg. 2, line 3]
incoming = [(s, r) for (s, r, obj) in edges if obj == o]
total = zeros(d)
for (s, r) in incoming:
# Attention weight for this edge [eq. 4]
a = attention(previous[s], rel_emb[layer][r],
rel_emb[layer][r_q], layer)
total = total + a * (previous[s] + rel_emb[layer][r])
# Linear map and activation [eq. 3]
current[o] = act(W[layer] @ total)
previous = current
# Entities not visible at layer L keep a zero representation [alg. 2]
return [w @ previous[e] if e in visible else 0 for e in entities]
# Query-dependent attention on one edge [eq. 4]
def attention(state_s, rel_r, rel_query, layer):
# Concatenate the three inputs, then project with ReLU
hidden = relu(W_alpha[layer] @ concat(state_s, rel_r, rel_query))
# One scalar per edge, squashed by a sigmoid [eq. 4]
return sigmoid(w_alpha[layer] @ hidden)Training uses the multi-class log loss of eq. 6, summed over the training queries, with each query scored against every entity §4.2. The paper says it minimises this with stochastic gradient descent §4.2 and uses Adam §5.1.
Cost §4.3: per query, RED-GNN costs O(d * min(D^L, |F| L)), where D is the average degree, versus O(|V| (min(D^L, |F| L) + d E L)) for the direct construction (RED-Simp, alg. 1). The paper states that RED-Simp and RED-GNN produce identical representations for the same triple [prop. 2; proof in app. C].
Interpretability §4.2, app. A: Theorem 1 §4.2, proof in app. C says that for any rule set that generates a set of relational paths, parameters and a threshold theta exist such that the edges with attention above theta form that path set's r-digraph. The proof relies on a universal-approximation argument app. C, so it is an existence result, not a learnability guarantee. For visualisation, alg. 3 (app. A) backtracks from e_a through edges with attention at least theta, and the case study uses theta = 0.5 with L = 3 on Family and UMLS §5.4.
Hyperparameters
The paper gives tuning ranges, not the selected values §5.1, §5.2. The selected per-dataset values are in the code (second table).
Tuning ranges stated in the paper:
| Name | Value | Where | Notes |
|---|---|---|---|
| learning rate | [1e-4, 1e-2] | §5.1 | Same range used for Neural LP and DRUM §5.1 |
| weight decay | [1e-5, 1e-2] | §5.1 | |
| dropout | [0, 0.3] | §5.1 | |
| batch size | {5, 10, 20, 50, 100} | §5.1 | |
| dimension d | {32, 48, 64, 96} | §5.1 | |
| attention dimension d_alpha | {3, 5} | §5.1 | |
| depth L | {3, 4, 5} | §5.1 | |
| activation delta | {identity, tanh, ReLU} | §5.1 | |
| transductive ranges | same as inductive | §5.2 | |
| optimiser | Adam | §5.1 | |
| maximum epochs | 50 | §5.1 | |
| model selection | best validation MRR | §5.1 | |
| learning-rate schedule | not stated | §5 | The code applies per-epoch exponential decay (second table) |
| initialisation | not stated | §4.2 | |
| random seeds, number of runs | not stated | §5 | Code uses seed 1234; no variance is reported |
| number of tuning trials | not stated | §5.1 | |
| hardware | RTX 2080Ti, 11 GB | §5 |
Per-dataset settings in the official code. Inductive settings come from Static/inductive/train.py, and transductive settings from Static/transductive/train.py. The transductive table shows the training batch and the evaluation batch separately.
| Config | lr | weight decay | lr decay per epoch | d | d_alpha | L | batch | dropout | delta |
|---|---|---|---|---|---|---|---|---|---|
| WN18RR V1 | 0.005 | 0.0002 | 0.991 | 64 | 5 | 5 | 100 | 0.21 | identity |
| FB15k-237 V1 | 0.0092 | 0.0003 | 0.994 | 32 | 5 | 3 | 20 | 0.23 | ReLU |
| NELL-995 V1 | 0.0021 | 0.000189 | 0.9937 | 48 | 5 | 5 | 10 | 0.2460 | ReLU |
| WN18RR V2 | 0.0016 | 0.0004 | 0.994 | 48 | 3 | 5 | 20 | 0.02 | ReLU |
| FB15k-237 V2 | 0.0077 | 0.0002 | 0.993 | 48 | 5 | 3 | 10 | 0.3 | ReLU |
| NELL-995 V2 | 0.0075 | 0.000066 | 0.9996 | 48 | 5 | 3 | 100 | 0.2881 | ReLU |
| WN18RR V3 | 0.0014 | 0.000034 | 0.991 | 64 | 5 | 5 | 20 | 0.28 | tanh |
| FB15k-237 V3 | 0.0006 | 0.000023 | 0.994 | 48 | 3 | 3 | 20 | 0.27 | ReLU |
| NELL-995 V3 | 0.0008 | 0.0004 | 0.995 | 16 | 3 | 3 | 10 | 0.06 | ReLU |
| WN18RR V4 | 0.006 | 0.000132 | 0.991 | 32 | 5 | 5 | 10 | 0.11 | ReLU |
| FB15k-237 V4 | 0.0052 | 0.000018 | 0.999 | 48 | 5 | 5 | 20 | 0.07 | identity |
| NELL-995 V4 | 0.0005 | 0.000398 | 1 | 16 | 5 | 5 | 20 | 0.1472 | tanh |
| Dataset | lr | weight decay | lr decay per epoch | d | d_alpha | L | train batch | eval batch | dropout | delta |
|---|---|---|---|---|---|---|---|---|---|---|
| Family | 0.0036 | 0.000017 | 0.999 | 48 | 5 | 3 | 20 | 50 | 0.29 | ReLU |
| UMLS | 0.0012 | 0.000115 | 0.9917 | 48 | 5 | 4 | 20 | 50 | 0.0024 | ReLU |
| WN18RR | 0.0021 | 0.000037 | 0.9962 | 48 | 5 | 5 | 100 | 50 | 0.0067 | tanh |
| FB15k-237 | 0.0009 | 0.000080 | 0.9938 | 48 | 5 | 4 | 5 | 1 | 0.0391 | ReLU |
| NELL-995 | 0.0011 | 0.000089 | 0.9938 | 48 | 5 | 5 | 5 | 1 | 0.2593 | ReLU |
| YAGO (not in paper) | 0.0003 | 0.000111 | 0.997 | 48 | 5 | 3 | 3 | 1 | 0.2131 | ReLU |
Sources: train.py and train.py. Both scripts run 50 epochs train.py.
Results
Author-reported. Metrics are filtered MRR, Hit@1 and Hit@10, with ties averaged §5.1. Hit@k is in percent, as printed. The inductive baseline numbers are not marked as copied; the transductive table marks copied values with "*" tab. 2. The text says RuleN was run with its default implementation §5.1.
Inductive reasoning tab. 1. Columns are the GraIL inductive benchmark versions V1 to V4 for WN18RR, FB15k-237 and NELL-995. The table is a headline in the paper, and the setup is in §5.1.
MRR:
| Method | WN18RR V1 | V2 | V3 | V4 | FB15k-237 V1 | V2 | V3 | V4 | NELL-995 V1 | V2 | V3 | V4 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| RuleN | .668 | .645 | .368 | .624 | .363 | .433 | .439 | .429 | .615 | .385 | .381 | .333 |
| Neural LP | .649 | .635 | .361 | .628 | .325 | .389 | .400 | .396 | .610 | .361 | .367 | .261 |
| DRUM | .666 | .646 | .380 | .627 | .333 | .395 | .402 | .410 | .628 | .365 | .375 | .273 |
| GraIL | .627 | .625 | .323 | .553 | .279 | .276 | .251 | .227 | .481 | .297 | .322 | .262 |
| RED-GNN | .701 | .690 | .427 | .651 | .369 | .469 | .445 | .442 | .637 | .419 | .436 | .363 |
Hit@1 (%):
| Method | WN18RR V1 | V2 | V3 | V4 | FB15k-237 V1 | V2 | V3 | V4 | NELL-995 V1 | V2 | V3 | V4 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| RuleN | 63.5 | 61.1 | 34.7 | 59.2 | 30.9 | 34.7 | 34.5 | 33.8 | 54.5 | 30.4 | 30.3 | 24.8 |
| Neural LP | 59.2 | 57.5 | 30.4 | 58.3 | 24.3 | 28.6 | 30.9 | 28.9 | 50.0 | 24.9 | 26.7 | 13.7 |
| DRUM | 61.3 | 59.5 | 33.0 | 58.6 | 24.7 | 28.4 | 30.8 | 30.9 | 50.0 | 27.1 | 26.2 | 16.3 |
| GraIL | 55.4 | 54.2 | 27.8 | 44.3 | 20.5 | 20.2 | 16.5 | 14.3 | 42.5 | 19.9 | 22.4 | 15.3 |
| RED-GNN | 65.3 | 63.3 | 36.8 | 60.6 | 30.2 | 38.1 | 35.1 | 34.0 | 52.5 | 31.9 | 34.5 | 25.9 |
Hit@10 (%):
| Method | WN18RR V1 | V2 | V3 | V4 | FB15k-237 V1 | V2 | V3 | V4 | NELL-995 V1 | V2 | V3 | V4 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| RuleN | 73.0 | 69.4 | 40.7 | 68.1 | 44.6 | 59.9 | 60.0 | 60.5 | 76.0 | 51.4 | 53.1 | 48.4 |
| Neural LP | 77.2 | 74.9 | 47.6 | 70.6 | 46.8 | 58.6 | 57.1 | 59.3 | 87.1 | 56.4 | 57.6 | 53.9 |
| DRUM | 77.7 | 74.7 | 47.7 | 70.2 | 47.4 | 59.5 | 57.1 | 59.3 | 87.3 | 54.0 | 57.7 | 53.1 |
| GraIL | 76.0 | 77.6 | 40.9 | 68.7 | 42.9 | 42.4 | 42.4 | 38.9 | 56.5 | 49.6 | 51.8 | 50.6 |
| RED-GNN | 79.9 | 78.0 | 52.4 | 72.1 | 48.3 | 62.9 | 60.3 | 62.1 | 86.6 | 60.1 | 59.4 | 55.6 |
Transductive reasoning tab. 2. "*" marks values copied from the original papers, "-" marks unavailable results, and "OOM" means out of memory tab. 2 caption. Dataset statistics are in tab. 3.
| Method | Family MRR | H@1 | H@10 | UMLS MRR | H@1 | H@10 | WN18RR MRR | H@1 | H@10 | FB15k-237 MRR | H@1 | H@10 | NELL-995 MRR | H@1 | H@10 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ConvE* | - | - | - | .94 | 92. | 96. | .43 | 39. | 49. | .325 | 23.7 | 50.1 | - | - | - |
| RotatE | .921 | 86.6 | 98.8 | .925 | 86.3 | 99.3 | .477 | 42.8 | 57.1 | .337 | 24.1 | 53.3 | .508 | 44.8 | 60.8 |
| QuatE | .941 | 89.6 | 99.1 | .944 | 90.5 | 99.3 | .480 | 44.0 | 55.1 | .350 | 25.6 | 53.8 | .533 | 46.6 | 64.3 |
| MINERVA | .885 | 82.5 | 96.1 | .825 | 72.8 | 96.8 | .448 | 41.3 | 51.3 | .293 | 21.7 | 45.6 | .513 | 41.3 | 63.7 |
| Neural LP | .924 | 87.1 | 99.4 | .745 | 62.7 | 91.8 | .435 | 37.1 | 56.6 | .252 | 18.9 | 37.5 | OOM | OOM | OOM |
| DRUM | .934 | 88.1 | 99.6 | .813 | 67.4 | 97.6 | .486 | 42.5 | 58.6 | .343 | 25.5 | 51.6 | OOM | OOM | OOM |
| RNNLogic* | - | - | - | .842 | 77.2 | 96.5 | .483 | 44.6 | 55.8 | .344 | 25.2 | 53.0 | - | - | - |
| pLogicNet* | - | - | - | .842 | 77.2 | 96.5 | .441 | 39.8 | 53.7 | .332 | 23.7 | 52.8 | - | - | - |
| CompGCN | .933 | 88.3 | 99.1 | .927 | 86.7 | 99.4 | .479 | 44.3 | 54.6 | .355 | 26.4 | 53.5 | OOM | OOM | OOM |
| DPMPN | .981 | 97.4 | 98.1 | .930 | 89.9 | 98.2 | .482 | 44.4 | 55.8 | .369 | 28.6 | 53.0 | .513 | 45.2 | 61.5 |
| RED-GNN | .992 | 98.8 | 99.7 | .964 | 94.6 | 99.0 | .533 | 48.5 | 62.4 | .374 | 28.3 | 55.8 | .543 | 47.6 | 65.1 |
Dataset statistics, transductive tab. 3. NELL-995* follows the version in [das2017go], not the one in [teru2019inductive] (the table caption says so).
| Dataset | entities | relations | facts F | valid | test |
|---|---|---|---|---|---|
| Family | 3,007 | 12 | 23,483 | 2,038 | 2,835 |
| UMLS | 135 | 46 | 5,327 | 569 | 633 |
| WN18RR | 40,943 | 11 | 86,835 | 3,034 | 3,134 |
| FB15k-237 | 14,541 | 237 | 272,115 | 17,535 | 20,466 |
| NELL-995* | 74,536 | 200 | 149,678 | 543 | 2,818 |
Ablation tab. 4. Each variant is evaluated on V1 of the three inductive datasets. Attn-w.o.-r_q removes the query relation from the attention. RED-Simp uses the direct construction of alg. 1 with a margin ranking loss on one negative sample, as in GraIL §5.5.
| Variant | WN18RR MRR | WN18RR H@10 | FB15k-237 MRR | FB15k-237 H@10 | NELL MRR | NELL H@10 |
|---|---|---|---|---|---|---|
| Attn-w.o.-r_q | .659 | 78.3 | .268 | 37.6 | .517 | 73.4 |
| RED-Simp | .683 | 79.6 | .311 | 45.3 | .563 | 75.8 |
| RED-GNN | .701 | 79.9 | .369 | 48.3 | .637 | 86.6 |
Per-distance MRR on WN18RR tab. 5. Distances are shortest-path lengths from e_q to e_a. The ratio row gives the share of test triples at each distance.
| Distance | 1 | 2 | 3 | 4 | 5 | >5 |
|---|---|---|---|---|---|---|
| ratio (%) | 34.9 | 9.3 | 21.5 | 7.5 | 8.9 | 17.9 |
| CompGCN (L=2) | .993 | .327 | .337 | .062 | .061 | .016 |
| DPMPN (L=5) | .982 | .381 | .333 | .102 | .057 | .001 |
| RED-GNN (L=5) | .993 | .563 | .536 | .186 | .089 | .005 |
GraIL without relation information tab. 6, app. B. Each variant is evaluated by MRR on V1 of the three inductive datasets. RED-no rel removes the relation term from the RED-GNN aggregation.
| Method | WN18RR V1 | FB15k-237 V1 | NELL-995 V1 |
|---|---|---|---|
| GraIL no rel | .620 | .255 | .475 |
| GraIL | .627 | .279 | .481 |
| RED-no rel | .557 | .198 | .384 |
| RED-GNN | .701 | .369 | .637 |
Other claims: RED-GNN has far fewer parameters than the other four transductive methods, because it learns no entity embeddings §5.3. The run-time comparison is in fig. 2 and is described only in words: GraIL is "hundreds of times" slower than RED-GNN on transductive data §5.3. The depth study fig. 4 shows MRR and coverage for L from 1 to 5 §5.5. For L of at least 3, RED-GNN is the best of the compared methods, and L is tuned over {3, 4, 5} §5.5.
Paper vs code
Code: AutoML-Research/RED-GNN, commit c9badffdfe6b46dd94849ea843734a5b3d830c57. The paper's footnote links this repository, which is the basis for treating it as official. The repository has no LICENSE file, so it is cited here, not quoted; code_license is recorded as none. The README cites a 2026 journal version of the paper (Artificial Intelligence, doi 10.1016/j.artint.2026.104520) README.md. The paper text read here is the arXiv v2 LaTeX, which is in WWW '22 format, so some differences may come from the journal revision.
Matches (checked, no discrepancy): messages are the subject state plus the layer relation embedding, scaled by attention, summed, then linear and activated models.py. The attention is a sigmoid over a ReLU hidden layer on the three concatenated inputs models.py. Identity relations are added to the facts load_data.py. Reverse relations are added to each triple load_data.py. Edge expansion goes only forward from the query entity load_data.py. Scores are zero for entities not visible at layer L models.py. The score has no bias, as in eq. 5 models.py. The loss is the sum over the batch of eq. 6 base_model.py.
Differences:
- GRU across layers (not in the paper). After every layer the code applies dropout and then a single GRU cell, shared by all layers. The GRU carries each node's hidden state across layers, with the state of a node carried over to its new index in the next layer models.py. The paper's h^L is the output of the last GNN layer eq. 3, eq. 5. The GRU parameters are not in the paper's parameter list Theta §4.2.
- Dropout between layers (not in the equations). The paper tunes a dropout rate §5.1 but states no placement. The code applies it after each layer, before the GRU models.py.
- Attention bias (not in the paper). The three attention projections are summed, not concatenated, and the query-relation projection and the scalar output carry biases models.py. Equation 4 has no bias terms.
- Weight decay and learning-rate decay. The code uses Adam with weight decay lambda applied to all parameters and an exponential learning-rate decay of gamma per epoch base_model.py. The paper states only Adam and the tuning range for weight decay §5.1.
- NaN guard (not in the paper). After every optimiser step, any NaN parameter is replaced by a uniform random number base_model.py.
- Model selection. The code prints the epoch with the best validation MRR, and it has no early stopping train.py. The paper says the hyperparameters are selected by validation MRR with at most 50 epochs §5.1.
- Inductive data mapping differs from the paper. As written, the loader trains on the queries in
valid.txtof the transductive directory load_data.py. Its validation queries are the transductivetest.txtqueries load_data.py. Its test set is the union of the inductivevalid.txtandtest.txtqueries load_data.py. The paper trains on T_tra and reports on T_tst §5.1. The data files are not in the repository, so the mapping could not be checked against the files. - Transductive split is re-drawn every epoch. The code merges the facts and training triples, shuffles them, and takes 3/4 as the fact graph and 1/4 as training queries load_data.py, then calls this after each epoch's evaluation base_model.py. The paper describes a 3:1 split §5.2 and does not mention re-drawing. The README describes a 3:1 random split of
train.txtREADME.md. Validation and test use the full known graph of facts and training triples load_data.py. - Ties. The code averages the full rank of tied scores but uses the minimum rank for the filtered rank utils.py. The paper says that ties are averaged §5.1.
- Hyperparameter values. The code fixes one configuration per dataset (second and third tables). The paper gives only ranges §5.1. The paper's d set {32, 48, 64, 96} does not contain the code's d = 16 for NELL-995 V3 and V4 train.py.
- Extra code.
Temporal/holds temporal-KG code, which the paper does not cover. Its results are not included in this card.
Requirements README.md: PyTorch 1.9.1 with CUDA 10.2 and torch_scatter 2.0.9. The code calls .cuda() throughout, and data directories are referenced but not included.
Pitfalls
- Table 1 bolding does not match the numbers, and the text overstates the margin. The text says RED-GNN "outperforms the baselines across all benchmarks" §5.1. In the printed tables, RuleN is higher on FB15k-237 V1 Hit@1 (30.9 vs 30.2, although RED-GNN is bolded), on NELL-995 V1 Hit@1 (54.5 vs 52.5), and DRUM (87.3) and Neural LP (87.1) are higher than RED-GNN (86.6) on NELL-995 V1 Hit@10 tab. 1. The paper acknowledges the Hit@10 gap in the rule-based methods §5.1.
- Table 2 has cells where RED-GNN is not best. DPMPN is higher on FB15k-237 Hit@1 (28.6 vs 28.3, bolded) and CompGCN on UMLS Hit@10 (99.4 vs 99.0) tab. 2. RED-GNN is best on MRR in all five datasets.
- Possible copy error in Table 2. The RNNLogic* and pLogicNet* rows show the same UMLS values (.842, 77.2, 96.5). The asterisk says these were copied from the original papers, so check them against those papers before reuse tab. 2. The ConvE* UMLS Hit values are printed as "92." and "96.".
- Commented-out hyperparameter table in the source. The LaTeX source contains a table of "optimal hyper-parameters" inside a comment block [tex source, appendix]. It is not in the published text, and some values differ from the code. For example, NELL-995 V2 weight decay is 0.00066 there and 0.000066 in the code, and WN18RR V1 uses ReLU there and identity in the code. This card does not use the commented table.
- Unreached candidates have a fixed logit of 0. Entities not visible at layer L get the score 0 alg. 2. The learned scores can be negative, so an unreached entity can outrank reached ones in the softmax and in the ranking. The paper's per-distance results show the drop beyond L hops tab. 5.
- Layer updates must read the previous layer. Algorithm 2 updates the states of layer l from those of layer l-1 alg. 2, line 3. Writing into the same buffer during the loop mixes layers. The pseudocode above uses a fresh buffer.
- Loss scale depends on batch size. Eq. 6 is a sum over the training queries, not a mean §4.2. The code also sums over the batch base_model.py. Averaging instead would change the effective learning rate, and the paper does not discuss this.
- Full softmax over all entities. The training loss needs a score for every entity per query eq. 6. The paper says this is why RED-Simp switched to a margin ranking loss §5.5. Memory and time grow with |V|.
- Dense baselines run out of memory on large graphs. The paper attributes the failure of three baselines on the largest transductive dataset to their use of a full adjacency matrix. They are marked OOM in the NELL-995 column §5.2, tab. 2.
- Complexity hides the cost of a deep recursion. The cost bound for RED-GNN depends on the neighbourhood growth min(D^L, |F| L) §4.3, which is large for high-degree graphs. The paper gives no measured peak memory for RED-GNN in the text.
- Single runs, no variance. The paper reports one number per cell and does not state seeds or the number of runs §5. Some margins are small, for example RED-GNN .374 vs DPMPN .369 MRR on FB15k-237 tab. 2. Without variance figures, such gaps cannot be judged as significant.
- Interpretability is a construction, not a learned guarantee. Theorem 1 shows that a parameter setting exists app. C. The case study shows attention maps for two datasets with L = 3 §5.4. The paper does not measure how often learned attention recovers the rules.
- Requires CUDA.
.cuda()is hard-coded in the model and loader models.py. CPU runs need code changes.
Lineage
- Builds on: relational paths and rule learners (RuleN, Neural LP, DRUM and the path samplers MINERVA and M-walk), named as cited in §2.1. No cards exist for these. Subgraph encoding follows GraIL §2.2, §4: GraIL, which the paper also uses as the main inductive baseline §5.1. The message-passing form follows the general GNN framework §2.2, eq. 1. The query-dependent attention follows GAT §4.2, with sigmoid in place of softmax §4.2.
- Compared against: RuleN, Neural LP, DRUM, GraIL in the inductive setting §5.1; ConvE, RotatE, QuatE, MINERVA, Neural LP, DRUM, RNNLogic, pLogicNet, CompGCN, DPMPN in the transductive setting §5.2.
- Concurrent work: NBFNet, cited as a concurrent method that recursively encodes all paths from the query entity with a full adjacency matrix §6. No card exists for it, and no arXiv id is given in the source.
- Superseded by: not stated in this card's sources. The repository README cites a 2026 journal version of this paper README.md.
Source and license
Adapted from “Knowledge Graph Reasoning with Relational Digraph” by Yongqi Zhang, Quanming Yao (arXiv:2108.06040), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors. Code citations refer to https://github.com/AutoML-Research/RED-GNN at commit c9badffdfe6b (none (no LICENSE file in repository)). Any quoted code is shown under that license.