D YNAMICALLY
P RUNED
M ESSAGE
P ASSING
N ETWORKS FOR L ARGE - SCALE K NOWLEDGE
G RAPH
R EASONING
Anonymous authors
Paper under double-blind review
A BSTRACT
We propose Dynamically Pruned Message Passing Networks (DPMPN) for largescale knowledge graph reasoning.
In contrast to existing models, embeddingbased or path-based, we learn an input-dependent subgraph to explicitly model reasoning process.
Subgraphs are dynamically constructed and expanded by applying graphical attention mechanism conditioned on input queries.
In this way, we not only construct graph-structured explanations but also enable message passing designed in Graph Neural Networks (GNNs) to scale with graph sizes.
We take the inspiration from the consciousness prior proposed by Bengio (2017) and develop a two-GNN framework to encode input-agnostic full structure representation and learn input-dependent local one coordinated by an attention module.
Experiments show the reasoning capability of our model to provide clear graphical explanations as well as predict results accurately, outperforming most stateof-the-art methods in knowledge base completion tasks.
I NTRODUCTION
Modern deep learning systems should bring in explicit reasoning modeling to complement their black-box models, where reasoning takes a step-by-step form about organizing facts to yield new knowledge and ﬁnally draw a conclusion.
Particularly, we rely on graph-structured representation to model reasoning by manipulating nodes and edges where semantic entities or relations can be explicitly represented (Battaglia et al., 2018).
Here, we choose knowledge graph scenarios to study reasoning where semantics have been deﬁned on nodes and edges.
For example, in knowledge base completion tasks, each edge is represented by a triple (cid:104) head, rel, tail (cid:105) that contains two entities and their relation. The goal is to predict which entity might be a tail given query (cid:104) head, rel, ? (cid:105) .
Existing models can be categorized into embedding-based and path-based model families. The embedding-based (Bordes et al., 2013; Sun et al., 2018; Lacroix et al., 2018) often achieves a high score by ﬁtting data using various neural network techniques but lacks interpretability.
The pathbased (Xiong et al., 2017; Das et al., 2018; Shen et al., 2018; Wang, 2018) attempts to construct an explanatory path to model an iterative decision-making process using reinforcement learning and recurrent networks.
A question is: can we construct structured explanations other than a path to better explain reasoning in graph context.
To this end, we propose to learn a dynamically induced subgraph which starts with a head node and ends with a predicted tail node as shown in Figure 1.
Graph reasoning can be powered by Graph Neural Networks.
Graph reasoning needs to learn about entities, relations, and their composing rules to manipulate structured knowledge and produce structured explanations.
Graph Neural Networks (GNNs) provide such structured computation and also inherit powerful data-ﬁtting capacity from deep neural networks (Scarselli et al., 2009; Battaglia et al., 2018).
Speciﬁcally, GNNs follow a neighborhood aggregation scheme to recursively aggregate information from neighbors to update node states.
After T iterations, each node can carry structure information from its T -hop neighborhood (Gilmer et al., 2017; Xu et al., 2018a).
GNNs need graphical attention expression to interpret.
Neighborhood attention operation is a popular way to implement attention mechanism on graphs (Velickovic et al., 2018; Hoshen, 2017) by focusing on speciﬁc interactions with neighbors.
Here, we propose a new graphical attention mechanism not only for computation but also for interpretation.
We present three considerations when [Figure] constructing attention-induced subgraphs: (1) given a subgraph, we ﬁrst attend within it to select a few nodes and then attend over those nodes’ neighborhood for next expansion; (2) we propagate attention across steps to capture long-term dependency; (3) our attention mechanism models reasoning process explicitly through pipeline disentangled from underlying representation computing.
GNNs need input-dependent pruning to scale.
GNNs are notorious for their poor scalability.
Consider one message passing iteration on a graph with | V | nodes and | E | edges.
Even if the graph is sparse, the complexity of O ( | E | ) is still problematic on large graphs with millions of nodes and edges.
Besides, mini-batch based training with batch size B and high dimensions D would lead to O ( BD | E | ) making things worse.
However, we can avoid this situation by learning input-dependent pruning to run computation on dynamical graphs, as an input query often triggers a small fraction of the entire graph so that it is wasteful to perform computation over the full graph for each input.
Cognitive intuition of the consciousness prior.
Bengio (2017) brought the notion of attentive awareness from cognitive science into deep learning in his consciousness prior proposal.
He pointed out a process of disentangling high-level factors from full underlying representation to form a lowdimensional combination through attention mechanism.
He proposed to use two recurrent neural networks (RNNs) to encode two types of state: unconscious state represented by a high-dimensional vector before attention and conscious state by a derived low-dimensional vector after attention.
We use two GNNs instead to encode such states on nodes.
We construct input-dependent subgraphs to run message passing efﬁciently, and also run full message passing over the entire graph to acquire features beyond a local view constrained by subgraphs.
We apply attention mechanism between the two GNNs, where the bottom runs before attention, called Inattentive GNN (IGNN) , and the above runs on each attention-induced subgraph, called Attentive GNN (AGNN) .
IGNN provides representation computed on the full graph for AGNN. AGNN reinforces representation within a cohesive group of nodes to produce sharp semantics.
Experimental results show that our model attains very competitive scores on HITS@1,3 and the mean reciprocal rank (MRR) compared to the best embedding-based method so far.
More importantly, we provide explanations while they do not.
A DDRESSING THE S CALE -U P P ROBLEM
Notation.
We denote training data by { ( x i , y i ) } N i =1 .
We denote a full graph by G = (cid:104)V , E(cid:105) with relations R and an input-dependent subgraph by G ( x ) = (cid:104) V G ( x ) , E G ( x ) (cid:105) which is an induced subgraph of G .
We denote boundary of a graph by ∂G
where V ∂G = N ( V G ) − V G and
N ( V G ) means neighbors of nodes in V G .
We also denote high-order boundaries such as ∂ 2 G where
V ∂ 2 G = N
( N ( V G )) ∪ N ( V G ) − V G .
Trainable parameters include node embeddings { e v } v ∈V , relation embeddings { e r } r ∈R , and weights used in two GNNs and an attention module.
When performing full or pruned message passing, node and relation embeddings will be indexed according to the operated graph, denoted by θ G or θ G ( x ) .
For IGNN, we use H t of size |V| × D to denote node hidden states at step t ; for AGNN, we use H t ( x ) of size | V G ( x ) | × D to denote.
The objective is written as (cid:80) Ni
=1 l ( x i , y i ; θ G ( x i ) , θ G ) , where G ( x i ) is dynamically constructed.
The scale-up problem in GNNs.
First, we write the full message passing in IGNN as
[Equation]
where f IGNN represents all involved operations in one message passing iteration over G , including: (1) computing messages along each edge with the complexity 1 of O ( BD |E| ) , (2) aggregating messages received at each node with O ( BD |E| ) , and (3) updating node states with O ( BD |V| ) .
For T -step propagation, the per-batch complexity is O
( BDT ( |E| + |V| )) .
Considering that backpropagation requires intermediate computation results to be saved during one pass, this complexity counts for both time and space.
However, since IGNN is input-agnostic, node representations can be shared across inputs in one batch so that we can remove B to get O ( DT ( |E| + |V| )) .
If we use a sampled edge set ˆ E from E such that | ˆ E| ≈ k |V| , the complexity can be further reduced to O ( DT |V| ) .
The pruned message passing in AGNN can be written as
[Equation]
Its complexity can be computed similarly as above.
However, we cannot remove B .
Fortunately, subgraph G ( x ) is not G .
If we let x be a node v , G ( x ) grows from a single node, i.e., G 0 ( x ) = { v } , and expands itself each step, leading to a sequence of ( G 0 ( x ) , G 1 ( x ) , . .
, G T ( x )) .
Here, we describe the expansion behavior as consecutive expansion , which means no jumping across neighborhood allowed, so that we can ensure that
[Equation]
Many real-world graphs follow the small-world pattern, and the six degrees of separation implies
G 0 ( x ) ∪ ∂ 6 G 0 ( x ) ≈ G .
The upper bound of G t ( x ) can grow exponentially in t , and there is no guarantee that G t ( x ) will not explode.
Proposition.
Given a graph G (undirected or directed in both directions), we assume the probability of the degree of an arbitrary node being less than or equal to d is larger than p , i.e., P (deg( v ) ≤ d ) > p, ∀ v ∈ V .
Considering a sequence of consecutively expanding subgraphs ( G 0 , G 1 , . .
, G T ) , starting with G 0 = { v } , for all t ≥ 1 , we can ensure
[Equation]
The proposition implies the guarantee of upper-bounding | V G t ( x ) | becomes exponentially looser and weaker as t gets larger even if the given assumption has a small d and a large p (close to 1).
We deﬁne graph increment at step t as ∆ G t ( x ) such that G t ( x ) =
G t − 1 ( x ) ∪ ∆ G t ( x ) .
To prevent G t ( x ) from explosion, we need to constrain ∆ G t ( x ) .
Sampling strategies. A simple but effective way to handle the large scale is to do sampling.
[Equation]
) , where we sample nodes from the boundary of G t − 1 ( x ) .
∆ G t ( x ) = ∂ (cid:92) G t − 1 ( x ) , where we take the boundary of sampled nodes from G t − 1 ( x ) . 3. ∆ G t ( x ) = ˆ ∂ (cid:92) G t − 1 ( x ) , where we sample nodes twice from G t − 1 ( x ) and from ∂ (cid:92) G t − 1 ( x ) . 4.
∆ G t ( x ) = ˆ ∂ (cid:92) G t − 1 ( x ) (cid:98) , where we sample nodes three times with the last from ˆ ∂ (cid:92) G t − 1 ( x ) .
Obviously, we have ˆ ∂ (cid:92) G t − 1 ( x ) (cid:98) ⊆
ˆ ∂ (cid:92) G t − 1 ( x ) ⊆
∂ (cid:92) G t − 1 ( x ) and G t − 1 ( x ) ∪ ∂ (cid:92) G t − 1 ( x ) ⊆
G t − 1 ( x ) ∪ ∂G t − 1 ( x ) .
Further, we let N {+
+}
and N 3 be the maximum number of sampled nodes in ∂ (cid:92) G t − 1 ( x ) and the last sampling of ˆ ∂ (cid:92) G t − 1 ( x ) (cid:98) respectively and let N 2 be per-node maximum sampled neighbors in ˆ ∂G t − 1 ( x ) , and then we can obtain much tighter guarantee as follow:
AggrOp ... AggrOp ...
AttdOp ...
Inattentive GNN Attentive GNN
OneBatch
Attention Module ...
[Figure]
or [Figure] P ( | V ∆ G t ( x ) | ≤ N 1 ( d − 1)) > p N 1 for ∂ (cid:92) G t − 1 ( x ) .
P ( | V ∆ G t ( x ) | ≤ N 1 N 2 ) = 1 and P ( | V ∆ G t ( x ) | ≤ N 1 · min( d − 1 , N 2 )) > p N 1 for ˆ ∂ (cid:92) G t − 1 ( x ) . P ( | V ∆ G t ( x ) | ≤ min( N 1 N 2 , N 3 )) = 1 for ˆ ∂ (cid:92) G t − 1 ( x ) (cid:98) . Attention strategies.
Although we guarantee | V G T ( x ) | ≤ 1 + T min( N 1 N 2 , N 3 ) by ˆ ∂ (cid:92) G t − 1 ( x ) (cid:98) and constrain the growth of G t − 1 ( x ) by decreasing either N 1 N 2 or N 3 , smaller sampling size means less area explored and less chance to hit target nodes.
To make efﬁcient selection rather than random sampling, we apply attention mechanism to do the top- K selection where K can be small.
We change ˆ ∂ (cid:92) G t − 1 ( x ) (cid:98) to ˆ ∂G t − 1 ( x ) (cid:101)(cid:101) where ∼ represents the operation of attending over nodes and picking the top- K .
There are two types of attention operations, one applied to G t − 1 ( x ) and the other applied to ˆ ∂G t − 1 ( x ) (cid:101) .
Note that the size of ˆ ∂G t − 1 ( x ) (cid:101) might be much larger if we intend to sample more nodes with larger N 2 to sufﬁciently explore the boundary.
Nevertheless, we can address this problem by using smaller dimensions to compute attention, since attention on each node is a scalar requiring a smaller capacity compared to node representation vectors computed in message passing.
DPMPN M ODEL 3. A RCHITECTURE DESIGN FOR KNOWLEDGE GRAPH REASONING
Our model architecture as shown in Figure 2 consists of:
• IGNN module : performs full message passing to compute full-graph node representations.
• AGNN module : performs a batch of pruned message passing to compute input-dependent node representations which also make use of underlying representations from IGNN.
• Attention Module : performs a ﬂow-style attention transition process, conditioned on node representations from both IGNN and AGNN but only affecting AGNN.
IGNN module.
We implement it using standard message passing mechanism (Gilmer et al., 2017).
If the full graph has an extremely large number of edges, we sample a subset of edges, ˆ E τ ⊂ E , randomly each step.
For a batch of input queries, we let node representations from IGNN be shared across queries, containing no batch dimension.
Thus, its complexity does not scale with batch size and the saved resources can be allocated to sampling more edges.
Each node v has a state H τv, : at step τ , where the initial H 0 v, : =
e v .
Each edge (cid:104) v (cid:48) , r, v (cid:105) produces a message, denoted by M τ (cid:104) v (cid:48) ,r,v (cid:105) , : at step τ .
The computation components include:
• Message function: M τ (cid:104) v (cid:48) ,r,v (cid:105) , : = ψ IGNN ( H τv (cid:48) , : , e r , H τv, : ) , where (cid:104) v (cid:48) ,
r, v (cid:105) ∈
ˆ E τ .
• Message aggregation: M τv, : = 1 √ N τ ( v ) (cid:80) v (cid:48) ,r M τ (cid:104) v (cid:48) ,r,v (cid:105) , : , where (cid:104) v (cid:48) ,
r, v (cid:105) ∈
ˆ E τ .
• Node state update function:
H τ +1 v, :
= H τv, : + δ IGNN ( H τv, : , M τv, : , e v ) , where v ∈ V .
We compute messages only for sampled edges, (cid:104) v (cid:48) , r, v (cid:105) ∈
ˆ E τ , each step.
Functions ψ IGNN and δ IGNN are implemented by a two-layer MLP (using leakyReLu for the ﬁrst layer and tanh for the second) with input arguments concatenated respectively.
Messages are aggregated by dividing the sum by the square root of N τ ( v ) , the number of neighbors that send messages to v , preserving the scale of variance.
We use a residual adding to update each node state instead of a GRU or a LSTM.
After running for T steps, we output a pooling result or simply the last, denoted by H = H T , to feed into downstream modules.
AGNN module.
AGNN is input-dependent, which means node states depend on input query x = (cid:104) head, rel, ?
(cid:105) , denoted by H tv, : ( x ) .
We implement pruned message passing, running on small subgraphs each conditioned on an input query.
We leverage the sparsity and only save H tv, : ( x ) for visited nodes v ∈ V G t ( x ) .
When t = 0 , we start from node head with V G 0 ( x ) = { v head } .
When computing messages, denoted by M t (cid:104) v (cid:48) ,r,v (cid:105) , : ( x ) , we use an attending-sampling-attending procedure, explained in Section 3.2, to constrain the number of computed edges.
The computation components include:
• Message function: M t (cid:104) v (cid:48) ,r,v (cid:105) , : ( x ) = ψ AGNN ( H tv (cid:48) , : ( x ) , c
r ( x ) , H tv, : ( x )) , where (cid:104) v (cid:48) , r, v (cid:105) ∈
E G t ( x ) 2 , and c r ( x ) =
[ e r , q head , q rel ] represents a context vector.
• Message aggregation: M tv, : ( x ) = 1 √ N t ( v ) (cid:80) v (cid:48) ,r M t (cid:104) v (cid:48) ,r,v (cid:105) , : ( x ) , where (cid:104) v (cid:48) , r, v
(cid:105) ∈
E G t ( x ) .
• Node state attending function: (cid:102) H t +1 v, : ( x ) = a t +1 v W H v, : , where a t +1 v is an attention score.
• Node state update function: H t +1 v, : ( x ) =
H tv, : ( x ) + δ AGNN ( H tv, : ( x ) , M tv, : ( x ) , c t +1 v ( x )) , where c t +1 v ( x ) =
[ (cid:102)
H t +1 v, : ( x ) , q head , q rel ] also represents a context vector.
Query context is deﬁned by its head and relation embeddings, i.e., q head =
e head and q rel =
e rel .
We introduce a node state attending function to pass node representation information from IGNN to AGNN weighted by a scalar attention score a t +1 v and projected by a learnable matrix W .
We initialize H 0 v, : ( x ) =
H v, : for node v ∈ V G 0 ( x ) , letting unseen nodes hold zero states.
Attention module.
Attention over T steps is represented by a sequence of node probability distributions, denoted by a t ( t = 1 , 2 . . .
, T ) .
The initial distribution a 0 is a one-hot vector with a
[ v head ] = 1 .
To spread attention, we need to compute transition matrices T t each step.
Since it is conditioned on both IGNN and AGNN, we capture two types of interaction between v (cid:48) and v :
H tv (cid:48) , : ( x ) ∼ H tv, : ( x ) , and H tv (cid:48) , : ( x ) ∼ H v, : .
The former favors visited nodes, while the latter is used to attend to unseen neighboring nodes.
[Equation]
5) where W 1 and W 2 are two learnable matrices.
Each MLP uses one single layer with the leakyReLu activation.
To reduce the complexity for computing T t , we use nodes v {+(cid:
+}
) ∈ VG t ( x ) (cid:101) , which contains nodes with the k -largest attention scores at step t , and use nodes v sampled from v (cid:48) ’s neighbors to compute attention transition for the next step.
Due to the fact that nodes v (cid:48) result from the top- k pruning, the loss of attention may occur to diminish the total amount.
Therefore, we use a renormalized version, a t +
=
T t a t / (cid:107) T t a t (cid:107) , to compute new attention scores.
We use attention scores at the ﬁnal step as the probability to predict the tail node.
[Figure]
3. C OMPLEXITY REDUCTION BY ITERATIVE ATTENDING , SAMPLING AND ATTENDING
AGNN deals with each subgraph relying on input x and keeps a few selected nodes in V G t ( x ) , called visited nodes .
Initially, V G 0 ( x ) contains only one node v head , and then V G t ( x ) is enlarged by adding new nodes each step.
When propagating messages, we can just consider the one-hop neighborhood each step.
However, the expansion goes so rapidly that it covers almost all nodes after a few steps.
The key to address the problem is to constrain the scope of nodes we can expand the boundary from, i.e., the core nodes which determine where we can go next.
We call it the attending-from horizon , G t ( x ) (cid:101) , selected according to attention scores a t .
Given this horizon, we may still need node sampling over the neighborhood N ( G t ( x ) (cid:101) ) in some cases where a hub node of extremely high degree exists to cause an extremely large neighborhood.
We introduce an attending-to horizon , denoted by (cid:98) N ( G t ( x ) (cid:101) ) (cid:101) , inside the sampling horizon , denoted by (cid:98) N ( G t ( x ) (cid:101) ) .
The attention module runs within the sampling horizon with smaller dimensions exchanged for sampling more neighbors for a larger coverage.
In one word, we face a trade-off between coverage and complexity, and our strategy is to sample more but attend less plus using small dimensions to compute attention.
We obtain the attending-to horizon according to newly computed attention scores a t +1 .
Then, message passing iteration at step t in AGNN can be further constrained on edges between G t ( x ) (cid:101) and (cid:98) N ( G t ( x ) (cid:101) ) (cid:101) , a smaller set than E G t ( x ) .
We illustrate this procedure in Figure 3.
E XPERIMENTS
Datasets.
We use six large KG datasets: FB15K, FB15K-237, WN18, WN18RR, NELL995, and
YAGO3-10.
[-FB15K-
 [28]-]FB15K-237 (Toutanova & Chen, 2015) is sampled from FB15K (Bordes et al., 2013) with redundant relations removed, and WN18RR (Dettmers et al., 2018) is a subset of WN18 (Bordes et al., 2013) removing triples that cause test leakage.
