Do Deep Neural Networks Capture Compositionality in Arithmetic Reasoning?

Keito Kudo, Yoichi Aoki, Tatsuki Kuribayashi, Ana Brassard, Masashi Yoshikawa, Keisuke Sakaguchi, Kentaro Inui

Abstract

This paper investigates the extent to which large language models (LLMs) exhibit compositionality in arithmetic reasoning. By defining three distinct dimensions of compositionality—systematicity, productivity, and substitutivity—and utilizing a hierarchical "skill tree" framework, the authors evaluate sequence-to-sequence models like T5 and BART. The study reveals a significant "systematicity gap": while models excel at productivity and substitutivity, they struggle to combine known arithmetic operations into multi-step chains, particularly when required to access and reuse intermediate results internally.

Introduction

The AI community remains divided on whether deep neural networks truly "reason" or simply perform sophisticated pattern matching. While models can solve complex multi-hop problems in some contexts, they often fail at basic logic in others. The authors argue that the missing link is compositionality—the ability to understand a whole based on its parts and the rules used to combine them. In symbolic reasoning, such as mathematics or programming, compositionality is fundamental.

This paper specifically investigates three dimensions of compositionality in arithmetic:

  1. Systematicity: The ability to combine known rules (e.g., addition and variable assignment) to solve a new, combined problem.
  2. Productivity: The ability to solve longer versions of problems encountered during training.
  3. Substitutivity: The ability to handle different variable names (e.g., using $\alpha$ instead of $A$).
Three dimensions of compositionality: Systematicity, Productivity, and Substitutivity.

Methodology

To isolate where reasoning breaks down, the researchers developed a "skill tree" framework. This hierarchy defines levels of complexity, starting from "primitives" (basic assignment, simple addition) and building toward complex multi-hop reasoning. By training models on specific nodes and testing them on others, the authors could precisely measure generalization.

The hierarchical 'skill tree' framework for evaluating multi-hop arithmetic reasoning.

Datasets and Models

The researchers introduced a controlled dataset of multi-hop arithmetic problems across 10 task levels. Each domain contains 100,000 training instances and 3,200 test instances, involving operations like addition, subtraction, and finding set extrema. They evaluated T5 (base, large, and xl) and BART. To further probe failure modes, they conducted ablation studies comparing arithmetic to string operations (copying text vs. calculating) and scratchpad training (forcing models to write intermediate steps).

Results and Discussion

The Systematicity Bottleneck

Models demonstrated high proficiency in Productivity and Substitutivity, frequently achieving 100% accuracy. However, they failed significantly on Systematicity. For example, in zero-shot evaluations for multi-hop tasks (Task 9), T5-xl accuracy dropped to approximately 27.5%. This suggests that models struggle to apply rules learned in one context to a different structural context.

The "Internal Access" Problem

The primary hurdle identified was not the arithmetic itself, but the "access to intermediate information." Models often fail when they must calculate a value (e.g., $1+2=3$) and then reuse that value in a subsequent step if it is not explicitly provided in the input. This was highlighted by a comparison with string concatenation: on Task 5, T5-xl's zero-shot accuracy was only 35.9% for arithmetic but jumped to 86.9% for string manipulation. This suggests that models rely heavily on surface-level copying; when they must retrieve a calculated value from internal weights, the reasoning process breaks down.

Scaling and Scratchpads

While scaling from T5-base to T5-xl provided incremental improvements, it did not resolve the fundamental systematicity failure. Similarly, while "Chain of Thought" style scratchpad training improved performance, it did not fully cure the underlying difficulty with systematic composition.

Conclusion

While modern LLMs are capable of handling long problems and varied syntax, they lack robust systematicity in arithmetic reasoning. The failure to reliably reuse internal knowledge in multi-step reasoning remains a significant challenge. Future research should explore new architectures or training objectives that explicitly reward the reuse of internal knowledge to bridge the gap between pattern matching and true symbolic reasoning.

Summary updated

BibTeX
@inproceedings{kudo2023do,
  author = {Keito Kudo and Yoichi Aoki and Tatsuki Kuribayashi and Ana Brassard and Masashi Yoshikawa and Keisuke Sakaguchi and Kentaro Inui},
  title = {{Do Deep Neural Networks Capture Compositionality in Arithmetic Reasoning?}},
  booktitle = {EACL},
  year = {2023},
  doi = {10.18653/v1/2023.eacl-main.98},
}
Figure