Exploring Generalization Ability of Pretrained Language Models on Arithmetic and Logical Reasoning

Cunxiang Wang, Boyuan Zheng, Yuchen Niu, Yue Zhang

Introduction

Large-scale Pretrained Language Models (PLMs) have demonstrated remarkable performance across a wide array of NLP benchmarks. However, a fundamental question remains: do these models truly "understand" the underlying logic of the tasks they perform, or are they merely sophisticated pattern matchers? This study by Wang et al. investigates the systematic generalization capabilities of PLMs, specifically focusing on whether a model trained on simple arithmetic or logic can apply those same rules to more complex, unseen distributions.

Methodology and Task Design

The researchers evaluated BART-Large, a generative transformer-based model, across five core reasoning tasks. To test generalization, they employed two evaluation setups:

  1. In-Distribution (ID): Test data follows the same constraints as training data (e.g., 3-digit addition).
  2. Cross-Distribution (CD): Test data varies by input length, output range, or both (e.g., testing 3-digit trained models on 4-digit problems).
Overview of the reasoning tasks evaluated, including Addition, Subtraction, Comparison, and Symbolic Logic.

The tasks included:

  • Numbering: Counting and listing characters.
  • Arithmetic: 3-digit addition and subtraction.
  • Comparison: Determining the relationship between two numbers.
  • Symbolic Logic: Evaluating boolean expressions (AND, OR, NOT, IMPLY).

Key Insights: The Distribution Wall

The study revealed a stark contrast between in-distribution mastery and cross-distribution failure. While BART achieved nearly 100% accuracy on ID arithmetic with minimal training, its performance collapsed to near zero when faced with different digit counts.

Traditional arithmetic requires mastering rules like carrying and borrowing, which PLMs fail to generalize to new distributions.

The Illusion of Rule-Mastery

The failure in arithmetic suggests that the model does not learn the universal algorithmic rules of carrying and borrowing. Instead, it seems to interpolate within the numerical range it has seen. Interestingly, the model generalized perfectly on Symbolic Logic and well on Counting, suggesting that some logical structures are more easily internalized by transformer architectures than the recursive, multi-step nature of multi-digit arithmetic.

Results Summary

The following table highlights the performance gap between ID and CD settings:

Task In-Distribution Cross-Distribution (Question) Cross-Distribution (Answer)
Counting ~100% 98.8% N/A
Addition 100% 1.0% 0%
Subtraction 100% 0.87% 0%
Comparison 100% 45.63% N/A
Symbolic Logic 100% 100% N/A

Overlap analysis further confirmed that while the model doesn't require exact question matches, it is heavily dependent on the training range. A brief test on GPT-3 showed similar degradation as digit counts increased, indicating that even much larger models may rely on memorized patterns from their massive corpora rather than true calculation.

Conclusion and Future Directions

The findings suggest that current PLMs are "local" learners rather than "global" reasoners. While they can simulate logic within a known distribution, they lack the robust algorithmic understanding required for true systematic generalization. Future research must focus on architectural innovations or training objectives that incentivize the learning of discrete, rule-based logic over surface-level statistical correlations.

Summary updated

BibTeX
@inproceedings{wang2021exploring,
  author = {Cunxiang Wang and Boyuan Zheng and Yuchen Niu and Yue Zhang},
  title = {{Exploring Generalization Ability of Pretrained Language Models on Arithmetic and Logical Reasoning}},
  booktitle = {NLPCC},
  year = {2021},
  url = {https://openreview.net/forum?id=tBCuW5IGC5},
}
Figure