summaries: This paper provides a very simple approach to the problem of knowledge base completion. The idea is this - given a query (subject, relation), you find other entities similar to subject, see which other paths they can take to their corresponding object if they express the relation, and check if the subject express those paths. Object reached this way are candidate answers. The one with most paths reached is marked correct. This paper proposes a non-parametric reasoning method for reasoning on incomplete knowledge bases. Specifically, for the task of finding a target entity given a source entity and a relation, since this specific relation might be missing for the source entity, multi-hop reasoning is required to get the answer. To get the reasoning paths, this paper proposes to first retrieve similar entities from the knowledge base that have the same outgoing relation, and then gather all possible reasoning paths from these retrieved entities. Finally, these reasoning paths extracted from other entities can be applied to the source entity in the query and get the answer. 
abstractText: We present a surprisingly simple yet accurate approach to reasoning in knowledge graphs (KGs) that requires no training, and is reminiscent of case-based reasoning in classical artificial intelligence (AI). Consider the task of finding a target entity given a source entity and a binary relation. Our non-parametric approach derives crisp logical rules for each query by finding multiple graph path patterns that connect similar source entities through the given relation. Using our method, we obtain new state-of-the-art accuracy, outperforming all previous models, on NELL-995 and FB-122. We also demonstrate that our model is robust in low data settings, outperforming recently proposed meta-learning approaches1.
authors.name: Rajarshi Das
authors.name: Ameya Godbole
authors.name: Shehzaad Dhuliawala
authors.name: Manzil Zaheer
authors.name: Andrew McCallum
authors.name: Melinda Gates
authors.name: Mukesh Ambani
references.authors: Agnar Aamodt Enric Plaza
references.title: Case-based reasoning: Foundational issues, methodological variations, and system approaches
references.venue: AI communications,
references.authors: Edoardo M Airoldi David M Blei Stephen E Fienberg Eric P Xing
references.title: Mixed membership stochastic blockmodels
references.authors: Kurt Bollacker Colin Evans Praveen Paritosh Tim Sturge Jamie Taylor
references.title: Freebase: A collaboratively created graph database for structuring human knowledge
references.venue: In ICDM,
references.authors: Antoine Bordes Nicolas Usunier Alberto Garcia-Duran Jason Weston Oksana Yakhnenko
references.title: Translating embeddings for modeling multi-relational data
references.venue: In NeurIPS,
references.authors: Antal van den Bosch Bertjan Busser Sander Canisius Walter Daelemans
references.title: An efficient memorybased morphosyntactic tagger and parser for dutch
references.venue: LOT Occasional Series,
references.authors: Matthias Broecheler Lilyana Mihalkova Lise Getoor
references.title: Probabilistic similarity logic
references.venue: In UAI,
references.authors: Ziqiang Cao Wenjie Li Sujian Li Furu Wei
references.title: Retrieve, rerank and rewrite: Soft template based neural summarization
references.venue: In ACL,
references.authors: Andrew Carlson Justin Betteridge Bryan Kisiel Burr Settles Estevam R. Hruschka Jr. Tom M. Mitchell
references.title: Toward an Architecture for Never-ending Language Learning
references.venue: In AAAI,
references.authors: Walter Daelemans Jakub Zavrel Peter Berck Steven Gillis
references.title: Mbt: A memory-based part of speech tagger-generator
references.venue: In WVLC,
references.authors: Rajarshi Das Arvind Neelakantan David Belanger Andrew McCallum
references.title: Chains of reasoning over entities, relations, and text using recurrent neural networks
references.authors: Rajarshi Das Shehzaad Dhuliawala Manzil Zaheer Luke Vilnis Ishan Durugkar Akshay Krishnamurthy Alex Smola Andrew McCallum
references.title: Go for a walk and arrive at the answer: Reasoning over paths in knowledge bases using reinforcement learning
references.venue: In ICLR,
references.authors: Tim Dettmers Pasquale Minervini Pontus Stenetorp Sebastian Riedel
references.title: Convolutional 2d knowledge graph embeddings
references.venue: In AAAI,
references.authors: Chelsea Finn Pieter Abbeel Sergey Levine
references.title: Model-agnostic meta-learning for fast adaptation of deep networks
references.venue: In ICML,
references.authors: Lise Getoor Ben Taskar
references.title: Introduction to statistical relational learning
references.venue: MIT press,
references.authors: Shu Guo Quan Wang Lihong Wang Bin Wang Li Guo
references.title: Jointly embedding knowledge graphs and logical rules
references.venue: In EMNLP,
references.authors: Kelvin Guu Tatsunori B. Hashimoto Yonatan Oren Percy Liang
references.title: Generating sentences by editing prototypes
references.venue: In TACL,
references.authors: Tatsunori B Hashimoto Kelvin Guu Yonatan Oren Percy S Liang
references.title: A retrieve-and-edit framework for predicting structured outputs
references.venue: In NeurIPS,
references.authors: Charles Kemp Joshua B Tenenbaum Thomas L Griffiths Takeshi Yamada Naonori Ueda
references.title: Learning systems of concepts with an infinite relational model
references.venue: In AAAI,
references.authors: Urvashi Khandelwal Omer Levy Dan Jurafsky Luke Zettlemoyer Mike Lewis
references.title: Generalization through memorization: Nearest neighbor language models
references.venue: In ICLR,
references.authors: Stanley Kok Pedro Domingos
references.title: Statistical predicate invention
references.venue: In ICML,
references.authors: Janet L Kolodner
references.title: Maintaining organization in a dynamic long-term memory
references.venue: Cognitive science,
references.authors: Juliana S Lancaster Janet L Kolodner
references.title: Problem solving in a natural task as a function of experience
references.venue: Technical report, Georgia Tech CS Department,
references.authors: David B Leake
references.title: Cbr in context: The present and future. Case-based reasoning: Experiences, lessons, and future
references.authors: Xi Victoria Lin Richard Socher Caiming Xiong
references.title: Multi-hop knowledge graph reasoning with reward shaping
references.venue: In EMNLP,
references.authors: Xin Lv Yuxian Gu Xu Han Lei Hou Juanzi Li Zhiyuan Liu
references.title: Adapting meta knowledge graph information for multi-hop reasoning over few-shot relations
references.authors: Kurt Miller Michael I Jordan Thomas L Griffiths
references.title: Nonparametric latent feature models for link prediction
references.venue: In Neurips,
references.authors: Bonan Min Ralph Grishman Li Wan Chang Wang David Gondek
references.title: Distant supervision for relation extraction with an incomplete knowledge base
references.venue: In HLT-NAACL,
references.authors: Pasquale Minervini Thomas Demeester Tim Rocktäschel Sebastian Riedel
references.title: Adversarial sets for regularising neural link predictors
references.venue: arXiv preprint arXiv:1707.07596,
references.authors: Pasquale Minervini Matko Bošnjak Tim Rocktäschel Sebastian Riedel Edward Grefenstette
references.title: Differentiable reasoning on large knowledge bases and natural language
references.venue: In AAAI,
references.authors: Stephen Muggleton
references.title: Inverse entailment and progol
references.venue: New generation computing,
references.authors: Stephen Muggleton Ramon Otero Alireza Tamaddoni-Nezhad
references.title: Inductive logic programming
references.authors: Stephen Mussmann Stefano Ermon
references.title: Learning and inference via maximum inner product search
references.venue: In ICML,
references.authors: Gaurav Pandey Danish Contractor Vineet Kumar Sachindra Joshi
references.title: Exemplar encoder-decoder for neural conversation generation
references.venue: In ACL,
references.authors: Hao Peng Ankur Parikh Manaal Faruqui Bhuwan Dhingra Dipanjan Das
references.title: Text generation with exemplar-based adaptive decoding
references.venue: In NAACL,
references.authors: J Ross Quinlan
references.title: Learning logical definitions from relations
references.venue: Machine learning,
references.authors: Edwina L Rissland
references.title: Examples in legal reasoning: Legal hypotheticals
references.venue: In IJCAI,
references.authors: Tim Rocktäschel Sebastian Riedel
references.title: End-to-end differentiable proving
references.venue: In NeurIPS,
references.authors: Brian H Ross
references.title: Remindings and their effects in learning a cognitive skill
references.venue: Cognitive psychology,
references.authors: Roger C Schank
references.title: Dynamic memory: A theory of reminding and learning in computers and people
references.venue: cambridge university press,
references.authors: Henk Schmidt Geoffrey Norman Henny Boshuizen
references.title: A cognitive perspective on medical expertise: theory and implications
references.venue: Academic medicine,
references.authors: Stefan Schoenmackers Oren Etzioni Daniel S Weld Jesse Davis
references.title: Learning first-order horn clauses from web text
references.venue: In EMNLP,
references.authors: Fabian Suchanek Gjergji Kasneci Gerhard Weikum
references.title: Yago: A core of semantic knowledge
references.venue: In WWW,
references.authors: Zhiqing Sun Zhi-Hong Deng Jian-Yun Nie Jian Tang
references.title: Rotate: Knowledge graph embedding by relational rotation in complex space
references.venue: In ICLR,
references.authors: Ilya Sutskever Joshua B Tenenbaum Russ R Salakhutdinov
references.title: Modelling relational data using bayesian clustered tensor factorization
references.venue: In Neurips,
references.authors: Théo Trouillon Johannes Welbl Sebastian Riedel Éric Gaussier Guillaume Bouchard
references.title: Complex embeddings for simple link prediction
references.venue: In ICML,
references.authors: Patrick Verga David Belanger Emma Strubell Benjamin Roth Andrew McCallum
references.title: Multilingual relation extraction using compositional universal schema
references.venue: In NAACL,
references.authors: William Yang Wang Kathryn Mazaitis William W Cohen
references.title: Programming with personalized pagerank: a locally groundable first-order probabilistic logic
references.venue: In CIKM,
references.authors: Jason Weston Emily Dinan Alexander Miller
references.title: Retrieve and refine: Improved sequence generation models for dialogue
references.venue: In ConvAI Workshop EMNLP,
references.authors: Sam Wiseman Karl Stratos
references.title: Label-agnostic sequence labeling by copying nearest neighbors
references.venue: In ACL,
references.authors: Wenhan Xiong Thien Hoang William Yang Wang
references.title: Deeppath: A reinforcement learning method for knowledge graph reasoning
references.venue: In EMNLP,
references.authors: Zhao Xu Volker Tresp Kai Yu Hans-Peter Kriegel
references.title: Infinite hidden relational models
references.venue: In UAI,
references.authors: Bishan Yang Wen-tau Yih Xiaodong He Jianfeng Gao Li Deng
references.title: Embedding entities and relations for learning and inference in knowledge bases
references.venue: In ICLR,
references.authors: Fan Yang Zhilin Yang William W Cohen
references.title: Differentiable learning of logical rules for knowledge base reasoning
references.venue: In NeurIPS,
references.authors: Daojian Zeng Kang Liu Siwei Lai Guangyou Zhou Jun Zhao
references.title: Relation classification via convolutional deep neural network
references.venue: In COLING,
references.authors: Jun Zhu Jiaming Song Bei Chen
references.title: Max-margin nonparametric latent feature models for link prediction
references.venue: In ICML,
sections.text: that requires no training, and is reminiscent of case-based reasoning in classical artificial intelligence (AI). Consider the task of finding a target entity given a source entity and a binary relation. Our non-parametric approach derives crisp logical rules for each query by finding multiple graph path patterns that connect similar source entities through the given relation. Using our method, we obtain new state-of-the-art accuracy, outperforming all previous models, on NELL-995 and FB-122. We also demonstrate that our model is robust in low data settings, outperforming recently proposed meta-learning approaches1.
sections.heading: 1. Introduction
sections.text: Given a new problem, humans possess the innate ability to ‘retrieve’ and ‘adapt’ solutions to similar problems from the past. For example, an automobile mechanic might fix a car engine by recalling previous experiences where cars exhibited similar symptoms of damage. This model of reasoning has been widely studied and verified in cognitive psychology for various applications such as mathematical problem solving [Ross, 1984], diagnosis by physicians [Schmidt et al., 1990], automobile mechanics [Lancaster and Kolodner, 1987] etc. A lot of classical work in artificial intelligence (AI), particularly in the field of case-based reasoning (CBR) has focused on incorporating such kind of reasoning in AI systems [Schank, 1982, Kolodner, 1983, Rissland, 1983, Aamodt and Plaza, 1994, Leake, 1996, inter-alia].
  At a high level, a case-based reasoning system is comprised of four steps [Aamodt and Plaza, 1994] — (a) ‘retrieve’, in which given a new problem, ‘cases’ that are similar to the given problem are retrieved. A ‘case’ is usually associated with a problem description (used for matching it to a new problem) and its corresponding solution. After the initial retrieval step, the previous solutions are (b) ‘reused’ for the problem in hand. Often times, however, the retrieved solutions cannot be directly used, and hence the solutions needs to be (c) ‘revised’. Lastly, if the revised solution is useful for solving the given problem, they are (d) ‘retained’ in a memory so that they can be used in the future.
  Knowledge graphs (KGs) [Suchanek et al., 2007, Bollacker et al., 2008, Carlson et al., 2010] contain rich facts about entities and capture relations with diverse semantics between those entities. However, KGs can be highly incomplete [Min et al., 2013], missing important edges (relations)
  1Code available at https://github.com/rajarshd/CBR-AKBC
  between entities. For example, consider the small fragment of the KG around the entity MELINDA GATES in figure 1. Even though a lot of facts about MELINDA is captured, it is missing the edge corresponding to works in city. A recent series of work address this problem by modeling multi-hop paths between entities in the KG, thereby able to reason along the path MELINDA→ ceo→ GATES FOUNDATION→ headquartered→ SEATTLE. However, the number of paths starting from an entity increases exponentially w.r.t the path length and therefore past work used parametric models to do approximate search using reinforcement learning (RL) [Xiong et al., 2017, Das et al., 2018, Lin et al., 2018]. Using RL-based methods have their own shortcomings, like hard to train and high computational requirements. Moreover, these models try to encode all the rules for reasoning into the parameters of the model which makes learning even harder.
  In this paper, we propose a simple non-parametric approach for reasoning in KGs (Figure 1). Given an entity and a query relation (eq,rq), we first retrieve k entities in the KG that are similar to eq and for which we observe the query relation edge rq. The retrieved entities could be present anywhere in the KG and are not just restricted in the immediate neighborhood of eq. Similarity between entities is measured based on the observed relations that the entities participate in. This ensures that the retrieved entities have similar observed properties as eq (e.g., if eq is a CEO, then the retrieved entities are also CEO’s or business person). Next, for each of the retrieved entities, our
  method finds a set of reasoning paths that connect the retrieved entities to the entities that they are connected with via the query relation rq. In this way, our method removes the burden of storing the reasoning rules in the parameters of the model and rather extract it from entities similar to the query entity. Next, our method checks if similar reasoning paths exists starting from the query entity eq. If similar paths exists, then the answer to the original query is found by starting from eq and traversing the KG by following the reasoning path. In practice, we find multiple reasoning paths which end at different entities and we rank the entities based on the number of reasoning paths that lead to them, with the intuition that an entity supported by multiple reasoning paths is likely to be a better answer to the given query.
  Apart from being non-parametric, our proposed method has many other desirable properties. Our method is generic and even though we find very simple and symbolic methods to work very well for many KG datasets, every component of our model can be augmented by plugging in sophisticated neural models. For example, currently we use simple symbolic string matching to find if a relation path exists for the query entity. However, this component can be replaced with a neural model that matches paths which are semantically similar to each other [Das et al., 2017]. Similarly, we currently use a very simple inner product to compute similarities between entity embeddings. But that can be replaced with more sophisticated maximum inner product search [Mussmann and Ermon, 2016].
  The contributions of the paper are as follows — (a) We present a non-parametric approach for reasoning over KGs, that uses multiple paths of evidence to derive an answer. These paths are gathered from entities in different parts of the KG that are similar to the query entity. (b) Our approach requires no training and can be readily applied to any new KGs. (c) Our method achieves state-of-the-art performance on NELL-995 and the harder subset of FB-122 outperforming sophisticated neural approaches and other tensor factorization methods. We also perform competitively on the WN18RR dataset. (d) Lastly, we provide detailed analysis about why our method outperforms parametric rule learning approaches like MINERVA [Das et al., 2018].
