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

Neural Arithmetic Expression Calculator

Kaiyu Chen, Yihan Dong, Xipeng Qiu, Zitian ChenarXiv 2018

Introduction

Deep learning has revolutionized pattern recognition, yet symbolic reasoning—particularly precise multi-digit arithmetic—remains a significant hurdle. While standard neural architectures like LSTMs can learn simple addition, they often fail when faced with the complexity of multi-digit multiplication or division. This failure stems from a lack of structural reusability; traditional models attempt to process mathematical expressions as monolithic patterns rather than nested, iterative procedures.

The Problem of Monolithic Learning

Humans solve complex problems like $(517 \times 9) + 100$ by decomposing them into simpler sub-tasks: multiplying individual digits, managing carries, and summing intermediate results. Standard "black box" neural networks lack this hierarchical structure, leading to poor generalization on longer or more complex expressions.

Methodology: Multi-level Hierarchical Reinforcement Learning (MHRL)

To address these limitations, researchers proposed a Multi-level Hierarchical Reinforcement Learning (MHRL) framework. This system operates through a collection of specialized "Skill Modules":

  1. Basic Skill Modules (BSM): These are simple Bi-Directional RNNs trained via supervised learning to perform elementary operations, such as single-digit addition or multiplication.
  2. Interactive Skill Modules (ISM): These act as high-level controllers. Instead of performing calculations directly, an ISM follows a policy to select appropriate sub-modules, use read/write pointers to extract sub-expressions from memory, and record results back into a "scratchpad" memory.

Training via Curriculum Teacher and Continual-learning Student (CTCS)

Training a multi-level hierarchy requires a sophisticated strategy. The authors introduced the Curriculum Teacher and Continual-learning Student (CTCS) framework, which employs two key techniques:

  • Difficulty Sampling: The "teacher" identifies specific samples where the "student" struggles and increases their frequency in the training set, mimicking "deliberate practice."
  • Dynamic Parameter Adjustment: The model adjusts its exploration rate (entropy) based on performance, preventing it from converging on sub-optimal local minima during complex task learning.

Experimental Results

The MHRL framework was tested against standard Seq2seq LSTMs and Neural GPUs on synthetic arithmetic data involving addition, subtraction, multiplication, division, and brackets.

The performance gap was definitive. On expressions of length 10:

  • Proposed MHRL Model: 100% accuracy.
  • Neural GPU: 2% accuracy.
  • Seq2seq LSTM: 0% accuracy.

The model demonstrated a unique ability to maintain perfect accuracy on multi-digit multiplication where baselines failed entirely. Furthermore, it showed strong generalization to longer expressions (length 20), although accuracy began to decline as the depth of the required hierarchy increased.

Conclusion and Future Work

The Neural Arithmetic Expression Calculator represents a significant step toward bridging the gap between connectionist neural networks and symbolic reasoning. By leveraging hierarchical decomposition and curriculum learning, the model achieves human-like precision in arithmetic. Future research will focus on extending this modularity to more complex domains like algebra and symbolic logic, and enabling the model to autonomously discover its own task hierarchies.

Summary updated

BibTeX
@misc{chen2018neural,
  author = {Kaiyu Chen and Yihan Dong and Xipeng Qiu and Zitian Chen},
  title = {{Neural Arithmetic Expression Calculator}},
  year = {2018},
  eprint = {1809.08590},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1809.08590},
}
Figure