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

Transformer的上下文内收敛性

In-Context Convergence of Transformers

University of Pennsylvania(宾夕法尼亚大学);National University of Singapore(新加坡国立大学);The Ohio State University(俄亥俄州立大学)

Yu Huang, Yuan Cheng, Yingbin Liang

AI总结:

该研究首次分析带softmax注意力的单层Transformer的上下文内学习动力学,证明平衡特征数据下的有限时间收敛性,揭示不平衡特征下的分阶段收敛规律,为理解Transformer上下文内学习机制提供新理论方法。

摘要:

Transformer近年来彻底变革了现代机器学习的诸多领域,其中一项突出发现是其卓越的上下文内学习能力:模型无需额外参数微调,仅利用任务特定提示就能解决未见过的任务。这也推动了近期旨在理解Transformer上下文内学习机制的理论研究,但现有研究仅聚焦于线性Transformer。在本研究中,我们迈出了研究通过梯度下降训练、具备softmax注意力的单层Transformer学习动力学的第一步,目标是让其在上下文内学习线性函数类。我们采用一种结构化数据模型,其中每个token均以平衡或不平衡方式从一组特征向量中随机采样。对于特征平衡的数据,我们通过分析注意力图训练动力学的两个阶段,建立了预测误差趋近于零的有限时间收敛保证。更值得注意的是,对于特征不平衡的数据,我们发现其学习动力学呈现分阶段收敛过程:Transformer首先针对主导特征的查询token收敛至近零预测误差,随后再针对占比不足特征的查询token收敛至近零预测误差,两个阶段分别历经1个和4个训练阶段。我们的证明采用了分析两类注意力权重竞争强度的新技术,权重的变化决定了不同的训练阶段。

英文摘要:

Transformers have recently revolutionized many domains in modern machine learning and one salient discovery is their remarkable in-context learning capability, where models can solve an unseen task by utilizing task-specific prompts without further parameters fine-tuning. This also inspired recent theoretical studies aiming to understand the in-context learning mechanism of transformers, which however focused only on linear transformers. In this work, we take the first step toward studying the learning dynamics of a one-layer transformer with softmax attention trained via gradient descent in order to in-context learn linear function classes. We consider a structured data model, where each token is randomly sampled from a set of feature vectors in either balanced or imbalanced fashion. For data with balanced features, we establish the finite-time convergence guarantee with near-zero prediction error by navigating our analysis over two phases of the training dynamics of the attention map. More notably, for data with imbalanced features, we show that the learning dynamics take a stage-wise convergence process, where the transformer first converges to a near-zero prediction error for the query tokens of dominant features, and then converges later to a near-zero prediction error for the query tokens of under-represented features, respectively via one and four training phases. Our proof features new techniques for analyzing the competing strengths of two types of attention weights, the change of which determines different training phases.

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

↑