arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2409.01659cs.CL
收藏

大语言模型在算术计算中的机制解释与改进

Interpreting and Improving Large Language Models in Arithmetic Calculation

University of Science and Technology of China(中国科学技术大学);Alibaba Cloud(阿里云);Hong Kong Baptist University(香港浸会大学);Institute of Artificial Intelligence, Hefei Comprehensive National Science Center(合肥综合性国家科学中心人工智能研究院)

Wei Zhang, Chaoqun Wan, Yonggang Zhang, Yiu-ming Cheung, Xinmei Tian, Xu Shen, Jieping Ye

AI总结:

本文揭示了LLMs执行算术计算时依赖少于5%的关键注意力头和MLPs的机制,并证明选择性微调这些关键组件可在不损害非数学任务性能的前提下显著提升数学计算能力。

摘要:

大语言模型(LLMs)在众多应用中展现出显著潜力,并显示出处理复杂推理任务(如数学计算)的涌现能力。然而,即使对于最简单的算术计算,LLMs背后的内在机制仍然神秘,这使得确保其可靠性变得困难。在这项工作中,我们深入揭示LLMs执行计算的一种具体机制。通过全面的实验,我们发现LLMs经常涉及一小部分(< 5%)的注意力头,这些注意力头在计算过程中对聚焦操作数和运算符起着关键作用。随后,来自这些操作数的信息通过多层感知器(MLPs)进行处理,逐步导向最终解。这些关键的注意力头/MLPs虽然是在特定数据集上识别出来的,但展现出跨不同数据集甚至不同任务的迁移性。这一见解促使我们研究选择性微调这些关键注意力头/MLPs以提升LLMs计算性能的潜在益处。我们通过实验发现,这种精确调优可以在数学能力上带来显著提升,同时不损害非数学任务上的性能。我们的工作作为对LLMs内在算术计算能力的初步探索,为揭示更复杂的数学任务奠定了坚实基础。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