Multi-View Reasoning: Consistent Contrastive Learning for Math Word Problem (2022)

Abstract: Math word problem solver requires both precise relation reasoning about quantities in the text and reliable generation for the diverse equation. Current sequence-to-tree or relation extraction methods regard this only from a fixed view, struggling to simultaneously handle complex semantics and diverse equations. However, human solving naturally involves two consistent reasoning views: top-down and bottom-up, just as math equations also can be expressed in multiple equivalent forms: pre-order and post-order. We propose a multi-view consistent contrastive learning for a more complete semantics-to-equation mapping. The entire process is decoupled into two independent but consistent views: top-down decomposition and bottom-up construction, and the two reasoning views are aligned in multi-granularity for consistency, enhancing global generation and precise reasoning. Experiments on multiple datasets across two languages show our approach significantly outperforms the existing baselines, especially on complex problems. We also show after consistent alignment, multi-view can absorb the merits of both views and generate more diverse results consistent with the mathematical laws.

## introduction math word problem (mwp) is a very significant and challenging task with a wide range of applications in both natural language processing and general artificial intelligence @xcite . the mwp is to predict the mathematical equation and the final answer based on a natural language description of the scenario and a math problem. it requires mathematical reasoning over the text @xcite , which is very challenging for conventional methods @xcite ., † corresponding author. 1 our source code and data are open sourced at https://github.com/zwq2018/ multi-view-consistency-for-mwp -× + 2 3 4 5 top-down reasoning 1 2 3 4 5 7 6 bottom-up reasoning 2 3 4 5 (2, 3 +) (exp1, 4 ×) (exp2, 5 -) 1 2 3 4 5 6 7 latent space h 3 h 3 h 2 h 2 question: xiao ming and zhang work in the orchard to pick fruit, xiao ming pick 2 fruits per minute, zhang pick 3 fruits per minute, they worked for 4 minutes, and then ate 5 fruits, how many fruits are left answer: 15 expr: (2 + 3) × 4 -5 multi-view post-order traversal (2 3 + 4 × 5 -) pre-order traversal (-× + 2 3 4 5 ) mid-order (2 + 3) × 4 -5 1 3 4 5 2 7 6 multi-order 1 3 4 5 2 7 6 consistent e xp 3 e xp 2 exp2 ex p3 remaining fruits total pick rate total fruits total pick rate total fruits remaining fruits total pick rate total fruits remaining fruits total pick rate total fruits remaining fruits h 1 h 1 exp 1 exp1 figure 1 : human solving has multiple reasoning views, and math equation also can be expressed in multi-order. pre-order traversal can be seen as a top-down reasoning view. post-order traversal corresponds exactly to the bottom-up reasoning view. consistent contrastive learning aligns two views in the same latent space. ## related work automatically solving mathematical problems has been studied for a long time, from rule-based methods @xcite @xcite with hand-crafted features and templatesbased methods @xcite to deep learning methods @xcite with the encoderdecoder framework. the introduction of transformer @xcite and pre-trained language models @xcite greatly improves the performance of mwps. from the perspective of proxy tasks, we divide the recent works into three categories: seq2seq-based translation, seq2structure generation, and iterative relation extraction. ## experiments datasets we evaluate our method on three standard datasets across two languages: mawps @xcite , math23k @xcite , and mathqa @xcite . math23k and mathqa are two widely used large datasets that contain 23k chinese mathematical problems and 20k english mathematical problems, respectively, and mawps only contains 1.9k english problems. we follow @xcite to preprocess some unsolvable problems in the dataset. we consider five operators for the datasets: addition, subtraction, multiplication, division, exponentiation as previous works did. the number of mathematical operations is used to measure the reasoning complexity and the text length denotes the semantic complexity. in figure 3 , we plot the average reasoning complexity (x-axis) and semantic complexity (y-axis) of the three datasets in the two-dimensional plane. the mathqa is the hardest to solve as it has the highest semantic complexity and reasoning complexity. in contrast, the mawps is the easiest to answer, as almost all problems require only two mathematical operations. the math23k dataset is the largest, with moderate reasoning complexity. baselines we divide the baselines into the following categories: seq2seq, seq2structure, iterative relation-extraction (i-re). besides, we also consider the methods that use contrasting learning for generation (cl-gen). in seq2seq, li et al. training details we adopt roberta-base and chinese-bert from huggingface @xcite for multilingual datasets as previous works. we use an adamw optimizer @xcite with a 2e-5 learning rate, batch size of 12, and beam search of size 4. all experiments were set up on an nvidia rtx 3090 24gb. following most previous works, we report the average answer accuracy (five random seeds) with standard deviation using the test set for math23k and mathqa, and the 5-fold crossvalidation performance on math23k and mawps. ## conclusion we treat the pre-order traversal of math equation as a top-down view and the post-order equation as bottom-up view. two reasoning views are naturally existing and both are necessary for complex mathematical reasoning. we design a multi-view reaoverall answer accuracy (%) 0 10 20 30 40 50 60 70 80 90 diversity equation prediction accuracy 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 5 7 9 11 13 dag cl-prototype gts bert-tree re-deduction ours teacher-dis ours re-deduction bert-tree gts cl-prototype dag teacher-dis seq2structure methods i-re methods equation accuracy diversity figure 5: we split the overall accuracy into two parts, i.e., equation accuracy and diversity. our overall accuracy and diversity are the highest (left). the seven methods are plotted in a 2d plane according to two metrics (right). our method performs well on both metrics.