Large language models have the ability to generate text that mimics patterns in their inputs. We introduce a simple Markov Chain sequence modeling task in order to study how this in-context learning (ICL) capability emerges. In our setting, each example is sampled from a Markov chain drawn from a prior distribution over Markov chains. Transformers trained on this task form \emph{statistical induction heads} which compute accurate next-token probabilities given the bigram statistics of the context. During the course of training, models pass through multiple phases: after an initial stage in which predictions are uniform, they learn to sub-optimally predict using in-context single-token statistics (unigrams); then, there is a rapid phase transition to the correct in-context bigram solution. We conduct an empirical and theoretical investigation of this multi-phase process, showing how successful learning results from the interaction between the transformer's layers, and uncovering evidence that the presence of the simpler unigram solution may delay formation of the final bigram solution. We examine how learning is affected by varying the prior distribution over Markov chains, and consider the generalization of our in-context learning of Markov chains (ICL-MC) task to $n$-grams for $n > 2$.
From Shortcut to Induction Head: How Data Diversity Shapes Algorithm Selection in Transformers
The University of Tokyo(东京大学);RIKEN AIP(理化学研究所AIP);Flatiron Institute(Flatiron研究所);CNRS(法国国家科学研究中心);Université Côte d’Azur(蔚蓝海岸大学);New York University(纽约大学)
What One Cannot, Two Can: Two-Layer Transformers Provably Represent Induction Heads on Any-Order Markov Chains
Massachusetts Institute of Technology(麻省理工学院);École Polytechnique Fédérale de Lausanne(瑞士联邦理工学院);University of California, Berkeley(加州大学伯克利分校);Princeton University(普林斯顿大学)
Phase Transitions in Attention: A Bayesian Theory of Copy Head Emergence
Racah Institute of Physics, Hebrew University of Jerusalem(拉卡学院物理研究所,耶路撒冷希伯来大学);John A. Paulson School of Engineering and Applied Sciences, Harvard University(约翰·A·保罗森工程与应用科学学校,哈佛大学);Institute for Advanced Simulation (IAS-6), Computational and Systems Neuroscience, Jülich Research Center(高级模拟研究所(IAS-6),计算与系统神经科学,茹里奇研究中心);Institute of AI for Health, Helmholtz Munich(健康人工智能研究所,海德堡-穆恩);RWTH Aachen University(亚琛工业大学);Department of Physics, Faculty 1, RWTH Aachen University(物理系,亚琛工业大学)