Preprint
Large Language Models

Number Understanding of LLMs

Haotong Yang, Yi Hu, Shijia Kang, Zhouchen Lin, Muhan Zhang
November 6, 2024International Conference on Learning Representations47 citations

47

Citations

5

Influential Citations

International Conference on Learning Representations

Venue

2024

Year

Abstract

Large language models (LLMs) can solve an increasing number of complex reasoning tasks while making surprising mistakes in basic numerical understanding and processing (such as 9.11>9.9). The latter ability is essential for tackling complex arithmetic and mathematical problems and serves as a foundation for most reasoning tasks, but previous work paid little attention to it or only discussed several restricted tasks (like integer addition). In this paper, we comprehensively investigate the numerical understanding and processing ability (NUPA) of LLMs. Firstly, we introduce a benchmark covering four common numerical representations and 17 distinct numerical tasks in four major categories, resulting in 41 meaningful combinations in total. These tasks are derived from primary and secondary education curricula, encompassing nearly all everyday numerical understanding and processing scenarios, and the rules of these tasks are very simple and clear. Through the benchmark, we find that current LLMs fail frequently in many of the tasks. To study the problem, we train small models with existing and potential techniques for enhancing NUPA (such as tokenizers, PEs, and number formats), comprehensively evaluating their effectiveness using our testbed. We also finetune practical-scale LLMs on our proposed NUPA tasks and find that 1) naive finetuning can improve NUPA a lot on many but not all tasks, and 2) surprisingly, techniques designed to enhance NUPA prove ineffective for finetuning pretrained models. We further explore the impact of chain-of-thought techniques on NUPA. Our work provides a more detailed and comprehensive understanding of NUPA in LLMs. Our benchmark and code are released at https://github.com/GraphPKU/number_cookbook.

Analysis

Why This Paper Matters

Large language models (LLMs) have demonstrated remarkable capabilities in complex reasoning, yet they often stumble on basic numerical comparisons like 9.11 > 9.9. This paper addresses this surprising gap by systematically investigating the numerical understanding and processing ability (NUPA) of LLMs. The authors argue that NUPA is foundational for arithmetic and mathematical reasoning, and previous work has largely overlooked it or focused on narrow tasks like integer addition. By introducing a comprehensive benchmark and conducting extensive experiments, this paper fills a critical gap in our understanding of LLM limitations.

The significance of this work lies in its breadth and depth. The benchmark covers four common numerical representations (e.g., decimal, fraction, scientific notation) and 17 distinct tasks across four major categories, resulting in 41 meaningful combinations. These tasks are derived from primary and secondary education curricula, making them representative of everyday numerical scenarios. The findings that current LLMs fail frequently on many of these tasks underscore a fundamental weakness that could undermine their reliability in real-world applications, especially in domains requiring precise numerical reasoning.

Technical Contributions

The paper makes several key technical contributions:

  • Comprehensive Benchmark: A new benchmark with 41 task-representation combinations, covering tasks like comparison, rounding, arithmetic, and unit conversion, all with simple rules.
  • Systematic Evaluation: Extensive evaluation of current LLMs, revealing specific task types where they fail most often.
  • Technique Assessment: Training small models with various tokenizers, positional encodings (PEs), and number formats to evaluate their impact on NUPA.
  • Finetuning Analysis: Finetuning practical-scale LLMs on the NUPA tasks, showing that naive finetuning can improve performance on many tasks but not all, and that techniques like specialized tokenizers are ineffective when applied to pretrained models.
  • Chain-of-Thought Exploration: Investigating how chain-of-thought prompting affects NUPA, providing insights into reasoning-based improvements.

Results

The paper reports that current LLMs fail frequently on many numerical tasks, with performance varying across task types. For instance, tasks involving decimal comparisons and fractions are particularly challenging. Naive finetuning on the NUPA tasks leads to substantial improvements on many tasks, but some tasks remain difficult. Surprisingly, techniques designed to enhance NUPA, such as custom tokenizers or positional encodings, do not yield benefits when finetuning pretrained models, suggesting that these techniques may not transfer well to large-scale models. The chain-of-thought experiments show mixed results, indicating that while reasoning can help, it does not fully resolve the underlying numerical understanding issues.

Significance

This paper provides a foundational analysis of a critical yet understudied aspect of LLM capability. By releasing a benchmark and code, it enables the research community to systematically measure and improve NUPA. The findings challenge the assumption that LLMs have robust numerical understanding and highlight the need for targeted interventions. The ineffectiveness of existing enhancement techniques in finetuning settings suggests that new approaches are needed, potentially involving architectural changes or training data modifications. This work will likely inspire further research on numerical reasoning in LLMs, with implications for educational AI, scientific computing, and any application requiring accurate numerical processing.