Thus, they are both considered more challenging.
NELL995 (Xiong et al., 2017) has separate datasets for 12 query relations each corresponding to a single-query-relation KBC task.
YAGO3-10 (Mahdisoltani et al., 2014) contains the largest KG with millions of edges.
Their statistics are shown in Table 1.
We ﬁnd some statistical differences between train and validation (or test).
In a KG with all training triples as its edges, a triple ( head, rel, tail ) is considered as a multi-edge triple if the KG contains other triples that also connect head and tail ignoring the direction.
We notice that FB15K-237 is a special case compared to the others, as there are no edges in its KG directly linking any pair of head and tail in validation (or test).
Therefore, when using training triples as queries to train our model, given a batch, for FB15K-237, we cut off from the KG all triples connecting the head-tail pairs in the given batch, ignoring relation types and edge directions, forcing the model to learn a composite reasoning pattern rather than a single-hop pattern, and for the rest datasets, we only remove the triples of this batch and their inverse from the KG to avoid information leakage before training on this batch.
This can be regarded as a hyperparameter tuning whether to force a multi-hop reasoning or not, leading to a performance boost of about 2% in HITS@1 on FB15-237.
Experimental settings.
We use the same data split protocol as in many papers (Dettmers et al., 2018; Xiong et al., 2017; Das et al., 2018).
We create a KG, a directed graph, consisting of all train triples and their inverse added for each dataset except NELL995, since it already includes reciprocal relations.
Besides, every node in KGs has a self-loop edge to itself.
We also add inverse relations into the validation and test set to evaluate the two directions.
For evaluation metrics, we use HITS@1,3,10 and the mean reciprocal rank (MRR) in the ﬁltered setting for FB15K-237, WN18RR,
[Table] [Table]
H@
H@ H@
MRR
H@ H@
H@
MRR
TransE [ ♠ ] - - 46.
DistMult [ ♣ ] 15.
43 DistMult [ ♥ ] 20.6 (.4) 31.8 (.2) - 29.0 (.2) 38.4 (.4) 42.4 (.3) - 41.3 (.3)
ComplEx [ ♣ ] 15.
44 ComplEx [ ♥ ] 20.8 (.2) 32.6 (.5) - 29.6 (.2) 38.5 (.3) 43.9 (.3) - 42.2 (.2)
ConvE [ ♣ ] 23.
43 ConvE [ ♥ ] 23.3 (.4) 33.8 (.3) - 30.8 (.2) 39.6 (.3) 44.7 (.2) - 43.3 (.2)
RotatE [ ♦ ] 24.
ComplEx-N3[ (cid:122) ] - -  - -
NeuralLP [ ♥ ] 18.2 (.6) 27.2 (.3) - 24.9 (.2) 37.2 (.1) 43.4 (.1) - 43.5 (.1)
MINERVA [ ♥ ] 14.1 (.2) 23.2 (.4) - 20.5 (.3) 35.1 (.1) 44.5 (.4) - 40.9 (.1) MINERVA [ (cid:52) ] - - 45.
[Table]
FB15K, WN18, and YAGO3-10, and use the mean average precision (MAP) for NELL995’s singlequery-relation KBC tasks.
For NELL995, we follow the same evaluation procedure as in (Xiong et al., 2017; Das et al., 2018; Shen et al., 2018), ranking the answer entities against the negative examples given in their experiments.
We run our experiments using a 12G-memory GPU, TITAN X (Pascal), with Intel(R) Xeon(R) CPU E5-2670 v3 @ 2.30GHz.
Our code is written in Python based on TensorFlow 2.0 and NumPy 1.16 and can be found by the link 3 below.
We run three times for each hyperparameter setting per dataset to report the means and standard deviations.
See hyperparameter details in the appendix.
Baselines.
We compare our model against embedding-based approaches, including TransE (Bordes et al., 2013), TransR
(Lin et al., 2015b), DistMult (Yang et al., 2015), ConvE (Dettmers et al., 2018), ComplE (Trouillon et al., 2016), HolE (Nickel et al., 2016), RotatE (Sun et al., 2018), and ComplEx-N3 (Lacroix et al., 2018), and path-based approaches that use RL methods, including
DeepPath (Xiong et al., 2017), MINERVA (Das et al., 2018), and M-Walk (Shen et al., 2018), and also that uses learned neural logic, NeuralLP (Yang et al., 2017).
Comparison results and analysis.
We report comparison on FB15K-23 and WN18RR in Table 2.
Our model DPMPN signiﬁcantly outperforms all the baselines in HITS@1,3 and MRR.
Compared to the best baseline, we only lose a few points in HITS@10 but gain a lot in HITS@1,3.
We speculate that it is the reasoning capability that helps DPMPN make a sharp prediction by exploiting graph-structured composition locally and conditionally.
When a target becomes too vague to predict, reasoning may lose its advantage against embedding-based models.
However, path-based baselines, with a certain ability to do reasoning, perform worse than we expect.
We argue that it might be inappropriate to think of reasoning, a sequential decision process, equivalent to a sequence of nodes.
The average lengths of the shortest paths between heads and tails as shown in Table 1 suggests a very short path, which makes the motivation of using a path almost useless.
The reasoning pattern should be modeled in the form of dynamical local graph-structured pattern with nodes densely connected
[Figure]
Convergence analysis.
Our model converges very fast during training.
We may use half of training queries to train model to generalize as shown in Figure 4(A).
Compared to less expensive embedding-based models, our model need to traverse a number of edges when training on one input, consuming much time per batch, but it does not need to pass a second epoch, thus saving a lot of training time.
The reason may be that training queries also belong to the KG’s edges and some might be exploited to construct subgraphs during training on other queries.
Component analysis.
Given the stacked GNN architecture, we want to examine how much each
GNN component contributes to the performance.
Since IGNN is input-agnostic, we cannot rely on its node representations only to predict a tail given an input query.
However, AGNN is inputdependent, which means it can be carried out to complete the task without taking underlying node representations from IGNN.
Therefore, we can arrange two sets of experiments: (1) AGNN + IGNN, and (2) AGNN-only.
In AGNN-only, we do not run message passing in IGNN to compute H v, : but instead use node embeddings as H v, : , and then we run pruned message passing in AGNN as usual.
We want to be sure whether IGNN is actually useful.
In this setting, we compare the ﬁrst set which runs IGNN for two steps against the second one which totally shuts IGNN down.
The results in Figure 4(B) (and Figure 7(B) in Appendix) show that IGNN brings an amount of gains in each metric on WN18RR (and FB15K-23), indicating that representations computed by full-graph message passing indeed help subgraph-based message passing.
Horizon analysis.
The sampling, attending-to, attending-from and searching (i.e., propagation steps) horizons determine how large area a subgraph can expand over.
These factors affect computation complexity as well as prediction performance.
Intuitively, enlarging the exploring area by sampling more, attending more, and searching longer, may increase the chance of hitting a target to gain some performance.
However, the experimental results in Figure 4(C)(D) show that it is not always the case.
In Figure 4(E), we can see that increasing the maximum number of attending- [Figure] AthletePlaysForTeamAthletePlaysInLeagueAthleteHomeStadiumAthletePlaysSportTeamPlaysSportOrgHeadQuarteredInCityWorksForPersonBornInLocationPersonLeadsOrgOrgHiredPersonAgentBelongsToOrgTeamPlaysInLeague [Figure]
[Figure]
T r a i n i n g T i m e f o r O n e E p o c h [Figure]
from nodes per step is useful.
That also explains why we call nodes in the attending-from horizon the core nodes , as they determine where subgraphs can be expanded and how attention will be propagated to affect the ﬁnal probability distribution on the tail prediction.
However, GPUs with a limited memory do not allow for a too large number of sampled or attended nodes especially for
Max-attending-from-per-step .
The detailed explanations can be found in attention strategies in Section 2 where the upper bound is controlled by N 1 N 2 and N 3 ( Max-attending-from-per-step corresponding to N 1 , Max-sampling-per-node to N 2 , and Max-attending-to-per-step to N 3 ).
In N 1 N 2 , Section 3.2 suggests that we should sample more by a large N 2 but attend less by a small N 1 .
Figure 4(F) suggests that the propagation steps of AGNN should not go below four.
Attention ﬂow analysis.
If the ﬂow-style attention really captures the way we reason about the world, its process should be conducted in a diverging-converging thinking pattern.
Intuitively, ﬁrst, for the diverging thinking phase, we search and collect ideas as much as we can; then, for the converging thinking phase, we try to concentrate our thoughts on one point.
To check whether the attention ﬂow has such a pattern, we measure the average entropy of attention distributions changing along steps and also the proportion of attention concentrated at the top-1,3,5 nodes.
As we expect, attention is more focused at the ﬁnal step and the beginning.
Time cost analysis.
The time cost is affected not only by the scale of a dataset but also by the horizon setting.
For each dataset, we list the training time for one epoch corresponding to our standard hyperparameter settings in the appendix.
Note that there is always a trade-off between complexity and performance.
We thus study whether we can reduce time cost a lot at the price of sacriﬁcing a little performance.
We plot the one-epoch training time in Figure 6(A)-(D), using the same settings as we do in the horizon analysis.
We can see that Max-attending-from-per-step and #Steps-in-AGNN affect the training time signiﬁcantly while Max-sampling-per-node and Max-attending-to-per-step affect very slightly.
Therefore, we can use smaller Max-sampling-per-node and Max-attending-to-per-step in order to gain a larger batch size, making the computation more efﬁciency as shown in Figure 6(E).
Visualization.
To further demonstrate the reasoning capability, we show visualization results of some pruned subgraphs on NELL995’s test data for 12 separate tasks.
We avoid using the training data in order to show generalization of the learned reasoning capability.
We show the visualization results in Figure 1.
See the appendix for detailed analysis and more visualization results.
Discussion of the limitation.
Although DPMPN shows a promising way to harness the scalability on large-scale graph data, current GPU-based machine learning platforms, such as TensorFlow and PyTorch, seem not ready to fully leverage sparse tensor computation which acts as building blocks to support dynamical computation graphs which varies from one input to another. Extra overhead caused by extensive sparse operations will neutralize the beneﬁts of exploiting sparsity.  R ELATED W ORK
Knowledge graph reasoning.
Early work, including TransE (Bordes et al., 2013) and its analogues (Wang et al., 2014; Lin et al., 2015b; Ji et al., 2015), DistMult (Yang et al., 2015), ConvE (Dettmers et al., 2018) and ComplEx (Trouillon et al., 2016), focuses on learning embeddings of entities and relations.
Some recent works of this line (Sun et al., 2018; Lacroix et al., 2018) achieve high accuracy.
Another line aims to learn inference paths (Lao et al., 2011; Guu et al., 2015; Lin et al., 2015a; Toutanova et al., 2016; Chen et al., 2018; Lin et al., 2018) for knowledge graph reasoning, especially DeepPath (Xiong et al., 2017), MINERVA (Das et al., 2018), and M-Walk (Shen et al., 2018), which use RL to learn multi-hop relational paths.
However, these approaches, based on policy gradients or Monte Carlo tree search, often suffer from low sample efﬁciency and sparse rewards, requiring a large number of rollouts and sophisticated reward function design.
Other efforts include learning soft logical rules (Cohen, 2016; Yang et al., 2017) or compostional programs (Liang et al., 2016).
Relational reasoning in Graph Neural Networks.
Relational reasoning is regarded as the key for combinatorial generalization, taking the form of entity- and relation-centric organization to reason about the composition structure of the world (Craik, 1952; Lake et al., 2017).
A multitude of recent implementations (Battaglia et al., 2018) encode relational inductive biases into neural networks to exploit graph-structured representation, including graph convolution networks (GCNs) (Bruna et al., 2014; Henaff et al., 2015; Duvenaud et al., 2015; Kearnes et al., 2016; Defferrard et al., 2016; Niepert et al., 2016; Kipf & Welling, 2017; Bronstein et al., 2017) and graph neural networks (Scarselli et al., 2009; Li et al., 2016; Santoro et al., 2017; Battaglia et al., 2016; Gilmer et al., 2017).
Variants of GNN architectures have been developed.
Relation networks (Santoro et al., 2017) use a simple but effective neural module to model relational reasoning, and its recurrent versions (Santoro et al., 2018; Palm et al., 2018) do multi-step relational inference for long periods; Interaction networks (Battaglia et al., 2016) provide a general-purpose learnable physics engine, and two of its variants are visual interaction networks (Watters et al., 2017) and vertex attention interaction networks (Hoshen, 2017); Message passing neural networks (Gilmer et al., 2017) unify various GCNs and GNNs into a general message passing formalism by analogy to the one in graphical models.
Attention mechanism on graphs.
Neighborhood attention operation can enhance GNNs’ representation power (Velickovic et al., 2018; Hoshen, 2017; Wang et al., 2018; Kool, 2018).
These approaches often use multi-head self-attention to focus on speciﬁc interactions with neighbors when aggregating messages, inspired by (Bahdanau et al., 2015; Lin et al., 2017; Vaswani et al., 2017).
Most graph-based attention mechanisms attend over neighborhood in a single-hop fashion, and (Hoshen, 2017) claims that the multi-hop architecture does not help to model high-order interaction in experiments.
However, a ﬂow-style design of attention in (Xu et al., 2018b) shows a way to model long-range attention, stringing isolated attention operations by transition matrices.
C ONCLUSION
We introduce Dynamically Pruned Message Passing Networks (DPMPN) and apply it to large-scale knowledge graph reasoning tasks.
We propose to learn an input-dependent local subgraph which is progressively and selectively constructed to model a sequential reasoning process in knowledge graphs.
We use graphical attention expression, a ﬂow-style attention mechanism, to guide and prune the underlying message passing, making it scalable for large-scale graphs and also providing clear graphical interpretations.
We also take the inspiration from the consciousness prior to develop a two-GNN framework to boost experimental performances.
Appendix P ROOF
Proposition.
Given a graph G (undirected or directed in both directions), we assume the probability of the degree of an arbitrary node being less than or equal to d is larger than p , i.e., P (deg( v ) ≤ d ) > p, ∀ v ∈ V .
Considering a sequence of consecutively expanding subgraphs ( G 0 , G 1 , . .
, G T ) , starting with G 0 = { v } , for all t ≥ 1 , we can ensure
[Equation]
Proof.
We consider the extreme case of greedy consecutive expansion, where G t =
G t − 1 ∪ ∆ G t =
G t − 1 ∪ ∂G t − 1 , since if this case satisﬁes the inequality, any case of consecutive expansion can also satisfy it.
By deﬁnition, all the subgraphs G t are a connected graph.
Here, we use ∆ V t to denote
V ∆ G t for short.
In the extreme case, we can ensure that the newly added nodes ∆ V t at step t only belong to the neighborhood of the last added nodes ∆ V t − 1 .
Since for t ≥ 2 each node in ∆ V t −already has at least one edge within G t − 1 due to the deﬁnition of connected graphs, we can have
[Equation]
For t = 1 , we have P ( | ∆ V 1 | ≤ d ) > p and thus
[Equation]
For t ≥ 2 , based on | V G t | = 1 + | ∆ V 1 | + . . .
+ | ∆ V t | , we obtain
P
[Equation]
which is
[Equation]
We can ﬁnd that t = 1 also satisﬁes this inequality.
H YPERPARAMETER S ETTINGS
[Table]
The hyperparameters can be categorized into three groups:
• Normal hyperparameters, including batch size , n dims att , n dims , learning rate , grad clipnorm , and n epochs
We set smaller dimensions,
n
dims att , for computation in the attention module, as it uses more edges than the message passing uses in AGNN, and also intuitively, it does not need to propagate high-
dimensional messages but only compute scalar scores over a sampled neighborhood, in concert with the idea in the key-value mechanism (Bengio, 2017).
We set n epochs =
in most cases, indicating that our model can be trained well by one epoch only due to its fast convergence.
• The hyperparameters in charge of the sampling-attending horizon, including max sampling per step that controls the maximum number to sample edges per step in IGNN, and max sampling per node , max attending from per step and max attending to per step that control the maximum number to sample neighbors of each selected node per step per input, the maximum number of selected nodes for attending-from per step per input, and the maximum number of selected nodes in a sampled neighborhood for attending-to per step per input in AGNN.
• The hyperparameters in charge of the searching horizon, including n steps in IGNN representing the number of propagation steps to run standard message passing in IGNN, and n steps in AGNN representing the number of propagation steps to run pruned message passing in AGNN.
Note that we tune these hyperparameters according to not only their performances but also the computation resources available to us.
In some cases, to deal with a very large knowledge graph with limited resources, we need to make a trade-off between efﬁciency and effectiveness.
For example, each of NELL995’s single-query-relation tasks has a small training set, though still with a large graph, so we can reduce the batch size in favor of affording larger dimensions and a larger samplingattending horizon without any concern for waiting too long to ﬁnish one epoch.
M ORE E XPERIMENTAL R ESULTS
[Table]
[Table]
[Table]
[Figure]
[Figure]
M ORE V ISUALIZATION R ESUTLS 10. C ASE STUDY ON THE A THLETE P LAYS F OR T EAM TASK
In the case shown in Figure 9, the query is ( concept personnorthamerica michael turner , concept:athleteplays-forteam , ?) and a true answer is concept sportsteam falcons .
From Figure 9, we can see our model learns that ( concept personnorthamerica michael turner , concept:athletehomestadium , concept stadiumoreventvenue georgia dome ) and ( concept stadiumoreventvenue georgia dome , concept:teamhomestadium inv , concept sportsteam falcons ) are two important facts to support the answer of concept sportsteam falcons .
Besides, other facts, such as ( concept athlete joey harrington , concept:athletehomestadium , concept stadiumoreventvenue georgia dome ) and ( concept athletejoey harrington , concept:athleteplaysforteam , concept sportsteam falcons ), provide a vivid example that a person or an athlete with concept stadiumoreventvenue georgia dome as his or her home stadium might play for the team concept sportsteam falcons .
We have such examples more than one, like concept athlete roddy white ’s and concept athlete quarterback matt ryan ’s. The entity con- cept sportsleague nﬂ cannot help us differentiate the true answer from other NFL teams [Figure] but it can at least exclude those non-NFL teams.
In a word, our subgraph-structured representation can well capture the relational and compositional reasoning pattern.
[Figure]
For the AthletePlaysForTeam task
[Table] [Table]
10. M ORE RESULTS
[Table]
[Figure]
Query: ( concept personnorthamerica matt treanor , concept : athleteplaysinleague , concept sportsleague mlb ) [Figure]
[Figure]
matt treanor
[Figure]
: athleteflyouttosportsteamposition
[Figure] [Table] [Table]
mlb
[Table]
mlb
[Table]
pence
[Table]
athleteplaysinleague
[Table]
sportsleague mlb
[Table]
pence
[Table]
athleteplayssport
[Table]
sport baseball
[Table]
sportsleague mlb ,
[Table]
coachesinleague inv , [Table] athlete ben hendrickson [Table]
mlb , [Table] : coachesinleague inv [Table]
coach
[Table]
hardy
[Table]
eli
[Table]
_new_england concept_geopoliticallocation_national
concept_athlete_ensberg concept_stateorprovince_states concept_sport_hockey concept_stadiumoreventvenue_united_center concept_athlete_eli_manning concept_sportsteam_new_york_giants concept_sportsleague_nfl concept_male_archie_manning concept_athlete_joe_bradley concept_sport_football
concept_stadiumoreventvenue_giants_stadium concept_lake_new concept_city_east_rutherford concept_sportsleague_nhl concept_stadiumoreventvenue_paul_brown_stadium concept_stadiumoreventvenue_mcafee_coliseum concept_stadiumoreventvenue_lucas_oil_stadium
For the AthleteHomeStadium task
Query: ( concept athlete eli manning , concept : athletehomestadium , concept stadiumoreventvenue giants stadium )
Selected key edges: concept athlete eli manning , concept : personbelongstoorganization , concept sportsteam new york giants concept athlete eli manning , concept : athleteplaysforteam , concept sportsteam new york giants concept athlete eli manning , concept : athleteledsportsteam , concept sportsteam new york giants concept athlete eli manning , concept : athleteplaysinleague , concept sportsleague nfl concept athlete eli manning , concept : fatherofperson inv , concept male archie manning concept sportsteam new york giants , concept : teamplaysinleague , concept sportsleague nfl concept sportsteam new york giants , concept :teamhomestadium , concept stadiumoreventvenue giants stadium concept
[Table]
For the AthletePlaysSport task
[Figure]
Query
[Table]
( concept athlete vernon wells ,
[Table]
: athleteplayssport ,
[Table]
sport baseball )
[Table]
[Table]
yankees
[Table]
sport_golf concept_company_national concept_sport_soccer concept_country_usa concept_sport_wrestling concept_sport_team concept_sport_fitness concept_sportsteam_packers concept_hobby_hiking concept_sport_sports
concept_hobby_fishing
concept_country_england concept_country_iraq concept_country_russia concept_coach_billy_butler concept_sportsteamposition_quarterback concept_sportsteam_red_wings concept_athlete_lidstrom concept_sportsteam_blue_jackets concept_sportsteam_montreal_canadiens concept_sportsteam_anaheim_ducks concept_sportsteam_columbus_blue_jackets concept_sport_hockey concept_sportsleague_nhl concept_sport_basketball concept_sportsteam_leafs concept_country___america concept_sport_football concept_sport_baseball concept_sport_golf
For the TeamPlaysSport task
Query: ( concept sportsteam red wings , concept : teamplayssport , concept sport hockey )
Selected key edges: concept sportsteam red wings , concept : teamplaysagainstteam , concept sportsteam montreal canadiens concept sportsteam red wings , concept : teamplaysagainstteam inv , concept sportsteam montreal canadiens concept sportsteam red wings , concept : teamplaysagainstteam , concept sportsteam blue jackets concept sportsteam red wings , concept : teamplaysagainstteam inv , concept sportsteam blue jackets concept sportsteam red wings , concept : worksfor inv , concept athlete lidstrom concept sportsteam
[Table]
[Figure]
For the OrganizationHeadQuarteredInCity task
[Table]
[Figure]
For the WorksFor task
Query: ( concept scientist balmer , concept : worksfor , concept university microsoft )
Selected key edges: concept scientist balmer , concept : topmemberoforganization , concept company microsoft concept scientist balmer , concept : organizationterminatedperson inv , concept university microsoft concept company microsoft , concept : topmemberoforganization inv , concept personus steve ballmer concept company microsoft , concept : topmemberoforganization inv , concept scientist balmer concept university microsoft , concept : agentcollaborateswithagent , concept personus steve ballmer concept university microsoft , concept : personleadsorganization inv , concept personus steve ballmer concept university microsoft , concept : personleadsorganization inv , concept person bill concept university microsoft , concept : organizationterminatedperson , concept scientist balmer concept university microsoft , concept : personleadsorganization inv , concept person robbie bach concept personus steve ballmer , concept : topmemberoforganization , concept company microsoft concept personus steve ballmer , concept : agentcollaborateswithagent inv , concept university microsoft concept personus steve ballmer , concept : personleadsorganization , concept university microsoft concept personus steve ballmer , concept : worksfor , concept university microsoft concept personus steve ballmer , concept : proxyfor , concept retailstore microsoft concept personus steve ballmer , concept : subpartof , concept retailstore
[Table]
For the PersonBornInLocation task
[Table]
[Figure]
[Table]
For the PersonLeadsOrganization task
Query: ( concept journalist bill plante , concept : personleadsorganization , concept company cnn pbs )
Selected
[Table]
edges:
[Table]
journalist bill plante ,
[Table]
: worksfor ,
[Table]
televisionnetwork cbs
[Table]
journalist bill [Table] [Table] : agentcollaborateswithagent inv ,
[Table] televisionnetwork cbs concept televisionnetwork cbs , [Table] : worksfor inv , concept journalist walter cronkite concept_journalist_bill_plante concept_televisionnetwork_cbs concept_person_edward_r__murrow concept_personus_scott_pelley concept_actor_daniel_schorr concept_journalist_wyatt_andrews concept_athlete_anthony_mason concept_journalist_connie_chung concept_journalist_andy_rooney concept_journalist_ed_bradley concept_writer_bill_geist concept_person_byron_pitts concept_personaustralia_harry_smith concept_journalist_morley_safer concept_journalist_gloria_borger concept_writer_bernard_goldberg concept_person_eric_sevareid concept_journalist_lesley_stahl concept_personmexico_david_martin concept_journalist_walter_cronkite concept_personaustralia_phil_jones concept_company_cnn__pbs concept_nonprofitorganization_cbs_evening concept_musicartist_television concept_crustacean_tv concept_website_cbs_evening_news concept_city_new_york concept_personeurope_william_paley concept_coach_douglas_edwards concept_academicfield_media concept_person_sean_mcmanus
concept_televisionstation_wcsc
concept_comedian_leslie_moonves concept_person_nina_tassler concept_televisionstation_kion_tv concept_televisionstation_wowk_tv concept_televisionstation_kbci_tv
concept_televisionstation_wjtv concept_politicsissue_entertainment concept_person_les_moonves concept_televisionstation_kfda concept_televisionstation_wdtv concept_televisionstation_khqa_tv concept_televisionstation_wrbl concept_televisionstation_wltx_tv concept_website_cbs concept_company_cbs_corp_ concept_recordlabel_universal concept_blog_mtv concept_journalist_bill_plante concept_televisionnetwork_cbs concept_person_edward_r__murrow concept_personus_scott_pelley concept_actor_daniel_schorr concept_journalist_wyatt_andrews
[Figure]
concept televisionnetwork
[Table]
, concept
[Table]
[Table] [Table] [Table] personus
[Table] [Table]
For the OrganizationHiredPerson task
[Figure]
Query: ( concept stateorprovince afternoon , concept : organizationhiredperson , concept personmexico
[Table]
concept personmexico ryan whitney , concept : worksfor , concept tradeunion congress concept personmexico ryan whitney , concept : worksfor , concept country left parties concept governmentorganization house , concept : personbelongstoorganization inv , concept personus party concept governmentorganization house , concept : worksfor inv , concept personmexico ryan whitney concept governmentorganization house , concept : organizationhiredperson , concept personmexico ryan whitney concept tradeunion congress , concept : organizationhiredperson , concept personus party concept tradeunion congress , concept : worksfor inv , concept personmexico ryan whitney concept tradeunion congress , concept : organizationhiredperson , concept personmexico ryan whitney concept country left parties , concept : organizationhiredperson , concept personus party [Figure] [Figure] [Figure]
concept [Figure] [Table] [Figure]
[Table] [Figure] [Table] [Figure]
[Table] [Figure] [Table] [Figure]
[Table] [Figure] [Table] [Figure]
[Table] [Figure] automobilemaker_announcement [Figure]
geopoliticallocation_ [Figure] concept_company_nbc concept_city_team concept_terroristorganization_state concept_automobilemaker_jeff_bezos [Figure]
_ceo_richard [Figure] concept_city_service
[Figure]
For the AgentBelongsToOrganization task
[Figure] [Table] [Table] [Figure]
_sportsteam_golden_state_
[Figure] _sportsteam_ [Figure] [Figure]
_sportsgame_
[Figure]
_sportsteam_la_clippers
[Figure]
_convention_games
[Figure]
_athlete_josh_howard
[Figure]
_awardtrophytournament_
[Figure]
[Figure]
_sportsteam_marshall
[Figure]
_sportsleague_nba
[Figure]
_sportsteam_
[Figure]
For the TeamPlaysInLeague task
[Table]
[Table]