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

Deep Neural Solver for Math Word Problems

Yan Wang, Xiaojiang Liu, Shuming Shi

Abstract

Math Word Problems (MWPs) present a significant challenge in Natural Language Processing, requiring the translation of narrative text into executable mathematical expressions. This paper introduces a Deep Neural Solver (DNS) that moves beyond traditional, manually-engineered statistical models. By employing a sequence-to-sequence (seq2seq) architecture to generate equation templates and incorporating a novel "significant number" filter, the authors achieve state-of-the-art performance on a massive new dataset, Math23k. The results demonstrate that deep learning can effectively capture the underlying logic of mathematical problems when provided with sufficient data.

Introduction

Solving a math word problem like "Dan has 2 pens, Jessica has 4. How many do they have in total?" requires a system to parse natural language and map it to a logical expression ($x = 2 + 4$). Historically, this was approached via rule-based symbolic systems or statistical learners dependent on heavy feature engineering. These methods often lacked the flexibility to generalize across diverse problem types. This research treats MWP solving as a translation task, mapping natural language directly to mathematical equation templates.

Methodology

The proposed Deep Neural Solver (DNS) integrates several key components to ensure both logical consistency and mathematical validity.

Seq2seq Model with Equation Templates

The core of the DNS is a seq2seq model using a GRU encoder and an LSTM decoder. To improve generalization, the model predicts "templates" rather than raw numbers. Numbers in the text are mapped to variables (e.g., $n_1, n_2$), allowing the network to learn the abstract logic of operations rather than memorizing specific arithmetic results.

Architecture of the Seq2seq model for generating equation templates from natural language input.

Significant Number Identification (SNI)

Not all numbers in a word problem are mathematically relevant (e.g., "In 1 day, 1 girl bought 5 apples"). The authors implemented an SNI module—an LSTM-based binary classifier—to filter out irrelevant quantities before they reach the solver. This module improved overall accuracy by approximately 4%.

Hybrid Model and Constraints

To prevent the generation of invalid expressions (e.g., $x = + + 5$), the decoder's activation function is constrained by five mathematical rules. Furthermore, the authors observed that simple retrieval (finding similar problems in the training set) is highly effective for common problem types. The final DNS is a hybrid system: it uses retrieval when a high-similarity match is found and defaults to the seq2seq solver otherwise.

Data and Evaluation

The study utilizes three primary datasets:

  • Math23k: A new, large-scale dataset of 23,161 Chinese elementary math problems, all involving linear equations with one unknown.
  • Alg514 & Dolphin1878: Smaller, standard benchmarks used to test the model's performance on more constrained or number-heavy problems.

Results

The DNS demonstrated a significant performance leap on the Math23k dataset. While the baseline statistical model (ZDC) achieved 42.1% accuracy, the hybrid DNS with SNI reached 64.7%.

Model accuracy compared against the number of training instances, highlighting the superior performance of the Hybrid and Seq2seq models as data scales.

As shown in the figure above, the performance of the neural models scales significantly with the amount of training data. Interestingly, on the much smaller Alg514 dataset, the deep learning model struggled (16.1% vs. 79.7% for traditional methods), confirming that neural solvers are data-hungry and require large-scale corpora to outperform rule-based systems.

Discussion and Conclusion

The success of the DNS lies in its ability to focus on relationships between quantities through templates rather than raw values. Unlike previous methods restricted to a fixed set of templates, the seq2seq model can generate entirely novel equation structures.

However, limitations remain. The current solver is restricted to linear equations with a single unknown. Future research will focus on extending this architecture to handle systems of equations, non-linear math (such as geometry), and more complex tree-structured outputs.

Summary updated

BibTeX
@inproceedings{wang2017deep,
  author = {Yan Wang and Xiaojiang Liu and Shuming Shi},
  title = {{Deep Neural Solver for Math Word Problems}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2017},
  doi = {10.18653/v1/d17-1088},
}
Figure