Query2Particles: Knowledge Graph Reasoning with Particle Embeddings

Answering complex logical queries on incomplete knowledge graphs (KGs) with missing edges is a fundamental and important task for knowledge graph reasoning. The query embedding method is proposed to answer these queries by jointly encoding queries and entities to the same embedding space. Then the answer entities are selected according to the similarities between the entity embeddings and the query embedding. As the answers to a complex query are obtained from a combination of logical operations over sub-queries, the embeddings of the answer entities may not always follow a uni-modal distribution in the embedding space. Thus, it is challenging to simultaneously retrieve a set of diverse answers from the embedding space using a single and concentrated query representation such as a vector or a hyper-rectangle. To better cope with queries with diversified answers, we propose Query2Particles (Q2P), a complex KG query answering method. Q2P encodes each query into multiple vectors, named particle embeddings. By doing so, the candidate answers can be retrieved from different areas over the embedding space using the maximal similarities between the entity embeddings and any of the particle embeddings. Meanwhile, the corresponding neural logic operations are defined to support its reasoning over arbitrary first-order logic queries. The experiments show that Query2Particles achieves state-of-the-art performance on the complex query answering tasks on FB15k, FB15K-237, and NELL knowledge graphs.


page 1

page 2

page 3

page 4


TFLEX: Temporal Feature-Logic Embedding Framework for Complex Reasoning over Temporal Knowledge Graph

Multi-hop logical reasoning over knowledge graph (KG) plays a fundamenta...

Beta Embeddings for Multi-Hop Logical Reasoning in Knowledge Graphs

One of the fundamental problems in Artificial Intelligence is to perform...

Message Passing for Query Answering over Knowledge Graphs

Logic-based systems for query answering over knowledge graphs return onl...

Query2box: Reasoning over Knowledge Graphs in Vector Space using Box Embeddings

Answering complex logical queries on large-scale incomplete knowledge gr...

Neural-Symbolic Models for Logical Queries on Knowledge Graphs

Answering complex first-order logic (FOL) queries on knowledge graphs is...

Logic Embeddings for Complex Query Answering

Answering logical queries over incomplete knowledge bases is challenging...

Query Embedding on Hyper-relational Knowledge Graphs

Multi-hop logical reasoning is an established problem in the field of re...

1 Introduction

Reasoning over a factual knowledge graph (KG) is the process of deriving new knowledge or conclusions from the existing data in the knowledge graph Chen et al. (2020). A recently developed sub-task of knowledge graph reasoning is complex query answering, which aims to answer complex queries over large knowledge graphs (Hamilton et al., 2018; Ren et al., 2020; Ren and Leskovec, 2020). Compared to KG completion tasks Liu et al. (2016); West et al. (2014), complex query answering requires reasoning over multi-hop relations and logical operations. As shown in Figure 1, complex KG queries are defined in predicate logic forms with relation projection operations, existential quantifiers , logical conjunctions , disjunctions , and negation . Answering these queries is challenging because real-world knowledge graphs (KG), such as Freebase (Bollacker et al., 2008), NELL (Carlson et al., 2010)

, and DBPedia

(Bizer et al., 2009), are incomplete. Consequently, sub-graph matching methods cannot be used to find the answers.

Figure 1: The example logical knowledge graph queries and their interpretations in natural language.
Figure 2: An example of answering a knowledge graph query by using the Query2Particles method. (A) The computational graph corresponds to the query “where did the non-Canadian Turing award laureates graduate from.” (B) The Query2Particles encodes each query into a set of vectors, called particle embeddings. The logical operations iteratively compute particle embeddings following the computational graph. The answers are determined by using the maximum similarities between the entity embeddings and any one of the resulting particle embeddings.

To address the challenge raised from the incompleteness of knowledge graphs, the query embedding methods are proposed (Hamilton et al., 2018; Ren et al., 2020; Ren and Leskovec, 2020; Sun et al., 2020). In this line of research, the queries and entities are jointly encoded into the same embedding space, and the answers are retrieved based on similarities between the query embedding and entity embeddings. In general, there are two steps in encoding a query to the vector space. First, a query is parsed into a computational graph with a directed acyclic graph (DAG) structure, as shown in Figure 2 (A). Then, the query representation is iteratively computed following the neural logic operations and relation projections in the DAG.