sections.heading: 2. Method
sections.heading: 2.1 Notation and Task Description
sections.text: Let E denote the set of entities and R denote the set of binary relations. A knowledge base (KB) is a collection of facts stored as triplets (e1, r,e2) where e1,e2 ∈ E and r ∈ R . From the KB, a knowledge graph G can be constructed where the entities e1,e2 are represented as the nodes and relation r as labeled edge between them. Formally, a KG is a directed labeled multigraph G = (V,E,R ), where V and E denote the vertices and edges of the graph respectively. Note that V = E and E ⊆V ×R ×V . Also, following previous approaches [Bordes et al., 2013, Xiong et al., 2017], we add the inverse relation of every edge, i.e. for an edge (e1, r,e2) ∈ E, we add the edge (e2, r−1,e1) to the graph. (If the set of binary relations R does not contain the inverse relation r−1, it is added to R as well). A path in a KG between two entities es, et is defined as a sequence of alternating entity and relations that connect es and et. A length of a path is the number of relation (edges) in the path. Formally, let a path p = (e1, r1,e2, . . . , rn,en+1) with st(p) = e1, en(p) = en+1 and len(p) = n. Let P denote the set of all paths and Pn denote the set of all paths with length up to n, i.e. Pn ⊆ P = {p ∈ P | len(p)≤n}.
  We consider the task of query answering on KGs. Query answering seeks to answer questions of the form ( e1q,rq,? ) (e.g. Melinda, works in city, ?), where the answer is an entity in the KG.
