RulE: Knowledge Graph Reasoning with Rule Embedding (2024)

Abstract: Knowledge graph reasoning is an important problem for knowledge graphs. In this paper, we propose a novel and principled framework called RulE (stands for Rule Embedding) to effectively leverage logical rules to enhance KG reasoning. Unlike knowledge graph embedding methods, RulE learns rule embeddings from existing triplets and first-order rules by jointly representing entities, relations and logical rules in a unified embedding space. Based on the learned rule embeddings, a confidence score can be calculated for each rule, reflecting its consistency with the observed triplets. This allows us to perform logical rule inference in a soft way, thus alleviating the brittleness of logic. On the other hand, RulE injects prior logical rule information into the embedding space, enriching and regularizing the entity/relation embeddings. This makes KGE alone perform better too. RulE is conceptually simple and empirically effective. We conduct extensive experiments to verify each component of RulE. Results on multiple benchmarks reveal that our model outperforms the majority of existing embedding-based and rulebased approaches. The code is released at https://github.com/XiaojuanTang/RulE

heading: 1 Introduction
text: Knowledge graphs (KGs) usually store millions of real-world facts and are used in a variety of applications (Wang et al., 2018; Bordes et al., 2014; Xiong et al., 2017). Examples of knowledge graphs include Freebase (Bollacker et al., 2008), WordNet (Miller, 1995) and YAGO (Suchanek et al., 2007). They represent entities as nodes and relations among entities as edges. Each edge encodes a fact in the form of a triplet (head entity, relation, tail entity). However, KGs are usually highly incomplete, making their downstream tasks more challenging. Knowledge graph reasoning,
*Corresponding authors
which predicts missing facts by reasoning on existing facts, has thus become a popular research area in artificial intelligence.
There are two prominent lines of work in this area: knowledge graph embedding (KGE) and rulebased KG reasoning. Knowledge graph embedding (KGE) methods such as TransE (Bordes et al., 2013), RotatE (Sun et al., 2019) and BoxE (Abboud et al., 2020) embed entities and relations into a latent space and compute the score for each triplet to quantify its plausibility. KGE is efficient and robust to noise. However, it only uses zeroth-order (propositional) logic to encode existing facts (e.g., “Alice is Bob’s wife.”) without explicitly leveraging first-order (predicate) logic. First-order logic uses the universal quantifier to represent generally applicable logical rules. For instance, “∀x, y : x is y’s wife → y is x’s husband". Those rules are not specific to particular entities (e.g., Alice and Bob) but are generally applicable to all entities. The other line of work, rule-based KG reasoning, in contrast, explicitly applies logic rules to infer new facts (Galárraga et al., 2013, 2015; Yi et al., 2018; Sadeghian et al., 2019; Qu et al., 2020). Unlike KGE, logical rules can achieve interpretable reasoning and generalize to new entities. However, the brittleness of logical rules greatly harms prediction performance. Consider the logical rule (x,works in, y) → (x, lives in, y) as an example. It is mostly correct. Yet, if somebody works in New York but actually lives in New Jersey, the rule can still only infer the wrong fact in an absolute way.
Considering that the aforementioned two lines of work can complement each other, addressing each other’s weaknesses with their own merits, it becomes imperative to study how to integrate logical rules with KGE methods in a principled manner. If we view this integration in a broader context, embedding-based reasoning can be seen as a neural method, while rule-based reasoning can be seen
4316
as a symbolic method. Neural-symbolic learning has also been a focus of artificial intelligence research in recent years (Parisotto et al., 2017; Yi et al., 2018; Manhaeve et al., 2018; Xu et al., 2018; Hitzler, 2022).
In the KG domain, such efforts exist too. Some works combine logical rules and KGE by using rules to infer new facts as additional training data for KGE (Guo et al., 2016, 2018) or directly convert some rules into regularization terms for specific KGE models (Ding et al., 2018; Guo et al., 2020). However, they both leverage logical rules merely to enhance KGE training without actually using logical rules to perform reasoning. In this way, they might lose the important information contained in explicit rules, leading to empirically worse performance than state-of-the-art methods.
To address the aforementioned limitations, we propose a simple and principled framework called RulE, which aims to learn rule embeddings by jointly representing entities, relations and logical rules in a unified space. As illustrated in Figure 1, given a KG and logical rules, RulE assigns an embedding to each entity, relation and rule, and defines respective mathematical operators between entities and relations (traditional KGE part) as well as between relations and rules (RulE part). It is important to note that we cannot define operators between entities and rules because rules are not specific to particular entities. By jointly optimizing entity, relation and rule embeddings in the same space, RulE allows injecting prior logical rule information to enrich and regularize the embedding
space. Our experiments reveal that this joint embedding can boost KGE methods themselves. Additionally, based on the relation and rule embeddings, RulE is able to give a confidence score to each rule, similar to how KGE gives each triplet a confidence score. This confidence score reflects how consistent a rule is with the existing facts, and enables performing logical rule inference in a soft way by softly controlling the contribution of each rule, which alleviates the brittleness of logic.
We evaluate RulE on benchmark link prediction tasks and show superior performance. Experimental results reveal that our model outperforms the majority of existing embedding-based and rulebased methods. We also conduct extensive ablation studies to demonstrate the effectiveness of each component of RulE. All the empirical results verify that RulE is a simple and effective framework for neural-symbolic KG reasoning.

heading: 2 Preliminaries
text: A KG consists of a set of triplets K = {(h, r, t) | h, t ∈ E , r ∈ R} ⊆ E ×R× E , where E denotes the set of entities and R the set of relations. For a testing triplet (h, r, t), we define a query as q = (h, r, ?). The knowledge graph reasoning (link prediction) task is to infer the missing entity t based on the existing facts and rules.

heading: 2.1 Embedding-based reasoning
text: Knowledge graph embedding (KGE) represents entities and relations as embeddings in a continuous space. It calculates a score for each triplet based on these embeddings via a scoring function. The embeddings are trained so that facts observed in the KG have higher scores than those not observed. The learning goal here is to maximize the scores of positive facts (existing triplets) and minimize those of sampled negative samples.
RotatE (Sun et al., 2019) is a representative KGE method with competitive performance on common benchmark datasets. It maps entities in a complex space and defines relations as elementwise rotations in each two-dimensional complex plane. Each entity and each relation is associated with a complex vector, i.e., h, r, t ∈ Ck, where the modulus of each element in r is fixed to 1 (multiplying a complex number with a unitary complex number is equivalent to a 2D rotation). If a triplet (h, r, t) holds, it is expected that t ≈ h ◦ r in the complex space, where ◦ denotes the Hadamard (element-wise) product. Formally, the distance
function of RotatE is defined as: d(h, r, t) =∥ h ◦ r − t ∥ . (1)