Although the query embedding methods are robust for dealing with the incompleteness of KGs, the embedding structure used for encoding the queries can be improved. Because of the multi-hop and compositional nature of complex KG queries, a single query may contain multiple sufficiently diverse answers. Thus, the ideal query embedding may follow a multi-modal distribution111

A multi-modal distribution is a distribution with two or more distinct peaks in the probability density function.

in the embedding space. For example, the answers to the query, “Find entities, who are not American, were the Nobel Prize winners and eventually moved to the US,” involve intermediate entities with different attributes, such as gender, nationality, research fields, etc. It is difficult to use a single embedding vector to find all final answer embeddings. Box embedding Ren et al. (2020) partially solved this problem, but for complicated attributes, a single box may be too coarse, and intermediate entities are distributed far away from each other, so they are more like several disjoint clusters rather than a single big region in the embedding space. So for the query embedding methods, the capability to simultaneously encode a set of answers from different areas is necessary.

To better address the diversity of answers, we propose Query2Particles, a new query embedding method for complex query answering. In this approach, each query is encoded into a set of vectors in the embedding space, called particle embeddings. The particle embeddings of a query are iteratively computed by following the computational graph parsed from the query. Then the answers to this query are determined by using the maximum similarities between the entity embeddings and any one of the resulting particle embeddings. Experimental results show that Query2Particle achieves state-of-the-art performance on complex query answering over three standard knowledge graphs: FB15K, FB15k-237, and NELL. Meanwhile, the inference speed of Query2Particles is comparable to other query embedding methods and is higher than query decomposition methods on multi-hop queries. Further analysis indicates that the optimal numbers of particles for different query types depend on the structures of the queries. Our experimental code is released on github222https://github.com/HKUST-KnowComp/query2particles.

Figure 3: In the example embedding space, the yellow dots are the answer entities, and the blue dots are the non-answer entities. The purple areas in (B), (C), and (D) demonstrate the neighborhoods of the vector embedding, the box embedding, and the particle embeddings respectively. In this case, the particle embeddings are more suitable for finding the answers clustered in different areas in the embedding space.

2 Related Work

Other query embedding approaches are closely related to our work. These query embedding methods leverage different structures to encode logical KG queries, and they can answer various scopes of logical queries. The GQE method proposed by Hamilton et al. (2018) can answer the conjunctive queries by representing queries as vector representations. Ren et al. (2020) used hyper-rectangles to encode and answer existential positive first-order (EPFO) queries. At the same time, Sun et al. (2020) proposed to improve the faithfulness of the query embedding method by using centroid-sketch representations on EPFO queries. The conjunctive queries and EPFO queries are both subsets of first-order logic (FOL) queries. The Beta Embedding (Ren and Leskovec, 2020)

is the first query embedding method that supports a full set of operations in FOL by encoding entities and queries into probabilistic Beta distributions. In a contemporaneous work,

Zhang et al. (2021) uses cone embeddings to encode the FOL queries. As shown in Figure 3, compared to these query embedding approaches, the Q2P method can encode the FOL queries to address the diversity of answers. Note that, Ren et al. (2020) proposed to use the disjunctive normal form (DNF) to address the answer diversities resulting from the union operations. This partly solve the problem, but the diversity of the answers is not solely caused by the union operation, but a joint effort of multi-hop projections, intersection, and complement. As a result, using particle embeddings is a more general solution.

Query decomposition Arakelyan et al. (2020)

is another approach to answering complex knowledge graph queries. In this line of research, a complex query is decomposed into atomic queries, and the probabilities of atomic queries are modeled by link predictors. In the inference process, continuous optimization and beam search are used for finding the answers. Meanwhile, the rule and path-based methods

Guo et al. (2016); Xiong et al. (2017); Lin et al. (2018); Guo et al. (2018); Chen et al. (2019) use pre-defined or learned rules to do multi-hop KG reasoning. These methods explicitly model the intermediate entities in the query. Instead, the query embedding methods directly embed the complex query and retrieve the answers without explicit modeling intermediate entities. So the query embedding methods are more scalable to large knowledge graphs and complex query structures.

Neural link predictors Wang et al. (2014); Trouillon et al. (2016); Dettmers et al. (2018); Sun et al. (2018)

