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

基于马尔可夫数据的Transformers:常数深度即足够

Transformers on Markov Data: Constant Depth Suffices

UC Berkeley(加州大学伯克利分校);EPFL(洛桑联邦理工学院)

Nived Rajaraman, Marco Bondaschi, Kannan Ramchandran, Michael Gastpar, Ashok Vardhan Makkuva

AI总结:

研究Transformer在k阶马尔可夫数据上的行为,发现固定深度单头模型即可实现低测试损失,并证明三层Transformer能表示上下文条件经验分布,揭示了其捕获上下文的机制。

摘要:

基于注意力的Transformers在跨领域和跨模态的生成过程建模方面取得了显著成功。在本文中,我们研究了Transformers在取自k阶马尔可夫过程的数据上的行为,其中序列中下一个符号的条件分布取决于之前观察到的k个符号。我们在经验上观察到一个与先前发现相矛盾的惊人现象:当训练时间足够长时,具有固定深度且每层1个注意力头的Transformer能够在取自k阶马尔可夫源的序列上实现较低的测试损失,即使k不断增大也是如此。此外,这种较低的测试损失是通过Transformer表示和学习上下文条件经验分布的能力来实现的。在理论方面,我们的主要结果是,具有单头和三层的Transformer能够表示k阶马尔可夫源的上下文条件经验分布,这与我们的经验观察相一致。在此过程中,我们证明了具有O(log_2(k))层的纯注意力Transformers能够通过组合归纳头来追踪序列中之前的k个符号,从而表示上下文条件经验分布。通过理解Transformers在马尔可夫源上的行为,这些结果为Transformers学习捕获上下文的机制提供了更深入的见解。

英文摘要:

Attention-based transformers have been remarkably successful at modeling generative processes across various domains and modalities. In this paper, we study the behavior of transformers on data drawn from \kth Markov processes, where the conditional distribution of the next symbol in a sequence depends on the previous $k$ symbols observed. We observe a surprising phenomenon empirically which contradicts previous findings: when trained for sufficiently long, a transformer with a fixed depth and $1$ head per layer is able to achieve low test loss on sequences drawn from \kth Markov sources, even as $k$ grows. Furthermore, this low test loss is achieved by the transformer's ability to represent and learn the in-context conditional empirical distribution. On the theoretical side, our main result is that a transformer with a single head and three layers can represent the in-context conditional empirical distribution for \kth Markov sources, concurring with our empirical observations. Along the way, we prove that \textit{attention-only} transformers with $O(\log_2(k))$ layers can represent the in-context conditional empirical distribution by composing induction heads to track the previous $k$ symbols in the sequence. These results provide more insight into our current understanding of the mechanisms by which transformers learn to capture context, by understanding their behavior on Markov sources.

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

↑