A Generation-based Deductive Method for Math Word Problems (2023)

Abstract: Math word problems (MWP) involving advanced operators such as linear equation solver cannot be easily tackled by earlier MWP methods, because the existing generation methods suffer from repeated sub-expression generation and deductive methods are restricted to dealing with binary operations. This paper propose a new multivariate directed acyclic graph (mDAG) as an alternative to the generation methods’ binary expression tree or the deductive methods’ binary directed acyclic graph. Then to produce the topological ordering of mDAG, we propose a generation-based deductive (GeDe) model, which equips a generation model with a re-encoder to keep the deductive property but avoid the expensive enumeration of the deductive methods. GeDe performs well on math problems with many operators on the widely used benchmarks as well as solving multivariate operators on our own CMWPA benchmark. Our code is available at https://github.com/hyx1999/GeDe

## introduction solving math word problems (mwps) is the task of answering natural language problems that require mathematical reasoning ability @xcite . to achieve such a skill, researchers have proposed a variety of mwp solvers, each of which seeks to produce a specific logic form that can be used to calculate the answer to the problem. deductive methods and generation-based methods are typically the two main approaches used to solve mwps. inspired by advances in machine translation, some generation-based methods directly adopt a sequence-to-sequence (seq2seq) model to generate the sequence of the math expression according to the problem @xcite . to further capture the structure of the math expression, some sequence-to-tree (seq2tree) methods (xie and sun, 2019) adopt a tree decoder to generate the binary expression tree, where each node denotes an operator or a quantity. these generation-based methods, however, suffer from a fatal flaw in that they require repeated generation of the same sub-expression (or sub-tree), which makes them inefficient. for example, in figure 1 (a), the sub-expression (94 -35 × 2) ÷ (4 -2) is generated four times. humans, on the other hand, can represent repeated sub-expressions with an intermediate quantity that can be naturally reused in the following computation process. deductive approaches @xcite are suggested to address the aforementioned reuse issue. specifically, deductive methods convert the math expression into a binary directed acyclic graph (bdag), where each node represents an operation that consists of a binary operator and two input quantities. the calculation result of an operation is represented by a new intermediate quantity. then, these methods need to generate a topological ordering, i.e., an operation sequence, of the bdag. by doing this, subsequent operations can easily reuse the previously generated intermediate quantities. as shown in figure 1 (b), quantity q 3 represents the sub-expression (94-2×35)÷(4-2), which is then reused by two subsequent operations denoted by quantity q 4 and q 8 . when the operation sequence is inferred, these operations are computed consecutively to produce the final answer. beyond the ability to reuse the intermediate quantity, deductive methods are more interpretable because the step-by-step generation of operations helps people understand how the reasoning works. to generate the operation at each reasoning step, existing deductive methods follow an "enumerate-then-classify" procedure. to be more precise, they create a collection of candidate operations by listing every possible combination of the quantities and operators, and then they use a classifier to choose the operation that has the highest probability, which can be viewed as a greedy search strategy. ## problem definition the goal of mwp is to generate a specific logic form that can be executed to answer the problem @xmath0, p 2 , .., p n } which consists of n tokens and m quantity tokens @xmath1, q 2 , ..., q m }. some commonsense constants, such as π and e, may not explicitly appear in the problem; thus, we additionally add them to the quantity set q. in this paper, we define the multivariate foot_0 directed acyclic graph (mdag) as our target logic form, which describes the process of solving mwps. the nodes of mdag denote operations that consist of an operator and multiple quantities, and the edges represent the dependency between nodes. our goal is to generate a operation sequence @xmath2, o 2 , ..., o |o| ) which can be obtained from the topological ordering of mdag. |o| is the number of operations. the t-th operation is a sequence of tokens o @xmath3, a t 2 , ..., a t |o t | ) with each token representing an operator or a quantity. each operator is selected from the operator set v , which is predefined by the provided dataset. each quantity is choosen from q, which is initialized with the m quantity tokens in p and can gradually grow as the steps of reasoning progress. |o t | is the number of tokens of the t-th operation. ## experiments in this section, we establish a dataset for multivariant advanced operators and show that the proposed gede is capable of doing these types of operations successfully. we also conduct experiments on four widely-adopted mwp datasets to show the effectiveness of our model on binary operations. ## conclusion and future work this paper proposes a multivariant direct acyclic graph (mdag) to describe a math expression in order to handle the advanced multivariant operators. then to generate the topological ordering of mdag, we propose a generation model equipped with a re-encode strategy to keep the deductive property but avoid the expensive enumeration of existing deductive methods. a hierarchical beam search algorithm is implemented to enable the inner token and outer operation searches. extensive experiments on three standard datasets and one automatically created dataset demonstrate the proposed model's advantage in solving math problems with binary operators and advanced operators.