are also related to this work. The link predictors learn the distributed representations of entities and relations in embedding space and use different neural structures to classify whether there exists a certain relation between two entities. The link predictors can be used for one-hop queries, but cannot be directly used for answering complex queries.

3 Preliminaries

In this section, we formally define the complex logical knowledge graph queries and the corresponding computational graphs. The knowledge graph reasoning is conducted on a multi-relational knowledge graph , where each vertex represents an entity, and each relation is a binary function defined as . For any , and , there is a relation between entities and if and only if .

3.1 First-Order Logic Query

The complex knowledge graph query is defined in first-order logic form with logical operators such as existential quantifiers , conjunctions , disjunctions , and negations . In a first-order logic query, there is a set of anchor entities , existential quantified variables , and a unique target variable . The query intends to find the answers , such that there simultaneously exist satisfying the logical expression in the query. For each FOL query, it can be converted to a disjunctive normal form, where the query is expressed as a disjunction of several conjunctive expressions:


Each represents a conjunctive expression of several literals , and each is an atomic or the negation of an atomic expression expressed by any of the following expressions: , , , or . Here is one of the anchor entities, and are distinct variables satisfying .

3.2 Computational Graph and Operations

As shown in Figure 2 (A), for a first-order query, there is a corresponding computational graph. In the computational graph, each node corresponds to an intermediate query embedding, and each edge corresponds to a neural logic operation to be defined in the following section. Both the input and output of these operations are query embeddings. These operations are used for implicitly modeling different set operations over the intermediate answer sets. These set operations include relational projection, intersection, union, and complement: (1) Relational Projection: Given a set of entities and a relation , the relational projection will return all entities having relation with at least one of entity . Namely, ; (2) Intersection: Given sets of entities , this operation computes their intersection ; (3) Union: Given several sets of entities , the union operation calculates their union ; (4) Complement: Given a set of entities , the complement operation calculates its absolute complement .

Figure 4: The in blue and the in yellow are the input and output particles respectively. (A) The embeddings are projected to by the relation . (B) The resulting embeddings are computed from three sets of particles by the intersection . (C) The output are computed from the input by the complement . (D) The are directly taken from the all input particles in without any additional parameterization.

4 Query2Particles

In this section, we first introduce the particle embeddings structure and the neural logic operations, and then we present the learning of the model.

4.1 Particles Representations of Queries

In Query2Particles, each query is represented as a set of vectors, called particles. For simplicity, a set of particles are represented as a matrix . All the operations discussed in the following sections are invariant to the permutations of the particle vectors in the matrix. Formally, the particle embeddings are


where each vector is a particle vector. As shown in Figure 2, the computations along the computation graph start with the anchor entities, such as “Turing Award”. Suppose the entity embedding of an anchor entity is denoted as . Then, the initial particle embeddings are computed as the sum of and a learnable offset matrix ,


Here and in the following sections, the addition between the matrix and the vector is defined as the broadcasted element-wise addition.

4.2 Logical Operations

In this sub-section, we define and parameterize four types of neural logic operations: projection, intersection, negation, and union.

4.2.1 Projection

Suppose the is the embedding vector of the relation . The relation projection is expressed as , where the and are input and output particle embeddings. Instead of directly adding the same relation embedding to all particles in to model the relation projection following Bordes et al. (2013), we incorporate multiple neuralized gates (Chung et al., 2014) to individually adjust the relation transition for each particle in , which are expressed as follows:


Here, and are the sigmoid and hyperbolic tangent functions, and is the Hadamard product. Also, are parameter matrices. is interpreted as the relation transitions for each of the particles given the relation embedding , and and are the update gate and the reset gate used for customizing the relation transitions for each particle. Meanwhile, the relation projection result for each particle should also depend on the positions of other input particles. To allow information exchange among different particles, a scaled dot-product self-attention (Vaswani et al., 2017) module is also incorporated,


The are parameters used for modeling the input Query, Key, and Value for the self-attention module Attn. The Attn represents the scaled dot-product self-attention,


Here, the , , and represent the input Query, Key, and Value for this attention layer.

4.2.2 Intersection

The intersection operation is defined on multiple sets of particle embeddings . It outputs a single set of particle embeddings . The particles from the are first merged into a new matrix , and this matrix serves as the input of the intersection operation. The operation updates the position of each particle according to the positions of other input particles in