sections.heading: 2.2 Case-based Reasoning on Knowledge Graphs
sections.text: This section describes how we apply case-based reasoning (CBR) in a KG. In CBR, given a new problem, similar cases are retrieved from memory [Aamodt and Plaza, 1994]. In our setting, a problem is a query ( e1q,rq,? ) for a missing edge in the KG. A case is defined as an observed fact (e1, r,e2) in a KG along with a set of paths up to length n that connect e1 and e2. Formally, a case c = (e1, r,e2,P) ⊆ V ×R ×V × Pn is a 4 tuple where (e1, r,e2) ∈ G and P ⊆ P(e1,e2) = {p ∈ Pn | st(p) = e1,en(p) = e2}. In practice, it is intractable to store all paths between e1 and e2 (P(e1,e2)) and therefore we only store a random sample. Note, that we have a case for every observed triple in the KG and we denote the set of all such cases as C . We also assume access to a pre-computed similarity matrix S ∈ RV×V which stores the similarity between any two given entities in a KG. Intuitively, two entities which exhibit the same relations should have a high similarity (e.g., an athlete should have a high similarity score with another athlete). Lastly, we define a memory M that serves as the store for all the cases present in a KG and also the similarity matrix, i.e. M = (C ,S).
  As explained earlier, CBR broadly comprises of four steps, which we explain briefly for our setup on a KG.
  • Retrieve: In this step, given a query ( e1q,rq,? ) , our method first retrieves a set of k similar
  entities w.r.t e1q using the pre-computed similarity matrix S, such that for each entity e′ in the retrieved set, we observe at least one fact of the form (e′,rq,e′′) in G . In other words, each retrieved entity should have at least one outgoing edge in G with the edge label as rq. Next, we gather all such facts (e′,rq,e′′) in G for each of the retrieved e′. Note, that there could be more than one fact for a given entity and query relation (e.g. USA, has city, New York City and USA, has city, Boston, for the entity ‘USA’ and query relation ‘has city’). Finally for all the gathered facts from the k-nearest neighbors, we retrieve all the cases from the memory store M . As noted before, in our formulation, a case is a fact augmented with a sample of KG paths that connect the entities of the fact. As we will see later (§ 3), the KG paths often represent reasoning rules that determine why the fact (e′,rq,e′′) hold true. The goal of CBR is to reuse these rules for the new query.
  • Reuse: The reasoning paths that were gathered in the retrieve step are re-used for the query entity. As described before, a path in a KG is an alternating sequence of entities and relations. The path gathered from the nearest neighbors have entities which are in the immediate neighborhood of the nearest neighbor entities. To reuse these paths, we first replace the entities from the paths with un-instantiated variables and only extract the sequence of relations in them [Schoenmackers et al., 2010]. For example, if we have a retrieved case (a fact with a set of paths) such as ((USA,has city,Boston) ,{(USA,has state,Massachusetts,city in state,Boston)}), we remove the entities from the path and extract rules such as: has state(x,y),city in state(y,z) =⇒ has city(x,z). We gather all such paths from all the cases retrieved for a query. Since the same path type can occur in different cases, we maintain a list of paths sorted w.r.t the counts (in descending order).
  • Revise: After the paths have been gathered, we look if those paths exists for the query entity e1q. In our approach we find that simple symbolic exact-string matching for the relations works quite well. However, neural relation extraction systems [Zeng et al., 2014, Verga et al., 2016] can be incorporated to map a relation to other similar relations to improve recall. We keep this direction as a part of our future work. Instead if we find an exact match for the sequence of
  relations, we revise the rules by instantiating the variables with the entities which lie along the path in the neighborhood of e1q.
  • Retain: Finally, a case including the query fact and the paths that lead to the correct answer for the query can be added to the memory store M .
  Computing the similarity matrix: CBR approaches need access to a similarity matrix S to retrieve similar cases to the query entity. Intuitively, the similarity between entities that have similar relations should be higher (e.g. similarity between two athletes should be higher than the similarity between an athlete and a country). To model this, we parameterize each entity with an m-hot vector e ∈ RR . That is, each entity is a m-hot vector with the dimension equal to the size of the number of binary relations in the KB. An entry in the vector is set to 1, if an entity has at least one edge with that relation type, otherwise is set to 0. Even though, this is a really simple way of parameterizing an entity, we found this to work extremely well in practice. However, as previously mentioned we propose a generic method and one could replace the entity embeddings with any pre-trained vectors from any model. As an example, we present experiments by replacing our m-hot representation with pre-trained embeddings obtained from the state-of-the-art RotatE model [Sun et al., 2019]. Lastly, the similarity between two entities is calculated by a simple inner product between the normalized embeddings.
  Caching ‘cases’ in the memory store: CBR also needs access to store containing cases. As mentioned before, in our setup a ‘case’ is a KG triple, along with a sample of paths that connect the two entities of the triple. Since the number of paths between entities grow exponentially w.r.t path length, it is intractable to store all paths between an entity pair. We instead consider a small subgraph around each entity in the KG spanned by 1000 randomly sampled paths of length up to 3. Next, for each triple (e1, r,e2) in the KG, we exhaustively search the subgraph around e1, collected in the previous step to find paths up to length 3 which lead to e2. These paths along with the fact form a case. This process is repeated for all the triples and each case is added to the case store C .
  Both the similarity matrix S and the case store C are pre-computed offline and is stored in the memory M . Once that is done, our method requires no further training and can be readily used for any query in the KG.
