Graph-to-Tree Learning for Solving Math Word Problems (2020)

Abstract: While the recent tree-based neural models have demonstrated promising results in generating solution expression for the math word problem (MWP), most of these models do not capture the relationships and order information among the quantities well. This results in poor quantity representations and incorrect solution expressions. In this paper, we propose Graph2Tree, a novel deep learning architecture that combines the merits of the graph-based encoder and tree-based decoder to generate better solution expressions. Included in our Graph2Tree framework are two graphs, namely the Quantity Cell Graph and Quantity Comparison Graph, which are designed to address limitations of existing methods by effectively representing the relationships and order information among the quantities in MWPs. We conduct extensive experiments on two available datasets. Our experiment results show that Graph2Tree outperforms the state-of-the-art baselines on two benchmark datasets significantly. We also discuss case studies and empirically examine Graph2Tree’s effectiveness in translating the MWP text into solution expressions.

## introduction math word problem (mwp), which involves automatically answering a mathematical question according to a textual description, is an important natural language understanding task that has been studied by researchers since the 1960s @xcite . a typical mwp is a short narrative that describes a problem and poses a question about an unknown quantity. in recent years, deep learning-based models have been developed to solve mwps. these deep learning methods are able to automate the learning of features and generalize well by returning new solution expressions that are unseen in the training datasets. @xcite proposed a large-scale mwp dataset and applied a vanilla sequence to sequence (seq2seq) model to translate the language text to a solution expression. since then, many research efforts mainly focused on improving the generation of solution expressions. some researchers have proposed seq2seq models to improve solution expression generation using implicit @xcite and explicit @xcite @xcite tree structures. improving the representation of quantity is a potential approach to achieve better solution expressions. for example, to get the correct solution expression for the problem described in to enrich the representation of a quantity, the relationships between the descriptive words associated with a quantity need to be modeled. however, such relationships cannot be effectively modeled using recurrent models, which are commonly used in the existing mwp deep learning methods. inspired by the concept of quantity schema @xcite and qset @xcite , we design the quantity cell graph to associate informatively descriptive words to quantity. we first extract associated nouns, verbs, adjectives, units, and rates that describe a quantity in the mwp text. next, we construct a graph where the extracted descriptive words are represented as neighbor nodes directly linked to a quantity. finally, a neural network model is used to learn enriched latent representations of the quantities based on the constructed quantity cell graph. the loss of quantities' numerical qualities in existing mwp methods can also result in poor quantity representations. most of the existing mwp methods often replace quantities with special symbols (e.g., "n 1 ", "n 2 ", etc.) @xcite @xcite . the loss of quantities' numerical qualities could be problematic when generating solution expressions. take the example in besides improving the quantity representation, we also aim to improve the solution expression generative process. for longer solution expressions in mwps, as some quantities are repeatedly used in different arithmetic sub-solution expressions, the existing methods which utilized recurrent neural networks may not be able to learn the underlying reasoning process and arithmetic order. for example, in ## problem formulation we denote the text of the math word problem as p , where p is a sequence of word tokens and numeric values. we let v @xmath3, • • • , v m } denote the word tokens in p and n @xmath4, • • • , n l } denote the set of quantities in p . our goal is to map p to a valid and correct mathematical expression e p . solving mwps requires an understanding of quantities in problem and their complex mathematical relationships. mwps are often expressed in a linear textual sequence form, which is not ideal for learning the quantities' complex interactions. thus, we propose to formulate the problem into graph form so that the relationships between quantities can be expressed more explicitly. the problem text p is transformed into graph g by augmenting the text sequences with other structural information like dependency parsing and pos tagging. the final mathematical expression e p that we aim to construct can always be represented as a solution expression tree t . t may include constant quantities, operators and quantities in n p . the set of constant quantities v con contains some special values not appeared in text like π, 1. the set of math operators v op contains {+, -, * , /}. overall, the target vocabulary of p can be denoted as v @xmath5. the goal of our graph2tree model here is to estimate the conditional probability p (e p |p ), which can be transformed as p (t |g, v dec ). ## methodology figure 1 shows our proposed graph2tree framework. graph2tree first encodes the mwp text input using bilstm and simultaneously constructs quantity cell graph and quantity comparison graph. the output of bilstm, word-level representations, are used as node representations. together with the two constructed graphs, the node representations are input into a graph transformer to learn a graph representation of the mwp. the multigcn component of the graph transformer is modified to learn the graph representation based on the quantity cell graph and quantity comparison graph. this enriches the final graph representation with quantities' relationship information and numerical qualities. pooling is used to aggregate all nodes into a pool-based graph embedding vector as the graph transformer's output. finally, the output graph representation and the updated node representations are used as input to a tree-structure decoder to infer the final solution expression tree. ## experiment in this section, we compare our proposed graph2tree model with state-of-the-art baselines. we also conduct ablation study and analysis to investigate the effectiveness of various components of our model. ## conclusion in this paper, we proposed a novel mwp solver, graph2tree, which improves the task performance by enriching the quantity representations in the problem. we conducted extensive experiments to evaluate our model against state-of-the-art baselines. our experiments shown that graph2tree is able to outperform the baselines on the mwp task. for future work, we aim to consider more complex relationships among the quantities and other attributes to enrich quantity representations further. we will also explore adding heuristic in the treebased decoder to guide and improve the generation of solution expression.