. This process is modeled by the scaled dot-product self-attention followed by a multi-layer perceptron (MLP) layer,


Here are parameters for the self-attention layer. The MLP here denotes a multi-layer proceptron layer with ReLU activation, and the parameters in the MLP layers in different operations are not shared. To keep the number of particles unchanged, we uniformly sub-sample particles out of the particles in as the final output of the intersection operation.

4.2.3 Complement

The input of the complement operation is a single set of particle embeddings , and the operation is formulated as . The complement operation updates the position of each particle based on the distributions of other input particles. The operation is then modeled by scaled dot-product attention followed by an MLP layer, and this can be formulated by


Here, the are the resulting particle embeddings for the complement operation, and the values in are parameters. Intuitively speaking, the proposed structure can model the complement operation by encouraging the particles to move towards the areas that are not occupied by any of the input particles.

4.2.4 Union

The union operation is directly modeled by all the input particles without extra parameterization. In detail, the particles from the input particle embeddings are directly merged into a new set of particles,


4.3 Scoring

After the particle embeddings for the target variable of the query are computed, the scoring function between the particle embeddings and each entity embedding is used for calculating the maximal similarities between each particle vectors in and entity embedding vector. Here, the inner product is used to compute the similarity scores between vectors, and the overall scoring function is expressed by


4.4 Learning Query2Particles

To train the Query2Particles model, we compute the normalized probability of the entity being the correct answer of query by using the softmax function on all similarity scores,


Then we construct the cross-entropy loss from the given probabilities to maximize the log probabilities of all correct query-answer pairs:


The denotes is one of the positive query-answer pairs, and in total there are such pairs.

Figure 5: The query structures used for training and evaluation. For brevity, the , , , and represent the projection, intersection, negation, and union operations respectively. The query types on the left are trained and evaluated under supervised settings. There are not training queries for the four types of queries on the right, and they are directly evaluated at the test time to measure the generalization capability of the models to unseen query types.
FB15K FB15K-237 NELL
Model 1p 2p 3p 2i 3i Pi Ip 2u Up Avg Avg Avg
BetaE 65.1 25.7 24.7 55.8 66.5 43.9 28.1 40.1 25.4 41.6 20.9 24.6
Q2B 68.0 21.0 14.2 55.1 66.5 39.4 26.1 35.1 16.7 38.0 20.1 22.9
GQE 54.6 15.3 10.8 39.7 51.4 27.6 19.1 22.1 11.6 28.0 16.3 18.6
Q2P (Ours) 82.6 30.8 25.5 65.1 74.7 49.5 34.9 32.1 26.2 46.8 21.9 25.5

Table 1: The MRR results for existential positive first-order (EPFO) queries used by Ren and Leskovec (2020). The full results are shown in the supplementary materials.
Dataset Model 2in 3in Inp Pin Pni Avg
Mrr H@10 Mrr H@10 Mrr H@10 Mrr H@10 Mrr H@10 Mrr H@10
FB15k BetaE 14.3 30.8 14.7 31.9 11.5 23.4 6.5 14.3 12.4 26.3 11.8 25.3
Q2P (Ours) 21.9 41.3 20.8 40.2 12.5 24.2 8.9 18.8 17.1 33.6 16.4 31.6
FB15k-237 BetaE 5.1 11.3 7.9 17.3 7.4 16.0 3.6 8.1 3.4 7.0 5.4 11.9
Q2P (Ours) 4.4 10.1 9.7 20.7 7.5 16.7 4.6 9.9 3.8 7.2 6.0 12.9

BetaE 5.1 11.6 7.8 18.2 10.0 20.8 3.1 6.9 3.5 7.2 5.9 12.9
Q2P (Ours) 5.1 12.1 7.4 18.2 10.2 21.4 3.3 7.0 3.4 7.6 6.0 13.3
Average BetaE 8.2 17.9 10.1 22.5 9.6 20.1 4.4 9.8 6.4 13.5 7.8 16.7
Q2P (Ours) 10.5 21.2 12.6 26.4 10.1 20.8 5.6 11.9 8.1 16.1 9.4 19.3