sections.heading: 3. Experiments
sections.heading: 3.1 Data and Evaluation Protocols
sections.text: We test our CBR based approach on three datasets that are often used in the community for benchmarking models — FB122 [Guo et al., 2016], NELL-995 [Xiong et al., 2017], and WN18RR [Dettmers et al., 2018]. FB122 comes with a set of KB rules that can be used to infer missing triples in the dataset. We do not use the rules in the dataset and even show that our model is able to recover the rules from similar entities to the query. WN18RR was created by Dettmers et al. [2018] from the original WN18 dataset by removing various sources of test leakage, making the datasets more realistic and challenging. We compare our CBR based approach with various state-of-the-art models using standard ranking metrics such as HITS@N and mean reciprocal rank (MRR). For fair comparison to baselines, after a fact is predicted we do not add the new case (inferred fact and paths) in the memory (retain step in § 2.2), as that would mean we would use more information than our baselines to predict the followup queries. Hyper-parameters: The various hyper-parameters for our method are the number of nearest neighbor retrieved for a query entity (k), the number of paths that are gathered from the retrieved entity (l) and
  the maximum path length considered (n). For all our experiments, we set n = 3. We tune k and l for each dataset w.r.t the given validation set.
sections.heading: 3.2 Results on Query Answering
sections.text: We first present results on query answering (link prediction) on the three datasets and compare to various state-of-the-art baseline models. It is quite common in literature [Bordes et al., 2013, Yang et al., 2015, Dettmers et al., 2018, Sun et al., 2019] to report aggregate results on both tail prediction (e1, r,?) and head prediction (?, r−1,e2). To be exactly comparable to baselines, we report results on tail prediction for NELL-995 and for other datasets, we report average of head and tail predictions.
  NELL-995: Table 2 reports the query answering performance on the NELL-995 dataset. We compare to several strong baselines. In particular, we compare to various embedding based models such as DistMult [Yang et al., 2015], ComplEx [Trouillon et al., 2016] and ConvE [Dettmers et al., 2018]. We also wanted to compare to various neural models for learning logical rules such as neuraltheorem-provers [Rocktäschel and Riedel, 2017], NeuralLP [Yang et al., 2017] and MINERVA [Das et al., 2018]. However, only MINERVA scaled to the size of NELL-995 dataset and others did not. As it is clear from table 2, CBR outperforms all the baselines by a large margin with gains of over 4% on the strict HITS@1 metric. We further discuss and analyze the results in sec (3.4).
  FB122: Next we consider the FB122 dataset by Guo et al. [2016]. Comparing results on FB122 is attractive for a couple of reasons — (a) Firstly, this dataset comes with a set of logical rules hand coded by the authors that can be used for logical inference. It would be interesting to see if our CBR approach is able to automatically uncover the rules from the data. (b) Secondly, there is a recent work on a neural model for logical inference (GNTPs) [Minervini et al., 2020] that scales neural-theorem-provers [Rocktäschel and Riedel, 2017] to this dataset and hence we can directly compare with them. Table 1 reports the results. We compare with several baselines. CBR significantly outperforms GNTPs and even outperforms most models which have access to the hand-coded rules
  during training. We also find that CBR is able to uncover correct rules for 27 out of 31 (87%) query relations.
  WN18RR: Finally, we report results of WN18RR in table 3. CBR performs competitively with GNTPs and most embedding based methods except RotatE [Sun et al., 2019]. Upon further analysis, we find that for 210 triples in the test set, the entity was not present in the graph and hence no answers were returned for those query entities.
