NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Solving arithmetic word problems by scoring equations with recursive neural networks

Klim Zaporojets, Giannis Bekoulis, Johannes Deleu, Thomas Demeester, Chris Develder · DOI

TL;DR

This paper introduces a novel approach to solving arithmetic word problems by using tree-structured neural networks (Tree-RNNs) to score candidate equations. This method significantly improves accuracy, especially on complex problems involving multiple or non-commutative operations, outperforming previous state-of-the-art by over 15%.

What Problem Does This Paper Address?

Solving arithmetic word problems is a challenging task in natural language processing (NLP) that requires both understanding language and performing mathematical reasoning. A key difficulty lies in the vast number of potential equations that could represent a given problem, and the need to identify the correct one. Existing methods often rely on sequential processing of text or hand-crafted features, which can struggle with the inherent hierarchical structure of mathematical expressions and the nuances of non-commutative operations. This paper aims to bridge this gap by proposing a method that explicitly models the structure of mathematical equations.

Methods

The core of this work is the application of Tree-Recursive Neural Networks (Tree-RNNs), specifically Tree-LSTM architectures, to encode and score candidate arithmetic equations. The process involves:

  1. Candidate Generation: An Integer Linear Programming (ILP) solver, similar to prior work, generates a set of potential candidate equations for each word problem.
  2. Expression Tree Transformation: Each candidate equation is converted into an expression tree, where numbers are leaf nodes and operations are internal nodes. This structure naturally captures the order of operations.
  3. Tree-LSTM Encoding: Two Tree-LSTM variants, T-LSTM (Child-Sum Tree-LSTM) and NT-LSTM (N-ary Tree-LSTM), are used to encode these expression trees.
  4. T-LSTM sums the hidden states of child nodes before processing.
  5. NT-LSTM uses distinct weight matrices for each child's hidden state, allowing it to better distinguish the order of operands, which is crucial for non-commutative operations.
  6. Scoring and Ranking: The encoded tree representations are used to score each candidate equation. The equation with the highest score is selected as the solution.
  7. Baseline Comparison: A sequential BiLSTM model (B-LSTM) is used as a baseline to compare the effectiveness of the tree-structured approach against traditional sequential models.

Datasets

The primary dataset used for training and evaluation is SingleEQ, introduced by Koncel-Kedziorski et al. (2015). This dataset contains 508 arithmetic word problems with varying degrees of complexity. The authors also define several subsets of SingleEQ to analyze performance based on:

  • Complexity: Single (one operator) vs. Multi (multiple operators).
  • Symmetry: Symmetric (e.g., +, ×) vs. Asymmetric (e.g., -, ÷) operations, and combinations thereof (Singlesym, Multisym, Singleasym, Multiasym).

Key Insights and Ideas

  • Structure Matters: Explicitly modeling the hierarchical structure of mathematical equations using tree-based neural networks (Tree-LSTMs) is more effective than sequential processing for arithmetic word problems.
  • Non-Commutativity is Key: The NT-LSTM architecture, with its ability to handle distinct child node states, significantly improves performance on problems involving non-commutative operations (like subtraction and division), where operand order is critical.
  • Feature-Based Limitations: Current state-of-the-art models relying on hand-crafted features struggle with complex problems, especially those involving non-commutative operations, as these features often fail to generalize.
  • Noise Robustness: The proposed Tree-LSTM models, particularly NT-LSTM, show robustness even when presented with noisy candidate equations, outperforming feature-based methods in challenging scenarios.

Key Results

  • Overall Improvement: The proposed Tree-LSTM models (T-LSTM and NT-LSTM) achieve an overall accuracy improvement of more than 3% on the Full SingleEQ dataset compared to previous state-of-the-art.
  • Complex Problems: The performance gain is substantial on more complex problems (requiring multiple and/or non-commutative operations), with an improvement of over 15% accuracy points.
  • Sequential vs. Tree-Based: NT-LSTM outperforms sequential LSTMs (B-LSTM) by 4% accuracy points on complex problems.
  • NT-LSTM Advantage: NT-LSTM shows a notable advantage over T-LSTM on subsets involving non-commutative operations, indicating the importance of its asymmetric child node handling.
  • Robustness: In a noisy candidate generation setting (ILP + Asym), NT-LSTM significantly outperforms sequential B-LSTM on problems with multiple operations.

Limitations and Future Work

  • Complex Reasoning Errors: A significant portion (57%) of the system's errors stem from problems requiring complex reasoning, even when numbers are correctly extracted. This highlights the ongoing challenge of deep mathematical reasoning.
  • Parsing and Counting: Errors also occur in parsing and counting when multiple entities are involved, suggesting a need for improved entity identification and extraction.
  • World Knowledge: A portion of errors (21%) are attributed to a lack of world knowledge (e.g., understanding units, numerical concepts like "odd numbers").
  • Future Directions: The authors suggest complementing tree structures with additional information to better capture entity relationships within sentences. Improving parsing and entity identification is also a key area for future work. Additionally, incorporating external world knowledge is proposed to address knowledge-based errors.

Summary updated

BibTeX
@article{zaporojets2021solving,
  author = {Klim Zaporojets and Giannis Bekoulis and Johannes Deleu and Thomas Demeester and Chris Develder},
  title = {{Solving arithmetic word problems by scoring equations with recursive neural networks}},
  journal = {Expert Systems with Applications},
  year = {2021},
  doi = {10.1016/j.eswa.2021.114704},
}
Figure