arXiv:2409.01659cs.CL2024-09ICML被引 57

发现大模型算术计算依赖少数关键注意力头和MLP,可精准微调提升性能。

Interpreting and Improving Large Language Models in Arithmetic Calculation

  • 定位算术计算中起核心作用的少量注意力头与MLP模块
  • 仅微调关键组件即显著提升算术能力,且不影响其他任务表现
  • 成果对理解模型内部机制有启发,适合关注推理可解释性的研究者

大型语言模型(LLMs)在众多应用中展现出巨大潜力,并表现出处理复杂推理任务(如数学计算)的涌现能力。然而,即便是最简单的算术计算,其内在机制仍不明确,难以确保可靠性。本文深入探究了LLMs执行计算的具体机制。通过全面实验,我们发现模型在计算过程中通常仅依赖极少数注意力头(少于5%),这些头部在聚焦操作数与运算符方面起关键作用。随后,相关信息经由多层感知机(MLPs)逐步处理,最终得出结果。这些关键头部/MLPs虽在特定数据集上识别,但具有跨数据集甚至跨任务的可迁移性。这一发现促使我们探索选择性微调这些核心组件以提升计算性能的可能性。实验证明,这种精准微调能显著增强模型的数学能力,同时不损害非数学任务的表现。本工作为揭示LLMs内在算术计算能力提供了初步探索,为理解更复杂的数学任务奠定了基础。

原文摘要 · Abstract (English)

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.

大模型推理算术计算注意力机制可解释性

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。