Table 2: The MRR and Hit@10 results for complement queries used by Ren and Leskovec (2020). Beta Embedding is the only baseline model that can answer queries with the complement operation.

5 Experiments

The experiments in this section demonstrate the effectiveness and efficiency of Query2Particles.

5.1 Experimental Setup

The Query2Particles method is evaluated on three commonly used knowledge graphs, FB15K Bordes et al. (2013), FB15K-237 Toutanova and Chen (2015), and NELL995 Carlson et al. (2010) with the standard training, validation, and testing edges separations. For each of these graphs, the corresponding training graph , validation graph , and testing graph are created from training edges, training + validation edges, and training + validation + testing edges respectively.

There are two sets of complex logical queries sampled from these knowledge graphs, and the existing methods evaluate their performance on either of them. Specifically, Ren et al. (2020) sample nine different types of existential positive first-order (EPFO) queries. For these queries, five types of them (1p, 2p, 3p, 2i, 3i) are used for training and evaluation in a supervised setting. For the rest of four types of queries (2u, up, ip, pi), they do not appear in the training set and are directly evaluated in a zero-shot way. In another work, Ren and Leskovec (2020) refine these queries by raising the difficulties of the existing nine types of queries. They also include five types of complement queries (2in, 3in, inp, pni, pin) for general first-order logic (FOL) queries. These complement queries are also trained and evaluated in the supervised setting, but their training samples are fewer than other types. More details about the knowledge graphs and sampled queries are shown in the appendix. To demonstrate the performance of Query2Particles, it is evaluated on both sets of queries. Note that, the query-answer pairs used for training are only from the training graph . For validation and testing, only the hard answers from validation graph and testing graph are evaluated.

5.2 Baselines

The Query2Particles model is compared with the following baselines in the following sections.

Graph Query Embedding (GQE) answers conjunctive logic queries by encoding the logical queries into vectors Hamilton et al. (2018).

Query2Box (Q2B) answers existential positive first-order logic queries by encoding them into boxes in the embedding space Ren et al. (2020).

Beta Embedding (BetaE) answers first-order logic queries by modeling them as Beta Distributions Ren and Leskovec (2020). This is the current state-of-the-art model on first-order logic queries.

The reported mean reciprocal rank (MRR) scores of these baselines are used by the BetaE paper (Ren and Leskovec, 2020), and Query2Particles (Q2P) is evaluated following with the same metrics under the filtered setting, in which the rankings of answers are computed excluding all other correct answers. Meanwhile, the Q2P method is also compared with other methods on EPFO queries with the queries used by Ren et al. (2020).

Continuous Query Decomposition (CQD) decomposes the complex queries to multiple atomic queries that can be solved by link predictors Arakelyan et al. (2020) .

Embedding Query Language (EmQL) improves the faithfulness in the reasoning process by encoding EPFO queries into centroid-sketch representations Sun et al. (2020).

The reported Hit@3 results of these two baselines are used by Arakelyan et al. (2020); Sun et al. (2020). Our model is evaluated on FB15K, FB15K-237, and NELL in the same setting.

FB15K FB15K-237 NELL
Model 1p 2p 3p 2i 3i Ip Pi 2u Up Avg Avg Avg
EmQL 42.4 50.2 45.9 63.7 70.0 60.7 61.4 9.0 42.6 49.5 35.8 46.8
   sketch 50.6 46.7 41.6 61.8 67.3 54.2 53.5 21.6 40.0 48.6 35.5 46.8
CQD-Beam 91.8 77.9 57.7 79.6 83.7 37.5 65.8 83.9 34.5 68.0 29.0 37.6
CQD-CO 91.8 45.4 19.1 79.6 83.7 33.6 51.3 81.6 31.9 57.6 27.2 36.8
Q2P (Ours) 90.2 74.6 73.4 86.0 89.6 63.7 77.6 83.4 52.7 76.8 43.0 52.2
Table 3: The Hit@3 results for existential positive first-order queries originally used by Ren et al. (2020) and the comparisons are made against the state-of-the-art baselines including EmQL and CQD methods. The best results are marked in bold and the second-best ones are marked with underlines. The full results are in the appendix.

5.3 Implementation Details

