Seeking Patterns, Not just Memorizing Procedures: Contrastive Learning for Solving Math Word Problems

32620

Authors

nan

Abstract

AbstractMath Word Problem (MWP) solving needs to discover the quantitative relationships over natural language narratives. Recent work shows that existing models memorize procedures from context and rely on shallow heuristics to solve MWPs. In this paper, we look at this issue and argue that the cause is a lack of overall understanding of MWP patterns. We first investigate how a neural network understands patterns only from semantics, and observe that, if the prototype equations are the same, most problems get closer representations and those representations apart from them or close to other prototypes tend to produce wrong solutions. Inspired by it, we propose a contrastive learning approach, where the neural network perceives the divergence of patterns. We collect contrastive examples by converting the prototype equation into a tree and seeking similar tree structures. The solving model is trained with an auxiliary objective on the collected examples, resulting in the representations of problems with similar prototypes being pulled closer. We conduct experiments on the Chinese dataset Math23k and the English dataset MathQA. Our method greatly improves the performance in monolingual and multilingual settings.

Keywords

nan

Full Content

Findings of the Association for Computational Linguistics: ACL 2022, pages 2486 - 2496 May 22-27, 2022 c⃝2022 Association for Computational Linguistics Seeking Patterns, Not just Memorizing Procedures: Contrastive Learning for Solving Math Word Problems Zhongli Li1∗, Wenxuan Zhang2∗†, Chao Yan2†, Qingyu Zhou1, Chao Li1, Hongzhi Liu2, Yunbo Cao1 1Tencent Cloud Xiaowei 2Peking University {neutrali,qingyuzhou,diegoli,yunbocao}@tencent.com {zwx980624@stu,cyan@stu,liuhz@ss}.pku.edu.cn Abstract Math Word Problem (MWP) solving needs to discover the quantitative relationships over natural language narratives. Recent work shows that existing models memorize proce- dures from context and rely on shallow heuris- tics to solve MWPs. In this paper, we look at this issue and argue that the cause is a lack of overall understanding of MWP patterns. We first investigate how a neural network under- stands patterns only from semantics, and ob- serve that, if the prototype equations like n1 + n2 are the same, most problems get closer representations and those representations apart from them or close to other prototypes tend to produce wrong solutions. Inspired by it, we propose a contrastive learning approach, where the neural network perceives the diver- gence of patterns. We collect contrastive ex- amples by converting the prototype equation into a tree and seeking similar tree structures. The solving model is trained with an auxiliary objective on the collected examples, resulting in the representations of problems with simi- lar prototypes being pulled closer. We conduct experiments1 on the Chinese dataset Math23k and the English dataset MathQA. Our method greatly improves the performance in monolin- gual and multilingual settings. 1 Introduction A Math Word Problem (MWP) is described as a natural language narrative with a math question. The MWP solver is required to generate a solution equation, which can be calculated to get the nu- merical answer, by understanding the contextual problem description. In teaching, students are encouraged to recog- nize that mathematics is really about patterns and ∗ Zhongli Li and Wenxuan Zhang contributed equally. Qingyu Zhou is the corresponding author. † Contribution done during internship at Tencent Cloud Xiaowei. 1The code is available at https://github.com/ zwx980624/mwp-cl. n1 + n2 n1 / n2 Prob. C: A bee has 6 legs. How many legs do 2 bees have? Eq: 2 * 6 Prob. B: Joyce starts with 75 apples. She gives 52 to Larry. How many apples does Joyce end with? Eq: 75 - 52 Prob. A: Norma has 88 cards. She loses 70. How many cards will Norma have ? Eq: 88 - 70 Prob. D: 2 bee have 12 legs. How many legs does a bee have? Eq: 12 / 2 𝑛1 + 𝑛2 𝑛1 − 𝑛2 (𝑛1 + 𝑛2) ÷ 𝑛3 (𝑛1 + 𝑛2) × 𝑛3 𝑛1 × 𝑛2 𝑛1 ÷ 𝑛2 (n1 + n2) * n3 n1 − n2 n1 * n2 (n1 + n2) / n3 Figure 1: The visualization of the problem representa- tions by T-SNE. "Prob." and "Eq" are short for the math word problem and its solution equation. The problem A and B are in the same prototype equation "n1 − …

Content truncated to 500 words

Labeled Text

AbstractMath Word Problem (MWP) solving needs to discover the quantitative relationships over natural language narratives. Recent work shows that existing models memorize procedures from context and rely on shallow heuristics to solve MWPs. In this paper, we look at this issue and argue that the cause is a lack of overall understanding of MWP patterns. We first investigate how a neural network understands patterns only from semantics, and observe that, if the prototype equations are the same, most problems get closer representations and those representations apart from them or close to other prototypes tend to produce wrong solutions. Inspired by it, we propose a contrastive learning approach, where the neural network perceives the divergence of patterns. We collect contrastive examples by converting the prototype equation into a tree and seeking similar tree structures. The solving model is trained with an auxiliary objective on the collected examples, resulting in the representations of problems with similar prototypes being pulled closer. We conduct experiments on the Chinese dataset Math23k and the English dataset MathQA. Our method greatly improves the performance in monolingual and multilingual settings.

Publication Details

Paper ID:
32620
Year:
2022
Publication:
TIPSTER
Publication Type:
conf
DOI:
nan