We study the dynamics of gradient flow for training a multi-head softmax attention model for in-context learning of multi-task linear regression. We establish the global convergence of gradient flow under suitable choices of initialization. In addition, we prove that an interesting "task allocation" phenomenon emerges during the gradient flow dynamics, where each attention head focuses on solving a single task of the multi-task model. Specifically, we prove that the gradient flow dynamics can be split into three phases -- a warm-up phase where the loss decreases rather slowly and the attention heads gradually build up their inclination towards individual tasks, an emergence phase where each head selects a single task and the loss rapidly decreases, and a convergence phase where the attention parameters converge to a limit. Furthermore, we prove the optimality of gradient flow in the sense that the limiting model learned by gradient flow is on par with the best possible multi-head softmax attention model up to a constant factor. Our analysis also delineates a strict separation in terms of the prediction accuracy of ICL between single-head and multi-head attention models. The key technique for our convergence analysis is to map the gradient flow dynamics in the parameter space to a set of ordinary differential equations in the spectral domain, where the relative magnitudes of the semi-singular values of the attention weights determines task allocation. To our best knowledge, our work provides the first convergence result for the multi-head softmax attention model.
Center for Foundation Models and Generative AI & Department of Computer Science, Northwestern University, USA(基础模型与生成人工智能中心及计算机科学系,西北大学,美国);School of Mathematical Sciences, Fudan University(复旦大学数学科学学院);University of California, Berkeley, USA(加州大学伯克利分校,美国);Center for Foundation Models and Generative AI & Department of Computer Science & Department of Statistics and Data Science, Northwestern University, USA(基础模型与生成人工智能中心及计算机科学系与统计与数据科学系,西北大学,美国)
School of Informatics, University of Edinburgh(爱丁堡大学信息学院);ILLC, University of Amsterdam(阿姆斯特丹大学语言、逻辑与计算研究所);Department of Computational Linguistics, University of Zurich(苏黎世大学计算语言学系)
GLL: A Differentiable Graph Learning Layer for Neural Networks
Department of Mathematics University of California, Los Angeles(数学系,加州大学洛杉矶分校);Computing + Mathematical Sciences (CMS) Department California Institute of Technology(计算与数学科学系(CMS),加州理工学院);School of Mathematics University of Minnesota(数学系,明尼苏达大学)
In-Context Algorithm Emulation in Fixed-Weight Transformers
Center for Foundation Models and Generative AI, Northwestern University(西北大学基础模型与生成式人工智能中心);Department of Computer Science, Northwestern University(西北大学计算机科学系);Ensemble AI;Engineering Science, University of Toronto(多伦多大学工程科学系);Department of Statistics and Data Science, Northwestern University(西北大学统计与数据科学系)
Neural Network Quantum Field Theory from Transformer Architectures
Steklov Mathematical Institute, Russian Academy of Sciences(斯托克洛夫数学研究所,俄罗斯科学院);Institute for Theoretical and Mathematical Physics(理论与数学物理研究所);Institute for Nuclear Research of the Russian Academy of Sciences(俄罗斯科学院核研究所);Department of Particle Physics and Cosmology, Physics Faculty(粒子物理与宇宙学系)
Sliceformer: Make Multi-head Attention as Simple as Sorting in Discriminative Tasks
Gaoling School of Artificial Intelligence, Renmin University of China(中国人民大学高瓴人工智能学院);Beijing Key Laboratory of Big Data Management and Analysis Methods(大数据管理与分析方法北京市重点实验室)
Center for Foundation Models and Generative AI, Northwestern University(基础模型与生成式人工智能中心,西北大学);Department of Computer Science, Northwestern University(计算机科学系,西北大学);Department of Statistics and Data Science, Northwestern 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(物理系,亚琛工业大学)