The Query2Particles model is trained on the queries in an end-to-end manner. To fairly compare with previous methods, we set the same size of embedding vectors as four hundred. We use the validation queries to tune hyperparameters for our model by using grid search. In the grid search, we consider the batch size from

, dropout rate from , learning rate from , and label smoothing from

. The final hyperparameters are shown in the supplementary materials. Our experiments are conducted on Titan Xp with PyTorch 1.8, and they are repeated three times.

5.4 Comparison with Baselines

First, we compare Query2Particles (Q2P) with GQE, Q2B, and BetaE on the first-order logic queries used by Ren and Leskovec (2020). The results on all fourteen types of queries are reported in Table 1 and Table 2. To fairly compare with the baseline methods, we keep the same number of parameters used in each type of query embedding.

As shown in Tables 1 and 2, the Q2P model can achieve more accurate results than GQE, Q2B, and BetaE on all types of queries except 2u. As we keep the number of query embedding parameters the same, it indicates that the structure of particle embeddings is more suitable for encoding complex queries than boxes or Beta distributions.

Though it is slightly less accurate on the 2u queries, Q2P is more efficient in encoding the queries that include union operations. This is because Q2P is the first embedding method that directly models the union operation. To avoid direct modeling of the union operation, all previous embedding methods pre-process the queries by converting them to DNF forms. However, the DNF forms can be exponentially larger than the original queries, and the conversion also takes exponential time. Meanwhile, BetaE proposes to use De Morgan’s law to replace one union operation with one intersection and three complements, but this substitution still largely increases the query complexity. Instead, Q2P directly models the union operation without any pre-processing or additional parameterization, while achieving the state-of-the-art performance on up, which is more complicated and involving the Union operation.

We also compare our model with EmQL and CQD methods on the queries used by Ren et al. (2020). On average, our model has better Hit@3 scores on all datasets333In this paper, we only focus on the inductive setting, so we skip the comparison with EmQL under the entailment setting, in which the test graph is used for both training and testing.. Compared to the CQD method, the Q2P method is better at answering multi-hop queries. encodes the complex queries into centroid-sketch representations, which cannot compactly encode sufficiently diverse answers. The Q2P method specifically addresses the diversity of answers, so it has higher empirical performance. CQD performs better on shorter queries like 1p, 2p, and 2u, because it can use the state-of-the-art link predictors. Also, as shown in Figure 6, the Q2P method demonstrates a faster inference speed than the CQD method on multi-hop queries, because CQD uses inference time optimization, which is either a continuous optimization or a beam search. The inference time optimization simplifies the learning of CQD but also slows down the inference efficiency on large graphs.

Figure 6: The inference time of different types of queries on FB15k, which has the largest number of edges among three graphs.

5.5 The Improvement of Q2P-Kp

Experiments show that the performance of the diversified queries can be largely improved by using more particles. To demonstrate the effects, we conduct additional evaluations on the most diversified 10% queries for each query type, as shown in the Divr columns in Table 4. In doing so, we use the number of answers to measure the diversity of each query. In the same table, we also present the original results in the Full columns as a comparison.

We can observe that there is a significant performance gap between the Full and Divr results, which demonstrates that the diversified queries are harder to answer. Meanwhile, it is also observed that comparing to Q2P-1p, Q2P-Kp (K1) significantly improves the MRR of Divr queries by 7.8 points. From this perspective, the improvement of Q2P-Kp (K1) over Q2P-1p is significant on those challenging queries.

5.6 Further Ablation Study for Q2P-1P

To better explain the superior performance of Q2P-1P over the baseline models, we conduct further ablations studies in Table 5.

First, we remove all the self-attention layers Attn. Then the performance of intersection operations largely decreased. This can be explained that the self-attention structure is important for aggregating the information from multiple sub-queries.

Then, we remove all the neural network structures, including all

MLP and Attn from all operations, and replace them with the operations defined in the GQE model Hamilton et al. (2018). Then the performance of Q2P is also reduced. This indicates that the neural structures in the particle operations are also important to the overall improvement. Thus, we infer that the baseline model underfit the complex queries in the training set, and the performance can be improved by introducing more parameters and non-linearity. This conclusion is also aligned with Sun et al. (2020), in which they found the baselines cannot faithfully answer the queries that are observed in the training time.