heading: 2.2 Rule-based reasoning
text: Logical rules are usually expressed as firstorder logic formulae, e.g., ∀x, y, z : (x, r1, y) ∧ (y, r2, z) → (x, r3, z), or r1(x, y) ∧ r2(y, z) → r3(x, z) for brevity. The left-hand side of the implication “→” is called rule body or premise, and the right-hand side is rule head or conclusion. Logical rules are often restricted to be closed, which form chains. For a chain rule, successive relations share intermediate entities (e.g., y), and the rule head’s and rule body’s head/tail entity are the same. Chain rules include common logical rules in KG such as symmetry, inversion, composition, hierarchy, and intersection rules. These rules play an important role in KG reasoning. The length of a rule is the number of atoms (relations) that exist in its rule body. A grounding of a rule is obtained by substituting all variables x, y, z with specific entities. If all triplets in the body of a grounding rule exist in the KG, we get a support of this rule. Those rules that have nonzero support are called activated rules. When inferring a query (h, r, ?), rule-based reasoning enumerates relation paths between head h and each candidate tail, and uses activated rules to infer the answer. See Appendix 9 for illustrative examples.

heading: 3 Method
text: This section introduces our proposed model RulE. RulE is a principled framework to combine KG embedding with logical rules by learning rule embeddings. As illustrated in Figure 2, the training process of RulE consists of three key components. Consider a KG containing triplets and a set of logical rules automatically extracted or predefined by experts. They are: 1) Joint entity/relation/rule embedding. We model the relationship between entities and relations as well as the relationship between relations and logical rules to jointly train entity, relation and rule embeddings in a continuous space, as demonstrated in Figure 1. 2) Soft rule reasoning. With the rule and relation embeddings, we calculate a confidence score for each rule which is used as the weight of activated rules to output a grounding rule score. 3) Finally, we integrate the KGE score calculated from the entity and relation embeddings trained in the first stage and the grounding rule score obtained in the second stage to reason unknown triplets.

heading: 3.1 Joint entity/relation/rule embedding
text: Given a triplet (h, r, t) ∈ K and a rule R ∈ L, we use h, r, t,R ∈ Ck to represent their embeddings, respectively, where k is the dimension of the complex space (following RotatE). Similar to KGE, which encodes the plausibility of each triplet with a scoring function, RulE additionally defines a scoring function for logical rules. Based on the two scoring functions, it jointly learns entity, relation and rule embeddings in the same space by maximizing the plausibility of existing triplets K (zeroth-order logic) and logical rules L (first-order logic). The following describes in detail how to model the triplets and logical rules together.
Modeling the relationship between entities and relations To model triplets, we take RotatE (Sun et al., 2019) due to its simplicity and competitive performance. Its loss function with negative sampling is defined as:
Lt(h, r, t) = − log σ(γt − d(h, r, t))− ∑
(h′,r,t′)∈N
1
|N| log σ(d(h, r, t)− γt), (2)
where γt is a fixed triplet margin, d(h, r, t) is the distance function defined in Equation (1), and N is the set of negative samples constructed by replacing either the head entity or the tail entity with a random entity using a self-adversarial negative sampling approach. Note that RulE is not restricted to particular KGE models. The RotatE can be replaced with other models, such as TransE (Bordes et al., 2013) and ComplEx (Trouillon et al., 2016), too.
Modeling the relationship between relations and logical rules A universal first-order logical rule is some rule that universally holds for all entities. Therefore, we cannot relate such a rule to specific entities. Instead, it is a higher-level concept related only to the relations it is composed of. Our modeling strategy is as follows. For a logical rule R : r1 ∧ r2 ∧ . . . ∧ rl → rl+1, we expect that rl+1 ≈ (r1 ◦ r2 ◦ . . . ◦ rl) ◦R. Because the modulus of each element in r is restricted to 1, the multiple rotations in the complex plane are equivalent to the summation of the corresponding angles. We define g(r) to return the angle vector of relation r (taking the angle for each element of r). Note that the definition of Hadamard product in Equation 1 is equivalent to the term g(r) as defined in Equation 3. More interpretations are provided
in Appendix 15. Then, the distance function is formulated as follows: dr(r1, . . . , rl+1,R) = ∥ l∑
i=1
g(ri)
+ g(R)− g(rl+1) ∥ . (3)
We also employ negative sampling, the same as when modeling triplets. At this time, it replaces a relation (either in rule body or rule head) with a random relation. The loss function for logical rules is defined as:
Lr(r1, . . . , rl+1,R) = − log σ(γr − dr)
− ∑
(r′1,...,r ′ l+1,R)∈M
1
|M| log σ(d ′ r − γr), (4)
where γr is a fixed rule margin and M is the set of negative rule samples.
Note that the above strategy is not the only possible way. For example, when considering the relation order of logical rules (e.g., sister’s mother is different from mother’s sister), we design a variant of RulE using position-aware sum, which shows slightly improved performance on some datasets. See Appendix 14. Nevertheless, we find that Equation (3) is simple and good enough, thus keep it as the default choice.
Joint training Given a KG containing triplets K and logical rules L, we jointly optimize the two
loss functions (2) and (4) to get the final entity, relation and rule embeddings:
L = ∑
(h,r,t)∈K Lt(h, r, t)
+ α ∑
(r1,...,rl,R)∈L Lr(r1, . . . , rl+1,R),
(5)
where α is a hyperparameter to balance the two losses. Note that the two losses act as each other’s regularization terms. The rule loss (4) cannot be optimized alone, otherwise there always exist (r1, . . . , rl+1,R)s that can perfectly minimize the loss, leading to meaningless embeddings. However, when jointly optimizing it with the triplet loss, the embeddings will be regularized, and rules more consistent with the triplets tend to have lower losses (by being more easily optimized). On the other hand, the rule loss also provides a regularization to the triplet (KGE) loss by adding additional constraints that relations should satisfy. This additional information enhances the KGE training, leading to entity/relation embeddings more consistent with prior rules.

