Abstract
Solving Math Word Problems (MWPs) requires a sophisticated blend of linguistic comprehension and mathematical logic. Traditional models often struggle due to a lack of external common-sense knowledge and a failure to capture the hierarchical structure of natural language narratives. This paper introduces the Reasoning with Pre-trained Knowledge and Hierarchical Structure (RPKHS) network. By integrating implicit knowledge from RoBERTa with a dual-level hierarchical reasoning encoder, RPKHS achieves state-of-the-art performance on major benchmarks, significantly bridging the gap between human-like reasoning and automated problem solving.
Introduction
The challenge of Math Word Problem (MWP) solving lies in the translation of a textual narrative into a formal mathematical equation. This task is hindered by two primary obstacles: the "Knowledge Gap" and "Flat Reasoning."
The Knowledge Gap refers to the limitation of models trained solely on problem-specific text. Humans rely on extensive background knowledge to disambiguate terms—for instance, recognizing that "account" in a financial context refers to a balance, whereas in a legal context, it might mean an explanation. Without this "common sense," models often misinterpret semantic nuances.
Flat Reasoning occurs when models treat a problem as a simple sequence of words. In reality, MWPs are hierarchical: words form sentences, and sentences form a narrative where certain components are more mathematically significant than others. A model that ignores this structure fails to prioritize the most critical information.
The RPKHS Framework
To address these issues, we propose the RPKHS network, which employs a two-pronged encoder strategy followed by a tree-based decoder.
Dual-Encoder Strategy
- Pre-trained Knowledge Encoder: Utilizing RoBERTa, the model extracts implicit linguistic and factual knowledge. This allows the system to understand complex semantics and context-dependent word meanings before processing the mathematical components.
- Hierarchical Reasoning Encoder: This component uses two levels of Gated Recurrent Units (GRUs) with attention mechanisms. The word-level captures relationships within sentences, while the sentence-level aggregates these representations to identify which parts of the narrative are most critical to the solution.
Merging and Decoding
An adaptive gating function merges the outputs of both encoders, dynamically balancing "common sense" knowledge with "structural" reasoning. The final equation is generated by a Goal-driven Tree Structure (GTS) decoder. Unlike standard sequence-to-sequence models, a tree decoder naturally handles the nested nature of mathematical operations, such as parentheses and operator precedence.
Experimental Evaluation
The RPKHS model was evaluated on two standard benchmarks: Math23K (a large-scale Chinese dataset) and MAWPS (an English dataset).
The results demonstrate a significant leap in performance:
- Math23K: Accuracy reached 83.9%, a 6.5% absolute increase over the previous state-of-the-art (Graph2Tree).
- MAWPS: Accuracy reached 89.8%, representing a 6.1% gain.
- Robustness: 5-fold cross-validation on Math23K confirmed stable performance at 82.2%.
Qualitative Analysis and Insights
Ablation studies confirm that the synergy between pre-trained knowledge and hierarchical reasoning is vital. While each component improves performance individually, their combination provides a synergistic boost, suggesting they are complementary.
As shown in the case studies, the model successfully identifies "quantity words" and links them to their specific contexts (e.g., connecting "2" to "tickets"). This mimics human focus, where the solver ignores irrelevant narrative filler and concentrates on the mathematical core. The pre-trained encoder acts as a "semantic anchor," helping the model parse correct meanings from complex text where simpler models typically fail.
Conclusion
The RPKHS network represents a significant advancement in MWP solving by addressing the fundamental limitations of semantic knowledge and structural reasoning. While the use of large pre-trained models increases computational overhead, the gains in accuracy and logical consistency are substantial. Future work will explore the integration of explicit mathematical rules and external knowledge graphs to further enhance the model's symbolic reasoning capabilities.
Summary updated