However, solely using more complex structures cannot address the problem raised from the diversity of the answers. As shown in Table 4, on the top of Q2P-1p, Q2P-Kp (K1) can still largely improve the performance on the diversified queries.

1p 2i 2u 2in Average
Full Divr Full Divr Full Divr Full Divr Full Divr
Q2P-1p 81.8 44.8 63.4 28.8 33.4 11.3 18.9 15.0 49.4 25.0
Q2P-2p 82.6 49.4 65.1 35.5 32.1 13.3 21.9 20.7 50.4 29.7
Q2P-3p 82.9 53.0 64.4 37.7 33.6 18.6 21.8 21.6 50.6 32.8
Table 4: The Full columns demonstrate the averaged MRR results, and the Divr columns demonstrate the averaged MRR on the top ten-percent diversified queries.
Models 1p 2p 2i 2u 2in

83.4 31.5 66.0 38.9 22.3
Q2P-1p 81.8 30.7 63.4 33.4 18.9
   Self Attention 78.5 28.5 30.9 30.3 15.2
   All NNs GQE Ops 56.7 16.1 39.2 20.1
Q2P 68.0 21.0 55.1 35.1
GQE 54.6 15.3 39.7 22.1

Table 5: The ablation study on the Q2P neural networks. The Q2P-KP result shows the highest result when K is ranged from 2 to 6.

6 Conclusion

In this paper, we proposed Query2Particles, a query embedding method for answering complex logical knowledge graph queries over incomplete knowledge graphs. The Query2Particle method supports a full set of FOL operations. Specifically, the Q2P method is the first query embedding method that can directly model the union operation without any preprocessing. Experimental results show that the Q2P method achieves state-of-the-art performances on answering FOL queries on three different knowledge graphs while using comparable inference time as the previous methods.

7 Ethical Impacts

This paper introduces a knowledge graph reasoning method, and the experiments are on several publicly available benchmark datasets. As a result, there is no data privacy concern. Meanwhile, this paper does not involve human annotations, and there is no related ethical concerns.

8 Acknowledgements

