Recall and Learn: A Memory-augmented Solver for Math Word Problems (2021)

Abstract: In this article, we tackle the math word problem, namely, automatically answering a mathematical problem according to its textual description. Although recent methods have demonstrated their promising results, most of these methods are based on template-based generation scheme which results in limited generalization capability. To this end, we propose a novel human-like analogical learning method in a recall and learn manner. Our proposed framework is composed of modules of memory, representation, analogy, and reasoning, which are designed to make a new exercise by referring to the exercises learned in the past. Specifically, given a math word problem, the model first retrieves similar questions by a memory module and then encodes the unsolved problem and each retrieved question using a representation module. Moreover, to solve the problem in a way of analogy, an analogy module and a reasoning module with a copy mechanism are proposed to model the interrelationship between the problem and each retrieved question. Extensive experiments on two well-known datasets show the superiority of our proposed algorithm as compared to other state-of-the-art competitors from both overall performance comparison and micro-scope studies.

## introduction the task of math word problem (mwp) aims at automatically solving a mathematical question according to its textual description. given a problem description, a model needs to understand the relevant quantities and reason the corresponding expression, which is a difficult task because it requires the model to learn mathematics knowledge from the labeled problem and generalize the knowledge to the unseen problems. in fact, great efforts have been made to address the mwps in the research community. boosted by the proliferation of deep learning techniques, seq2seq-based models have been developed to solve mwps. @xcite presented a largescale mwp dataset math23k and proposed an rnn-based framework with a number mapping technique, which aims to generate a math template first, and then fill the extracted number from the problem into the slots of the generated template to obtain an expression. this two-stage method is widely used as a baseline by the latest papers, such as math-en @xcite , gts @xcite , graph2tree @xcite , ape @xcite and so on @xcite . despite its value and significance, the math word problem has not been well addressed due to the following challenges: 1) although promising results have been reported, the aforementioned models all use the template-based framework to solve mwps, such a two-stage process may introduce systematic cumulative errors. in light of this, how to solve mwps properly without using the template is a non-trivial task. 2) furthermore, instead of learning through a single training example, the way human learn often rely on the so-called analogical learning method, which is able to explore the inherent laws between various cases and generalize them to new examples @xcite . therefore, how to combine the analogical learning method in a unified framework is worth exploring. to address the aforementioned issues, as revealed in figure 1 , we design a novel memoryaugmented model named real (short for "recall and learn") to solve the mwp task in an end-toend manner. real is able to recall some familiar questions that have been solved when solving a new problem, and learns to generate a similar solution in an analogical way. specifically, real model first initializes a memory module by a dataset formed with questions and their expressions. when solving a problem, the memory module is utilized to retrieve the most similar questions as references according to the unsolved problem. next, a representation module is proposed to extract item memories of the unsolved problem and the retrieved question. thereafter, we employ an analogy module to construct relational memory based on the item memories. finally, a reasoning module is applied to generate the expression of the unsolved problem by combining the generation and copy mechanisms. extensive experiments show that we have achieved competitive performance on mwp task. moreover, our proposed model is able to improve the performance by retrieving more questions, which shows the model has the ability to learn by analogy. the main contributions of this work are summarized as follows: ## related work in this section, we briefly review some literatures that are tightly related to our work, namely, math 1 https://github.com/sfeng-m/real4mwp ## method the framework of real is presented in figure 2 . in general, our proposed framework is composed of four key components: 1) memory module is constructed with a pre-trained model and is able to return top-k similar questions given a math word problem. 2) representation module is used to represent each token of the problem and the question in an inductive manner. 3) analogy module is utilized to aggregate the information of the problem and the retrieved question for better generating the correct expression. 4) reasoning module is combined with a copy mechanism that acts as a decoder to generate each token of the expression based on the input sequence. ## experiments in this section, we conduct extensive experiments on two well-known datasets to answer the following five research questions: rq1 how does our proposed real framework perform as compared to other state-of-the-art competitors? rq2 are memory and copy mechanisms equally important? how does real model perform if one mechanism is removed? rq3 how does real perform with respect to various number of retrieved questions? rq4 how does real perform when solving problems of varying expression lengths (difficulties)? rq5 can we visualize the solving process for mwp task? ## conclusion and future work in this work, we propose a memory-augmented solver called real for mwps. under the real framework, there are four key components: 1) memory module; 2) representation module; 3) analogy module; 4) reasoning module, which are proposed to perform analogical learning schema based on the retrieved similar questions. in ad-dition, to enhance the generation performance, a copy mechanism is designed to properly aggregate the information of operands from the problem description. the experimental results show that real achieves state-of-the-art performance for mwp task. extensive micro-scope studies demonstrate the ability of real in learning by analogy. in the future, we plan to extend our work in the following two directions. first, the model's performance can be further improved if the memory module of real model is jointly trained with the whole framework. second, we will consider designing a more meaningful analogy module that can take the structure of question and expression into account, thus providing more information for the reasoning module to generate the problem solution.