arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2406.03068cs.LGcs.AIcs.CLstat.ML
收藏

分布关联与上下文内推理:前馈层与注意力层的研究

Distributional Associations vs In-Context Reasoning: A Study of Feed-forward and Attention Layers

Courant Institute of Mathematical Sciences(柯朗数学科学研究所);Flatiron Institute(弗拉蒂伦研究所);Center for Data Science(数据科学中心);New York University(纽约大学)

Lei Chen, Joan Bruna, Alberto Bietti

AI总结:

本文在受控合成环境中研究Transformer前馈层与注意力层的分工,发现前馈层偏向学习二元词组等分布关联,注意力层专注上下文内推理,并揭示梯度噪声是差异关键,最后在Pythia模型上验证了类似现象。

摘要:

大型语言模型在涉及基本形式上下文内推理的任务中取得了成功,例如生成连贯的语言,以及存储大量知识。此类模型背后的Transformer架构核心是前馈层和注意力层,它们通常分别与知识和推理相关联。在本文中,我们在一个受控的合成环境中从实证和理论两方面研究这一区别,在该环境中,某些下一个词元预测同时涉及分布信息和上下文内信息。我们发现,前馈层倾向于学习简单的分布关联,例如二元词组,而注意力层则专注于上下文内推理。我们的理论分析指出,梯度中的噪声是造成这种差异的关键因素。最后,我们通过对Pythia模型家族在简单推理任务上进行消融实验,说明了类似差异如何在预训练模型中出现。

英文摘要:

Large language models have been successful at tasks involving basic forms of in-context reasoning, such as generating coherent language, as well as storing vast amounts of knowledge. At the core of the Transformer architecture behind such models are feed-forward and attention layers, which are often associated to knowledge and reasoning, respectively. In this paper, we study this distinction empirically and theoretically in a controlled synthetic setting where certain next-token predictions involve both distributional and in-context information. We find that feed-forward layers tend to learn simple distributional associations such as bigrams, while attention layers focus on in-context reasoning. Our theoretical analysis identifies the noise in the gradients as a key factor behind this discrepancy. Finally, we illustrate how similar disparities emerge in pre-trained models through ablations on the Pythia model family on simple reasoning tasks.

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

↑