The authors of this paper were supported by the NSFC Fund (U20B2053) from the NSFC of China, the RIF (R6020-19 and R6021-20) and the GRF (16211520) from RGC of Hong Kong, the MHKJFS (MHP/001/19) from ITC of Hong Kong and the National Key R&D Program of China (2019YFE0198200) with special thanks to Hong Kong Mediation and Arbitration Centre (HKMAAC) and California University, School of Business Law & Technology (CUSBLT), and the Jiangsu Province Science and Technology Collaboration Fund (BZ2021065).


  • E. Arakelyan, D. Daza, P. Minervini, and M. Cochez (2020) Complex query answering with neural link predictors. In International Conference on Learning Representations, Cited by: §2, §5.2, §5.2.
  • C. Bizer, J. Lehmann, G. Kobilarov, S. Auer, C. Becker, R. Cyganiak, and S. Hellmann (2009) Dbpedia-a crystallization point for the web of data. Journal of web semantics 7 (3), pp. 154–165. Cited by: §1.
  • K. Bollacker, C. Evans, P. Paritosh, T. Sturge, and J. Taylor (2008) Freebase: a collaboratively created graph database for structuring human knowledge. In Proceedings of ACM SIGMOD 2008, pp. 1247–1250. Cited by: §1.
  • A. Bordes, N. Usunier, A. Garcia-Duran, J. Weston, and O. Yakhnenko (2013) Translating embeddings for modeling multi-relational data. Advances in neural information processing systems 26. Cited by: §4.2.1, §5.1.
  • A. Carlson, J. Betteridge, B. Kisiel, B. Settles, E. R. Hruschka, and T. M. Mitchell (2010) Toward an architecture for never-ending language learning. In

    Twenty-Fourth AAAI conference on artificial intelligence

    Cited by: §1, §5.1.
  • X. Chen, S. Jia, and Y. Xiang (2020) A review: knowledge reasoning over knowledge graph. Expert Systems with Applications 141, pp. 112948. Cited by: §1.
  • X. Chen, M. Chen, W. Shi, Y. Sun, and C. Zaniolo (2019) Embedding uncertain knowledge graphs. In Proceedings of the AAAI Conference on Artificial Intelligence, Vol. 33, pp. 3363–3370. Cited by: §2.
  • J. Chung, C. Gulcehre, K. Cho, and Y. Bengio (2014)

    Empirical evaluation of gated recurrent neural networks on sequence modeling


    NIPS 2014 Workshop on Deep Learning, December 2014

    Cited by: §4.2.1.
  • T. Dettmers, P. Minervini, P. Stenetorp, and S. Riedel (2018) Convolutional 2d knowledge graph embeddings. In Proceedings of the AAAI Conference on Artificial Intelligence, Vol. 32. Cited by: §2.
  • S. Guo, Q. Wang, L. Wang, B. Wang, and L. Guo (2016) Jointly embedding knowledge graphs and logical rules. In

    Proceedings of the 2016 conference on empirical methods in natural language processing

    pp. 192–202. Cited by: §2.
  • S. Guo, Q. Wang, L. Wang, B. Wang, and L. Guo (2018) Knowledge graph embedding with iterative guidance from soft rules. In Proceedings of the AAAI Conference on Artificial Intelligence, Vol. 32. Cited by: §2.
  • W. Hamilton, P. Bajaj, M. Zitnik, D. Jurafsky, and J. Leskovec (2018) Embedding logical queries on knowledge graphs. Advances in neural information processing systems 31. Cited by: §1, §1, §2, §5.2, §5.6.
  • X. V. Lin, R. Socher, and C. Xiong (2018) Multi-hop knowledge graph reasoning with reward shaping. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 3243–3253. Cited by: §2.
  • Z. Liu, M. Sun, Y. Lin, and R. Xie (2016) Knowledge representation learning: a review. Journal of Computer Research and Development 53 (2), pp. 247. Cited by: §1.
  • H. Ren, W. Hu, and J. Leskovec (2020) Query2box: reasoning over knowledge graphs in vector space using box embeddings. In International Conference on Learning Representations, Cited by: Table 10, Table 8, §1, §1, §1, §2, §5.1, §5.2, §5.2, §5.4, Table 3.
  • H. Ren and J. Leskovec (2020) Beta embeddings for multi-hop logical reasoning in knowledge graphs. Advances in Neural Information Processing Systems 33, pp. 19716–19726. Cited by: Table 6, Table 7, Table 8, Table 9, §1, §1, §2, Table 1, Table 2, §5.1, §5.2, §5.2, §5.4.
  • H. Sun, A. Arnold, T. Bedrax Weiss, F. Pereira, and W. W. Cohen (2020) Faithful embeddings for knowledge base queries. Advances in neural information processing systems 33. Cited by: §1, §2, §5.2, §5.2, §5.6.
  • Z. Sun, Z. Deng, J. Nie, and J. Tang (2018) RotatE: knowledge graph embedding by relational rotation in complex space. In International Conference on Learning Representations, Cited by: §2.
  • K. Toutanova and D. Chen (2015) Observed versus latent features for knowledge base and text inference. In Proceedings of the 3rd workshop on continuous vector space models and their compositionality, pp. 57–66. Cited by: §5.1.
  • T. Trouillon, J. Welbl, S. Riedel, É. Gaussier, and G. Bouchard (2016) Complex embeddings for simple link prediction. In

    International conference on machine learning

    pp. 2071–2080. Cited by: §2.
  • A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin (2017) Attention is all you need. Advances in neural information processing systems 30. Cited by: §4.2.1.
  • Z. Wang, J. Zhang, J. Feng, and Z. Chen (2014)

    Knowledge graph embedding by translating on hyperplanes

    In Proceedings of the AAAI Conference on Artificial Intelligence, Vol. 28. Cited by: §2.
  • R. West, E. Gabrilovich, K. Murphy, S. Sun, R. Gupta, and D. Lin (2014) Knowledge base completion via search-based question answering. In Proceedings of the 23rd international conference on World wide web, pp. 515–526. Cited by: §1.
  • W. Xiong, T. Hoang, and W. Y. Wang (2017)

    DeepPath: a reinforcement learning method for knowledge graph reasoning

    In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 564–573. Cited by: §2.
  • Z. Zhang, J. Wang, J. Chen, S. Ji, and F. Wu (2021) Cone: cone embeddings for multi-hop reasoning over knowledge graphs. Advances in Neural Information Processing Systems 34. Cited by: §2.