PathReasoner: Modeling Reasoning Path with Equivalent Extension for Logical Question Answering (2024)

Abstract: Logical reasoning task has attracted great interest since it was proposed. Faced with such a task, current competitive models, even large language models (e.g., ChatGPT and PaLM 2), still perform badly. Previous promising LMs struggle in logical consistency modeling and logical structure perception. To this end, we model the logical reasoning task by transforming each logical sample into reasoning paths and propose an architecture PathReasoner. It addresses the task from the views of both data and model. To expand the diversity of the logical samples, we propose an atom extension strategy supported by equivalent logical formulas, to form new reasoning paths. From the model perspective, we design a stack of transformer-style blocks. In particular, we propose a path-attention module to joint model in-atom and cross-atom relations with the highorder diffusion strategy. Experiments show that PathReasoner achieves competitive performances on two logical reasoning benchmarks and great generalization abilities.

heading: 1 Introduction
text: With the emergence of pre-trained language models (PLMs) (Kenton and Toutanova, 2019; Brown et al., 2020), recent years have witnessed remarkable progress in the task of machine reading comprehension (MRC) (Rajpurkar et al., 2016; Lai et al., 2017). To tackle more complex scenarios in reality, the challenging logical reasoning task (Yu et al., 2019; Liu et al., 2021a) has been proposed to exploit the model reasoning capability (Huang and Chang, 2023) over text1. Similar to the traditional MRC task, it also takes the context, question and options as inputs and requires the model to predict the final answer. Due to the diverse logical characteristics implied in the text, logical reasoning
∗Correspondence to Qika Lin and Jun Liu. 1Logical reasoning is a broad concept covering various
tasks, but we mainly address the task in the form of MRC.
task brings huge challenges to current LMs. Especially, faced with such tasks, large language models (LLMs), e.g., ChatGPT2 and PaLM 23, also struggle a lot which is proved by previous evaluation works (Xu et al., 2023a; Liu et al., 2023). Under such circumstances, this paper will focus more on addressing logical reasoning tasks with small LMs, which are light-weighted and more flexible for future applications4.
Previous competitive LMs expose two limitations in the performance. Firstly, it lacks consistent model predictions on samples with equal logical semantics. For example in Figure 1(a), we make changes to the expression of the original context while maintaining the semantic unchanged, where not...unless is equally transformed into the expression of only if. However, the LMs give inconsistent predictions between the original sample and the
2https://chat.openai.com 3https://ai.google/discover/palm2/ 4The focus of this paper is mainly on small LMs, since they are more efficient and effective compared with LLMs on the logical reasoning tasks. But we still report LLM performances for comparison in the experiment section.
13413
modified one. We blame the problem on the lack of training samples in logical reasoning. Compared with some classic MRC datasets like SQuAD (Rajpurkar et al., 2016, 2018), CoQA (Reddy et al., 2019) with over 100,000 training samples, logical reasoning datasets like ReClor (Yu et al., 2019) and LogiQA (Liu et al., 2021a) are much more sparse with only several thousand samples. Thus, such sparsity limits the learning of logic semantics. Previous work (Jiao et al., 2022) leverages general corpus to conduct continual pretraining, but it does not address the sparsity of logical text in essential.
Secondly, it remains a challenge to enhance the model perception for logical structures. For example in Figure 1(b), we randomly replace the explicit logical relation words or inverse the negations for the context, which destroys the original semantics. But the LMs fail to change the prediction accordingly. It demonstrates that current LMs are insensitive to the logical connectives, instead they focus more on facts within the text. Considering that current LMs are pre-trained with general objectives on the fact corpus (e.g., Wikipedia), they are naturally weak in capturing the logical structures usually existing in logical-specific scenarios. Some studies like DAGN (Huang et al., 2021), Logiformer (Xu et al., 2022), and AdaLoGN (Li et al., 2022) have attempted to model the explicit logical relations from various perspectives, such as causal and co-occurrence. All of them build text graphs to conduct the reasoning, which limits the scalability to larger text and more complex scenarios.
In view of the above challenges, we propose an architecture PathReasoner, which considers a new paradigm for logical reasoning tasks via reasoning path modeling. Based on the predefined logical rule forms, we represent each natural sentence as an atom and transform each sample into reasoning paths with confidence scores. Under such a paradigm, PathReasoner addresses the task from two views. From the view of expanding the data diversity, we first obtain equivalent atom combinations through external logical formulas, generating new reasoning paths and textualizing them as new samples. From the model view, we propose a reasoning path modeling network. It encodes both function symbols and variables in atoms and forms an atom embedding sequence as the input. In a path-attention module, we model high-order relations from both in-atom and cross-atom perspectives. Through the fusion of token, atom, and path
embedding, the prediction can be derived. Our technical contributions are as follows, and additional key values are in Appendix I: (1) We unify the text inputs into atoms and reasoning paths. Based on it, an architecture PathReasoner is proposed to improve both the diversity of samples and logic perception capability. (2) In light of the sparsity of training data, we propose an atom extension strategy to form new training samples. To better capture logical structures, we introduce a path-attention module with highorder relation modeling, enabling joint updates of information within atoms and across atoms. (3) Extensive experiments show superior performances on two logical reasoning benchmarks. Significant generalization capabilities are also verified.

