W EAKLY S UPERVISED E XPLAINABLE P HRASAL R EASONING WITH N EURAL F UZZY L OGIC
Anonymous authors
Paper under double-blind review
A BSTRACT
Natural language inference (NLI) aims to determine the logical relationship between two sentences, such as Entailment , Contradiction , and Neutral .
In recent years, deep learning models have become a prevailing approach to NLI, but they lack interpretability and explainability.
In this work, we address the explainability of NLI by weakly supervised logical reasoning, and propose an
Explainable Phrasal Reasoning (EPR) approach.
Our model first detects phrases as the semantic unit and aligns corresponding phrases in the two sentences.
Then, the model predicts the NLI label for the aligned phrases, and induces the sentence label by fuzzy logic formulas.
Our EPR is almost everywhere differentiable and thus the system can be trained end to end.
In this way, we are able to provide explicit explanations of phrasal logical relationships in a weakly supervised manner.
We further show that such reasoning results help textual explanation generation.
I NTRODUCTION
Natural language inference (NLI) aims to determine the logical relationship between two sentences (called a premise and a hypothesis ), and target labels include Entailment , Contradiction , and
Neutral (Bowman et al., 2015; MacCartney & Manning, 2008).
Figure 1 gives an example, where the hypothesis contradicts the premise.
NLI is important to natural language processing, because it involves logical reasoning and is a key problem in artificial intelligence.
Previous work shows that
NLI can be used in various downstream tasks, such as information retrieval (Karpukhin et al., 2020) and text summarization (Liu & Lapata, 2019).
In recent years, deep learning has become a prevailing approach to NLI (Bowman et al., 2015;
Mou et al., 2016; Wang & Jiang, 2016; Yoon et al., 2018).
Especially, pretrained language models with the Transformer architecture (Vaswani et al., 2017) achieve state-of-the-art performance for the NLI task (Radford et al., 2018; Zhang et al., 2020).
However, such deep learning models are black-box machinery and lack interpretability.
In real applications, it is important to understand how these models make decisions (Rudin, 2019).
Several studies have addressed the explainability of NLI models.
Camburu et al.
(2018) generate a textual explanation by sequence-to-sequence supervised learning, in addition to NLI classification; such an approach is multi-task learning of text classification and generation, which does not perform reasoning itself.
MacCartney et al.
(2008) propose a scoring model to align related phrases; Parikh et al.
(2016) and Jiang et al.
(2021) propose to obtain alignment by attention mechanisms.
However, they only provide correlation information, instead of logical reasoning.
Other work incorporates upward and downward monotonicity entailment reasoning for NLI (Hu et al., 2020; Chen et al., 2021), but these approaches are based on hand-crafted rules (e.g., every downward entailing some ) and are restricted to Entailment only; they cannot handle Contradiction or Neutral .
In this work, we address the explainability for NLI by weakly supervised phrasal logical reasoning.
Phrasal reasoning refers to reasoning about phrasal logical relationships.
And our goal is to explain
NLI predictions with phrasal logical relationships between the premise and hypothesis.
Intuitively, an NLI system with an explainable reasoning mechanism should be equipped with the following functionalities:
The system should be able to detect corresponding phrases and tell their logical relationship, e g., several men contradicting one man , but pull in a fishing net entailing holding the net (Figure 1).
The system should be able to induce sentence labels from phrasal reasoning.
In the example, the two sentences are contradictory because there exists one contradictory phrase pair.
More importantly, such reasoning should be trained in a weakly supervised manner, i e., the phraselevel predictions are trained from sentence labels only.
Otherwise, the reasoning mechanism becomes multi-task learning, which requires massive fine-grained human annotations.
[Figure]
To this end, we propose an Explainable Phrasal
Reasoning (EPR) approach to the NLI task.
Our model obtains phrases as semantic units, and aligns corresponding phrases by embedding similarity.
Then, we predict the NLI labels (namely,
Entailment , Contradiction , and Neutral ) for the aligned phrases.
Finally, we propose to induce the sentence-level label from phrasal labels in a fuzzy logic manner (Zadeh, 1988; 1996).
Our model is differentiable and the phrasal reasoning component can be trained with the weak supervision of sentence NLI labels.
In this way, our EPR approach satisfies all the desired properties mentioned above.
In our experiments, we developed a comprehensive methodology (data annotation and evaluation metrics) to quantitatively evaluate phrasal reasoning performance, which has not been accomplished in previous work.
We extend previous studies and obtain plausible baseline models.
Results show that our EPR yields much more meaningful explanation in terms of F scores against human annotation.
To further demonstrate the quality of extracted phrasal relationships, we feed them to a textual explanation model.
Results show that our EPR reasoning leads to an improvement of 2 points in
BLEU scores, achieving a new state of the art on the e-SNLI dataset (Camburu et al., 2018).
Our contributions are summarized as follows:
We formulate a phrasal reasoning task for natural language inference (NLI), addressing the interpretability of neural models.
We propose an EPR model that induces sentence-level NLI labels from explicit phrasal logical labels by neural fuzzy logic.
EPR is able to perform reasoning in a weakly supervised way.
We annotated phrasal logical labels and designed a set of metrics to evaluate phrasal reasoning.
We further use our reasoning results to improve textual explanation generation.
Our code and annotated data are released for future studies.
To the best of our knowledge, we are the first to develop a weakly supervised phrasal reasoning model for the NLI task.
R ELATED W ORK
Natural Language Inference.
MacCartney & Manning (2009) propose seven natural logic relations in addition to Entailment , Contradiction , and Neutral .
MacCartney & Manning (2007) also distinguish upward entailment ( every mammal upward entailing some mammal ) and downward entailment ( every mammal downward entailing every dog ) as different categories.
Manually designed lexicons and rules are used to interpret Entailment in a finer-grained manner, such as downward and upward entailment (Hu et al., 2020; Chen et al., 2021).
Feng et al.
(2020) apply such natural logic to
NLI reasoning in the word level; however, our experiments will show that their word-level treatment is not an appropriate granularity, and they fail to achieve meaningful reasoning performance.
The above reasoning schema focuses more on the quantifiers of first-order logic (Beltagy et al., 2016).
However, the SNLI dataset (Bowman et al., 2015) we use only contains less than 5% samples with explicit quantifiers, and seven-category schema complicates reasoning in the weakly supervised setting.
Instead, we adopt three-category NLI labels following the SNLI dataset.
Our focus is entity-based reasoning, and the treatment of quantifiers is absorbed into phrases.
We also notice that previous work lacks explicit evaluation on the reasoning performance for NLI.
For example, the SNLI dataset only provides sentence-level labels.
The HELP (Yanaka et al., 2019a) and MED (Yanaka et al., 2019b) datasets concern monotonicity inference problems, where the label is also at the sentence level; they only consider Entailment , ignoring Contradiction and Neutral .
Thus, we propose a comprehensive framework for the evaluation of NLI reasoning.
e-SNLI.
Camburu et al.
(2018) propose the e-SNLI task of textual explanation generation and use LSTM as a baseline.
Kumar & Talukdar (2020) propose the NILE approach, using multiple decoders to generate explanations for all E , C , and N labels, and then predicting which to be selected.
Zhao & Vydiswaran (2021) propose the LIREx approach, using additionally annotated rationales for explanation generation.
Narang et al.
(2020) finetune T5 with multiple explanation generation tasks.
Although these systems can generate explanations, the nature of such finetuning approaches renders the explanation generator per se unexplainable.
By contrast, we design a textual explanation generation model that utilizes EPR’s phrasal reasoning, obtained in a weakly supervised manner.
Neuro-Symbolic Approaches.
In recent years, neuro-symbolic approaches have attracted increasing interest in the AI and NLP communities for interpreting deep learning models.
Typically, these approaches are trained by reinforcement learning or its relaxation, such as attention and Gumbelsoftmax (Jang et al., 2017), to reason about certain latent structures in a downstream task.
For example, Lei et al.
(2016) extract key phrases for a text classification task, and Liu et al.
(2018) extract key sentences for paragraph classification.
Lu et al.
(2018) extract entities and relations for document understanding.
Liang et al.
(2017) and Mou et al.
(2017) perform SQL-like execution based on input text for semantic parsing.
Xiong et al.
(2017) hop over a knowledge graph for reasoning the relationships between entities.
Our work addresses logical reasoning for the NLI task, which is not tackled in previous neuro-symbolic studies.
Fuzzy Logic.
Fuzzy logic (Zadeh, 1988; 1996) models an assertion and performs logic calculation with probability.
For example, a quantifier (e.g., “most”) and assertion (e.g., “ill”) are modeled by a score in (0 , 1) ; the score of a conjunction s ( x 1 ∧ x 2 ) is the product of s ( x 1 ) and s ( x 2 ) .
In old-school fuzzy logic studies, the mapping from language to the score is usually given by human-defined heuristics (Zadeh, 1988; Nozaki et al., 1997), and may not be suited to the task of interest.
By contrast, we train neural networks to predict the probability of phrasal logical relations, and induce the sentence NLI label by fuzzy logic formulas.
Thus, our approach takes advantage of both worlds of symbolism and connectionism.
Mahabadi et al.
(2020) apply fuzzy logic formulas to replace multi-layer perceptrons for NLI.
But they are unable to provide expressive reasoning because their fuzzy logic works on sentence features.
Our work is inspired by Mahabadi et al. However, we propose to apply fuzzy logic to the detected and aligned phrases, enabling our approach to provide reasoning in a symbolic (i.e., expressive) way. We develop our own fuzzy logic formulas, which are also different from Mahabadi et al.  O UR EPR A PPROACH
In this section, we describe our EPR approach in detail, also shown in Figure 2.
It has three main components: phrase detection and alignment, phrasal NLI prediction, and sentence label induction.
Phrase Detection and Alignment.
In NLI, a data point consists of two sentences, a premise and a hypothesis.
We first extract content phrases from both input sentences by rules and heuristics.
For example, “[ AUX ] + [ NOT ] + VERB + [ RP ]” is treated as a verb phrase.
2 Full details are presented in
Appendix A.1.
Compared with the word level (Parikh et al., 2016; Feng et al., 2020), a phrase is a more meaningful semantic unit for logical reasoning.
We then align corresponding phrases in the two sentences based on cosine similarity.
Let P =
(p 1 , · · · , p M ) and H =
(h 1 , · · · , h N ) be the premise and hypothesis, respectively, where p m and h n are extracted phrases.
We apply Sentence-BERT (Reimers & Gurevych, 2019) to each individual phrase and obtain the local phrase embeddings by
[Equation]
Local Transformer Encoder
T h
e r e i s o n e m a n h o l d i n g t
h e n e t .
H
y p
o t
h e s i s
S e n t e n c e - B E R
T
Premise Several men helping each other pull in a fishing net .
Local similarity matrix
Several men
One man pull in a fishing net holding the net helping P
H
Sentence-BERT
E C
N a) Phrase Detection and Alignment b) Phrasal NLI Prediction c) Sentence Label Induction
Global similarity matrix
Feed-forward Network
Global Transformer Encoder each other
A li g n m e n t S
e l e c t i o n
N o r m a li
z
e
Scores E C
N
P
h r a s e <EMPTY>
Sentence Label
F u zz y L
o g i c
[Table]
We also apply Sentence-BERT to the entire premise and hypothesis sentences to obtain the global phrase embeddings p ( G ) m and h ( G ) n by mean-pooling the features of the time steps corresponding to the words in the phrase.
The phrase similarity is given by
[Equation]
[Equation]
where γ is a hyper-parameter balancing the lexical and contextual representations of a phrase (Hewitt & Manning, 2019).
It is noted that Sentence-BERT is fine-tuned on paraphrase datasets, and thus is more suitable for phrasal similarity matching than pretrained language model (Devlin et al., 2019).
We obtain phrase alignment between the premise and hypothesis in a heuristic way.
For every phrase p m in the premise, we look for the most similar phrase h n from the hypothesis by
[Equation]
Likewise, for every phrase h n in the hypothesis, we look for the most similar phrase p m from the premise.
A phrase pair (p m , h n ) is considered to be aligned if h n is selected as the closest phrase to p m , and p m is the closest to h n .
Such hard alignment is different from commonly used soft attention-based approaches (Parikh et al., 2016).
Our alignment method can ensure the quality of phrase alignment, and more importantly, leave other phrases unaligned (e.g., helping each other in
Figure 1), which are common in the NLI task.
The process is illustrated in Figure 2a.
Phrasal NLI Prediction.
Our model then predicts the logical relationship of an aligned phrase pair ( p , h ) among three target labels: Entailment , Contradiction , and Neutral .
While previous work (Feng et al., 2020) identifies finer-grained labels for NLI, we do not follow their categorization, because it complicates the reasoning process and makes weakly supervised training more difficult.
Instead, we adopt three-way phrasal classification, which is also consistent with sentence NLI labels.
We represent a phrase, say, p in the premise, by a vector embedding, and we consider two types of features: a local feature p ( L ) and a global feature p ( G ) , re-used from the phrase alignment component.
They are concatenated as the phrase representation p
=
[ p ( L ) ; p ( G ) ] .
Likewise, the phrase representation for a hypothesis phrase h is obtained in a similar way.
Intuitively, local features force the model to perform reasoning in a serious manner, but global features are important to sentence-level prediction.
Such intuition is also verified in an ablation study (§ 4.2).
Then, we use a neural network to predict the phrasal NLI label ( Entailment , Contradiction , and
Neutral ).
This is given by the standard heuristic matching (Mou et al., 2016) based on phrase embeddings, followed by a multi-layer perceptron (MLP) and a three-way softmax layer:
[Equation]
where ◦ is element-wise product and a semicolon refers to column vector concatenation.
E , C , and N refer to the Entailment , Contradiction , and Neutral labels, respectively.
It should be mentioned that a phrase may be unaligned, but plays an important role in sentence-level
NLI prediction, as shown in Table 1.
Thus, we would like to predict phrasal NLI labels for unaligned phrases as well, but pair them with a special token ( p ⟨ EMPTY ⟩ or h ⟨ EMPTY ⟩ ), whose embedding is randomly initialized and learned by back-propagation.
Sentence Label Induction.
We observe the sentence NLI label can be logically induced from phrasal
NLI labels.
Based on the definition of the NLI task (Bowman et al., 2015), we develop the following induction rules.
Entailment Rule:
According to Bowman et al. (2015), a premise entailing a hypothesis means that, if the premise is true, then the hypothesis must be true.
We find that this can be oftentimes transformed to phrasal relationships: a premise entails the hypothesis if all paired phrases have the label Entailment .
Let { (p k , h k ) } Kk =1 (cid:83) { (p k , h k ) } K ′ k
= K +1 be all phrase pairs.
For k = 1 , · · · , K , they are aligned phrases; for k = K + 1 , · · · , K ′ , they are unaligned phrases paired with the special token, i.e., p k
= p ⟨ EMPTY ⟩ or h k = h ⟨ EMPTY ⟩ .
Then, we induce a sentence-level Entailment score by
[Equation]
This works in a fuzzy logic fashion (Zadeh, 1988; 1996), deciding whether the sentence-level label should be Entailment considering the average of phrasal predictions.
Here, we use the geometric mean, because it is biased towards low scores, i.e., if there exists one phrase pair with a low Entailment score, then the chance of sentence label being Entailment is also low.
Unaligned pairs should be considered in Eq.
(5), because an unaligned phrase may indicate Entailment , shown in the second example of Table 1.
Notice that the resulting value S sentence ( E | P , H) is not normalized with respect to Contradiction and Neutral ; thus, we call it a score (instead of probability), which will be normalized afterwards.
Contradiction Rule: Two sentences are contradictory if there exists (at least) one paired phrase labeled as Contradiction .
The fuzzy logic version of this induction rule is given by
[Equation]
Here, the max operator is used in the induction, because the contradiction rule is an existential statement, i.e., there exist(s) · · · .
Also, unaligned phrases are excluded in calculating the sentencelevel Contradiction score, because an unaligned phrase indicates the corresponding information is missing in the other sentence and it cannot be Contradiction (recall examples in Table 1).
Rule for Neutral:
Two sentences are neutral if there exists (at least) one neutral phrase pair, but there does not exist any contradictory phrase pair.
The fuzzy logic formula is
[Equation]
The first factor determines whether there exists a Neutral phrase pair (including unaligned phrases, illustrated in the first example in Table 1).
The second factor evaluates the negation of “at least one contradictory phrase,” as suggested in the second clause of the Rule for Neutral.
Finally, we normalize the scores into probabilities by dividing the sum, since all the scores are already positive.
This is given by
[Equation]
where L ∈ { E , C , N } , and Z = S sentence ( E |· ) + S sentence ( C |· ) + S sentence ( N |· ) is the normalizing factor.
Training and Inference.
We use cross-entropy loss to train our EPR model by minimizing − log P sentence ( t |· ) , where t ∈ { E , C , N } is the groundtruth sentence-level label.
Our underlying logical reasoning component can be trained end-to-end by back-propagation in a weakly supervised manner, because the fuzzy logic rules are almost everywhere differentiable.
While certain points in the max operators in Eqs.
(6) and (7) may not be differentiable at certain points, max operators are common in max-margin learning and the rectified linear unit (ReLU) activation functions, and do not cause trouble in back-propagation.
Once our EPR model is trained, we can obtain both phrasal and sentence-level labels.
This is accomplished by performing argmax on predicted probabilities (4) and (8), respectively.
Improving Textual Explanation.
Camburu et al.
(2018) annotated a dataset to address NLI interpretability by predicting an explanation sentence.
For the example in Figure 1, the reference explanation is “There cannot be one man and several men at same time.”
In this part, we apply the predicted phrasal logical relationships to textual explanation generation and examine whether our EPR’s output can help a downstream task.
Figure 3 shows the overview of our textual explanation generator.
We concatenate the premise and hypothesis in the form of “ Premise : · · · Hypothesis : · · · ”, and feed it to a standard Transformer encoder (Vaswani et al., 2017).
We utilize the phrase pairs and our predicted phrasal labels as factual knowledge to enhance the decoder.
Specifically, our EPR model yields a set of tuples { (p k , h k , l k ) } Kk =1 for a sample, where l k ∈ { E , N , C } is the predicted phrasal label for the aligned phrases, p k and h k .
We embed phrases by Sentence-BERT: p ( L ) and h ( L ) as in Eq.
(1); the phrasal label is represented by a one-hot vector l k =
onehot(l k ) .
They are concatenated as a vector m k
=
[ p k ; h k ; l k ] .
We compose the vectors as a factual memory matrix M =
[ m ⊤ 1 ; · · · ; m ⊤ K ] ∈ R K × d , where d is the dimension of m k .
[Figure]
Our decoder follows a standard Transformer architecture (Vaswani et al., 2017), but is equipped with additional attention mechanisms to the factual memory.
Consider the i th decoding step.
We feed the factual memory to an MLP as ˜ M
=
MLP( M ) .
We compute attention a f over ˜ M with the embedding of the input y i − 1 , and aggregate factual information c f for the rows m t in M f :
[Equation]
where a fk is the k th element of the a f vector and ˆ m t is the k th row of the ˜ M matrix.
The factual information c f is fed to another layer
g i =
MLP([ c f ; y i − 1 ]) + c f .
Our Transformer decoder layer starts with self-attention ˜
q i =
SelfAttn( g i ) .
Then, residual connection and layer normalization are applied as q i = LayerNorm(˜ q
i + g i ) .
A cross-attention mechanism obtains input information by v i =
CrossAttn
( q i , H ) , where H is the representation given by the encoder.
v i is fed to the Transformer’s residual connection and layer normalization sub-layer.
Multiple Transformer layers as mentioned above are stacked to form a deep architecture.
The model is trained by standard cross-entropy loss against the reference explanation as in previous work (Kumar & Talukdar, 2020; Zhao & Vydiswaran, 2021; Narang et al., 2020).
In this way, the model is enhanced with factual information given by our EPR weakly supervised reasoning.
Experiments will show that it largely improves the BLEU score by 2 points (§ 4.2), being a new state of the art.
This further verifies that our EPR indeed yields meaningful phrasal explanations.
E XPERIMENTS 4. D ATASETS AND E VALUATION M ETRICS
The main dataset we used in our experiments is the Stanford Natural Language Inference (SNLI) dataset (Bowman et al., 2015), which consists of 550K training samples, 10K validation samples, and another 10K test samples.
Each data sample consists of two sentences (premise and hypothesis) and a sentence-level groundtruth label.
4 For sentence-level NLI prediction, we still use accuracy to evaluate our approach, following previous work (Parikh et al., 2016; Chen et al., 2017; Radford et al., 2018).
To evaluate the phrasal reasoning performance, we need additional human annotation and evaluation metrics, because most previous work only considers sentence-level performance (Feng et al., 2020) and has not performed quantitative phrasal reasoning evaluation.
Although Camburu et al.
[Table] annotated phrase highlights in their e-SNLI dataset, they are incomplete and do not provide logical relationships.
Specifically, our annotators selected relevant phrases from two sentences and tagged them with phrasal NLI labels; they also selected and tagged unaligned phrases.
We further propose a set of F -scores, which are a balanced measure of precision and recall between human annotation and model output for Entailment , Contradiction , Neutral , and Unaligned in terms of word indexes.
Details of human annotation and evaluation metrics are shown in Appendix B.
Inter-annotator agreement is presented in Table 2 in comparison with model performance (detailed in the next part).
Here, we compute the agreement by treating one annotator as the ground truth and another as the system output; the score is averaged among all annotator pairs.
As seen, humans generally achieve high agreement with each other, whereas model performance is relatively low.
This shows that our task and metrics are well-defined, yet phrasal logical reasoning is a challenging task for machine learning models.
We evaluated our textual explanation approach on the e-SNLI dataset (Camburu et al., 2018), which extends the SNLI dataset with one reference explanation for each training sample, and three reference explanations for each validation or test samples.
Each reference explanation comes with highlighted rationales, a set of annotated words in the premise or hypothesis considered as the reason for the explanation annotation.
We do not use these highlighted rationales, but enhance the neural model with EPR output for textual explanation generation.
We follow previous work (Camburu et al., 2018;
Narang et al., 2020), adopting BLEU (Papineni et al., 2002) and SacreBLEU (Post, 2018) scores as the evaluation metrics; they mainly differ in the tokenizer.
Camburu et al.
(2018) also report low consistency of the third annotated reference, and thus use only two references for evaluation.
In our study, we consider both two-reference and three-reference BLEU/SacreBLEU.
Appendix A. provides additional implementation details of textual explanation generation.
4. R ESULTS
Phrasal Reasoning Performance.
To the best of our knowledge, phrasal reasoning for NLI was not explicitly evaluated in previous literature.
Therefore, we propose plausible extensions to previous studies as our baselines.
We consider the study of Neural Natural Logic (NNL, Feng et al., 2020) as the first baseline.
It applies an attention mechanism (Parikh et al., 2016), so that each word in the hypothesis is softly aligned with the words in the premise.
Then, each word in the hypothesis is predicted with one of the seven natural logic relations proposed by MacCartney & Manning (2009).
We consider the maximum attention score as the alignment, and map their seven natural logic relations to our three-category NLI labels: Equivalence , ForwardEntailment (cid:55)→ Entailment ; Negation ,
Alternation (cid:55)→ Contradiction ; and ReverseEntailment , Cover , Independence (cid:55)→ Neutral .
Table 2 shows that the word-level NNL approach cannot perform meaningful phrasal reasoning, although our metrics have already excluded explicit evaluation of phrases.
The low performance is because their soft attention leads to a large number of mis-alignments, whereas their seven-category logical relations are too fine-grained and cause complications in weakly supervised reasoning.
In addition, NNL does not allow unaligned words in the hypothesis, showing that such a model is inadequate for NLI reasoning.
By contrast, our EPR model extracts phrases of meaningful semantic [Table] units, being an appropriate granularity of logical reasoning.
Moreover, we work with three-category
NLI labels following the sentence-level NLI task formulation.
This actually restricts the model capacity, forcing the model to perform serious phrasal reasoning.
In addition, we include another intuitive BERT-based competing model for comparison.
We first apply our own heuristics of phrase detection and alignment (thus, the model will have the same
F UP and F UH scores); then, we directly train the phrasal NLI predictor by sentence-level labels.
We obtain the sentence NLI prediction by taking argmax over Eq.
We call this STP (Sentence label Training Phrases).
As seen, STP provides some meaningful phrasal reasoning results, because the training can smooth out the noise of phrasal labels, which are directly set as the sentence-level labels.
But still, its performance is significantly lower than our EPR.
Moreover, we see that EPR with local phrase embeddings achieves the highest reasoning performance, and that EPR with concatenated features achieve a good balance between sentence-level accuracy and reasoning.
Our EPR variants were ran 5 times with different initialization, and standard deviations are also reported in Table 4.
As seen, our improvement compared with the best baseline is aroundtimes of the standard deviation in mean F scores, which is a large margin.
Suppose the F scores are
Gaussian distributed, 5 the improvement is also statistically significant ( p -value <
1e-15 comparing our worse variant with the best competing model by one-sided test).
We further compare our EPR with non-reasoning models, which are unable to provide phrasal explanations but may or may not achieve high sentence accuracy.
Specifically, Mahabadi et al.
(2020) apply fuzzy logic to sentence embeddings.
They manage to reduce the number of model parameters, but their model is not interpretable.
Analysis.
We consider three ablated models to verify the effect of every component in our EPR model: (1) Random chunker, which splits the sentence randomly based on the number of chunks detected by our system; (2) Random aligner, which randomly aligns phrases but keeps the number of aligned phrases unchanged; and (3) Mean induction, which induces the sentence NLI label by the geometric mean of phrasal NLI prediction.
In addition, we consider local phrase embedding features, global features, and their concatenation for the above model variants.
Due to the large number of settings, each variant was run only once; we do not view this as a concern because Table 2 shows low variance of our approach.
Also, the underlying language model is un-finetuned in our ablation study, as it yields slightly lower performance but is much more efficient.
As seen in Table 3, the random chunker and aligner yield poor phrasal reasoning performance, showing that working with meaningful semantic units and their alignments is important to logical reasoning.
This also verifies that our word index-based metrics are able to evaluate phrase detection and alignment in an implicit manner.
Interestingly, local features yield higher reasoning performance, but global and concatenated features yield higher sentence accuracy.
This is because global features provide aggregated information of the entire sentence, but also allow the model to bypass meaningful reasoning.
In the variant of the mean induction, for example, the phrasal predictor can simply learn to predict the sentence-level label with global sentence information; then, the mean induction is an ensemble of multiple predictors.
In this way, it achieves the highest sentence accuracy (0.43 points higher than our full model with concatenated features), but is 6 points lower in reasoning performance.
This reminds us of the debate between old schools of AI (Chandrasekaran et al., 1988; Boucher & Dienes, 2003; Goel, 2022).
Recent deep learning models take the connectionists’ view
[Table]
and generally outperform symbolists’ approaches in terms of the ultimate prediction, but they lack expressible explanations.
Combining neural and symbolic methods becomes a hot direction in recent
AI research (Liang et al., 2017; Dong et al., 2018; Yi et al., 2018).
In general, our EPR model with global features achieves high performance in both reasoning and ultimate prediction for the NLI task.
[Table]
Results of Textual Explanation Generation.
In this part, we apply
EPR’s predicted output—phrasal logical relationships—as factual knowledge to textual explanation generation.
Most previous studies use the groundtruth sentence-level NLI label and/or highlighted rationales.
This requires human annotations, which are resource consuming to obtain.
By contrast, we require no extra humanannotated resources; our factual knowledge is based on our weakly supervised reasoning approach.
Table 4 shows our explanation generation performance on e-SNLI.
Since evaluation metrics are not consistently used for explanation generation in previous studies, we replicate the approaches when the code or checkpoint is available.
For large pretrained models, we quote results from the previous paper (Narang et al., 2020).
Their model is called WT5, having 220M or 11B parameters depending on the underlying T5 model.
Profoundly, we achieve higher performance with 60M-parameter
T5-small, which is 3.3x and 170x smaller in model size than the two WT5 variants.
In addition, we conducted a controlled experiment using the rationale highlights annotated by
Camburu et al.
(2018) for e-SNLI.
It achieves a relatively small increase of 0.2–0.5 BLEU points, whereas our EPR’s outputs yield a 2-point improvement.
The difference in the performance gains show that our EPR’s phrasal logical relationships provide more valuable information than humanannotated highlights.
In general, we achieve a new state of the art on e-SNLI with a small language model, demonstrating the importance of phrasal reasoning in textual explanations.
Additional Results.
We show additional results as appendices: § C.1.
Reasoning performance on the
MNLI dataset; § C.2.
Error analysis; § C.3.
Case studies of our EPR model; and § C.4.
Case studies of textual explanation generation.
C ONCLUSION
The paper proposes an explainable phrasal reasoning (EPR) model for NLI with neural fuzzy logic, trained in a weakly supervised manner.
We further propose an experimental design, including data annotation, evaluation metrics, and plausible baselines.
Results show that phrasal reasoning for NLI is a meaningfully defined task, as humans can achieve high agreements.
Our EPR achieves decent sentence-level accuracy, but much higher reasoning performance than all competing models.
We also achieve a new state-of-the-art performance on e-SNLI textual explanation generation by applying EPR’s phrasal logical relationships.
Limitation and Future Work.
This paper performs phrase detection and alignment by heuristics.
They work well empirically in our experiments, although further improvement is possible (for example, by considering syntactic structures).
However, our main focus is neural fuzzy logic for weakly supervised reasoning.
This largely differs from previous work based on manually designed lexicons and rules (Hu et al., 2020; Chen et al., 2021).
Our long-term goal is to develop a weakly supervised, end-to-end trained neuro-symbolic system that can extract semantic units and perform reasoning for a given downstream NLP task.
This paper is an important milestone towards the long-term goal.
A I MPLEMENTATION D ETAILS A. P HRASE D ETECTION
We present more details about our phrase detection.
We use SpaCy 6 to obtain the part-of-speech (POS) tag 7 of every word.
SpaCy also tags noun phrases.
However, if a noun phrase follows a preposition (with a fine-grained POS tag being IN ), we remove it from noun phrases but tag it as a prepositional phrase.
In addition, we extract verbs by the POS tag VERB .
A verb may be followed by a particle with the fine-grained POS tag being RP (e.g., show off ).
It is treated as a verb phrase.
In order to handle negation, we allow optional AUX NOT before a verb, (e.g., could not help ).
This, however, only counts less than 1% in the dataset, and does not affect our model much.
To capture all possible phrase-level semantic units, we treat remaining open class words 8 as individual phrases.
Finally, the remaining non-content words (in the categories of closed words and others) are discarded (e.g., “there is”).
This is appropriate, because they do not represent meaningful semantics or play a role in reasoning.
Table 5 summarizes all the rules used in our approach.
They are executed in order and extracted phrases are exclusive.
For example, the playground in the phrase at the playground will not be treated as a standalone noun phrase, as it is already part of a prepositional phrase.
Empirically, our rule-based approach works well for the NLI dataset, and our logical reasoning is at the granularity of the extracted phrases.
It should be mentioned that our rules are effective, easy to implement, and generalizable to different tasks.
In fact, they are used by third-party researchers for summarization after our paper was preprinted.
In their work, our rules are adopted to extract phrases for generating factually consistent and faithful summaries.
(Citations will be given after double-blind review.)
Therefore, these rules can be considered as additional contributions (instead of disadvantages) of this paper.
Our long-term research goal is to develop a fully automated mechanism that can perform phrase detection/alignment and logical reasoning in an end-to-end fashion, as mentioned in § 5.
[Table]
[Figure]
Details of the EPR Model.
We chose the pre-trained model all-mpnet-base-v2 9 from the SentenceBERT study (Reimers & Gurevych, 2019) and obtained 768 -dimensional local and global phrase embeddings.
Our MLP had the same dimension as the embeddings, i.e., 768 D for the local and global variants, or 1536 D for the concatenation variant.
We chose the coefficient for the global feature in Eq.
(2) from a candidate set of { 0 . 0 , 0 . 2 , 0 . 4 , 0 . 6 , 0 . 8 , 1 . 0 } .
Figure 4 shows the hyperparameter tuning results on SNLI (mentioned in § 4.2) and MNLI (to be discussed in § C.1).
We find that 0 .yields the best sentence accuracy in SNLI, and that 1 . 0 is the best for MNLI.
As our focus is on reasoning, we set the coefficient to be 0 . 6 , because it yields the highest phrasal reasoning performance and decent sentence-level performance for both experiments and in terms of both geometric mean and arithmetic mean of F scores.
During training, the pre-trained language model (LM) was either finetuned or un-finetuned.
Fine-tuning yields higher performance (Table 2), whereas un-finetuned
LM is more efficient for in-depth analyses (Table 3).
We trained the model with a batch size of 256.
We used Adam (Kingma & Ba, 2015) with learning rate of 5e-5, β 1 =0.9, β 2 =0.999, learning rate warmup over the first 10 percent of the total steps, and linear decay of the learning rate.
The model was trained up to 3 epochs, following the common practice (Dodge et al., 2020).
Our main model variants were trained 5 times with different parameter initializations, and we report the mean and standard deviation.
Details of Textual Explanation Generation.
We used the pretrained T5-small model for fine-tuning with a batch size of 32.
The optimizer was Adam with an initial learning rate of 3e-4, β 1 =0.9, β 2 =0.999, learning rate warm-up for the first 2 epochs, and linear decay of the learning rate up toepochs; then we decreased the learning rate to 3e-6 and trained the model until the validation BLEU score did not increase for 2 epochs.
B D ATA A NNOTATION AND R EASONING E VALUATION M ETRICS
Previous studies have not explicitly evaluated reasoning performance.
Typically, they resort to sentence-level classification accuracy (Wang & Jiang, 2016;
Mahabadi et al., 2020) or case studies (Parikh et al., 2016;
Feng et al., 2020) to demonstrate the effectiveness of their alleged interpretable models, which we believe is inadequate.
Therefore, we annotated a model-agnostic corpus about phrasal logical relationships and developed a set of metrics to quantitatively evaluate the phrasal reasoning performance.
The resources are released on our website (Footnote 1) to facilitate future research.
[Figure]
D ATA A NNOTATION
We annotated the phrases and their logical relationships in a data sample.
The annotators were asked to select corresponding phrases from both premise and hypothesis, and label them as either Entailment ,
Contradiction , or Neutral , with the sentence-level NLI label being given.
Annotators could also select a phrase from either a premise or a hypothesis and label it as Unaligned .
The process can be repeated until all phrases are labeled for a data sample.
Figure 5 shows a screenshot of our annotation page.
In the left panel, the annotator could select phrases in the two sentences and mark them with
NLI labels.
In the right panel, the annotator is able to view the annotated phrases of a sample, as well as navigating through different samples.
The annotation was performed by three in-lab researchers who are familiar with the NLI task.
Our preliminary study shows low agreement when the annotators are unfamiliar with the task; thus it is inappropriate to recruit Mechanical Turkers for annotation.
We randomly selected 100 samples for annotation, following previous work on textual explanation for SNLI (Camburu et al., 2018), which is adequate to show statistical significance.
Since our annotation only concerns data samples, it is agnostic to any machine learning model.
B. E VALUATION M ETRICS FOR P HRASAL R EASONING
We propose a set of F -scores in Entailment , Contradiction , Neutral , and Unaligned to quantitatively evaluate the phrasal reasoning performance.
We first introduce our metric for one data sample and then explain the extension to a corpus.
[Table]
P ) E
P ( H ) E
P E R ( P ) E
R ( H ) E
R E F E
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
Consider the Entailment category as an example.
We first count the number of “hits” (true positives) between the word indexes of model output and annotation.
Using word indexes (instead of words) rules out hitting the words in mis-aligned phrases (Example 1, Table 6).
Then, we calculate precision scores for the premise and hypothesis, denoted by P ( P ) E and P ( H ) E , respectively.
Their geometric mean P E =
( P ( P ) E
P ( H ) E ) 1 / 2 is considered as the precision for Entailment .
Here, the geometric mean rules out incorrect reasoning that hits either the premise or the hypothesis, but not both (Example 2,
Table 6).
Further, we compute the recall score R E in a similar way, and finally obtain the F -score by
F E = 2 P E R E P E + R E .
Likewise, F C and F N are calculated for Contradiction and Neutral .
In addition, we also compute the F -score for unaligned phrases in premise and hypothesis, denoted by F UP and F UH , respectively.
When calculating our F -scores for a corpus, we use micro-average, i.e., the precision and recall ratios are calculated in the corpus level.
This is more stable, especially considering the varying lengths of sentences.
Moreover, we compare model output against three annotators and perform an arithmetic average, further reducing the variance caused by ambiguity.
It should be emphasized that our metrics evaluate phrase detection and alignment in an implicit manner.
A poor phrase detector and aligner will result in a low reasoning score (shown in our ablation study), but we do not calculate phrase detection and alignment accuracy explicitly.
This helps us cope with the ambiguity of the phrase granularity (Example 3, Table 6).
To summarize, we propose an evaluation framework including data annotation (§ B.1) and evaluation metric (§ B.2).
This is our contribution in formulating the phrasal reasoning task for NLI.
C A DDITIONAL R ESULTS C. R ESULTS ON MNLI
In this appendix, we provide additional results on the matched section of the MNLI dataset (Williams et al., 2018), which consists of 393K training samples, 10K validation samples, and another 10K test samples.
It has the same format as the SNLI dataset, but samples come from multiple domains and are more diverse.
We follow § 4.1 and use the same protocol to create the phrasal reasoning annotation for MNLI dataset based on 100 randomly selected samples.
However, we found that MNLI is much noisier than SNLI; particularly, the sentences labeled as Neutral in MNLI share few related phrases.
For example, the two sentences do not have much in common in the sample “ Premise: If you still want to join, it might be worked. ”
and “ Hypothesis: Your membership is the only way that this could work ”.
Moreover, inter-human agreement is low in terms of the Neutral category.
Therefore, we believe the corpus quality is low for Neutral .
To ensure meaningful evaluation, we ignored the evaluation of Neutral in this experiment, although our reasoning approach is not changed.
The remainingsamples containing Entailment and Contradiction serve as the MNLI phrasal reasoning corpus.
We consider the EPR variant with concatenated local and global features, since the SNLI experiment shows it achieves a good balance between sentence-level accuracy and reasoning.
Our models were run 5 times with different initializations.
[Table]
As seen in Table 7, our EPR approach is again worse than humans, but largely improves the reasoning performance compared with NNL and STP baselines.
Its sentence-level prediction is also comparable to (although slightly lower than) finetuning Transformers.
The results are highly consistent with
SNLI experiments, showing the robustness of our approach.
C. E RROR A NALYSIS
To show how phrasal reasoning affects sentence-level prediction, we perform an error analysis in
Table 8.
Specifically, we examine the reasoning performance (arithmetic mean of F -scores) when the sentence label is correctly and incorrectly predicted in the SNLI dataset (Bowman et al., 2015).
As shown, EPR models with both local and concatenated features have much higher reasoning performance when sentence labels are correctly predicted than incorrectly predicted.
The positive correlation between the phrasal reasoning performance and sentence-level accuracy shows the meaningfulness of our fuzzy logic induction rule.
We also find that the model with local features has a higher reasoning performance than with concatenated features, even when the sentence-level prediction is wrong.
This is because the local model is unaware of the context of the sentences.
Thus, it must perform strict phrasal reasoning based on the induction rules, even if in this case the reasoning process is imperfect and leads to sentence-level errors.
C. C ASE S TUDY OF EPR
We present case studies of EPR in Figure 6.
We see that our EPR indeed performs impressive reasoning for the NLI task, which is learned in a weakly supervised manner with only sentence-level labels.
In Example (a), the two sentences are predicted Entailment because three young boys entails the boys and at the beach entails in the beach , whereas unaligned phrases enjoying and a day are allowed in the premise for Entailment .
In Example (b), playing contradicts asleep , and the two sentences are also predicted Contradiction .
Likewise, Example (c) is predicted Neutral because the aligned phrases on a concrete boardwalk and near the beach are neutral.
In our study, we also find several interesting examples where EPR’s reasoning provides clues suggesting that the target labels may be incorrect in the SNLI dataset.
In Example (d), our model
[Figure] [Figure]
EPR’s
[Figure]
Output on a deserted beach
[Figure]
Input Premise : Some dogs are running on a deserted beach.
Hypothesis : There is only one dog at the beach.
[Figure]
explanation Some dogs is more than one dog.
Reference explanations:
[Figure]
explanation generation)
[Figure]
predicts Neutral for looking and admiring , as well as for at black and white photos and the old photographs .
Thus, the two sentences are predicted Neutral , as opposed to the provided label
Entailment .
We believe our model’s reasoning and prediction are correct, because people looking at something may or may not admire it; a black-and-white photo may or may not be an old photo either (as it could be a black-and-white artistic photo).
C.
C ASE S TUDY OF THE T EXTUAL E XPLANATION G ENERATION
We conduct another case study to show how EPR’s reasoning is used in the textual explanation generation task.
As seen in Figure 7, factual information given by EPR’s weakly supervised reasoning yields meaningful structured factual tuples, namely, on a deserted beach entailing at the beach , Some dogs contradicting only one dog , and running unaligned (matched with a special token [EMPTY] ).
Our explanation generation model attends to these factual tuples, and the heat map shows that our model gives the most attention weights (with an average of 0.61) to the tuple, Some dogs contradicting only one dog , to generate the explanation “Some dogs is more than one dog.”
This example illustrates that the factual tuples given by our EPR model provides meaningful information to and improves textual explanation generation.