Interpreting and Improving Large Language Models in Arithmetic Calculation

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Zhang, Wei, Wan, Chaoqun, Zhang, Yonggang, Cheung, Yiu-ming, Tian, Xinmei, Shen, Xu, Ye, Jieping
Natura: Preprint
Pubblicazione: 2024
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866912013149536256
author Zhang, Wei
Wan, Chaoqun
Zhang, Yonggang
Cheung, Yiu-ming
Tian, Xinmei
Shen, Xu
Ye, Jieping
author_facet Zhang, Wei
Wan, Chaoqun
Zhang, Yonggang
Cheung, Yiu-ming
Tian, Xinmei
Shen, Xu
Ye, Jieping
contents Large language models (LLMs) have demonstrated remarkable potential across numerous applications and have shown an emergent ability to tackle complex reasoning tasks, such as mathematical computations. However, even for the simplest arithmetic calculations, the intrinsic mechanisms behind LLMs remain mysterious, making it challenging to ensure reliability. In this work, we delve into uncovering a specific mechanism by which LLMs execute calculations. Through comprehensive experiments, we find that LLMs frequently involve a small fraction (< 5%) of attention heads, which play a pivotal role in focusing on operands and operators during calculation processes. Subsequently, the information from these operands is processed through multi-layer perceptrons (MLPs), progressively leading to the final solution. These pivotal heads/MLPs, though identified on a specific dataset, exhibit transferability across different datasets and even distinct tasks. This insight prompted us to investigate the potential benefits of selectively fine-tuning these essential heads/MLPs to boost the LLMs' computational performance. We empirically find that such precise tuning can yield notable enhancements on mathematical prowess, without compromising the performance on non-mathematical tasks. Our work serves as a preliminary exploration into the arithmetic calculation abilities inherent in LLMs, laying a solid foundation to reveal more intricate mathematical tasks.
format Preprint
id arxiv_https___arxiv_org_abs_2409_01659
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Interpreting and Improving Large Language Models in Arithmetic Calculation
Zhang, Wei
Wan, Chaoqun
Zhang, Yonggang
Cheung, Yiu-ming
Tian, Xinmei
Shen, Xu
Ye, Jieping
Computation and Language
Large language models (LLMs) have demonstrated remarkable potential across numerous applications and have shown an emergent ability to tackle complex reasoning tasks, such as mathematical computations. However, even for the simplest arithmetic calculations, the intrinsic mechanisms behind LLMs remain mysterious, making it challenging to ensure reliability. In this work, we delve into uncovering a specific mechanism by which LLMs execute calculations. Through comprehensive experiments, we find that LLMs frequently involve a small fraction (< 5%) of attention heads, which play a pivotal role in focusing on operands and operators during calculation processes. Subsequently, the information from these operands is processed through multi-layer perceptrons (MLPs), progressively leading to the final solution. These pivotal heads/MLPs, though identified on a specific dataset, exhibit transferability across different datasets and even distinct tasks. This insight prompted us to investigate the potential benefits of selectively fine-tuning these essential heads/MLPs to boost the LLMs' computational performance. We empirically find that such precise tuning can yield notable enhancements on mathematical prowess, without compromising the performance on non-mathematical tasks. Our work serves as a preliminary exploration into the arithmetic calculation abilities inherent in LLMs, laying a solid foundation to reveal more intricate mathematical tasks.
title Interpreting and Improving Large Language Models in Arithmetic Calculation
topic Computation and Language
url https://arxiv.org/abs/2409.01659