heading: 2 Related Work
text: Recent progress in MRC promotes the emergence of more complex tasks like logical reasoning. Previously, several datasets on logical reasoning have been proposed, including ReClor (Yu et al., 2019), LogiQA (Liu et al., 2021a) and AR-LSAT (Zhong et al., 2021). They have attracted much attention since some LMs fail to show superiority. Previous works on the logical reasoning task can be categorized into two folds.
Sequence-based. These models are usually accompanied by data augmentation strategies. LReasoner (Wang et al., 2022) proposes to extend text with logical formulas to enrich the context information. MERIt (Jiao et al., 2022) proposes a contrastive strategy based on the meta-path and leverages the extra data to pre-train the model. However, both of them lack the relation modeling of logical units in the sequence.
Graph-based. DAGN (Huang et al., 2021) is the first work to divide the text into discourse units and utilize the graph neural networks (Zhou et al., 2020) to update the representations. But its chaintype graph structure limits the expression of complex relations between logical units. FocalReasoner (Ouyang et al., 2021) focuses on the fact triplet extracted from the text and builds a supergraph for reasoning. But it ignores the effects of the logical connectives within the text. To better model the logic within text, AdaLoGN (Li et al., 2022) designs an adaptive network to update the text graph progressively. Logiformer (Xu et al., 2022) proposes a two-branch graph transformer
network to address the text from syntax and logic. However, it is costly to form and update the text graph during the reasoning process. In general, the graph-based methods naturally lack expansibility, especially when the text becomes larger.
Considering the above drawbacks, we propose a reasoning pattern based on the reasoning paths (instantiated logical rules) for the first time. It models the logical reasoning task from a special perspective and combines the advantages of both sequence and graph-based methods.

heading: 3 Preliminary
text: This work considers unifying the inputs into the form of logical rules (Lin et al., 2021) since it is a more natural way to uncover logical structures of the text while maintaining the important facts. The distinctive values of such definitions over firstorder logic (Xu et al., 2023c) and propositional logic are in Appendix C. We introduce the following two definitions. Definition 1: atom. We transform each natural sentence into one atom (Hinman, 2018), which consists of one function symbol and several variables. For example, given the sentence Paula will visit the dentist only if Bill goes golfing, we define the expression OnlyIf(A,B) as the atom. OnlyIf is the function symbol that denotes the explicit connective phrase in the sentence. And A,B are called variables to represent abstract sentence constitutes, whose instantiation are Paula will visit the dentist and Bill goes golfing respectively. Similarly, we can also derive other atoms from the text, such as Unless(A,B), Since(A,B), InFact(A).
According to the reasoning patterns, we define four categories of function symbols, shown in Table 1. The first is causal relations for deterministic facts. The second and third ones are conditional assumptions, where NA focuses on the uniqueness of the condition. The last one is facts with no explicit logical relations. Definition 2: reasoning path. Based on Definition 1, we can unify the context, question and options of each input into the form of the logical rule (Lin et al., 2022; Pan et al., 2022), such as Eq. 1:
ε, F1(A,B) ∧ F2(C,A) ∧ F3(D) ∧ · · ·︸ ︷︷ ︸ rule body ⇒ Q(ai)︸ ︷︷ ︸ rule head . (1)
Rule body functions as the modeling of the context part, which is represented as the conjunction of
atoms. Rule head consists of the concatenation of the question sentence and option ai, which is also represented as the conjunction of atoms in the implementation. The symbol ε indicates the confidence score of the logical rule. Since each option is bounded with one logical rule, ε is also equal to the confidence of option ai. In actual cases, the function symbols (e.g., F1, F2) and variables (e.g., A,B) are instantiated as the natural language. Therefore, this paper defines the instantiated logical rule as the reasoning path.
Implementation We use over 100 pre-defined function symbols, grouped into four categories, and apply hand-crafted rules to match them in the sentence. The function symbols along with the punctuation can be divided into one or two parts, as instantiated variables. This strategy is relatively complete, illustrated in Appendix B.

heading: 4 Methods
text: To tackle the challenges in the logical reasoning task, we propose the architecture PathReasoner, shown in Figure 2. It includes two main parts: (a) Equivalent Path Extension (EPE) and (b) Reasoning Path Modeling (RPM). The former module is aimed at expanding the sample diversity to improve the consistency of model prediction. The latter one targets at improving the logic perception capability of the reasoning model.

heading: 4.1 Equivalent Path Extension
text: After unifying the inputs into the logical rule form, it is natural to exploit the equivalent logic to facilitate the equivalent extension.

heading: 4.1.1 External Logical Formulas
text: In the beginning, we introduce external logical formulas to achieve the atom extension. Corresponding to the function symbols, we employ the following logical formulas. (A) Equivalence Logic. It defines the bi-directional derivation between atoms as Eq. 2, where □ ∈
{Cause,SA} and ¬ denotes the negation.
□(A,B) ⇔ □(¬B,¬A). (2) (B) Single Atom Derivation. Such logical formula is targeted at transforming NA atoms to SA, i.e.,
NA(A,B) ⇒ SA(¬A,¬B). (3) (C) Multiple Atom Derivation. Depending on the conjunction of atoms, we can generate more diverse text. We only present the logical formulas with two atom conjunction in Eq. 4 and 5, since more complex situations can be derived by repeating the extension process.
⋆(A,B) ∧△(B,C) ⇒ ⋆(A,C), (4)
Fact(A) ∧▽(A,B) ⇒ Fact(B). (5) In above equations, ⋆ ∈ {Cause,NA,SA},△ ∈ {Cause,NA,SA} and ▽ ∈ {Cause,NA,SA}.