sections.heading: 3.3 Experiments with limited data
sections.text: As mentioned before, our CBR based approach needs no training and gathers reasoning patterns from few similar entities. Therefore, it should ideally perform well for query relations for which we do not have a lot of data. Recently, Lv et al. [2019] studied this problem and propose a meta-learning [Finn et al., 2017] based solution (Meta-KGR) for few-shot relations. We compare with their model to see if CBR based approach will be able to generalize for such few-shot relations. Table 4 reports the results and quite encouragingly we find that we outperform all sophisticated meta-learning approaches by a large margin.
sections.heading: 3.4 Analysis: CBR is capable of doing contextualized reasoning
sections.text: In this section, we analyze the performance of our non-parametric approach and try to understand why it works better than existing parametric rule learning models like MINERVA. Lets consider the relation ‘agent belongs to organization’ in the NELL-995 dataset. Here the query entity can belong to a wide varity of types. For example, these are all triples for the query relation in NELL995— (George Bush, agent belongs to organization, House of Republicans), (Vancouver Canucks, agent belongs to organization, NHL), (Chevrolet, agent belongs to organization, General Motors). As can be seen, the query entity for a relation can belong to many different types and hence the logical rules that needs to be learned would be different. An advantage of CBR based approach is
  that, for each query entity it retrieves similar contexts and then gather rules from them. One the other hand, models like MINERVA has to encode all rules into its parameters which makes learning harder. In other words, CBR is capable of doing better fine-grained contextual reasoning for a given query. To further confirm this hypothesis, we count the number of paths that CBR finds that lead to the correct answer and compare it with MINERVA. CBR learns a total of 306.4 unique paths that lead to answer compared to 176.83 of MINERVA. Figure 2 plots the counts for each query relation which further shows that CBR finds more varied paths than MINERVA.
