Skip to main content
QUICK REVIEW

[论文解读] Arithmetic Without Algorithms: Language Models Solve Math With a Bag of Heuristics

Yaniv Nikankin, Anja Reusch|arXiv (Cornell University)|Oct 28, 2024
Computability, Logic, AI AlgorithmsComputer Science被引用 3
一句话总结

该论文揭示,大型语言模型并非通过学习到的算法或记忆来解决算术推理,而是通过一种“启发式规则集合”——即一组稀疏的神经元,每个神经元实现简单的基于模式的规则,以提升特定数值范围或模式的logits。该机制在训练早期即已出现,并解释了模型大部分的准确性,挑战了关于大型语言模型具备算法泛化能力的传统假设。

ABSTRACT

Do large language models (LLMs) solve reasoning tasks by learning robust generalizable algorithms, or do they memorize training data? To investigate this question, we use arithmetic reasoning as a representative task. Using causal analysis, we identify a subset of the model (a circuit) that explains most of the model's behavior for basic arithmetic logic and examine its functionality. By zooming in on the level of individual circuit neurons, we discover a sparse set of important neurons that implement simple heuristics. Each heuristic identifies a numerical input pattern and outputs corresponding answers. We hypothesize that the combination of these heuristic neurons is the mechanism used to produce correct arithmetic answers. To test this, we categorize each neuron into several heuristic types-such as neurons that activate when an operand falls within a certain range-and find that the unordered combination of these heuristic types is the mechanism that explains most of the model's accuracy on arithmetic prompts. Finally, we demonstrate that this mechanism appears as the main source of arithmetic accuracy early in training. Overall, our experimental results across several LLMs show that LLMs perform arithmetic using neither robust algorithms nor memorization; rather, they rely on a "bag of heuristics".

研究动机与目标

  • 探究大型语言模型(LLMs)是否通过稳健的算法或对训练数据的记忆来解决算术推理。
  • 从神经元层面逆向工程LLMs算术推理的内部机制。
  • 确定启发式机制在训练过程中何时以及如何出现。
  • 对单个神经元在算术准确性中的作用进行分类与量化。
  • 通过展示模型对启发式模式的依赖,挑战“LLMs通过算法推理实现泛化”的假设。

提出的方法

  • 使用因果分析,作者隔离出负责LLMs算术推理的最小电路。
  • 分析算术电路中的单个神经元,识别对特定输入模式激活的神经元。
  • 根据激活模式,将神经元分类为启发式类型,如结果范围型、基于模式型或模运算型规则。
  • 通过消融实验与忠实性分析,评估每类启发式类型对模型准确性的贡献。
  • 追踪训练各阶段启发式机制的出现过程,以确定其主导出现的时间点。
  • 在多个LLMs(如Llama3-8B、GPT-J)上进行实验,以确保研究发现的普适性。
Figure 1: Bag of heuristics visualization. We show that transformer LLMs solve arithmetic prompts by combining several unrelated heuristics, each activating according to rules based on the input values of operands, and boosting the logits of corresponding result tokens. These heuristics are manifest
Figure 1: Bag of heuristics visualization. We show that transformer LLMs solve arithmetic prompts by combining several unrelated heuristics, each activating according to rules based on the input values of operands, and boosting the logits of corresponding result tokens. These heuristics are manifest

实验结果

研究问题

  • RQ1LLMs是否通过稳健且可泛化的算法或对训练样本的记忆来解决算术问题?
  • RQ2LLMs算术推理的内部机制是什么——特别是单个神经元在其中的作用?
  • RQ3启发式神经元如何贡献于模型准确性?它们是否足以解释模型性能?
  • RQ4‘启发式规则集合’机制在训练过程中何时出现?
  • RQ5启发式神经元在训练分布之外的泛化能力如何?

主要发现

  • 一组稀疏的神经元,每个实现不同的启发式规则,解释了模型算术准确性的绝大部分。
  • 该机制并非算法性的,而是由一系列无关的启发式规则组合而成,例如提升特定数值范围结果的logits,或匹配数字模式。
  • 启发式神经元对特定输入模式激活——例如,一个神经元在答案落在240至270之间时,会提升该范围的logits。
  • '启发式规则集合'机制在训练初期即已出现并迅速占据主导地位,表明其从一开始就构成主要机制。
  • 忠实性分析确认,启发式类型无序组合能够解释模型在算术提示上的大部分行为。
  • 不符合预定义启发式类型的神经元对准确性贡献极小,表明该启发式机制对正确表现而言既充分又必要。
(a)
(a)

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。