heading: 3.2 Soft rule reasoning
text: As shown in Figure 2, during soft rule reasoning, we use the joint relation and rule embeddings to compute the confidence score of each rule. Similar
to how KGE gives a triplet score, the confidence score of a logical rule Ri : ri1 ∧ ri2 ∧ ...∧ ril → ril+1 is calculated by:
wi = γr − d(ri1 , . . . , ril+1 ,Ri), (6)
where d(ri1 , . . . , ril+1,Ri) is defined in Equation (3).
To predict a triplet, we perform rule grounding by finding all paths connecting the head and tail that can activate some rule. Often a triplet can have several different rules activated, each with different number of supports (activated paths). An example is shown in Figure 2. The triplet (e1, r3, e6) can be predicted by rule R1 and R3 with the grounding paths e1 → r1 → r2 → e6 and e1 → r7 → r8 → e6. In this case, a straightforward way is to use the maximum (i.e., max(w1, w3)) or summation (i.e., w1+w3) of the confidences of those activated rules as the grounding rule score of the triplet.
However, the above way will lose the dependency among different rules. For example, consider the following two rules: parent_of(x, y) → mother_of(x, y) and sister_of(x, z)∧aunt_of(z, y) → mother_of(x, y). We know that they individually are both not reliable, because a parent can also be a father, and an aunt’s sister can be another aunt. However, when these two rules are activated together, one can almost surely infer the “mother” relation. In practice, those rules extracted automatically may contain a lot of redundancy or noise. Compared to the naive aggregation approach (such as summation or maximum), we choose to use an MLP to model the complex interdependencies among rules.
Specifically, let us still consider the example in Figure 2. We construct a soft multi-hot encoding v ∈ R|L| such that vi is the product of the confidence of Ri and the number of grounding paths activating Ri (# of supports). Formally, vi = wi×|P(h, r, t,Ri)| for i ∈ {1, . . . ,L}, where P(h, r, t,Ri) is the set of supports of the rule Ri applying to the current triplet (h, r, t). For the candidate e6 in Figure 2, the value of v1 is w1 × 1 (grounding path e1 → r7 → r8 → e6 appears one times), v3 is w3 × 1, and others (unactivated rules) are 0.
With this soft multi-hot encoding v, we apply an
1Except for YAGO3-10, DistMult, ComplEx and TuckER results are taken from Abboud et al. (2020).
MLP on v to calculate the grounding rule score:
sg(h, r, t) = MLP(v). (7)
Note that for a query (h, r, ?), we will iterate over all candidates t, and the grounding paths for all candidates can be efficiently computed by running BFS. The complexity analysis is presented in Appendix 13. Once we have the grounding rule score for all candidate answers, we further use a softmax function to compute the probability of the true answer. Finally, we train the MLP by maximizing the log likelihood of the true answers in the training triplets. Fine-grained implementation details are included in Appendix 10.

heading: 3.3 Inference
text: Finally, during inference, we predict any missing fact with a weight-ed sum of the KGE score (st = γt − d(h, r, t)) and the grounding rule score (Equation (7)):
s(h, r, t) = st(h, r, t) + β · sg(h, r, t′), (8)
where β is a hyperparameter balancing the weights of embedding-based and rule-based reasoning.

heading: 4 Experiments
text: In this section, we empirically evaluate RulE on several benchmark KGs and show superior performance to existing embedding-based, rule-based methods and hybrid approaches that combine both. Additionally, we also conduct extensive ablation experiments to verify the effectiveness of each component of RulE. Furthermore, we provide theoretical analysis and case studies in Appendix 18 to provide further insights and understanding.

heading: 4.1 Experiment settings
text: Datasets We choose six datasets for evaluation: FB15k-237 (Toutanova and Chen, 2015), WN18RR (Dettmers et al., 2018), YAGO310 (Mahdisoltani et al., 2014), UMLS, Kinship, and Family (Kok and Domingos, 2007). More details of data split and logical rules used in the experiments are in Appendix 16.
Baselines We compare with a comprehensive suite of embedding and rule-based baselines. (1)
1For UMLS and Kinship, [*] means the numbers are taken from Qu et al. (2020); [†] means we rerun the methods with the same evaluation process. For Family, Neural-LP and DRUM results are taken from Sadeghian et al. (2019) and others from our rerun results.
Embedding-based models: we include TransE (Bordes et al., 2013), DisMult (Yang et al., 2014), ComplEx (Trouillon et al., 2016), ConvE (Dettmers et al., 2018), TuckER (Balažević et al., 2019) and RotatE (Sun et al., 2019). (2) Rule-based models: we compare with MLN (Richardson and Domingos, 2006), PathRank (Lao and Cohen, 2010), as well as popular rule learning methods NeuralLP (Yang et al., 2017), DRUM (Sadeghian et al., 2019), RNNLogic+ (w/o emb.) (Qu et al., 2020) and NCRL (Cheng et al., 2023). (3) Joint KGE and logical rules: we also compare with baselines that ensemble embedding-based and rule-based method, including RNNLogic+ (with emb.) (Qu et al., 2020) and Naive Combination (Meilicke et al., 2021). See more introduction to RNNLogic+ in Appendix 11. (4) For our RulE, we present results of embeddingbased, rule-based and integrated reasoning. The first variant only uses KGE scores obtained from joint entity/relation/rule embedding to reason unknown triplets, denoted by RulE (emb.). The second variant only uses the grounding score calculated from soft rule reasoning, denoted by RulE (rule.). The last one is the full model combining both, denoted by RulE (emb & rule.). Furthermore, to sufficiently verify the effect of rule embedding on different KGE models, we also experiment with a variant of RulE (emb.) using TransE (Bordes et al., 2013) as the KGE model, denoted by emb with TransE.. We conduct additional experiments on more datasets to compare RulE with the graph-based method NBFNet (Zhu et al., 2021) (see Appendix 17.4). Considering the relation order of logical rules, we also design another variant of RulE using position-aware sum (see Appendix 14). Evaluation protocols We follow the setting in RNNLogic (Qu et al., 2020) and evaluate models by Mean Reciprocal Rank (MRR) as well as Hits at N (H@N). For above baselines, we carefully tune the parameters and achieve better results than reported in RNNLogic. To ensure a fair comparison, in the KGE part of RulE, we use the same parameters as those used in TransE and RotatE without further tuning them and rerun RNNLogic+ with the same logical rules as RulE (See Appendix 16.3). Hyperparameter settings By default, we use RotatE (Sun et al., 2019) as our KGE model. We search for parameters according to validation set performance. The ranges of the hyperparameters in the grid search and final adopted values are provided in Appendix 16.4.

heading: 4.2 Results
text: The results are shown in Table Tables 1 and 2. We observe that: (1) RulE outperforms both embedding-based and rule-based methods on most datasets, especially on UMLS and Kinship which show significant improvements. This indicates that combining KGE and rule-based methods with rule embedding can take advantage of both and improve the performance of KG reasoning. (2) Compared with loosely composed methods (i.e., RNNLogic+ (with emb.) and Naive Combination), RulE (emb & rule.) obtains better results on all datasets, demonstrating that it is more beneficial for KG reasoning
to use rule embedding to bridge embedding-based and rule-based approaches than naively combining them. A detailed analysis is as follows.
Embedding logical rules helps KGE We first compare RulE (emb.) with RotatE. Note that RulE (emb.) and RulE (emb with TransE.) only add an additional rule embedding loss to the KGE training and still use KGE scores only for prediction. As presented in Table 1 and 2, RulE (emb.) and RulE (emb with TransE.) both achieve comparable or higher performance than the corresponding KGE models, especially for RulE (emb with TransE.), which obtains 4.4% and 4.7% absolute MRR gain than TransE on UMLS and Kinship. This indicates that by jointly embedding entities/relations/rules into a unified space, RulE can inject logical rule information to enrich and regularize the embedding space and improve the generalization of KGE. This verifies the effectiveness of joint entity/relation/rule embedding.
We also observe that the improvement of RulE (emb with TransE.) is more significant than RulE (emb.). The reason is probably that RotatE is expressive enough to capture many relational patterns of KG, thus more complex logical rules may be needed. In Table 3, we further use TransE and
ComplEx as the KGE model of RulE and test on FB15k and WN18 datasets. They both obtain superior performance to the corresponding KGE models (see Appendix 17.1).
Additionally, we find that RulE (emb with TransE.) on UMLS and Kinship achieves more improvement than FB15k-237 and WN18RR. The reason is probably that UMLS and Kinship contain more rule-inferrable facts while WN18RR and FB15k-237 consist of more general facts (like the publication year of an album, which is hard to infer via rules). This phenomenon is observed in previous works too (Qu et al., 2020). To verify it, we perform a data analysis in Appendix 12.
Soft rule reasoning outperforms hard rule reasoning We compare RulE (rule.) with rule mining methods. Note that we rerun RNNLogic+ with the same rules as RulE for fair comparisons. From Table 1 and 2, we can observe that RulE (rule.) outperforms existing hard rule reasoning baselines except for WN18RR on NCRL. This demonstrates that soft multi-hot encoding over MLP is more powerful than other ways of performing rule inference.
Comparison with other joint reasoning and rule-enhanced KGE models We also compare with RNNLogic+ (emb & rule.) and Naive Combination, which separately trains embedding-based and rule-based methods and then only loosely ensemble them. Although the final inference of RulE (emb & rule.) is similar to the above methods (weighted sum over KGE score and grounding rule score), RulE uses rule embedding as a bridge to strengthen KGE and rule reasoning process, by injecting rule information to the KGE embedding space and also extracting rule confidence for soft
rule reasoning. This demonstrates that the interaction between embedding-based methods and rulebased methods can further enhance each other and the rule embedding serves as the medium. We further study how the hyperparameter β balances both of them. See more details in Appendix 17.2.

heading: 4.3 Ablation study
text: This section analyzes whether individual components of the RulE design are useful via ablation experiments. As the usefulness of joint entity/relation/rule embedding has been verified extensively by previous experiments, here we focus on validating the soft rule reasoning part. Specifically, we compare the following RulE versions: (1) standard, which is the standard RulE (rule.) described in Section 3.2; (2) hard-encoding, which only uses hard 1/0 to select activated rules instead of the rule confidence obtained from joint relation/rule embeddings. This is to verify that the confidence scores of logical rules, which are learned through jointly embedding KG and logical rules, help rule-based reasoning; (3) sum (w/o MLP) and max (w/o MLP), which replace the MLP layer with sum and max respectively over the weights of all activated rules as the grounding rule score. This is to demonstrate the importance of capturing the complex interdependencies among logical rules.
Ablation Results As presented in Table 4, standard achieves better performance than hardencoding, which indicates that using soft multi-hot encoding to perform logical rule inference in a soft way is beneficial to the rule reasoning process. Besides, the performances of sum (w/o MLP) and max (w/o MLP) versions degrade sharply compared to standard, showing that it is important to use an MLP to capture the complex interdependencies among rules.

heading: 5 Related work
text: Embedding-based methods Embedding-based methods aim to learn embeddings for entities and relations and estimate the plausibility of unobserved triplets based on these learned embeddings (Bordes et al., 2013; Yang et al., 2014; Trouillon et al., 2016; Sun et al., 2019; Balažević et al.,
2019; Vashishth et al., 2019; Zhang et al., 2020a; Abboud et al., 2020; Ge et al., 2023).
Rule-based methods Learning logical rules for knowledge graph reasoning has also been extensively studied, including Inductive Logic Programming (Quinlan, 1990), Markov Logic Networks (Kok and Domingos, 2005; Beltagy and Mooney, 2014), AMIE (Galárraga et al., 2013), AMIE+ (Galárraga et al., 2015), Neural-LP (Yang et al., 2017), DRUM (Sadeghian et al., 2019), RNNLogic (Qu et al., 2020) and other methods (Cheng et al., 2023; Nandi et al., 2023). They almost solely use the learned logical rules for reasoning, which suffer from brittleness and are hardly competitive with embedding-based reasoning in most benchmarks.
Joint KGE and logical rules Some work tries to incorporate logical rules into KGE models. They usually use logical rules to infer new facts as additional training data for KGE (Guo et al., 2016, 2018) or inject rules via regularization terms during training (Wang et al., 2015; Ding et al., 2018). However, they do not really perform reasoning with logical rules.
GNN-based methods Recently, there are some KG reasoning works based on graph neural networks (Schlichtkrull et al., 2018; Teru et al., 2020; Zhang et al., 2020b; Zhu et al., 2021; Li et al., 2023). They exploit neighboring information via message-passing mechanisms. More details of related work and comparison with RNNLogic (Qu et al., 2020) are provided in Appendix 8.

heading: 6 Conclusion
text: We propose a simple and principled framework RulE to jointly represent entities, relations and logical rules in a unified embedding space. The incorporation of rule embedding allows injecting rule information to enrich and regularize the embedding space, thus improving the generalization of KGE. Besides, we also demonstrate that with the learned rule embedding, RulE can perform rule inference in a soft way and empirically verify that using an MLP can effectively model the complex interdependencies among rules, thus enhancing rule inference.

heading: 7 Limitations
text: A limitation of RulE is that, similar to prior works which apply logical rules for inference, RulE’s soft rule reasoning part needs to enumerate all paths between entity pairs, making it difficult to scale. Another limitation is that currently we only consider chain rules provided as prior knowledge. In the future, we plan to explore more efficient and effective rule reasoning algorithms and consider more complex rules. Besides, currently, we focus on chain rules provided as prior knowledge, i.e., Horn clause, a disjunctive clause (a disjunction of literals) with at most one positive. We acknowledge the importance of addressing negation operators, for example, ∀x, y, z : ¬r1(x, y) ∧ r2(y, z) → r3(x, z). In future explorations, we may consider leveraging betaE (Ren and Leskovec, 2020), a probabilistic embedding framework to handle negation operator in complex multi-hop logical reasoning.

heading: Acknowledgements
text: This work is partially supported by the National Key R&D Program of China (2022ZD0160300), the National Key R&D Program of China (2021ZD0114702), the National Natural Science Foundation of China (62276003).

heading: 8 Related work
text: Embedding-based methods Embedding-based methods aim to learn embeddings for entities and relations and estimate the plausibility of unobserved triplets based on these learned embeddings (Bordes et al., 2013; Yang et al., 2014; Trouillon et al., 2016; Cai and Wang, 2017; Sun et al., 2019; Balažević et al., 2019; Vashishth et al., 2019; Zhang et al., 2020a; Abboud et al., 2020; Ge et al., 2023). Much prior work in this regard views a relation as some operation or mapping function between entities. Most notably, TransE (Bordes et al., 2013) defines a relation as a translation operation between some head entity and tail entity. It is effective in modelling inverse and composition rules. DistMult (Yang et al., 2014) uses a bilinear mapping function to model symmetric patterns. RotatE (Sun et al., 2019) uses rotation operation in complex space to capture symmetry/antisymmetry, inversion and composition rules. CompoundE (Ge et al., 2023) leverages translation, rotation, and scaling operations to create relation-dependent compound operations on head and/or tail entities. BoxE (Abboud et al., 2020) models relations as boxes and entities as points to capture symmetry/anti-symmetry, inversion, hierarchy and intersection patterns but not composition rules. These approaches learn representations solely based on triplets (zeroth-order logic) contained in the given KG. In contrast, our approach is able to embody more complex first-order logical rules in the embedding space by jointly modeling entities, relations and logical rules in a unified framework.
Rule-based methods Learning logical rules for knowledge graph reasoning has also been extensively studied. As one of the early efforts, Quinlan (1990) uses Inductive Logic Programming (ILP) to derive logical rules (hypothesis) from all the training samples in a KG. Markov Logic Networks (MLNs) (Kok and Domingos, 2005; Brocheler et al., 2012; Beltagy and Mooney, 2014) define the joint distribution of given variables (observed facts) and hidden variables (missing facts) such that missing facts can be inferred in the probabilistic graphical model. AMIE (Galárraga et al., 2013) and AMIE+ (Galárraga et al., 2015) first enumerate possible rules and then learn a scalar weight for each rule to encode its quality. Neural-LP (Yang et al., 2017) and DRUM (Sadeghian et al., 2019) mine rules by simultaneously learning logic rules
and their weights based on TensorLog (Cohen et al., 2017). RNNLogic (Qu et al., 2020) simultaneously trains a rule generator and reasoning predictor to generate high-quality logical rules. Nandi et al. (2023) propose three augmentations aimed at enhancing the rule set’s coverage in RNNLogic-based models. NCRL (Cheng et al., 2023) infers rule head by recursively merging atomic compositions in rule body. Except for RNNLogic, the above methods solely use the learned logical rules for reasoning, which suffer from brittleness and are hardly competitive with embedding-based reasoning in most benchmarks. Although RNNLogic considers the effect of KGE during inference, it pretrains KGE separately from logical rule learning without jointly modeling KGE and logical rules in the same space. Most existing works focus on mining rules from observed triplets. In contrast, we focus on the setting where rules are already given (either mined from KG or provided as prior knowledge) and the task is to leverage the rules for better inference. Thus, in principle, our framework can be combined with any rule mining model to improve their rule usage.
Joint KGE and logical rules Some recent work tries to incorporate logical rules into KGE models to improve the generalization performance of KGE reasoning. KALE (Guo et al., 2016) and RUGE (Guo et al., 2018) use logical rules to infer new facts as additional training data for KGE. Several other works inject rules via regularization terms during training, including Wang et al. (2015) and Ding et al. (2018). These methods leverage logical rules only to enhance KGE training and do not really perform reasoning with logical rules. Although Meilicke et al. (2021) combines symbolic and embedding-based methods, it only loosely ensembles the rankings generated by embedding-based and symbolic methods. In contrast, our method jointly learns entity/relation/rule embeddings in a unified space, which is shown to enhance KGE itself. With the learned rule embedding, RulE can also perform logical rule inference in a soft way, improving the rule-based reasoning process. Moreover, the combination of both further advance the performance.
GNN-based methods Recently, there are some KG reasoning works based on graph neural networks (Schlichtkrull et al., 2018; Teru et al., 2020; Zhang et al., 2020b; Zhu et al., 2021; Li et al., 2023). They exploit neighboring information via message-passing mechanisms, which are empiri-
cally powerful and can be applied to the inductive setting. However, they usually suffer from high complexity. Furthermore, these methods cannot leverage prior/domain knowledge presented as logical rules, its interpretability is built on pathexplanation of the predictions.

heading: 9 Example of rule-based reasoning
text: The length of a rule is the number of atoms (relations) that exist in its rule body. One example of a length-2 rule is:
born_in(x, y) ∧ city_of(y, z) → nationality(x, z), (9) of which born_in(·) ∧ city_of(·) is the rule body and nationality(·) is the rule head. A grounding of a rule is obtained by substituting all variables x, y, z with specific entities. For example, if we replace x, y, z with Bill Gates, Seattle, US respectively, we get a grounding:
born_in(Bill Gates,Seattle) ∧ city_of(Seattle,US) → nationality(Bill Gates,US)
(10)
If all triplets in the body of a grounding rule exist in the KG, we get a support of this rule. Those rules that have nonzero support are called activated rules. When inferring a query (h, r, ?), rule-based reasoning enumerates relation paths between head h and each candidate tail, and uses activated rules to infer the answer. For example, if we want to infer nationality(Bill Gates, ?), given the logical rule (9) as well as the existing triplets born_in(Bill Gates,Seattle) and city_of(Seattle,US), the answer US can be inferred.

heading: 10 Fine-grained implementation details
text: This section introduces the fine-grained implementation details. Recall the soft reasoning process: we use the joint relation and rule embeddings to compute a scalar as the confidence score of each rule, then construct a soft multi-hot encoding with the confidence, and finally pass the MLP layer to output the grounding rule score. In other words, we obtain the grounding rule score by using a multihot encoding vector to activate an MLP. However, in practice, we can use a fine-grained way, i.e., use multiple multi-hot encoding vectors rather than only one.
Specifically, recall that R, r ∈ Ck are the embeddings of logical rules and relations, respectively. To prevent confusion, we use v[i] to denote the i-th elements of vector v. With the optimized relation and rule embeddings, we can compute the confidence vector of a logical rule Ri : ri1 ∧ ri2 ∧ ... ∧ ril → ril+1 as:
ci = γr k
− ( l∑
j=1
rij +Ri − ril+1)p, (11)
where p is a hyperparameter, usually the same as the norm defined in Equation (3) , γr is the fixed rule margin defined in Equation (4). Note that ci is a k-dimensional vector, slightly different from the definition in Section 3.2. Each element of ci represents a way of encoding the confidence of rule Ri. Given the confidence vector ci, we can further construct k multi-hot encoding vectors. Each multihot encoding vector activates the MLP to output a grounding score. Further, the mean of all the grounding scores is computed as the grounding rule score sg of a triplet.
Let us consider the example (e1, r3, e6) in Figure 2. We construct k soft multi-hot encoding vectors {vj ∈ R|L|, j = 1, . . . , k} such that vj [i] is the product of of the confidence of Ri and the number of grounding paths activating Ri. Formally, vj [i] = ci[j] × |P(h, r, t,Ri)| for i ∈ {1, . . . ,L}, where P(h, r, t,Ri) is the set of supports of the rule Ri applying to the current triplet (h, r, t). For the candidate e6 in Figure 2, the value of multi-hot encoding vector vj [1] is c1[j]× 1, vj [3] is c3[j]× 1, and others are 0 (i.e., vj [k] = 0, k = 2, 4, . . . ,L).
With these soft multi-hot encoding vectors, we apply an MLP to output the grounding rule score:
sg = 1
k
k∑
j=1
MLP(vj). (12)
Note that the MLP used by different soft multi-hot encodings is the same. Once we have the grounding rule score for all candidate answers, we further use a softmax function to compute the probability of the true answer. Finally, we optimize the MLP and grounding-stage rule embedding by maximizing the log likelihood of the true answers based on these training triplets.

heading: 11 Introduction of RNNLogic+
text: RNNLogic (Qu et al., 2020) aims to learn logical rules from knowledge graphs, which simultane-
ously trains a rule generator as well as a reasoning predictor. The former is used to generate rules while the latter learns the confidence of generated rules. Because RulE is designed to leverage the rules for better inference, to compare with it, we only focus on the reasoning predictor RNNLogic+, which is a more powerful predictor than RNNLogic. The details are described in this section.
Given a KG containing a set of triplets and logical rules, RNNlogic+ associates each logical rule with a grounding-stage rule embedding R(g) (different from the joint rule embedding in RulE), for a query (h, r, ?), it grounds logical rules into the KG, finding different candidate answers. For each candidate answer t′, RNNLogic+ aggregates all the rule embeddings of those activated rules, each weighted by the number of paths activating this rule (# supports). Then an MLP is further used to project the aggregated embedding to the grounding rule score sr(h, r, t′):
sr = MLP ( AGG({R(g)i , |P(h,Ri, t′)|}Ri∈L) )
(13) where LN is the layer normalization operation, AGG is the PNA aggregator (Corso et al., 2020), L is the set of generated high-quality logical rules, and P(h,Ri, t′) is the set of supports of the rule Ri which starts from h and ends at t′. Once RNNLogic+ computes the score of each candidate answer, it can use a softmax function to compute the probability of the true answer. Finally, the predictor can be optimized by maximizing the log likelihood of the true answers based on training triplets. In essence, when replacing the PNA aggregator with sum aggregation, it is equivalent to using hard multi-hot encoding to activate an MLP (i.e., only using hard 1/0 to select activated rules). However, RulE additionally employs the confidence scores of rules as soft multi-hot encoding.
During inference, there are two variants of models:
• RNNLogic+ (w/o emb.): This variant only uses the logical rules for knowledge graph reasoning. Specifically, we calculate the score sr of each candidate answer defined in Equation (13).
• RNNLogic+ (with emb.): It uses RotatE (Sun et al., 2019) to pretrain knowledge graph embeddings models, which is different from RulE in that RulE jointly models KGE and logical rules in the same space to learn entity,
relation and logical rule embeddings. During inference, it linearly combines the grounding rule score and KGE score as the final prediction score, i.e.,
s(h, r, t′) = sr(h, r, t′) + α ∗ KGE(h, r, t′), (14) where KGE(h, r, t′) is the KGE score calculated with entity and relation embeddings optimized by RotatE alone, and α is a positive hyperparameter weighting the importance of the knowledge graph embedding score.

heading: 12 Analysis of rule-inferrable indicator
text: This section analyzes the rule-inferrable of KGs. Naturally, without considering the directions of edges, any rule can be viewed as a cycle by including both the relation path and the target relation itself. To simplify the analysis, we assume that any cycle can be a logical rule, regardless of concrete relations and the correct semantic information. If a relation appears in a rule, it must be an edge consisting of the cycle; on the other hand, if an edge can be a part of a cycle, it must be a participant relation of the rule. Based on the above hypothesis, we define the proportion of edges existing in cycles to evaluate the rule-inferrable of KGs (i.e., the rule-inferrable indicator).
To verify our hypothesis, we conduct simulation experiments with a Family Tree KG (Hohenecker and Lukasiewicz, 2020), an artificially closed-world dataset generated with logical rules. By randomly selecting N% of triplets to replace with randomly sampled triplets, we evaluate their rule-inferrable indicators. As shown in Table 5, as the randomness increases, the proportion of edges appearing in cycles decreases and are all lower than in the standard Family Tree. These results indicate that the proportion of edges appearing in the rings can empirically measure the rule-inferrable of KGs.
Next, we analyze the rule-inferrable on all datasets, i.e., FB15k-237, WN18RR, YAGO3-10, UMLS, Kinship and Family. The results are included in Table 6. We observe that: UMLS, Kinship and Family reach 100% of 3-membered cycles while YAGO3-10 and WN18RR have a relatively low proportion, especially WN18RR, which is only about 17%. Therefore, we can empirically conclude that compared to those KGs containing more general facts (FB15k-237, WN18RR and YAGO310), UMLS, Kinship and Family are more ruleinferrable datasets. Furthermore, the performance
improvement of the RulE (emb with TransE.) is more significant, which is consistent with the observation in our experiments (See Table 2).

heading: 13 Complexity analysis
text: This section analyzes the complexity of RulE. We use d to denote hidden dimension and E is the set of relations (edges).
During training, for the joint entity/relation/rule embedding stage, the amortized time of a single triplet or a logical rule is O(d) due to linear operations. For the soft reasoning part, considering a query (h, r, ?), RulE performs a BFS search from h to find all candidates and compute their grounding rule scores. We group triplets with the same h, r together, where each group contains |V|. For each group, we only need to use an MLP to get predictions, which takes O(|E|d2) time. Thus, the amortized time for a single triplet is O( |E|d 2
|V| ). During inference, we compute the final score with a weighted sum of the KGE score and the grounding rule score. Thus each triplets takes O( |E|d 2
|V| + d) time. The inference time of RulE and RNNLogic+ on different datasets is presented in Table 7. We can see that RulE has similar inference time to RNNLogic+.

heading: 14 A variant of RulE with position-aware sum
text: In this section, considering the relation order of rules, we design a variant of RulE using positionaware sum and evaluate the variant based on TransE and RotatE.
It is obvious that 2D rotations and translations are commutative—they cannot model the noncommutative property of composition rules, which is crucial for correctly expressing the relation order of a rule. Take sister_of(x, y)∧mother_of(y, z) → aunt_of(x, z) as an example. If we permute the relations in rule body, e.g., change (sister_of ∧ mother_of) to (mother_of ∧ sister_of), the rule is
no longer correct. However, the above model will output the same score since (r1 ◦ r2) = (r2 ◦ r1) and (r1 + r2) = (r2 + r1).
Therefore, to respect the relation order of logical rules, we use position-aware sum to model the relationship between logical rules and relations. Recall that r ∈ Ck is the embedding of relation and g(r) is to return the angle vector of relation r. For each logical rule R : r1 ∧ r2 ∧ . . . ∧ rl → rl+1, we associate it with a rule embedding R = [R1,R2, ...,Rl],R ∈ Ckl, where l is the length of the logical rule and [·, ·] is concatenation operation. Based on the above definitions, we can formulate the distance function as:
d(r1, r2, . . . , rl+1,R) =∥ l∑
j=1
( g(rk) · g(Rk) )
− g(rl+1) ∥, (15)
where · is an element-wise product. Then we use Equation (4) to further define the loss function of logical rules.
Experimental results with TransE and RotatE are displayed in Table 8. RulE (emb_o.) is the new version that uses position-aware sum. From the results, we can see that RulE (emb_o.) almost obtains superior performance to the corresponding KGE models, again empirically demonstrating that jointly representing entity, relation and rule embeddings can improve the generalization of KGE. Moreover, the performance of RulE (emb_o.) is comparable with RulE (emb.) in FB15k-237 and WN18RR. It also increases a lot in UMLS and Kinship, especially Kinship, which outperforms RulE (emb with TransE.) with a 2.9% improvement in MRR. The reason is probably that relation order plays an important role in modeling logical rules for rule-inferrable datasets (e.g., UMLS and Kinship).

heading: 15 Different representations of entity-relation loss and relation-rule loss
text: The entity-relation loss is defined in terms of the Hadamard product, while the relation-rule loss is defined in terms of g(r). Essentially, the two representations are equivalent. We utilize distinct representations for the sake of convenience and to maintain consistency with the model’s implementation. Following the RotatE (Sun et al., 2019) paper, the entity-relation loss (i.e., t ≈ h ◦ r) is defined in terms of the Hadamard product, which is equivalent to rotating the entity-vector with a relation-angle in 2D complex space. For relation-rule loss, if a logical rule R : r1 ∧ r2 ∧ ... ∧ rl → rl+1 holds, we expect that rl+1 ≈ (r1 ◦ r2 ◦ ... ◦ rl) ◦ R . As RotatE restricts the modulus of each r’s dimension to be 1, the multiple rotations in the complex plane are equivalent to the summation of the corresponding angles (with the modulus unchanged), making it convenient to use the summation of angles in implementation. Therefore, we do not maintain modulus for r and R (since they are all 1) in our implementation, but only maintain their angular vectors, denoted by g(r) and g(R). To keep consistency with our implementation, it is beneficial to define the function g(r) as the angle vector of relation r and directly formulate the distance function in terms of angle vectors.

heading: 16 Experiment setup

heading: 16.1 Data statistics
text: The detailed statistics of six datasets for evaluation are provided in Table 9. FB15k-237 (Toutanova and Chen, 2015), WN18RR (Dettmers et al.,
2018) and YAGO3-10 are subsets of three largescale knowledge graphs, FreeBase (Bollacker et al., 2008) and WordNet (Miller, 1995) and YAGO3 (Mahdisoltani et al., 2014). UMLS, Kinship and Family (Kok and Domingos, 2007) are three benchmark datasets for statistical relational learning. For FB15k-237, WN18RR and YAGO3-10, we use the standard split. For Kinship and UMLS, we follow the data split from RNNLogic (Qu et al., 2020) (i.e., split the dataset into train/validation/test with a ratio 3 : 2 : 5) and report the results of some baselines taken from RNNLogic. For Family, we follow the split used by DRUM (Sadeghian et al., 2019). To ensure a fair comparison, we use RNNLogic to mine logical rules and rerun the reasoning predictor of RNNLogic+ with the same logical rules. Here, we consider chain rules, covering common logical rules in KG such as symmetry, composition, hierarchy rules, etc. Because inverse relations are required to apply rules, we preprocess the KGs to add inverse links. More introduction is included in Appendix 16.2.

heading: 16.2 Data process
text: Most rules mined by rule mining systems are not chain rules. They usually need to be transformed into chain rules by inversing some relations. Considering r1(x, y) ∧ r2(x, z) → r3(y, z) as an example, with replacing r1(x, y) with r−11 (y, x), the rule can be converted into chain rule r1(y, x)−1 ∧ r2(x, z) → r3(y, z). Based on the above, for data processing, we need to add a inverse version triplet (t, r−1, h) for each triplet (h, r, t), representing the inverse relationship r−1 between entity t and entity h.
Table 8: Results of reasoning on FB15k-237, WN18RR, UMLS and Kinship. H@k is in %.
FB15k-237 WN18RR UMLS Kinship MRR H@1 H@3 H@10 MRR H@1 H@3 H@10 MRR H@1 H@3 H@10 MRR H@1 H@3 H@10
TransE 0.329 23.0 36.9 52.8 0.222 1.2 39.9 53.0 0.704 55.4 82.6 92.9 0.300 14.3 35.2 63.7 RulE (emb with TransE.) 0.346 25.1 38.5 53.4 0.242 6.7 37.8 52.6 0.748 61.8 85.1 93.4 0.347 20.7 39.8 62.3 RulE (emb_o with TransE.) 0.336 24.2 37.2 52.2 0.220 3.3 37.2 50.9 0.765 66.9 82.9 92.4 0.376 22.7 42.4 70.0
RotatE 0.337 23.9 37.4 53.2 0.476 43.1 49.2 56.2 0.802 69.6 89.0 96.3 0.672 53.8 76.4 93.5 RulE (emb with RotatE.) 0.337 24.0 37.5 52.9 0.484 44.3 49.9 56.3 0.807 70.6 89.2 96.3 0.675 53.8 77.1 93.7 RulE (emb_o with RotatE.) 0.338 24.1 37.6 53.3 0.484 44.1 50.0 56.7 0.809 71.6 88.3 96.2 0.676 53.8 77.2 93.9
Table 9: Statistics of six datasets.
Dataset #Entities #Relations #Train #Validation #Test #Rules # length of rules
FB15k-237 14,541 237 272,115 17,535 20,466 131,883 ≤3 WN18RR 40,943 11 86,835 3,034 3,134 7,386 ≤5 YAGO3-10 123,182 37 1,079,040 5,000 5,000 7,351 ≤2 UMLS 135 46 1,959 1,306 3,264 18,400 ≤3 Kinship 104 25 3,206 2,137 5,343 10,000 ≤3 Family 3007 12 23,483 2,038 2,835 2,400 ≤3

heading: 16.3 Evaluation protocol
text: During evaluation, for each test triplet (h, r, t), we build two queries (h, r, ?) and (t, r−1, ?) with answer t and h. For each query, we compute the KGE score and grounding rule score (Equation 7) for each candidate entity. As KGE scores and rule scores are scattered over different value ranges, we need to normalize the score before we compute the aggregated score. We map the grounding rule score to [min,max] such that min and max are the minimum and maximum of KGE scores, i.e., map to the range of KGE scores. Then RulE weighted sums over both scores (i.e., β∗sg+(1−β)∗stnorm). Once we have the final score for all candidate answers, consider the situation that many entities might be assigned the same score. Following RNNLogic (Qu et al., 2020), we first random shuffles of those entities which receive the same score and then compute the expectation of evaluation metric over them.

heading: 16.4 Hyperparameter optimization
text: We search for parameters according to validation set performance. For above baselines, we carefully tune the parameters and achieve better results than reported in RNNLogic (Qu et al., 2020). To ensure a fair comparison, in the KGE part of RulE, we use the same parameters as those used in TransE and RotatE without further tuning them. When comparing RulE (rule.) with RNNLogic+ (w/o emb.), we use the same logical rules mined from RNNLogic (Qu et al., 2020). Note that the reported results for TransE and RotatE are indeed based on their best parameter settings, where we carefully tuned their parameters such that our reported results for TransE and RotatE are even higher than those reported in RNNLogic (Qu et al., 2020). However, in the KGE part of RulE, we use the same parameters as those used in TransE and RotatE without further tuning them. So the truth is, we did not adopt TransE/RotatE settings tuned on RulE for TransE/RotatE, but on the contrary, adopt TransE/RotatE settings tuned on themselves for RulE. This should bring disadvantages to RulE, yet we still observe improved performance.
The hyperparameters are tuned by the grid search, The range is set as follows: embedding dimension k ∈ {500, 1000, 2000}, batch size of triplets and rules b ∈ {256, 512, 1024}, the weight balancing two losses (Lt and Lr) α ∈ {0.5, 1, 2, 3, 4, 5}, triplet margin and rule margin γt, γr ∈ [0 : 30 : 1] and the weight balancing embedding-based and rule-based reasoning β ∈ [0 : 0.05 : 1]. The optimal parameter con-
figurations for different datasets for RulE (emb & rule.) can be found in Table 10, including embedding dimension k, batch size of triplets bt, batch size of rules br, fix margin of triplets γt, fix margin of triplets γr, learning rate lr, self-adversarial sampling temperature adv, regularization coefficient λ, the weight balancing the importance of rules in joint loss function (Equation 5) α, batch size in soft rule reasoning gb and the weight of inference process (Equation 8) β. Note that we use RotatE as the KGE model.

heading: 17 Experiment details

heading: 17.1 Embedding logical rules helps KGE
text: This section discusses the effectiveness of rule embedding on KGE. As shown in Table 12, the two variants using TransE and ComplEx as KGE models are denoted by RulE (emb with TransE.) and RulE (emb with ComplEx.), respectively. They both obtain superior performance to the corresponding KGE models.
We also further compare with other rule-enhance KGE models. In the experiment setup, RulE (emb with TransE.) uses the same logical rules as KALE (Guo et al., 2016); RulE (emb with ComplEx.) uses the same logical rules as ComplExNNE-AER (Ding et al., 2018). The comparison shows that RulE (emb with TransE.) yields more accurate results than KALE. For RulE (emb with ComplEx.), although it does not outperform ComplEx-NNE+AER (probably because it additional injects the regularization terms on entities
but RulE does not), compared to RUGE, RulE (emb with ComplEx.) also obtains 2% improvement in MRR on FB15k as well as comparable results on WN18.
For a fair comparison, RulE (emb. TransE) applies the same logical rules as KALE; RulE (emb. ComplEx) uses the same logical rules as ComplExNNE-AER.

heading: 17.2 Sensitivity analysis of beta
text: To analyze how the hyperparameter β balances the weights of embedding-based and rule-based reasoning (defined in Equation (8)), we conduct experiments for RulE under varying β. Figure 3a and 3b show the results on Fb15k-237 and WN18RR.
With the increase of β, the performance of RulE first improves and then drops on both datasets. This is because the information captured by logical rules and knowledge graph embedding is complementary, thus combining embedding-based and rulebased methods can enhance knowledge graph reasoning. Moreover, the trend of β for the performance on the two datasets is different (FB15k237 tends to drop faster than WN18RR). We think that in WN18RR, information captured by the rulebased method may be more than embedding-based, leading that the rule-based method is more predominant in WN18RR (β = 0.6).

heading: 17.3 More results of ablation study
text: More results of ablation study are presented in Table 13 and 14.

heading: 17.4 Comparison NBFNet with RulE
text: We follow the results of FB15k-237 and WN18RR reported in NBFNet and conduct additional experiments on UMLS, Kinship and family datasets. The results (MRR) are shown in Table 11:
NFBNet has better results than RulE on FB15k237, WN18RR and UMLS. However, RulE achieves comparable or higher performance than NBFNet on Kinship and family, especially on Kinship, where RulE obtains about 10% absolute MRR gain. This might be explained by that Kinship and family contain more rule-inferrable facts while WN18RR and FB15k-237 consist of more general facts (a more detailed discussion is given in Appendix 12). This indicates that our method RulE is more favorable for knowledge graphs where rules play an important role, which is expected as it leverages rules explicitly. Another advantage of RulE is the ability to use prior/domain knowledge, while GNN-based methods cannot leverage prior/domain knowledge presented as logical rules. Moreover, RulE is more interpretable on rule-level than GNN methods, which is still valuable in certain domains. Although NBFNet is also interpretable, RulE’s interpretability is on rule level while that of NBFNet is on path level. For example, when the KG system desires high interpretability (such as those in medical applications), each inferred knowledge must be accompanied with which exact rules are responsible for the inference, otherwise the doc-
tors are hard to trust it. In contrast, GNN methods (such as NBFNet) are only interpretable on path-level instead of rule-level. Take "Alice is Bob’s mother" as an example, GNN methods might tell us the path "Alice is David’s mother" and "David is Bob’s brother" is activated during the inference, while our RulE can not only tell us that this path is activated, but also the rule ∀x, y, z : mother(x, y)∧ brother(y, z) → mother(x, z) is responsible behind the prediction.
In summary, although NBFNet demonstrates state-of-the-art performance on many KGs, we still believe a hybrid method that can explicitly model and leverage logical rules is desired and worth studying.

heading: 18 Theoretical analysis and case studies
text: As mentioned in the main body, the rule embeddings are not only used to regularize the embedding learning. On the other hand, with the rule embeddings, RulE can compute the confidence score for each logic rule, which enhances the original hard rule-based reasoning process through soft rule confidence. Additionally, combining the jointly trained KGE and the confidence-enhanced rule-based rea-
soning, we arrive at a final neural-symbolic model achieving superior performance on many datasets.
Consider the rule r1(x, y)∧ r2(y, z) → r3(x, z) as an example, where x, y, z represent specific entities. Given three facts, we obtain y = x ◦ r1; z = y ◦ r2; z = x ◦ r3. Combining these equations, we deduce r1 ◦ r2 = r3. However, those mined rules may not be confidently correct. Thus, we assign a residual embedding as a rule embedding to each logical rule, i.e., r1 ◦ r2 ◦ R = r3. By adding additional constraints that relations should satisfy, rule loss provides a regularization to the triplet (KGE) loss, improving the generalization of KGE. Meanwhile, with the relation and rule embeddings, RulE can further give a confidence score to each rule, which reflects how consistent a rule is with the existing facts and enables performing the rule inference process in a soft way. This provides an explanation of why RulE is better than naive combination methods.
We further provide some case studies illustrating the confidence scores of logical rules learned by RulE on the family dataset.
(1) brother(x, y) ∧ brother(z, y) ∧ mother(t, z) → son(x, t) 0.932 (2) brother(y, x) ∧ brother(y, z) ∧ father(t, z) → son(x, t) 0.798 (3) mother(x, y) ∧ brother(z, y) → mother(x, z) 0.834 (4) wife(x, y)∧son(z, y) → mother(x, z) 0.589
Ideally, rules with higher success probability should yield higher confidence scores. For instance, rule (1) has a higher confidence score than rule (2) because the x in rule (2) could also be the daughter of t, while the x in rule (1) must be male because x is y’s brother. Our RulE successfully learns them out. Another example is rule (3) and rule (4). They both infer x is z’s mother, but rule (4) is less confident because x can also be z’s stepmother.

heading: Future Work
text: In the future, we plan to explore more efficient and effective rule reasoning algorithms and consider more complex rules. Besides, currently, we focus on chain rules provided as prior knowledge, i. e. , Horn clause, a disjunctive clause (a disjunction of literals) with at most one positive. We acknowledge the importance of addressing negation operators, for example, ∀x, y, z : ¬r1(x, y) ∧ r2(y, z) → r3(x, z). In future explorations, we may consider leveraging betaE (Ren and Leskovec, 2020), a probabilistic embedding framework to handle negation operator in complex multi-hop logical reasoning