sections.heading: 3.5 Results with RotatE embeddings
sections.text: As mentioned before, the CBR approach is generic and one can incorporate sophisticated models into each of the step. We run experiments where the m-hot representation of entities is replaced with pretrained embeddings obtained from a trained RotatE [Sun et al., 2019] model for building the similarity matrix. On the WN18RR dataset, we get a MRR of 0.425 as compared to 0.423 with our original approach.
sections.heading: 3.6 Limitations of our Current Work
sections.text: A key limitation of our current work is the symbolic matching of reasoning paths. Different symbolic sequence of relation can have similar semantics (e.g. works in org, org located in and studies in,
  college located in are similar paths for inferring lives in relation), but in our current work, these paths would be treated differently. This limitation can be alleviated by learning a similarity kernel for paths using distributed representation of relations.
  On error analysis, we found that a major source of error occurs in our ranking of entities. Currently, ranking of predicted entities is done via number of paths that lead to it. Even though, this simple technique works well, we noticed that, if we had access to an oracle ranker, our performance would improve significantly. For example, in FB122 dataset, CBR retrieves a total of 241 entities out of more than 9.5K entities. An oracle ranking of these entities would increase the accuracy (HITS@1) from 0.28 to 0.74. This indicates that a substantial gain could be obtained if we train a model to rank the retrieved entities, a direction we leave as future work.
  3.7 Inference time Dataset MINERVA CBR
  WN18RR 63s 69s
  NELL-995 35s 68s
  Table 5: Inference time (in seconds) on two datasets.
  Table 5 report the inference times of our model on the entire evaluation set of WN18RR (6268 queries) and NELL-995 (2825 queries) and compares it with MINERVA. Since our approach first retrieves similar entities and then gathers reasoning paths from them, it is slower than MINERVA. However, given the empirical improvements in accuracy, we believe this is not a significant tradeoff.
