arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2410.11474cs.LGmath.OCstat.ML
收藏

Transformers 如何变得“丰富”:近似与动力学分析

How Transformers Get Rich: Approximation and Dynamics Analysis

Mingze Wang, Ruoxi Yu, Weinan E, Lei Wu

AI总结:

本研究通过近似与动力学分析揭示了 transformers 实现 induction head 机制的原理,发现训练过程中模型会从懒惰的 n-gram 机制突变至丰富的 induction head 机制。

摘要:

Transformers 展现了卓越的上下文学习能力,然而对其底层机制的理论理解仍然有限。近期一项研究(Elhage et al., 2021)发现了一种被称为 induction head 的“丰富”上下文机制,这与忽略长程依赖的“懒惰” $n$-gram 模型形成对比。在本研究中,我们针对 transformers 如何实现 induction heads 提供了近似与动力学分析。在近似分析中,我们形式化了标准与广义 induction head 机制,并探讨了 transformers 如何高效实现它们,重点关注各 transformer 子模块的独特作用。在动力学分析中,我们研究了在合成混合目标上的训练动力学,该目标由 4-gram 和上下文 2-gram 组成。这一受控设定使我们能精确刻画整个训练过程,并揭示出随着训练推进,从懒惰(4-gram)到丰富(induction head)机制的突变。

英文摘要:

Transformers have demonstrated exceptional in-context learning capabilities, yet the theoretical understanding of the underlying mechanisms remains limited. A recent work (Elhage et al., 2021) identified a ``rich'' in-context mechanism known as induction head, contrasting with ``lazy'' $n$-gram models that overlook long-range dependencies. In this work, we provide both approximation and dynamics analyses of how transformers implement induction heads. In the {\em approximation} analysis, we formalize both standard and generalized induction head mechanisms, and examine how transformers can efficiently implement them, with an emphasis on the distinct role of each transformer submodule. For the {\em dynamics} analysis, we study the training dynamics on a synthetic mixed target, composed of a 4-gram and an in-context 2-gram component. This controlled setting allows us to precisely characterize the entire training process and uncover an {\em abrupt transition} from lazy (4-gram) to rich (induction head) mechanisms as training progresses.

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

↑