arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2402.04161cs.LGcs.CLcs.ITmath.ITstat.ML
收藏

马尔可夫注意力:一种通过马尔可夫链对Transformer进行原理性分析的框架

Attention with Markov: A Framework for Principled Analysis of Transformers via Markov Chains

EPFL(苏黎世联邦理工学院);UT Austin(得克萨斯大学奥斯汀分校)

Ashok Vardhan Makkuva, Marco Bondaschi, Adway Girish, Alliot Nagle, Martin Jaggi, Hyeji Kim, Michael Gastpar

AI总结:

本文提出基于马尔可夫链的Transformer原理性分析框架,从理论上刻画单层Transformer的损失景观,解释了其陷入一元语法局部最小值而深层模型能学习二元语法的现象,并给出局部最优出现的条件。

摘要:

基于注意力的Transformer已在包括自然语言在内的众多学科中取得了巨大成功。为了加深对其序列建模能力的理解,人们越来越关注使用马尔可夫输入过程来研究它们。一个关键发现是,当在一阶马尔可夫链上训练时,具有两层或更多层的Transformer会一致地发展出归纳头机制,以估计上下文中的二元语法条件分布。相比之下,单层Transformer无法形成归纳头,只能直接学习马尔可夫核,但常常面临一个令人意外的挑战:它们会陷入表示一元语法分布的局部最小值,而更深的模型则能可靠地收敛到真实的二元语法分布。尽管单层Transformer在理论上可以对一阶马尔可夫链进行建模,但它们在实践中无法学习这一简单核的经验性失败仍然是一个令人好奇的现象。为了解释单层模型的这种对比行为,本文引入了一个通过马尔可夫链对Transformer进行原理性分析的新框架。利用该框架,我们从理论上刻画了单层Transformer的损失景观,并证明了全局最小值(二元语法)和不良局部最小值(一元语法)的存在取决于数据属性和模型架构。我们精确界定了这些局部最优出现的条件范围。在实验的支持下,我们证明了理论发现与经验结果一致。最后,我们概述了该领域中的若干开放问题。代码可在https://github.com/Bond1995/Markov获取。

英文摘要:

Attention-based transformers have achieved tremendous success across a variety of disciplines including natural languages. To deepen our understanding of their sequential modeling capabilities, there is a growing interest in using Markov input processes to study them. A key finding is that when trained on first-order Markov chains, transformers with two or more layers consistently develop an induction head mechanism to estimate the in-context bigram conditional distribution. In contrast, single-layer transformers, unable to form an induction head, directly learn the Markov kernel but often face a surprising challenge: they become trapped in local minima representing the unigram distribution, whereas deeper models reliably converge to the ground-truth bigram. While single-layer transformers can theoretically model first-order Markov chains, their empirical failure to learn this simple kernel in practice remains a curious phenomenon. To explain this contrasting behavior of single-layer models, in this paper we introduce a new framework for a principled analysis of transformers via Markov chains. Leveraging our framework, we theoretically characterize the loss landscape of single-layer transformers and show the existence of global minima (bigram) and bad local minima (unigram) contingent on data properties and model architecture. We precisely delineate the regimes under which these local optima occur. Backed by experiments, we demonstrate that our theoretical findings are in congruence with the empirical results. Finally, we outline several open problems in this arena. Code is available at https://github.com/Bond1995/Markov .

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

↑