Counterfactual Reasoning with Knowledge Graph Embeddings (2024)

Abstract: Knowledge graph embeddings (KGEs) were originally developed to infer true but missing facts in incomplete knowledge repositories.In this paper, we link knowledge graph completion and counterfactual reasoning via our new task CFKGR. We model the original world state as a knowledge graph, hypothetical scenarios as edges added to the graph, and plausible changes to the graph as inferences from logical rules. We create corresponding benchmark datasets, which contain diverse hypothetical scenarios with plausible changes to the original knowledge graph and facts that should be retained. We develop COULDD, a general method for adapting existing knowledge graph embeddings given a hypothetical premise, and evaluate it on our benchmark. Our results indicate that KGEs learn patterns in the graph without explicit training. We further observe that KGEs adapted with COULDD solidly detect plausible counterfactual changes to the graph that follow these patterns. An evaluation on human-annotated data reveals that KGEs adapted with COULDD are mostly unable to recognize changes to the graph that do not follow learned inference rules. In contrast, ChatGPT mostly outperforms KGEs in detecting plausible changes to the graph but has poor knowledge retention. In summary, CFKGR connects two previously distinct areas, namely KG completion and counterfactual reasoning.

## introduction reasoning about hypothetical situations (counterfactual reasoning) and anticipating the effects of a change in the current state of the world is central to human cognition @xcite , and has been identified as a key concept in game theory @xcite and agent-based systems @xcite . it has even been argued that the capacity to reason about alternative configurations of the world could be a pre-requisite if paris was the capital of japan ... @xcite paris would likely be in asia (paris, continent, asia) ## cfkgr: task description we introduce counterfactual kg reasoning (cfkgr) a novel task to assess the ability of machine learning systems to reason in hypothetical scenarios. cfkgr describes the originally observed world state as a knowledge graph and introduces hypothetical scenarios by adding previously unseen facts to the graph. to perform well on cfkgr, models need to (1) identify plausible changes to the original world state induced by the hypothetical scenario and (2) understand which facts are unaffected by the hypothetical scenario. ## cfkgr: dataset creation for our dataset construction, we leverage rules found by rule mining systems, which capture prominent patterns in kgs. automatically mined rules are naturally compatible with the content of the kg and are known to be a useful tool for kgc (e.g., @xcite . since there is no trivial way to reliably generate f -, we only consider the addtions f + . concretely, we define f + via mined composition rules of the form we choose composition rules since they are well studied in standard kg completion benchmarks (safavi and koutra, 2020) and inferential benchmarks @xcite . moreover, composition rules, as given in (1), infer local changes. this is desirable since most relevant changes induced by a hypothetical scenario will likely occur in its close neighborhood. we consider understanding the implications induced by composition rules as a first step to more general and complex hypothetical reasoning. ## counterfactual reasoning with knowledge graph embeddings kge models find low-dimensional vector representations for entities and relations while preserving the information contained in the kg. to judge the plausibility of a given triple, kge models use a scoring function ϕ(h, r, t) : e × r × @xmath0. a triple is typically classified as valid if it satisfies ϕ(h, r, t) ≥ µ r , for a relation-specific threshold µ @xmath1. to extend kges to our task, we propose couldd (counterfactual reasoning with knowledge graph embeddings), a general method for adapting existing knowledge graph em-algorithm 1: couldd training and prediction. the short-hand notation ϕ θ (t τ c ) denotes scoring all test cases associated with τ c and l θ denotes the cross-entropy loss. importantly, couldd only requires access to the counterfactual triple τ c and the original fact set f and does not require additional task-specific training data or information about the rules used to in the following, we conduct two types of experiments: first, we evaluate pre-trained kges, couldd, and chatgpt on our cfkgr datasets with expected labels to assess whether the methods can apply inference rules found by a rule mining system in hypothetical scenarios. in our second set of experiments, we evaluate on human-labeled data to check whether the methods also capture human reasoning, which does not necessarily align with mined inference rules (see section 3.3). ## discussion comparison with human cf reasoning. our labeling efforts and experiments show that counterfactual reasoning on kgs is a challenging task. both kges and chatgpt leave much room for improvement on cfkgr. moreover, as indicated by our annotation results ( advantage of kg-based benchmarks. kgs are a powerful tool for defining hypothetical scenarios and their consequences. the rich world knowledge stored in kgs allows to create interesting casespecific inferences. in the example question above, would the judgement change if we replace "girls aloud" by a band that is not a girl group? this aspect is largely missing from current counterfactual reasoning benchmarks for llms @xcite , as they mostly handle generic entities. ## conclusion this work introduces the novel task cfkgr, which requires models to reason on a counterfactual kg. by utilizing the world knowledge stored in kgs, we create datasets consisting of diverse hypothetical scenarios and their implications, as defined by inference rules. further, we propose couldd, a general method for counterfactual reasoning on kgs, and evaluate its effectiveness on automatically generated and human-annotated data. we extend our experiments to chatgpt and find that it generally outperforms couldd at making counterfactual inferences. however, chatgpt largely does not recognize which facts are invariant to the hypothetical scenario. both couldd and chat-gpt leave much headroom on the task, highlighting the difficulty of cfkgr.