Neural-Symbolic Solver for Math Word Problems with Auxiliary Tasks

Jinghui Qin, Xiaodan Liang, Yining Hong, Jianheng Tang, Liang Lin

Introduction

Solving Math Word Problems (MWPs) represents a significant challenge in artificial intelligence, requiring a synthesis of natural language understanding and discrete mathematical reasoning. While deep learning models excel at pattern recognition, they often struggle with the precise, multi-step logic needed to map narrative text to symbolic equations. Common failure modes include "hallucinating" numbers or failing to account for implicit commonsense constraints, such as the number of legs on an animal.

Methodology: The NS-Solver Architecture

The proposed NS-Solver (Neural-Symbolic Solver) addresses these challenges through a hybrid approach that combines a neural "programmer" with a symbolic "executor."

The NS-Solver architecture integrates a neural programmer with symbolic execution and four specialized auxiliary tasks to ensure mathematical and linguistic consistency.

The architecture consists of three core components:

  1. Problem Reader: A bidirectional GRU that encodes the problem text into a rich vector representation.
  2. Programmer: A tree-structured decoder that generates a symbolic equation in the form of a prefix tree.
  3. Symbolic Executor: Leveraging the SymPy library, this component solves the generated equations with 100% mathematical precision, eliminating the risk of calculation errors common in purely neural approaches.

Auxiliary Tasks for Symbolic Grounding

To bridge the gap between language and math, the model is trained on four auxiliary tasks that act as regularizers:

  • Self-supervised Number Prediction (SNP): Enhances the model's ability to identify and locate numerical quantities within the text.
  • Commonsense Constant Prediction (CCP): Predicts hidden constants (e.g., "dozen" = 12) required for the solution, narrowing the search space for the programmer.
  • Program Consistency Checker (PCC): A semantic loss function ensuring predicted equations are mathematically equivalent to ground truth, regardless of formatting.
  • Duality Exploiting (DE): A multi-task learning objective where the model simultaneously predicts Part-of-Speech (POS) tags, improving its grasp of linguistic structure.

Datasets and Evaluation

The NS-Solver was evaluated on two benchmarks:

  • Math23K: A standard dataset of ~23,000 one-unknown linear problems.
  • CM17K: A new, more challenging dataset introduced by the authors containing over 17,000 samples. CM17K includes complex arithmetic, non-linear equations, and equation sets, featuring longer descriptions and more diverse operations than previous benchmarks.

Results and Discussion

The NS-Solver achieved state-of-the-art results, reaching 75.67% accuracy on Math23K and 54.05% on the more difficult CM17K dataset (a 5.93% improvement over the GTS baseline).

NS-Solver maintains significantly higher accuracy than neural-only models (GTS) as the complexity of the equation tree increases.

A key finding is the model's robustness to complexity. As shown in the figure above, while the performance of purely neural models like GTS degrades sharply as equation length increases, the NS-Solver maintains a higher performance ceiling. This suggests that the auxiliary tasks and symbolic grounding effectively regularize the model, allowing it to generalize better to intricate, multi-step problems.

Conclusion

By integrating symbolic execution with targeted auxiliary tasks, the NS-Solver effectively mitigates common pitfalls in neural math solvers. While challenges remain in parsing highly nuanced linguistic "tricks" and extremely long equations, this hybrid approach provides a scalable framework for more reliable automated mathematical reasoning.

Summary updated

BibTeX
@inproceedings{qin2021neural,
  author = {Jinghui Qin and Xiaodan Liang and Yining Hong and Jianheng Tang and Liang Lin},
  title = {{Neural-Symbolic Solver for Math Word Problems with Auxiliary Tasks}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2021},
  doi = {10.18653/v1/2021.acl-long.456},
}
Figure