heading: 4.1.2 Reasoning Path Engine and Filter
text: Taking original reasoning paths and equivalent logical formulas as inputs, the reasoning path engine module aims to generate the candidate samples.
Firstly, we conduct multi-round atom extension. For example in Fig. 2(a), there exist four atoms in the original reasoning path. At the first round, the atom Unless(C,B) can derive If(¬C,¬B), and
also a new atom OnlyIf(C,A) can be added into the atom base through the conjunction derivation of Unless(C,B) and OnlyIf(B,A). We repeat the extension process to include all potential atoms. Thus, an extended atom base is formed.
Secondly, our purpose is to mine atom combinations to form new reasoning paths. By enumerating all possible combinations, we select the ones which can recover the original path in reverse. For example, the combination of OnlyIf(B,A), OnlyIf(C,B), Fact(¬C) and If(¬C,¬A) is a valid candidate because it can derive the original path with external logical formulas.
Thirdly, we replace the variables with the corresponding text and textualize the reasoning path form into regular sample form (with context, question and options).
To reduce noise (e.g., incorrect syntax) in the newly generated candidates, we introduce the path filter module. Specifically, we leverage the PLM (e.g., RoBERTa (Liu et al., 2019)) to train the original samples from the downstream datasets. Therefore, a set of weight parameters is obtained, which is defined as the pre-trained filter in this paper.
When feeding each sample into the pre-trained filter, we can obtain the confidence score εi of the ith reasoning path related to option ai. The predicted option ak is derived with the maximum confidence scores. We keep the samples with both
correct predictions and high scores, which means ak = a
∗ and εk > ε∗. ak is the predicted option with confidence score εk. a∗ is the ground-truth option and ε∗ is the threshold that controls the effectiveness of the reasoning path filter.

