[Paper Review] Seeking Patterns, Not just Memorizing Procedures: Contrastive Learning for Solving Math Word Problems
This paper proposes a contrastive learning approach to improve math word problem (MWP) solving by helping models recognize underlying quantitative patterns rather than memorizing procedural cues. By constructing contrastive examples based on equation tree structures, the method pulls representations of problems with similar patterns closer and pushes dissimilar ones apart, significantly boosting performance on Math23k and MathQA in both monolingual and multilingual settings.
Math 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.
Motivation & Objective
- To address the issue of MWP models relying on shallow heuristics and memorizing procedures instead of understanding quantitative patterns.
- To investigate how neural networks perceive MWP patterns through semantic representations, particularly in BERT layers.
- To improve model generalization by explicitly distinguishing between similar and dissimilar problem patterns using contrastive learning.
- To enable multilingual transfer by leveraging language-independent MWP patterns across Chinese and English datasets.
- To demonstrate that better pattern perception leads to more accurate equation generation, especially for problems previously misclassified.
Proposed method
- The method uses a BERT-based encoder to extract semantic representations of MWP narratives.
- It constructs contrastive examples by converting prototype equations into tree structures and identifying positive pairs with identical or similar subtree structures.
- Negative examples are collected based on differing operator types or tree sizes, even when the number of operators is the same.
- The model is jointly trained with a standard equation generation loss and a contrastive learning loss that pulls similar pattern representations closer and pushes dissimilar ones apart.
- The contrastive loss is applied during a two-stage training process, with a learnable weight to balance the objectives.
- The approach is evaluated on Math23k (Chinese) and MathQA (English), with multilingual adaptation to enable cross-lingual transfer.
Experimental results
Research questions
- RQ1How do neural networks perceive MWP patterns when relying only on semantic representations?
- RQ2Can contrastive learning improve MWP solving by enhancing the model's ability to distinguish between similar and dissimilar problem patterns?
- RQ3To what extent can contrastive learning improve performance in multilingual MWP solving settings?
- RQ4Does the model's representation space become more structured and cluster-like after applying contrastive learning?
- RQ5Can data from one language improve performance in another language through shared pattern understanding?
Key findings
- The model's performance improved significantly on both Math23k and MathQA, with consistent gains in monolingual and multilingual settings.
- The Calinski-Harabasz index increased after contrastive learning, indicating better clustering of problem representations around their prototype equations.
- T-SNE visualizations showed that representations of problems with the same prototype equation became more tightly grouped, while those with different patterns were more dispersed.
- The method reduced incorrect predictions for problems that were previously far from their prototype’s center representation.
- The model achieved better accuracy in distance intervals [0.6,0.7) and [0.7,0.8), indicating improved discrimination of ambiguous or distant cases.
- Examples in Table 7 showed that contrastive learning corrected critical errors, such as misapplying operations like addition instead of subtraction in rate problems.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.