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

像Transformers一样思考

Thinking Like Transformers

Technion(以色列理工学院);Bar Ilan University(巴伊兰大学);Allen Institute for AI(艾伦人工智能研究所)

Gail Weiss, Yoav Goldberg, Eran Yahav

摘要:

Transformer背后的计算模型是什么?递归神经网络在有限状态机中有直接的相似之处,允许围绕架构变体或训练模型进行清晰的讨论和思考,而Transformers没有这样熟悉的相似之处。在本文中,我们的目标是改变,提出了一个计算模型的变压器编码器的形式的程序设计语言。我们将变换器编码器的基本组件--注意力和前馈计算--映射到简单的原语中,围绕这些原语,我们形成了一种程序设计语言:受限访问序列处理语言(RASP)。我们展示了如何RASP可以用来编程解决方案的任务,可以想象的是由一个Transformer学习,以及如何一个Transformer可以训练模仿RASP解决方案。特别是,我们提供RASP程序直方图,排序和戴克语言。我们进一步使用我们的模型,涉及他们的困难方面所需的层数和注意头:分析RASP程序意味着最大数量的头和层编码任务所需的Transformer。最后,我们看到如何从我们的抽象获得的见解可能被用来解释在最近的作品中看到的现象。

英文摘要:

What is the computational model behind a Transformer? Where recurrent neural networks have direct parallels in finite state machines, allowing clear discussion and thought around architecture variants or trained models, Transformers have no such familiar parallel. In this paper we aim to change that, proposing a computational model for the transformer-encoder in the form of a programming language. We map the basic components of a transformer-encoder -- attention and feed-forward computation -- into simple primitives, around which we form a programming language: the Restricted Access Sequence Processing Language (RASP). We show how RASP can be used to program solutions to tasks that could conceivably be learned by a Transformer, and how a Transformer can be trained to mimic a RASP solution. In particular, we provide RASP programs for histograms, sorting, and Dyck-languages. We further use our model to relate their difficulty in terms of the number of required layers and attention heads: analyzing a RASP program implies a maximum number of heads and layers necessary to encode a task in a transformer. Finally, we see how insights gained from our abstraction might be used to explain phenomena seen in recent works.

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

↑