arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2409.17335cs.LGstat.ML
收藏

面向下一词元预测的训练Transformer的非渐近收敛性

Non-asymptotic Convergence of Training Transformers for Next-token Prediction

The Pennsylvania State University(宾夕法尼亚州立大学);The Ohio State University(俄亥俄州立大学)

Ruiquan Huang, Yingbin Liang, Jing Yang

AI总结:

本文对单层Transformer在下一词元预测中的训练动态进行非渐近分析,提出两阶段训练算法,证明前馈层和注意力层均以次线性速度收敛到最大间隔解方向,且交叉熵损失具有线性收敛速率,并揭示了其在数据集偏移下的泛化能力。

摘要:

Transformer因其处理序列数据的卓越能力而在现代机器学习中取得了非凡的成功,尤其是在下一词元预测(NTP)任务中。然而,对其在NTP中表现的理论理解仍然有限,现有研究主要关注渐近性能。本文对由一个自注意力模块和一个前馈层组成的单层Transformer的训练动态进行了细粒度的非渐近分析。我们首先利用基于偏序的数学框架刻画了NTP训练数据集的基本结构性质。然后,我们设计了一个两阶段训练算法,其中用于训练前馈层的预处理阶段和用于训练注意力层的主阶段均表现出快速收敛性能。具体而言,两个层都沿其对应的最大间隔解方向以次线性速度收敛。我们还证明交叉熵损失具有线性收敛速率。此外,我们证明训练后的Transformer在数据集偏移下表现出非平凡的预测能力,这揭示了Transformer卓越泛化性能的原因。我们的分析技术包括建立关于注意力梯度的新性质,并进一步深入分析这些性质如何促进训练过程的收敛。我们的实验进一步验证了理论发现。

英文摘要:

Transformers have achieved extraordinary success in modern machine learning due to their excellent ability to handle sequential data, especially in next-token prediction (NTP) tasks. However, the theoretical understanding of their performance in NTP is limited, with existing studies focusing mainly on asymptotic performance. This paper provides a fine-grained non-asymptotic analysis of the training dynamics of a one-layer transformer consisting of a self-attention module followed by a feed-forward layer. We first characterize the essential structural properties of training datasets for NTP using a mathematical framework based on partial orders. Then, we design a two-stage training algorithm, where the pre-processing stage for training the feed-forward layer and the main stage for training the attention layer exhibit fast convergence performance. Specifically, both layers converge sub-linearly to the direction of their corresponding max-margin solutions. We also show that the cross-entropy loss enjoys a linear convergence rate. Furthermore, we show that the trained transformer presents non-trivial prediction ability with dataset shift, which sheds light on the remarkable generalization performance of transformers. Our analysis technique involves the development of novel properties on the attention gradient and further in-depth analysis of how these properties contribute to the convergence of the training process. Our experiments further validate our theoretical findings.

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

↑