揭示Transformer实现上下文学习的四种机制及其形成条件
Distinct mechanisms underlying in-context learning in transformers

- 通过分层子电路分析,发现四种不同计算模式
- 数据多样性决定记忆与泛化的边界(K1*、K2*)
- 适合研究模型内部工作机制的研究者阅读
现代分布式网络,尤其是Transformer,展现出一种称为'上下文学习'的能力,能根据输入统计特性自适应调整计算,使固定网络可应用于广泛系统。本文针对在有限离散马尔可夫链集合S上训练的Transformer,完整刻画了其行为的机制。Transformer表现出四种算法阶段:是否记忆、是否泛化,以及是否使用1点或2点统计量。这些阶段由多层子电路实现,体现两种本质不同的上下文自适应计算机制。最小模型揭示了两种模式的关键特征。记忆与泛化阶段由两个边界划分,分别依赖于数据多样性K = |S|:第一个边界K1*由子电路间的动力学竞争决定,第二个边界K2*由表征瓶颈决定。对训练动态的对称性约束理论解释了从1点到2点泛化的突变,并识别出使网络能够泛化的损失函数关键特征。综上,我们证明Transformer会发展出不同子电路来实现上下文学习,并明确了不同机制占优的条件。
原文摘要 · Abstract (English)
Modern distributed networks, notably transformers, acquire a remarkable ability (termed `in-context learning') to adapt their computation to input statistics, such that a fixed network can be applied to data from a broad range of systems. Here, we provide a complete mechanistic characterization of this behavior in transformers trained on a finite set $S$ of discrete Markov chains. The transformer displays four algorithmic phases, characterized by whether the network memorizes and generalizes, and whether it uses 1-point or 2-point statistics. We show that the four phases are implemented by multi-layer subcircuits that exemplify two qualitatively distinct mechanisms for implementing context-adaptive computations. Minimal models isolate the key features of both motifs. Memorization and generalization phases are delineated by two boundaries that depend on data diversity, $K = |S|$. The first ($K_1^\ast$) is set by a kinetic competition between subcircuits and the second ($K_2^\ast$) is set by a representational bottleneck. A symmetry-constrained theory of a transformer's training dynamics explains the sharp transition from 1-point to 2-point generalization and identifies key features of the loss landscape that allow the network to generalize. Put together, we show that transformers develop distinct subcircuits to implement in-context learning and identify conditions that favor certain mechanisms over others.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。