heading: 4.2 Reasoning Path Modeling
text: From the model view, we propose the reasoning path modeling module. Given the input context, question, and options of one sample, we first unify them into the form of the reasoning path based on 3. The initial representation of instantiated variable set V = {V1, V2, ..., VK} and function symbols set S = {S1, S2, ..., SM} can be acquired respectively, where K and M are the number of variables and function symbols in the sample.
For the variable Vk with token sequence {v(k)1 , v (k) 2 , ..., v (k) |Vk|}, we leverage the LM as the encoder to obtain the token-level embedding {v(k)1 , v (k) 2 , ..., v (k) |Vk|}. Thus, its initial representation Vk ∈ Rd is calculated by the average pooling. We randomly initialize the representations for the function symbol Sm:
Vk = 1
|Vk|
Vk∑
i=1
v (k) i , Sm = Init(Sm). (6)
By aligning the variables and function symbol for each atom, we can form the atom embedding sequence A ∈ R(M+K)×d. To take the order feature into consideration, we include the position embedding (Vaswani et al., 2017) to the input sequence:
Ai = Ai + PosEmbed(Ai), (7)
where Ai is the embedding of the ith unit in A, which can be either a variable or a function symbol. In this way, PathReasoner implements the sequential representation of logical rules.
To perform message passing over the reasoning paths, we propose a stack of L layer blocks in a similar style of Transformer. Specifically, we feed the input sequence into both the self-attention and the proposed path attention module.
For the self-attention module of the lth layer, we follow the regular method, which projects the input sequence into query Q(l) ∈ R(M+K)×d, key K(l) ∈ R(M+K)×d and value V(l) ∈ R(M+K)×d by the projection matrices. Then, the output of the self-attention module can be derived as H(l)SA.
For simplicity, we omit the description of multihead attention in the main paper, but the selection of head number will be discussed in Appendix E.3.
For the path attention module, we first obtain the interaction matrix M(l)seq ∈ R(M+K)×(M+K) by self multiplication of the input sequence A. It models the interaction between any two units. Besides, the importance of each unit can be further considered from the perspective of in-atom and cross-atom.
In-atom interaction models the information aggregation within one atom. Take the atom Si(Vj , Vk) with two variables Vj , Vk and one function symbol Si as an example (i,j and k are index in the input sequence), the attention score can be computed as:
s (l) in = LeakyReLU(W (l) in tanh(V (l)||S(l)i )), (8)
where S(l)i ∈ Rd denotes the embedding of function symbol Si. V(l) ∈ Rd is obtained by averaging the variable embedding V(l)j and V (l) k . For atom with a single variable, the average step can be omitted. || represents the concatenation between feature vectors. W is the trainable projection parameters (the same below).
To embed the in-atom attention, we leverage a score matrix M(l)in ∈ R(M+K)×(M+K):
M (l) in (i, j) = M (l) in (i, k) = { s (l) in , Si(Vj , Vk) exists −∞, otherwise .
(9) We define M(l)in as a symmetric attention matrix, thus there also exist M(l)in (j, i) = M (l) in (i, j) and M (l) in (k, i) = M (l) in (i, k).
Cross-atom interaction models the message passing over different atoms. For the same variable Vp and Vq (p, q are unit index of the input sequence), the attention score is obtained:
s(l)crs = LeakyReLU(W (l) crs((V (l) p +V (l) q )/2)),
(10) where V(l)p and V (l) q are the embeddings of two instantiated variables. Similar to in-atom attention, we obtain a crossatom score matrix M(l)crs ∈ R(M+K)×(M+K):
M(l)crs(p, q) = { s (l) crs, if Vp, Vq co-occurs −∞, otherwise (11)
Since these two attention matrices only model one-order interaction between related units, the long-distance message passing is limited. Also, we extract the atom based on the explicit logical connectives, it ignores the implicit interactions within the logical text. Therefore, we introduce a diffusion aggregation strategy (Zhao et al., 2021; Liu et al., 2021b) to achieve high-order attention:
M (l) in−h =
N∑
i=1
αi(M (l) in ) i, (12)
M (l) crs−h =
N∑
i=1
βi(M (l) crs) i, (13)
where N is the maximum order number, αi and βi are the trade-off coefficients to control the diffusion procedure. In this way, the one-order attention flow can be efficiently diffused to high-order relations. We can update the feature of sequence H(l)seq ∈ R(M+K)×d through joint utilization of these three attention matrices:
H(l)seq = softmax(M (l) seq +M (l) in−h +M (l) crs−h)A.
(14) Within each atom, we aggregate the instantiated variable embedding in the function symbol to acquire a sequence of atom embedding, which can be represented as {H(l)S1 , ...,H (l) SM
}. Next, we define the reasoning path H(l)p ∈ Rd embedding as:
H(l)p = MeanPool( M
|| i=1 H (l) Si ). (15)
To align the output embedding of the selfattention module, we repeat and stack the reasoning path embedding for M+K times, obtaining the output of path-attention module H(l)PA ∈ R(M+K)×d. Note that the multi-head strategy is also applied in the path-attention module.
We obtain the optimized sequence embedding by adding H(l)SA and H (l) PA. Following the common practice in the Transformer architecture, we feed the sequence into the feedforward block and obtain the final output H(l)t of l
th layer. After the respective mean pooling process on
Hcls, H (L) t and H (L) p , the three features are concatenated and projected for the final prediction.

heading: 5 Experiments
text: This section provides comparison experiments with other strong baselines on two logical reasoning benchmarks. Extensive ablation studies and generalization evaluations are also followed.

heading: 5.1 Datasets and Baselines
text: The main experiments are conducted on two logical reasoning datasets ReClor (Yu et al., 2019) and LogiQA (Liu et al., 2021a). To verify the superiority of PathReasoner, we compare it with strong baselines, including RoBERTa-large (Liu et al., 2019), DAGN (Huang et al., 2021), FocalReasoner (Ouyang et al., 2021), LReasoner (Wang et al., 2022), AdaLoGN (Li et al., 2022), MERIt (Jiao et al., 2022), Logiformer (Xu et al., 2022), as well as LLMs like text-davinci-003, GPT-3.5-turbo and PaLM 2. All the experiments are conducted with a single GPU of Tesla A100. All detailed experimental settings are listed in Appendix E.3.

heading: 5.2 Comparison Results
text: The results of comparison experiments are presented in Table 2. Compared with previous SOTA baselines, PathReasoner presents superiority.
In ReClor dataset, PathReasoner outperforms all the graph-based methods. Compared with the SOTA method Logiformer, PathReasoner achieves improvements of 2.00% and 0.60% on the validation and test splits respectively. PathReasoner also shows superiority over all sequence-based methods, especially outperforming MERIt by 2.50% on the test split. Importantly, it surpasses human performance, i.e., 64.10% vs 63.00%, which greatly pushes the boundary of machine reasoning. In LogiQA dataset, PathReasoner still shows competitive performances, improving the SOTA results by 2.46% on the test split. PathReasoner demonstrates excellent performance and generalization in logical reasoning, as evidenced by its consistent results across two benchmarks.
Compared with representative LLMs, PathReasoner exhibits great superiority with a wide margin in the ReClor dataset. Also in the LogiQA dataset, it outperforms both text-davinci-003 and GPT-3.5 with obvious advantages and only falls behind PaLM 2 which is over x1000 in size.

heading: 5.3 Ablation Studies
text: Ablation studies for two main parts EPE and RPM in Table 3. For w/o whole of EPE, we remove
the whole part of EPE and only utilize the origin samples for training. The performance witnesses obvious drops of 3.70% and 2.00% on the two datasets respectively. For w/o path filter, we keep all the new paths to generate samples without filtering. The results prove the effectiveness of it with 1.30% and 1.23% gains on the test respectively. For w/o whole of RPM, we ablate the whole RPM and simply leverage the input sequence to predict the answer through a text encoder and a classifier. In this case, the model degenerates to RoBERTa-large baseline with more samples from EPE part. The results prove that the modeling of path significantly enhances the reasoning process.
To deeply verify modules in RPM, we carry out the following ablation studies. For w/o path attention, we remove the path attention module. The performance gains prove that it is key to RPM part. For in-atom att. and cross-atom att., we respectively ablate the attention modeling within atoms and across atoms. The former benefits the ReClor dataset a lot, while the latter is more helpful to the LogiQA dataset. It illustrates that in-atom and cross-atom attention are complementary to each other. For w/o diffusion, we remove the high-order diffusion strategy. Experiments show that the diffusion strategy is also vital to RPM part.

heading: 5.4 In-depth Analysis
text: We first analyze the model performances with different lengths of atoms in Fig. 3a. The bars represent the number of samples with different atom numbers, while the lines denote the performances with different atom numbers. For both ReClor and LogiQA datasets, PathReasoner maintains a high performance with moderate scale of atoms, which accounts for most samples in both datasets. Confronted with larger sample sizes, the performances decline. We argue that the gaps have been greatly narrowed with the proposed diffusion strategies, compared with previous models.
Secondly, we provide an analysis of the impact of the number of new samples. By controlling the maximum scale of new atom combinations, we can generate different numbers of samples. Fig. 3b shows the model performances under various cases,
where the horizontal axis denotes the number of new samples (with & w/o path filter) and the vertical axis is the model performance on the test. On the two datasets, the path filter plays a positive role in reducing redundancy and noise. Additionally, the optimal results are obtained at a moderate scale of new samples, and larger amounts of samples do not always bring gains in performance.
Thirdly, we discuss the model training efficiency in Fig. 3c. We make the comparison with the previous SOTA Logiformer on ReClor (left) and LogiQA (right). To make a clear illustration, we report the loss curve with steps (truncated at 0.1). From the results, PathReasoner shows faster convergence speed on both ReClor and LogiQA datasets. Detailedly, PathReasoner achieves 1.66x convergence speed than Logiformer on the ReClor dataset, and it has 1.34x speed on the LogiQA dataset. We provide more in-depth experiments in Appendix F.

heading: 5.5 Model Generalization
text: PathReasoner is also evaluated on other reasoning tasks to verify the generalization capability in Table 4. The experiments are conducted on Dream (Sun et al., 2019) and MuTual (Cui et al., 2020), which are multi-turn dialogue datasets requiring complex reasoning. We utilize RoBERTa-Large
model and the previous SOTA model Logiformer as baselines. Among all comparison metrics, PathReasoner achieves consistent superiority over them. Compared with Logiformer, PathReasoner outperforms it with 3.08% in the test split of Dream, 0.89% of the R@1 metric of MuTual and 1.81% of the R@1 metric of MuTual+. It demonstrates that PathReasoner can well generalize to different reasoning tasks. Also, other generalization experiments on EPE module and zero-shot settings are included in Appendix G,H.

heading: 5.6 Case Study
text: We provide the analysis for the interpretability of PathReasoner in Figure 4. In the successful case, PathReasoner correctly extracts the variables from the text and forms the reasoning path. In particular, We present the path attention map from RPM part to check the logical perception capability. Firstly, PathReasoner focuses more on the function symbols (e.g., If and Fact) and question sentences
(i.e., variable F ), with higher attention scores in the map. It verifies that PathReasoner is equipped with the perception of logic and question types. Secondly, the question is to match the logical structure between context and option. The corresponding atoms (e.g., If(D,E) and If(J,K)) are considered together in the module. It illustrates that PathReasoner is good at understanding the question and reasoning over paths.
In the failure case, PathReasoner wrongly categorizes the variable with different semantics together to A which leads to the mistake. It demonstrates that the variable extraction in PathReasoner is not good at distinguishing the minor difference, which has space for improvement.

heading: 6 Conclusion
text: To tackle the logical data scarcity and weak model perception of logical structures, we propose a new paradigm to model the logical reasoning task by representing each natural sentence as atom form and transforming logical samples into reasoning paths. Based on such unique modeling, an architecture PathReasoner is proposed to address the challenges. It achieves SOTA performances on two logical reasoning datasets. Also, extensive experiments demonstrate the effectiveness of each module and great generalization capability on other complex reasoning scenarios. In the future, we will propose a unified architecture based on PathReasoner to tackle the logical reasoning tasks over different modalities (e.g., images, text, graphs).

heading: 7 Acknowledgement
text: This work was supported by National Key Research and Development Program of China (2022YFC3303600), National Natural Science Foundation of China (62137002, 62293550, 62293553, 62293554, 61937001, 62250066, 62176209, 62176207, and 62192781), "LENOVOXJTU" Intelligent Industry Joint Laboratory Project, Natural Science Basic Research Program of Shaanxi (2023-JC-YB-593), the Youth Innovation Team of Shaanxi Universities, XJTU Teaching Reform Research Project "Acquisition Learning Based on Knowledge Forest".
Limitations
This paper proposes a novel direction for addressing logical reasoning tasks, which differs from the sequence-based methods and graph-based methods.
The core of the proposed model is to transform the input text into the form of logical rules with the conjunction of atoms and realize the equivalent extension and path reasoning over it. However, the extraction process of atoms is still very challenging. Although the current algorithm predefines some basic logical relations in advance and achieves great progress, it also requires the help of more comprehensive external logic bases in the future to improve the accuracy of atom extraction. In addition, the logical text in reality often contains noise (e.g., wrong logic). Although this paper has conducted extensive experiments on other reasoning datasets and complex settings to verify the generalization capability, there still remain unsolved on how to promote the models to more complex settings, like multi-modality scenarios.

heading: A Pilot Experiments
text: In this section, we provide the detailed pilot experiments mentioned in Fig. 1 of the main paper. For the model prediction consistency test, we equally replace the explicit logical connectives in a part of the samples on ReClor. The differences in performances are presented in Table 5.
It can be seen that current PLMs fail to maintain equal predictions on samples with the same logical semantics. It proves the motivation of the proposed method. Also, we provide the performances of PathReasoner in the same setting as the pilot experiments. Our model largely improves the prediction consistency, and only fails in 1.50% of the cases. It illustrates the robustness of PathReasoner in logic.
In addition, we conducted experiments on the model perception of logical connectives. By adding, deleting, or modifying the explicit logical connectives on some samples, we randomly break the original semantics of the context. We report the ratio of samples that fail to follow the logical changes. It tests the sensitivity of the model for capturing the logical relations. Results are shown in Table 6.
From the results, current PLMs are not always sensitive to the changes of logical connectives. BERT and RoBERTa can merely distinguish 29.30% and 21.63% of changes respectively. Therefore, it is worth considering enhancing the logic modeling for the language models, which supports our motivations. Also, we report the performance of PathReasoner on the last row of the table. Our model shows great superiority on enhancing the model perception of explicit logical connectives, being sensitive to 71.95% of the cases. It well verifies and supports our motivations.

heading: B Key Questions for Extraction Process
text: The whole extraction process leads to several key questions:
(1) Scenario coverage. Our predefined rules are relatively complete, and have covered extensive cases in syntax (guided by experts). We include over 100 instantiated function symbols (curated from NLTK) and it can cover most logical scenarios (details in Appendix D). Therefore, it can ensure the wide coverage of logical scenarios. Beyond that, we also include the Fact category of function symbols. It can be adapted to facts that do not have obvious logic. To sum up, our heuristic rules can extend to any kind of text in theory.
For an example out of the logical domain, the input is factual paragraph X, which consists of sentences A, B, C, and D. Our method adapts to such a scenario, and it can output Fact(A) ∧ Fact(B) ∧ Fact(C) ∧ Fact(D).
(2) Extraction accuracy. Based on the above descriptions, our method can cover any kind of text in theory. We randomly select 30 paragraphs, resulting in 148 pieces of sentences. We manually label the extraction accuracy of each sentence. To make a comparison, we also prompt GPT-4 (instruction+predefined function symbols + atom form+4shot examples) to finish this process. The results are listed in Table 7.

heading: C Distinction of Our Logical Forms
text: As some examples presented, our predefined logical forms are similar to first-order logic (FOL) and propositional logic. But our forms are more suitable for the scenarios in the following aspects.
(1) Customized function symbols. We define four types of function symbols and they are effective in equivalent transformation. The general FOL and propositional logic can not satisfy our customized requirements.
(2) Perception of sentence-level logic. In logical reasoning scenarios, rich logic exists more at the sentence level, thus we transform each sentence into an atom. However, FOL and propositional
logic are conditioned at the entity level or span level, which is more fine-grained. They are not necessarily effective in capturing logic.

heading: D Statistics of Function Symbols
text: In this section, we present the statistics of the logical connectives in two logical reasoning datasets ReClor and LogiQA. It will provide intuitive proof of the necessity and rationality of the function symbol categories.
Figure 5a presents the statistics of function symbols (i.e., Cause, SA, NA, Fact) in the context of two benchmarks. The outer cycle represents the train split, the middle one is the validation split and the inner one is the test split. In the ReClor dataset, nearly 40% of atoms are non-fact, which contain explicit logical connectives (i.e., Cause, SA, NA). Among them, Cause relations are the majority. In the LogiQA dataset, the ratio of the logical function symbols drops a lot, but it still accounts for about 20%.
Figure 5b shows the statistics of logical samples. We categorize the samples with any one of the three logical function symbols into has logic. Similar, we include samples with Cause, SA and NA to has Cause, has SA and has NA respectively. In ReClor, nearly 70% of the samples have explicit logical connectives. Also, over 60% of samples contain Cause atoms. In LogiQA, samples with logical connectives account for 50%. The ratio of samples containing Cause atoms drops to about 35% while the ratio of samples with NA atoms increases.
The above analysis illustrates that the two benchmark datasets are abundant in logical connectives. Thus, the modeling of logical atoms is of great necessity.

heading: E Experimental Settings
text: E.1 Benchmarks and other Datasets ReClor and LogiQA are two representative datasets for the logical reasoning task. The details are presented as follows. ReClor (Yu et al., 2019) includes 6,138 samples total with 4,638 training samples, 500 validation samples, and 1,000 samples for test. All of them are collected from some standardized graduate admission examinations. To discriminate the difficulty of the questions, the test split is divided into Test-E and Test-H, where the former represents the easy version of the test samples and the latter denotes the harder parts.
(a) Statistics of function symbols in train (outer cycle), validation (middle cycle) and test (inner cycle) splits.
LogiQA (Liu et al., 2021a) includes 8,678 samples sourced from National Civil Servants Examinations of China. It is further split into the training set, development set, and test set, with 7,376, 651, and 651 samples respectively.
Also, to verify the model generalization capability, we employ two dialogue datasets involving complex reasoning, which are Dream and MuTual. Also, we exploit the zero-shot logical reasoning capability of the proposed model on the recently proposed ZsLR benchmark. The details are presented below. Dream (Sun et al., 2019) contains 6,444 multiple choice questions, sourced from English-as-aforeign-language examinations. The samples are split into train, development and test sets with 3,869, 1,288 and 1,287 samples respectively. We report the exact match metric on both validation and test splits. MuTual (Cui et al., 2020) consists of 8,860 questions, divided into 7,088 training samples, 886 validation samples, 886 test samples. It is modified from Chinese high school English listening comprehension test data. Also, MuTualplus dataset is proposed to test whether the model is capable of selecting a safe response when necessary. Since the test split of MuTual is not made public, we only report the R@1 metric (recall at position one) on the validation set. ZsLR (Xu et al., 2023b) includes 6 zero-shot splits modified from ReClor dataset. Since the dataset contains 17 reasoning types in total, some types of samples are classified as seen types during training. For the test, it defines two metrics, one is Test-All
which tests on all the types of samples, and another is Test-Unseen which only tests on the unseen parts of types.
In this paper, we compare PathReasoner with all the previous methods of the logical reasoning task, including the SOTA model Logiformer. There methods can be categorized into sequence-based and graph-based, shown in Table 8. (1) Random. The results are obtained from the random predictions. (2) RoBERTa-Large (Liu et al., 2019). The trained language model RoBERTa is employed as the text encoder to obtain the predictions. It is also the same with the baselines of BERT-Large (Kenton and Toutanova, 2019) and XLNet-Large (Yang et al., 2019). (3) Human Performance (Yu et al., 2019; Liu et al., 2021a). The performances are averaged from the scores of some graduate students on the test split. (4) DAGN (Huang et al., 2021). It is the first graph-based work to tackle the logical reasoning task. It splits the text into nodes and leverages the graph neural networks to reason over the chain-type graph. (5) FocalReasoner (Ouyang et al., 2021). It focuses on the facts within the context and it extracts all the fact units to form a supergraph for reasoning. (6) LReasoner (Wang et al., 2022). It proposes to leverage the defined rules (e.g., De Morgan’s Laws) to extend the context. In addition, it employs data augmentation strategies (e.g., contrastive learning) to improve the diversity of the samples. (7) MERIt (Jiao et al., 2022). It proposes a metapath guided strategy to conduct the pretraining on the external corpus. The pre-trained module is further verified based on some off-the-shelf SOTA
methods. For a fair comparison, we directly derive the results of MERIt with the RoBERa-Large backbones from the original paper. (8) AdaLoGN (Li et al., 2022). It first builds a text graph based on the off-the-shelf method and models it in an adaptive neuro-symbolic system. (9) Logiformer (Xu et al., 2022). It models the context from the perspective of both logic and syntax, building a causal graph and a co-occurrence graph. Specifically, it reasons on the graph transformer networks with biased attention.
Additionally, we include the following representative large language models to make the comparisons. (10) text-davinci-003. It was created by OpenAI, of which the training data was collected up to Sep. 2021. The size of text-davinci-003 is 175B. (11) GPT-3.5-turbo. It is also from OpenAI and the training corpus is collected up to June. 2021. GPT-3.5-turbo is of the same size as text-davinci003. (12) PaLM 2. It was created by Google. It has a larger size than the above two LLMs, which is 540B.
The results of the three LLMs on the logical reasoning benchmarks are collected from (Xu et al., 2023a).
E.3 Implementation Details
In the implementation, to make a fair comparison, we employ the RoBERTa-large (Liu et al., 2019) model with the hidden size of 1024 as the encoder of text. We utilize the Adam (Kingma and Ba, 2014) for the optimization. Also, we set different hyper-parameters for the two logical reasoning datasets respectively. We tune some of the hyperparameters for the optimal within a scope. Table 9 presents the detailed information.
The listed hyper-parameters belong to three parts: general settings, equivalent path extension module, and reasoning path modeling module. Considering the calculation cost, we do not utilize the grid search strategy, instead, we sequentially search the hyper-parameters for the optimal. For the reasoning path modeling module, we select the maximum diffusion order N to be 2. Therefore, there only exist four diffusion trade-off co-efficient α1, α2, β1, β2, which satisfy α1 + α2 = 1 and β1 + β2 = 1. So we only list the tuning details of in-atom diffusion trade-off α1 and cross-atom diffusion trade-off β1.
F In depth Analysis
In this section, we provide more experiments to analyze the model performances.
F.1 Model Performance on Multiple Logics In the category of function symbols, we take Cause, SA, NA and Fact into consideration. Among them, the first three represent the logical relations (nonfact) while the last one represents the factual expression. Therefore, we give an analysis of how our model performs on these factual or logical samples. We test the model performance on three types of samples: (1) Fact, where all atoms are factual; (2) Simple Logic, where there only exists one category of logical function symbols in each sample; (3) Complex Logic, where multiple categories of logical function symbols are included in one sample. Table 10 presents the results of PathReasoner on the above settings, compared with RoBERTaLarge model and Logiformer. Since ReClor does not make the test split public, we only report the results on the validation split.
For factual types of samples, PathReasoner achieves 4.41% gains over the baselines. We argue that previous method like Logiformer focuses too much on the capture of logical relations but fails to better generalize to the fact-only samples. PathReasoner leverages the atom form to represent both the logical content and the factual content, thus it can also improve the performances on factual samples.
For simple logic samples and complex logic samples, PathReasoner also shows the superiority of 1.85% and 1.23% over Logiformer respectively. It demonstrates the competitiveness of PathReasoner in logical perception and reasoning. Meanwhile, we witness that PathReasoner does excellent in capturing simple logic and maintaining factual reasoning, but there still exists space for improvement on the complex logic.
F.2 Model Performance on Different Reasoning Types
In the ReClor dataset, the samples are divided into 17 reasoning types. Table 11 gives in-depth model performances on different reasoning types. Limited by space, we only present 11 types in the table. From the results, PathReasoner performs better in most cases. Specially, for IF, MF and MS, PathReasoner achieves obvious superiority. Considering that these reasoning types require the perception of logical structures, the gains in performance prove the effectiveness of PathReasoner.
F.3 High-order Diffusion Strategy Analysis
In the implementation, we set the maximum order of diffusion to 2, that is N = 2. Therefore, we employ two trade-off coefficients αi and βi to control the diffusion procedure. We search αi and βi from the set of {0, 0.1, 0.2, 0.3, 0.4} and report the results on the test split of ReClor in Figure 6. From the results, PathReasoner achieves the optimal simultaneously on both the validation and test splits.

heading: G Generalization of Equivalent Path Extension Module
text: Beyond the main experiments on logical reasoning benchmarks, generalization experiments (Table 4) and zero-shot settings (Table 6), we add a simple experiment with our proposed equivalent path extension (EPE). The aim is to achieve a plugin-and-play function to augment the training of LLMs. In detail, we randomly sample from the Flan collection (Wei et al.), leading to 80K original instruction-following samples. Then, we apply EPE to generate equivalent instruction samples. These augmented samples are leveraged to tune LLaMA-2-Chat (7B). The test experiments on MMLU (57 tasks) and BigBenchHard (21 tasks) are presented in Table 13.
With the EPE augmentation process, the tuned LLaMA-2-Chat can witness significant performance improvements, compared with two base-
lines: one is LLaMA-2-Chat, and another is LLaMA-2-Chat tuned on sampled Flan collection. Such findings largely expand the application scope of PathReasoner, especially in empowering the training of off-the-shelf LLMs.

heading: H Model Generalization on Zero-shot Logical Reasoning Settings
text: Previous work (Xu et al., 2023b) argued that the ideal full-data setting is not sufficient to test the logical reasoning performances and has proposed a new benchmark for generalized zero-shot logical reasoning (named ZsLR). To verify the model generalization on the zero-shot settings, we conduct experiments on ZsLR and compare with several SOTA baselines. The results are shown in Table 12.
From the results of 6 splits, PathReasoner is competitive on the majority of the cases compared with TaCo and Logiformer. For split v1, v3, v4, v5 and v6, PathReasoner outperforms all the strong baselines on the metric of Test-All, which verifies the great generalization ability on both seen and unseen
types of samples. Compared with the full-data setting SOTA model Logiformer, PathReasoner shows obvious superiority on all the splits and all the test metrics. The great advantages uncover the huge potential of modeling reasoning paths for the logical text, which improves the extensibility and generalization of the model. Also, it is worth noticing that there still exists space for improvement on the unseen types of samples, especially on the split of v2, v4, and v6.

heading: I Restatement of Our Key Novelty
text: We will clarify the obvious differences of our method compared with previous works (especially, the graph-based method). It can be divided into three points.
Extraction strategy. Transforming the natural language into units is a common method in the reasoning field. However, we largely differ in the definition of relationships. Previous works only limit to a subset of relation words. For example, Logiformer only attends to causal relations as the connectives. It is sufficient for evaluations (see Appendix D), which overfit the logical reasoning benchmarks. However, our definition of function symbols is different from previous works, and our coverage is broad enough (over 100 relation words). Therefore, our method can be extended to other scenarios, which have been verified with generalization experiments and zero-shot settings.
Flexible extension strategy. Benefiting from the distinctive definition of function symbols, we can formulate the context into the conjunction of atoms (i.e., reasoning paths). Therefore, we can easily conduct the equivalent path extension to derive new combinations of atoms. This advantage is distinctive from other works. It is also one of our main contributions.
In some graph-based methods, the text graph is updated to capture new relations along with the message-passing process. The whole process is extremely time-consuming, which is the main shortcoming. Our method actually decouples the dynamic extension process with the formulation of atoms and paths. It augments data diversity and improves training efficiency.
Incoporated advantages in the path attention module. In fact, the path attention module combines the advantages of sequence-based and graphbased methods. Previous sequence-based meth-
ods ignore logical structures but can handle longdistance dependency with Transformer structure. Graph-based methods usually rely on GNN-style modules to update the features, but lack the extensibility to larger context and fine-grained modeling within each unit (Logiformer attempts to solve it through attention bias, but still limits to a coarse level). In our path attention module, the advantages of sequence- and graph-based methods are inherited. It further achieves differentiable and interpretable reasoning (see Case Study).
To sum up, the distinctions between PathReasoner and other methods are significant. Also, we would like to emphasize that the distinction of PathReasoner does not only benefit the logical reasoning benchmarks, which previous works are limited to. PathReasoner indeed shows strong generalization capability and plug-in-and-play property (see Appendix G for details).

heading: Future Work
text: Although the current algorithm predefines some basic logical relations in advance and achieves great progress, it also requires the help of more comprehensive external logic bases in the future to improve the accuracy of atom extraction. In addition, the logical text in reality often contains noise (e. g. , wrong logic). Although this paper has conducted extensive experiments on other reasoning datasets and complex settings to verify the generalization capability, there still remain unsolved on how to promote the models to more complex settings, like multi-modality scenarios