SlowGuess/NAACL_2022_OCR huggingface dataset:
Ruixin Hong $^{1}$ , Hongming Zhang $^{2}$ , Xintong Yu $^{1}$ , Changshui Zhang $^{1}$
$^{1}$ Institute for Artificial Intelligence, Tsinghua University (THUAI);
<sup>1</sup>Beijing National Research Center for Information Science and Technology (BNRist);
$^{1}$ Department of Automation, Tsinghua University, Beijing, P.R.China
Tencent AI Lab, Seattle
{hrx20, yuxt16}@ mails.tsinghua.edu.cn,
hongmzhang@tencent.com, zcs@mail.tsinghua.edu.cn,
Knowing the reasoning chains from knowledge to the predicted answers can help construct an explainable question answering (QA) system. Advances on QA explanation propose to explain the answers with entailment trees composed of multiple entailment steps. While current work proposes to generate entailment trees with end-to-end generative models, the steps in the generated trees are not constrained and could be unreliable. In this paper, we propose METGEN, a Module-based Entailment Tree GENeration framework that has multiple modules and a reasoning controller. Given a question and several supporting knowledge, METGEN can iteratively generate the entailment tree by conducting single-step entailment with separate modules and selecting the reasoning flow with the controller. As each module is guided to perform a specific type of entailment reasoning, the steps generated by METGEN are more reliable and valid. Experiment results on the standard benchmark show that METGEN can outperform previous state-of-the-art models with only  $9\%$  of the parameters.
Explanation is recognized as a key factor toward responsible AI systems (Arrieta et al., 2020). In the context of question answering (QA), providing an explanation of the predicted answers can help improve the understandability, debuggability, and trustworthiness of QA models. Great efforts have been devoted to revealing how the models predict the answers and give explanations in various forms, including showing an attention map over passages (Seo et al., 2017), giving a snippet of textual evidence (DeYoung et al., 2020), and selecting answer-supporting sentences (Xie et al., 2020; Jansen and Ustalov, 2019). Among all explanation forms, the entailment trees (Dalvi et al., 2021) provide the most detailed and informative explanation by exposing the chains of reasoning
Figure 1: Given facts related to the question+answer, METGEN iteratively generates an entailment tree that contains the hypothesis (green), used facts (orange), and intermediate conclusions (blue) with several separate entailment modules and a reasoning controller.
from the knowledge to the predictions. As shown in Figure 1(a) and (c), given a hypothesis (summarizing a question+answer pair) and supporting facts (retrieved from a corpus), the goal is to generate an entailment tree where each non-leaf node is an entailment of its children. Providing a valid entailment tree would help users to understand how the hypothesis is proved, obtain novel intermediate conclusions from the basic knowledge, and gain detailed information to support decision making.
To generate the entailment trees, Dalvi et al. (2021) propose EntailmentWriter, an end-to-end sequence-to-sequence generative model, trained by maximizing the generation likelihood of the
Findings of the Association for Computational Linguistics: NAACL 2022, pages 1887 - 1905
linearized gold trees. However, they do not have an explicit strategy to constrain the validity of every single step and the tree structure. Thus, the steps are not guaranteed to satisfy the reasoning rules and could be incorrect and unreliable. For example, the step conclusion may not be entailed by the input premises or simply repeat one of the input premises (Dalvi et al., 2021). Furthermore, although their outputs are trees that can indicate the reasoning chains, the mapping mechanisms from the inputs to the trees remain implicit and invisible.
To tackle the above problems, we propose METGEN, a module-based framework to generate entailment trees in a more explicit approach and constrain the entailment steps with reasoning rules. As shown in Figure 1(b), given the target hypothesis and known facts, METGEN first uses the reasoning controller to select some steps that can help get closer to the hypothesis. Subsequently, METGEN executes the selected steps with single-step entailment modules and adds the generated intermediate facts into the known facts for the next round of reasoning. Through this iterative approach, METGEN proves the hypothesis step by step and generates the overall entailment tree.
Each module in METGEN is a generative model that can perform a specific type of entailment reasoning (e.g., making a substitution inference). To guide the modules to generate correct and sound conclusions, we train the modules with well-formed synthetic data containing the corresponding logical regularities of the reasoning types (Bostrom et al., 2021). Inspired by the forward chaining and backward chaining algorithms in logic programming (Chein and Mugnier, 2008), we adopt both deductive and abductive modules to execute forward and backward reasoning steps, respectively.
Experiments on the standard benchmark EntailmentBank (Dalvi et al., 2021) show that METGEN can outperform the previous best model with  $9.0\%$  of the model parameters. Manual evaluation results demonstrate that METGEN can generate more reliable steps. Further experiments under the data-scarce setting and cross-dataset setting (on eQASC and eOBQA (Jhamtani and Clark, 2020)) show that METGEN is more data-efficient and has better generalization capability compared with the baselines.
Explainability in Question Answering. Recent works have explored the explainability of QA in
various forms (Seo et al., 2017; Ye et al., 2020; Dalvi et al., 2021; Lamm et al., 2021; Wegreffer and Marasovic, 2021; Thayaparan et al., 2020; Rosenthal et al., 2021). One way is to retrieve multiple supporting facts related to the question or answer (Xie et al., 2020; Jansen and Ustalov, 2019; Jhamtani and Clark, 2020; Inoue et al., 2020; Yadav et al., 2019, 2020; Valentino et al., 2021; Cartuyvels et al., 2020; Zhang et al., 2020). These "rationales" (DeYoung et al., 2020) provide insights about what are used by the model to inform its predictions, but do not show how the facts are combined to generate novel intermediate conclusions. Some other works explain QA systems in a generative way, including generating explanation sentences that directly link a question to an answer (Camburu et al., 2018; Rajani et al., 2019) and thus expose the relevant knowledge used by models (Latcinnik and Berant, 2020; Shwartz et al., 2020). However, as these models generate explanations in a free form, the generated facts may not be necessarily sound (Bostrom et al., 2021). Recently, Bostrom et al. (2021) propose ParaPattern, an automated pipeline for building two kinds of single-step deductions. Different from the above work, our method generates the explanations in a multi-step tree structure (Dalvi et al., 2021), showing what and how facts are combined to draw novel intermediate conclusions and reach the final answer. The intermediate conclusions are generated by deductive and abductive entailment modules that are constrained to perform specific types of reasoning.
Multi-Hop Proof Generation. Recently, several works propose to use the transformers for multi-hop logical reasoning and generate reliable formal proofs (Clark et al., 2020; Talmor et al., 2020; Saha et al., 2020, 2021; Tafjord et al., 2021). However, they mainly focus on synthetic sentences, which have low linguistic variation and struggle to represent the flexible sentences in real QA scenarios.
Neural Module Networks. Decomposing the reasoning process into several pre-defined operations overlaps with the idea of neural module networks (Andreas et al., 2016; Hu et al., 2017; Gupta and Lewis, 2018; Gupta et al., 2020; Jiang et al., 2019). They typically assume that the question could be parsed into an executable program, i.e., the question explicitly describes the process to arrive at the answer. In our work, we tackle the questions/hypotheses that do not trivially describe the reasoning process and could be more challenging.
Figure 2: Reasoning process of METGEN framework. The goal is to prove the hypothesis with the given facts through reasoning iterations (the upper part). In the first reasoning iteration (the lower part), the initial state is denoted as  $H \Leftarrow \{s_1, s_2, s_3, s_4, s_5\}$ . First, the controller selects promising steps, such as the backward abductive step  $H - s_5$  and the forward deductive one  $s_4 + s_5$ . Then, single-step entailment modules perform the reasoning steps and generate novel intermediate facts including  $i_1, i_2, i_3$ . After that, the controller verifies that the states  $i_2 \Leftarrow \{s_1, s_2, s_3, s_4\}$  and  $H \Leftarrow \{s_1, s_2, s_3, i_1\}$  are closer to the completion of reasoning and thus selects them for the next reasoning iteration.
As shown in Figure 1, the inputs are a hypothesis  $H$  and some fact sentences  $S = \{s_1,s_2,\dots ,s_n\}$  (including both relevant and irrelevant ones) expressing knowledge.  $H$  is a declarative sentence derived from a question+answer pair and can be proved by the knowledge in  $S$ . The desired output is a valid entailment tree  $T$  with the root node being  $H$ , the leaves being facts selected from  $S$ , and the intermediate nodes being novel intermediate facts (e.g.,  $i_{1},i_{2}$ ).  $T$  is considered valid if each non-leaf node is a valid entailment (a conclusion that "a person would typically infer" (Dagan et al., 2013)) of its immediate children. We denote the annotated gold tree as  $T_{gold}$  and its leaf facts as  $S_{gold}$ . Following Dalvi et al. (2021), we consider three increasingly difficult tasks with different  $S$ :
Task1 (no-distractor):  $S = S_{gold}$
Task2 (distractor):  $S = S_{gold} + 15 - 20$  distractors,
Task3(full-corpus):  $S = \mathrm{acorpus}C$
4 METGEN
Figure 2 illustrates the reasoning process of METGEN. We reason one step at a time and iteratively generate the entailment trees. In each iteration, given a reasoning state (e.g., the initial state  $R_0:H\Leftarrow S$ , where we aim to prove  $H$  using  $S$ ),
the reasoning controller selects promising steps, including forward deductive steps and backward abductive ones. We then use the corresponding modules to perform single-step entailment on the selected steps and generate novel intermediate facts. Finally, we use the controller to verify the generated facts and select the correct states to perform further reasoning. We introduce details about the module design, reasoning controller, and reasoning algorithm in Sec 4.1, 4.2, and 4.3, respectively.
4.1 Single-step Entailment Modules
4.1.1 Module Definition
We propose to divide the single-step entailment reasoning ability into a set of well-defined basic logical operations. Such a design could help improve the generalization capability (Bostrom et al., 2021; Rudin, 2019). As shown in Table 1, we adopt three common reasoning types, covering over  $90\%$  of the steps in EntailmentBank according to the analysis by Dalvi et al. (2021). Note that the entailment module types could be adjusted according to the specific tasks or domains, which allows our method to be flexibly applied to other problems.
We adopt both the deductive and abductive versions of the reasoning types. Take a gold step  $s_1 + s_2 \to i_1$  as an example. Deduction is the process of reasoning from the premises to reach
Type	Definition	Logical Regularity	Example
Substitution	performing taxonomic, merynomic or other kinds of reasoning that substitute one entity for another	s1: ∀x ∈ XP(x)	s1: the mass of a planet causes the pull of gravity on that planet.
s2: a ∈ X	s2: earth is a kind of planet.
i1: P(a)	i1: the mass of earth causes the pull of gravity on earth.
Conjunction	combining the details of both input sentences into a single output sentence	s1: P(x)	s1: chemical splashing can cause harm to humans / to the eyes.
s2: Q(x)	s2: chemical splashing sometimes occurs during experiments.
i1: P ∧ Q(x)	i1: chemical splashing during experiments can cause harm to the eyes.
If-then	applying a conditional claim or a specific rule (one of the input sentences) to the other input sentences	s1: P(x) → Q(x)	s1: if something requires something else then that something else is important to that something.
s2: P(x)	s2: nuclear fusion is required for star formation.
i1: Q(x)	i1: nuclear fusion is important to star formation.
Table 1: The used reasoning types. Here,  $s_1$  and  $s_2$  denote input premises for deductive modules, while  $i_1$  denotes the entailed conclusion. For logical regularity,  $P(x)$  means that the predicate  $P$  is true for the entity  $x$ .
a logical conclusion. A deductive module takes the two premises  $s_1$  and  $s_2$  as inputs and outputs a conclusion  $\hat{i}_1$  according to its reasoning types (denoted as  $s_1 + s_2 \rightarrow \hat{i}_1$ ). Abduction is to find the best explanation given complete/incomplete observations (Harman, 1965). In the context of the entailment steps, given a conclusion  $i_1$  and a premise fact  $s_2$  as observations, the abductive module yields a plausible premise  $\hat{s}_1$  (denoted as  $i_1 - s_2 \rightarrow \hat{s}_1$ ), where the generated premise  $\hat{s}_1$  and the observed premise  $s_2$  would most likely infer the conclusion  $i_1$ . Although the steps in the EntailmentBank may have more than two premises, we only consider the case of two premises. The reason is that the  $n$ -premise step ( $n > 2$ ) could be further decomposed into several valid 2-premise steps (Dalvi et al., 2021) (See Appendix Figure 8 for a specific example).
4.1.2 Module Training
Training the entailment modules with data that contains the corresponding logical regularities would guide them to perform correct inferences and ensure soundness (Bostrom et al., 2021). We first train the modules with synthetic sentences to learn the logical transformations and then further fine-tune them with the end task.
We follow ParePattern (Bostrom et al., 2021), a pipeline based on syntactic retrieval, rule-based example construction, and automatic paraphrasing, to collect synthetic sentences from Wikipedia. Since Bostrom et al. (2021) only consider the substitution and contraposition deductions, we extend the method to conjunction and if-then deductions by designing the specific syntactic templates and construction rules (See Appendix A.1). In addition, we also considered the abductive form of these modules. We then fine-tune the modules with corresponding steps in EntailmentBank to adapt the modules to the science domain. Since the original
steps in EntailmentBank are not annotated with reasoning types, we manually label 400 steps of the training split and train a classifier with these steps. The remaining steps are labeled with the pseudo labels predicted by the classifier. We freeze the parameters of modules once the training is complete.
4.2 Reasoning Controller
In addition to single-step reasoning modules, we need to search for the correct path to reach the target hypothesis. The entire reasoning search space would grow rapidly as the number of input facts increases and there would also be complex branching in the trees. We introduce a reasoning controller to filter out incorrect facts, steps, and states to reduce the search space and complete the reasoning accurately and efficiently.
Figure 2 shows how the controller is used in each reasoning iteration. At the beginning of the iteration, the controller scores all possible steps and selects the most promising ones for single-step entailment. After the entailment modules generate intermediate facts, the controller estimates which state with a generated fact gets closer to the completion of reasoning and selects the best states for the next iteration. Besides the usage within each iteration, the controller also rates all facts at the start of the whole reasoning process and keeps only the relevant facts for the initial state when fact distractors exist.
4.2.1 Controller Model
The controller model scores steps, facts, and states based on a transformer, and its structure is shown in Figure 3.
Encoding. We first encode the target hypothesis and facts of state with a pre-trained transformer: [CLS]  $H[\mathrm{SEP}]s_1[\mathrm{SEP}]\ldots [\mathrm{SEP}]s_n[\mathrm{SEP}]$ . We obtain the contextualized representation  $h$  for  $H$  and  $\pmb{f}_i$  for  $s_i$  using the average contextualized representa
Figure 3: Reasoning controller illustration. Given a state, the controller predicts a score for the whole state, scores for facts, and scores for all possible steps.
tion of all tokens within the sentence.
Steps. We introduce feed forward networks  $\mathrm{FFN}_{\mathrm{ded}}$  and  $\mathrm{FFN}_{\mathrm{abd}}$  for deductive steps and abductive steps, respectively. Each combination of two facts is a possible deductive step  $(s_i,s_j)$ . Each combination of the target hypothesis and a fact is a possible abductive step  $(H,s_k)$ . We score them by a score function  $G_{step}$ ,
$$
\begin{array}{l} G _ {s t e p} \left(s _ {i}, s _ {j}\right) = \operatorname {F F N} _ {\mathrm {d e d}} \left(\left[ \boldsymbol {f} _ {i}, \boldsymbol {f} _ {j} \right]\right), \\ G _ {s t e p} (H, s _ {k}) = \operatorname {F F N} _ {\mathrm {a b d}} ([ h, f _ {k} ]), \tag {1} \\ \end{array}
$$
where  $[\cdot ]$  is the concatenate operation. We normalize the step scores by applying Softmax over all possible deductive and abductive steps.
Facts. The fact score indicates whether the fact is useful by how similar the fact is to the state's target hypothesis. We assume that if a fact has a smaller depth in the gold entailment tree (i.e., closer to the root), it would be more similar to the target hypothesis than those facts with a larger depth. We introduce  $\mathrm{FFN}_{\mathrm{fact}}$  as a learnable similarity function and determine the fact score by comparing it with the target,
$$
G _ {\text {f a c t}} \left(s _ {i}\right) = \sigma \left(\operatorname {F F N} _ {\text {f a c t}} \left(\left[ \boldsymbol {h}, \boldsymbol {f} _ {i} \right]\right)\right), \tag {2}
$$
where  $\sigma$  is the Sigmoid function.
State. The state score reflects the quality of the current state and indicates whether this state should be used for further reasoning. We assign the state score using the following two parts:
$$
G _ {\text {s t a t e}} (R) = \frac {\lambda}{n} \sum_ {s _ {i} \in S} G _ {\text {f a c t}} \left(s _ {i}\right) + (1 - \lambda) \sigma \left(\mathrm {F F N} _ {\mathrm {c l s}} \left(\boldsymbol {f} _ {[ \mathrm {C L S} ]}\right)\right), \tag {3}
$$
where  $\lambda$  is a learnable weight,  $f_{\mathrm{CLS}}$  is the representation of [CLS],  $\mathrm{FFN}_{\mathrm{cls}}$  is a feed forward network. The first part helps choose states that contain more relevant facts and fewer distractors. The second part comprehensively considers the whole state and gives the promising one a higher score.
4.2.2 Controller Training
Training State Construction. We decompose the gold entailment trees into several intermediate states for training. We add disturbances to the trees to make positive and negative states. For each gold deductive step (e.g.,  $s_1 + s_2 \rightarrow i_1$ ), we use the deductive module to predict a conclusion  $\hat{i}_1$ . If the predicted  $\hat{i}_1$  is correct, we replace  $i_1$  in the state with  $\hat{i}_1$  to make new positive states. Otherwise, we replace  $i_1$  with  $\hat{i}_1$  to make negative states. The abductive modules are also used in a similar way.
Loss Function. We train the controller with corresponding margin ranking losses  $\mathcal{L}_{step},\mathcal{L}_{fact}$ , and  $\mathcal{L}_{state}$  to learn to rank the correct steps, facts, and states ahead of incorrect ones, respectively. Specifically, the loss for scoring steps is
$$
\mathcal {L} _ {\text {s t e p}} = \frac {1}{N _ {1}} \sum_ {(p ^ {+}, p ^ {-})} \varphi \left(G _ {\text {s t e p}} \left(p ^ {+}\right), G _ {\text {s t e p}} \left(p ^ {-}\right), m _ {\text {s t e p}}\right), \tag {4}
$$
where  $p^+$  and  $p^{-}$  are the positive and negative step,  $N_{1}$  is the number of  $(p^{+},p^{-})$  pairs,  $\varphi (x_1,x_2,m) =$ $\max (0,x_2 - x_1 + m)$  is the margin loss, and  $m_{step}$  is the margin for steps.
For facts, we have
$$
\begin{array}{l} \mathcal{L}_{fact} = \frac{1}{N_{2}}\sum_{s_{1}^{+},s_{2}^{+}\in S_{gold}}\varphi (G_{fact}(s_{1}^{+}),G_{fact}(s_{2}^{+}),m_{fact}) \\ + \frac {1}{N _ {3}} \sum_ {s ^ {-} \notin S _ {\text {g o l d}}} - \log \left(1 - G _ {\text {f a c t}} \left(s ^ {-}\right)\right), \tag {5} \\ \end{array}
$$
where  $s_1^+$  is a fact which has smaller depth in the gold tree than  $s_2^+$ ,  $s^-$  is the distractor,  $N_2$  is the number of  $(s_1^+, s_2^+)$  pairs,  $N_3$  is the number of distractors, and  $m_{fact}$  is the margin for facts.
For states, we sample a positive state  $R^{+}$  and a negative state  $R^{-}$  from a tree and train the controller with
$$
\mathcal {L} _ {\text {s t a t e}} = \varphi \left(G _ {\text {s t a t e}} \left(R ^ {+}\right), G _ {\text {s t a t e}} \left(R ^ {-}\right), m _ {\text {s t a t e}}\right), \tag {6}
$$
where  $m_{state}$  is the margin for states.
Finally, we average the above losses over all trees in the training split and train the controller with
$$
\mathcal {L} = \mathcal {L} _ {\text {s t e p}} + \mathcal {L} _ {\text {f a c t}} + \mathcal {L} _ {\text {s t a t e}}. \tag {7}
$$
Appendix B gives more controller training details.
4.3 Reasoning Algorithm
Since the entailment trees are generated iteratively and the search space for reasoning could be large for each iteration, we adopt beam search for efficient reasoning. Given the initial state  $H \Leftarrow S$ , we first remove  $s_i$  with a low fact score to filter distractors. Subsequently, we perform several reasoning
Train	Dev	Test	All
Questions / Trees	1,131	187	340	1,840
Entailment steps	4,175	597	1,109	5,881
Table 2: EntailmentBank statistics.
iterations until the target hypothesis is proved or the maximum reasoning depth is reached. In each iteration, we select the steps with the highest step scores, execute the steps with all types of deductive or abductive modules, and construct novel states with the generated intermediate facts. We remain the top- $K$  states ranked with state scores for the next iteration, where  $K$  is the beam size. More algorithm details are in Appendix Algorithm 1.
We conduct experiments on EntailmentBank (Dalvi et al., 2021), the first dataset supporting QA explanations in the form of the entailment tree. EntailmentBank contains 1,840 entailment trees, each of which corresponds to a question from the ARC dataset (Clark et al., 2018). On average, each tree contains 7.6 nodes across 3.2 steps. Summary statistics are shown in Table 2.
Following Dalvi et al. (2021), we first align nodes in the predicted tree  $T_{pred}$  with nodes in the gold tree  $T_{gold}$  and then evaluate with three dimensions:
- Leaves: To evaluate whether  $T_{pred}$  uses the correct leaf facts, we compute F1 score by comparing the predicted leaf facts  $S_{pred}$  to  $S_{gold}$ .
- Steps: To evaluate whether the individual steps are structurally correct, we compare all steps in two trees and compute F1. A predicted step is considered structurally correct if its children's identifiers (e.g.,  $s_1$ ,  $i_2$ ) perfectly match the gold ones.
- Intermediates: To evaluate whether the intermediate conclusions are correct, we report the F1 of comparing the aligned intermediate conclusions. A predicted intermediate sentence  $\hat{i}$  is considered correct if the BLEURT-Large-512 score of the aligned intermediate pair  $(\hat{i},i)$  is larger than  $0.28^{1}$ .
The AllCorrect score is 1 if F1 is 1, 0 otherwise<sup>2</sup>. Given the above scores, we comprehensively evaluate  $T_{pred}$  with Overall AllCorrect whose value
is 1 if and only if all the leaves, steps and intermediates are all correct. This is a strict metric since any error in  $T_{pred}$  will lead to a score of 0.