Structure-Unified M -Tree Coding Solver for Math Word Problem (2022)

Abstract: As one of the challenging NLP tasks, designing math word problem (MWP) solvers has attracted increasing research attention for the past few years. In previous work, models designed by taking into account the properties of the binary tree structure of mathematical expressions at the output side have achieved better performance. However, the expressions corresponding to a MWP are often diverse (e.g., n_1+n_2 \times n_3-n_4 , n_3\times n_2-n_4+n_1 , etc.), and so are the corresponding binary trees, which creates difficulties in model learning due to the non-deterministic output space. In this paper, we propose the Structure-Unified M-Tree Coding Solver (SUMC-Solver), which applies a tree with any M branches (M-tree) to unify the output structures. To learn the M-tree, we use a mapping to convert the M-tree into the M-tree codes, where codes store the information of the paths from tree root to leaf nodes and the information of leaf nodes themselves, and then devise a Sequence-to-Code (seq2code) model to generate the codes. Experimental results on the widely used MAWPS and Math23K datasets have demonstrated that SUMC-Solver not only outperforms several state-of-the-art models under similar experimental settings but also performs much better under low-resource conditions.

## introduction given the description text of a mwp, an automatic solver needs to output an expression for solving the unknown variable asked in the problem that consists of mathematical operands (numerical values) and operation symbols (+, -, ×, ÷), as shown in fig. 1 . it requires that the solver not only understand the natural-language problem but also be able to model the relationships between the numerical values to perform arithmetic reasoning. these challenges mean mwp solvers are often broadly considered good test beds for evaluating the intelligence level of agents @xcite . in recent years, the research on designing automatic mwp solvers has also made great progress due to the success of neural network models on nlp. @xcite first apply a sequence-to-sequence (seq2seq) model to solve the mwp, and since then more methods @xcite @xcite based on seq2seq models have been proposed for further improvement. to use the structural information from expressions more effectively, other methods @xcite use sequenceto-tree (seq2tree) models with a well-designed tree-structured decoder to generate the pre-order sequence of a binary tree in a top-down manner and have achieved better performance. @xcite combines the merits of the graph-based encoder and tree-based decoder (graph2tree) to generate better solution expressions. promising results have been achieved in solving mwp, but the existing methods learn to output only one expression sequence or binary tree, ignoring that there is likely to be far more than one that can obtain the correct answer. for example, in fig. 1 , to answer the question "how many pages has mike read so far?", we can add up the number of pages that mike read each day to get the expression "2 × 3 + 4 + 5"; we can also calculate the first two days followed by the sum of pages read on the third day to get the expression "3 × 2 + (5 + 4)"; or we could even calculate the problem in a less obvious way with the expression "5 + 3 × 2 + 4". the number of different expression sequences or binary trees can grow very large with different combinations, which results in a large non-deterministic output space and creates difficulties in model learning. specifically, when a problem has multiple correct outputs, but the solver only obtains one of them, the knowledge learned by the model will be incomplete, and the demand for data will also increase, making most data-driven methods perform poorly under low-resource conditions. in previous work, to overcome these limitations, @xcite used the equation normalization method, which normalizes the output sequence by restricting the order of operands and has only a limited effect. @xcite proposed to use multiple decoders to learn different expression sequences simultaneously. however, the large and varying number of sequences for mwps makes the strategy less adaptable. for the models that learn the binary-tree output @xcite @xcite , they generally use a tree decoder to perform top-down and left-to-right generation that only generate one binary tree at a time, which dose not propose a solution to these limitations. to address the challenge that the output diversity in mwp increases the difficulty of model learning, we analyzed the causes for the diversity, which can be summarized as the following: in this paper, to account for the aforementioned challenge, we propose sumc-solver for solving math word problems. the following describes the main contents of our work: we designed the m-tree to unify the diverse output. existing work @xcite @xcite has demonstrated through extensive experiments that taking advantage of the tree structure information of mwp expressions can achieve better performance. we retain the use of a tree structure but further develop on top of the binary tree with an m-tree which contains any m branches. the ability of the m-tree to unify output structures is reflected in both horizontal and vertical directions: we designed the m-tree codes and a seq2code framework for the m-tree learning. we abandoned the top-down and left-to-right autoregressive generation used for binary trees in previous methods. the reason is that the generation can not avoid the diversity caused by the generation order of sibling nodes. instead, we encode the m-tree into m-tree codes that can be restored to the original m-tree, where the codes store the information of the paths from the root to leaf nodes and leaf nodes themselves. and inspired by the sequence labeling methods used in studies mentioned in 2.2, we innovatively use a seq2code framework to generate the m-tree codes in a non-autoregressive way, which takes the problem text as the input sequence and outputs the m-tree codes of the numbers (numerical values) in the math word problem. then we restore the codes to a m-tree that can represent the calculation logic between the numbers and finally calculate the answer. our contributions can be summarized as follows: ## the design of sumc-solver in this section, we present the design and implementation details regarding our proposed sumc-solver, including the problem definition in section 3.1, the design of the m-tree in section 3.2, and the detailed description of the m-tree codes and the seq2code model in section 3.3. ## conclusion in this paper, we proposed sumc-slover to solve math word problems, which applies the m-tree to unify the diverse output and the seq2code model to learn the m-tree. the experimental results on the widely used mawps and math23k datasets demonstrated that sumc-solver outperforms several state-of-the-art models under similar settings and performs much better under low-resource conditions.