Skip to main content
QUICK REVIEW

[论文解读] How does GPT-2 compute greater-than?: Interpreting mathematical abilities in a pre-trained language model

Michael Hanna, Ollie Liu|arXiv (Cornell University)|Apr 30, 2023
Topic ModelingComputer Science被引用 14
一句话总结

这篇论文通过在模型中识别一个最小因果电路并解释 MLPs 和注意力头如何对该行为做出贡献,分析 GPT-2 small 在年份跨度上的“>”运算能力。

ABSTRACT

Pre-trained language models can be surprisingly adept at tasks they were not explicitly trained on, but how they implement these capabilities is poorly understood. In this paper, we investigate the basic mathematical abilities often acquired by pre-trained language models. Concretely, we use mechanistic interpretability techniques to explain the (limited) mathematical abilities of GPT-2 small. As a case study, we examine its ability to take in sentences such as "The war lasted from the year 1732 to the year 17", and predict valid two-digit end years (years > 32). We first identify a circuit, a small subset of GPT-2 small's computational graph that computes this task's output. Then, we explain the role of each circuit component, showing that GPT-2 small's final multi-layer perceptrons boost the probability of end years greater than the start year. Finally, we find related tasks that activate our circuit. Our results suggest that GPT-2 small computes greater-than using a complex but general mechanism that activates across diverse contexts.

研究动机与目标

  • 在未进行显式训练的情况下,研究预训练语言模型如何展现数学能力。
  • 将机制性可解释性应用于 GPT-2 small,以揭示一个简单数学任务的内部电路。
  • 确定完成“greater-than”运算所需的最小组件集合。
  • 描述注意力头和 MLP 在传递与处理数值信息中的作用。

提出的方法

  • 定义年份跨度预测任务,其中 GPT-2 给出结束年份大于起始年份 YY 的概率更高。
  • 使用路径补丁(path patching)创建数据集(01-dataset),并衡量对组件补丁如何影响 logits 和概率差异。
  • 通过对注意力头和 MLPs(MLPs 8–11)对 logits 的直接贡献进行补丁,迭代地识别电路组件以分离出该电路。
  • 通过分析注意力模式(logit lens)和 MLP 内部的神经元级贡献来解释该电路。
  • 通过定向数据集补丁实验评估电路的充分性,并通过对电路外部组件的跨补丁来评估必要性。
Figure 1: Year-span prediction example ( XX =17 and YY =32) with sample (in)valid output years.
Figure 1: Year-span prediction example ( XX =17 and YY =32) with sample (in)valid output years.

实验结果

研究问题

  • RQ1一个最小的、因果性的电路是否能够解释 GPT-2 small 在年份跨度提示上的“大于”运算?
  • RQ2哪些组件(注意力头、MLP 和神经元)是完成此任务中“greater-than”运算所必需且充分的?
  • RQ3已识别的电路组件如何交互以传递起始年份 YY 并完成比较?
  • RQ4所发现的电路是否能推广到格式和输出空间相似的相关提示?
  • RQ5结果是否区分了记忆与泛化作为 GPT-2 的数学能力来源?

主要发现

  • 由 MLPs 8–11 和 a9.h1(注意力头)组成的电路在很大程度上解释了对数层中的“大于”计算。
  • 注意力头似乎将起始年份 YY 传递给下游的 MLPs,后者直接计算哪些输出年份大于 YY。
  • MLP 10(在较小程度上还有 MLP 9 和 MLP 11)对“大于”决策贡献最直接,神经元级分析显示该运算在 MLP 内分布在多个神经元之间。
  • 路径补丁实验表明该电路在很大程度上是充分的(概率差约为原始的 72.7%),当中断电路外部边缘时也必要(对照中为 -36.6%)。
  • logit lens 分析显示 MLPs 9–11 将大于 YY 的年份加权,形成一个在句末位置实现比较的左上三角模式。
Figure 3: A : The computational graph of GPT-2, run on our normal dataset. B : GPT-2, where the (MLP 10, logits) path is patched to receive 01 -input. C : GPT-2, where the (Attn 10, MLP 10, logits) path receives 01 -input. Nodes receiving normal input have blue output; nodes receiving 01 -input have
Figure 3: A : The computational graph of GPT-2, run on our normal dataset. B : GPT-2, where the (MLP 10, logits) path is patched to receive 01 -input. C : GPT-2, where the (Attn 10, MLP 10, logits) path receives 01 -input. Nodes receiving normal input have blue output; nodes receiving 01 -input have

阅读本论文

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

在 Nubint 中阅读本论文

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