sections.heading: 4. Related Work
sections.text: Bayesian non-parametric approaches for link prediction: There is a rich body of work which employs bayesian non-parametric approaches to automatically learn the latent dimension of entities. The infinite relational model (IRM) [Kemp et al., 2006] and its extensions [Xu et al., 2006] learns a possibly unbounded number of latent clusters from the graph and an entity is represented by its cluster membership. Later Airoldi et al. [2008] proposed the mixed membership stochastic block models that allows entities to have mixed membership over the clusters. Instead of cluster membership, Miller et al. [2009] propose a model that learn features of entities and the non-parametric approach allows learning unbounded number of dimensions. Sutskever et al. [2009] combine bayesian nonparametric and tensor factorization approaches and Zhu et al. [2012] allows non-parametric learning in a max-margin framework. Our method does not learn latent dimension and features of entities using a bayesian approach. Instead we propose a framework for doing non-parametric reasoning by learning patterns from k-nearest neighbors of the query entity. Also, the bayesian models have only been applied to very small knowledge graphs (containing few hundred entities and few relations). Rule induction in knowledge graphs is a very rich field with lots of seminal works. Inductive Logic Programming (ILP) [Muggleton et al., 1992] learns general purpose predicate rules from examples and background knowledge. Early work in ILP such as FOIL [Quinlan, 1990], PROGOL [Muggleton, 1995] are either rule-based or require negative examples which is often hard to find in KBs (by design, KBs store true facts). Statistical relational learning methods [Getoor and Taskar, 2007, Kok and Domingos, 2007, Schoenmackers et al., 2010] along with probabilistic logic [Richardson and Domingos, 2006, Broecheler et al., 2010, Wang et al., 2013] combine machine learning and logic but these approaches operate on symbols rather than vectors and hence do not enjoy the generalization properties of embedding based approaches. Moreover, unlike our approach, these methods do not learn rules from entities similar to the query entity. Recent work in rule induction, as discussed before
  [Yang et al., 2017, Rocktäschel and Riedel, 2017, Das et al., 2018, Minervini et al., 2020] try to encode rules in the parameters of the model. In contrast, we propose a non-parametric approach for doing so. Moreover our model outperforms them on several datasets. K-NN based approach in other NLP applications: Nearest neighbor models have been applied to a number of NLP applications in the past such as parts-of-speech tagging [Daelemans et al., 1996] and morphological analysis [Bosch et al., 2007]. There has also been several recent work which leverages k-nearest neighbors for various NLP tasks, which is a step towards case based reasoning. Retrieve-and-edit based approaches are gaining popularity for various structured prediction tasks [Guu et al., 2018, Hashimoto et al., 2018]. Accurate sequence labeling by explicitly and only copying labels from retrieved neighbors have been achieved by Wiseman and Stratos [2019]. Another recent line of work use training examples at test time to improve language generation [Weston et al., 2018, Pandey et al., 2018, Cao et al., 2018, Peng et al., 2019]. Improvements in language model have been also observed by Khandelwal et al. [2020] by utilizing explicit examples from past training data obtained from nearest neighbor search in the encoded space. However, unlike us these work do not extract explicit reasoning patterns (or solutions in cases) from nearest neighbors.
sections.heading: 5. Conclusion
sections.text: We propose a very simple non-parametric approach for reasoning in KGs that is similar to case-based reasoning approaches in classical AI. Our proposed model requires no training and can be readily applied to any knowledge graphs. It achieves new state-of-the-art performance in NELL-995 and FB122 datasets. Also we show that, our approach is robust in low-data settings. Overall, our nonparametric approach is capable of deriving crisp logical rules for each query by extracting reasoning patterns from other entities and entirely removes the burden of storing logical rules in the model parameters.
sections.heading: Acknowledgements
sections.text: This work is funded in part by the Center for Data Science and the Center for Intelligent Information Retrieval, and in part by the National Science Foundation under Grant No. IIS-1514053 and in part by the International Business Machines Corporation Cognitive Horizons Network agreement number W1668553 and in part by the Chan Zuckerberg Initiative under the project Scientific Knowledge Base Construction. Any opinions, findings and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect those of the sponsor.
title: A Simple Approach to Case-Based Reasoning in Knowledge Bases