F ai RR : Faithful and Robust Deductive Reasoning over Natural Language (2022)

Abstract: Transformers have been shown to be able to perform deductive reasoning on a logical rulebase containing rules and statements written in natural language. Recent works show that such models can also produce the reasoning steps (i.e., the proof graph) that emulate the model’s logical reasoning process. Currently, these black-box models generate both the proof graph and intermediate inferences within the same model and thus may be unfaithful. In this work, we frame the deductive logical reasoning task by defining three modular components: rule selection, fact selection, and knowledge composition. The rule and fact selection steps select the candidate rule and facts to be used and then the knowledge composition combines them to generate new inferences. This ensures model faithfulness by assured causal relation from the proof step to the inference reasoning. To test our framework, we propose FaiRR (Faithful and Robust Reasoner) where the above three components are independently modeled by transformers. We observe that FaiRR is robust to novel language perturbations, and is faster at inference than previous works on existing reasoning datasets. Additionally, in contrast to black-box generative models, the errors made by FaiRR are more interpretable due to the modular approach.

## introduction the field of ai has long pursued the goal of building systems that can automatically reason over some given explicit knowledge to generate conclusions and provide the reasoning steps involved in the process @xcite . recently, @xcite proposed a modern version of this problem, where the formal representation of knowledge is replaced by natural language statements in english. further, conc2: charlie is white. figure 1 : example of a theory, a statement, and a valid proof graph -an instance contains multiple facts and rules in blue and yellow respectively, followed by a statement in red. the proof graph describes the reasoning steps required to generate the statement. while ruletaker focuses on just predicting the statement entailment, some recent works @xcite have further developed systems that can also generate the reasoning steps (i.e., proof graph generation). however, these systems do not explicitly ensure the causality from the rule/fact selection to generating the intermediate inferences. since these systems are inherently black-box models, it is unclear if such constraints are implicitly learned by the models without being enforced externally. this, in turn, questions the faithfulness of the model's internal reasoning process @xcite . because the model has access to the full theory at input, it might use additional parts of the theory, than just the predicted proof, to generate the inference. in this paper, we address these shortcomings by developing a modularized framework to solve the deductive reasoning task. while existing methods generate both proofs and conclusions in a single step, in our framework we break this process into three steps: rule selection, fact selection, and knowledge composition. the rule selection step decides the relevant rule to use for an iterative inference step and fact selection uses this rule to select the relevant facts. then, the knowledge composition step reasons using only the selected rule and facts to generate the next intermediate inference. in figure 2 , we show the model schematics for our system and contrast it with previous methods. notably, we strictly restrict the information accessible at each step of our framework to make the reasoning process more faithful. for example, the fact selection step depends only on the selected rule, instead of all the rules in the rulebase. additionally, the generated inference depends explicitly on the selected rule and facts, as opposed to all the rules and facts in prior works. this makes the proof graph a by-product of the selection steps as we don't need to generate any separate proofs. since we constrain the inputs to each step, this also makes each subproblem easier to learn, leading to an overall more robust reasoning model. to model these three steps, we develop fairr, in which each component is a transformer-based model learning to perform the modular tasks. specifically, we use roberta-based models @xcite for the two selection tasks and a t5based model @xcite for the composition task. similar to proofwriter, we use synthetic rulebases to train fairr. to test the deductive reasoning capabilities in a more comprehensive way, we experiment with both existing deductive reasoning datasets and multiple newly-generated robustness dataset variants. overall, we find that fairr is more robust to novel language perturbations than baselines. additionally, our model is up to three times faster at inference due to the constrained input and outputs of different modules. lastly, we find that the errors made by our model are more interpretable and easier to debug compared to baseline generative models. this further demonstrates the faithfulness of our modularized reasoning framework. ## problem definition notations a theory t consists of a set of facts @xmath0, f 2 , . . . , f n } and rules @xmath1, r 2 , . . . , r m } expressed in natural language. an example of a theory is depicted in figure 1 . here, the sentences in the blue and yellow boxes are facts and rules, respectively. further, a proof graph is a directed graph connecting facts and rules that describe how a specific inference can be obtained from the theory. in figure 1 , the proof graph shows the steps involved in generating the inference "charlie is white.". to generate the proof graph we may need to infer some intermediate conclusions c i . these inferences are considered as part of the extended facts in the theory. for example, in fig. 1 , "charlie is kind" is an intermediate inference required to generate the correct proof graph. deductive reasoning the task of deductive reasoning is described as follows: given a theory t , and a statement s, predict if the theory supports the statement (entailment prediction) and if so, generate the proof graph that supports the statement (proof generation). for the example theory and statement in figure 1 , we see that the statement is indeed entailed by the theory and the valid proof graph is shown for the same. the main goal of this task is to evaluate if a model can generate valid rea-soning chains in the form of proof graphs to justify its entailment prediction. reasoning robustness we consider an auxiliary task that evaluates the robustness of the reasoning abilities used by the model. let p be a perturbation function that modifies a given theory t (statement s) to a theory t ′ (statement s ′ ), such that (t ′ , s ′ ) just has some surface changes in the natural language form but still requires the similar reasoning process as required for (t, s). a function that alters the subjects in the theory to unseen subjects is an example of such perturbation function. we perturb each theory statement pair (t, s) to create an equivalence set defined as the set ## experimental setup datasets following @xcite , we use the d* datasets for our experiments. these are a set of multiple datasets -namely d0, d1, d2, d3, d0-d3, and d5. the theory in these datasets are synthetically generated with increasing reasoning depths. for example, d3 dataset contains statements that require at most 3-hop reasoning steps. the d0-d3 contains all theories in d3 plus ∼ 20% of the d0-d2 training set theories. we also use the pararules dataset @xcite ) that contains around 2k theories expressed in paraphrased natural language. additionally, we generate three datasets that evaluate the robustness of the reasoning models as follows: we include more details on the perturbation sets used in our experiments in appendix b. baselines we compare fairr with two variants of proofwriter @xcite : all-at-once (pw ("all")) and iterative (pw ("iter")), wherever applicable foot_1 . the pw ("all") model is trained to predict the entailment and generate proof graph directly from the theory and statement in a single step. the pw ("iter") generates one-step inferences and corresponding proofs iteratively, until all possible inferences are generated, and then stitches the proof ## experiment results we compare fairr with proofwriter variants on three settings: generalization on d* datasets, robustness to perturbed theories, and efficiency in inference computation. we further conduct qualitative analysis to understand the inference errors. ## related works reasoning in text reasoning in text is a well studied problem in nlp. natural language inference (nli) @xcite is one of the most prominent tasks that require reasoning over text to answer if a statement is entailed, contradicted, or neutral, given a hypothesis. more recently, datasets like hotpotqa @xcite , babi @xcite , quartz @xcite , ropes @xcite , clutrr @xcite , etc., have studied different aspects of reasoning over textual inputs. these tasks usually require implicit reasoning, where the model needs to internally infer the rules required to solve the task. in contrast, ruletaker @xcite deals with explicit reasoning (also known as deductive reasoning). proof generation recently, some works have been addressing the problem of proof generation from an nl-based theory. prover @xcite trains a roberta-based model that predicts nodes and edges of the proof graph. proofwriter @xcite is a t5-based @xcite model, that iteratively generates one-hop conclusions and proofs from a theory. another work mul-tiprover @xcite , generates multiple possible proofs for a statement. while we study the same problem of proof generation similar to these works, we develop a more faithful and robust model designing a modular system for proof generation. formal reasoning there are some prior works that try to solve the problem of entailment prediction by first parsing the formal language from text. neural theorem prover @xcite uses neural networks to parse the formal logic from natural language and then reason over them. while this approach is more symbolic, it can lead to many challenges while parsing @xcite . the proof generation setting considered here bypasses this step and directly reasons over the given natural language text making it more useful in downstream applications. ## conclusion in this paper, we proposed fairr, a faithful and robust deductive reasoning model based on three modular components: rule selection, fact selection, and knowledge composition. fairr ensures causality from proof generation to entailment prediction by design. we established the effectiveness of our approach through experiments on testing robustness to language variations and demonstrating the interpretability of the errors made by our model. we also show that fairr is faster and more precise at deductive reasoning than prior baselines.