Transformers如何执行上下文自回归学习?
How do Transformers perform In-Context Autoregressive Learning?
AI总结:
本文研究Transformer如何执行上下文自回归学习,通过在自回归序列任务上训练模型,证明单层线性Transformer能实现梯度下降的一步,并推广至非交换正交矩阵情况。
摘要:
Transformers在语言建模任务中取得了最先进的性能。然而,其巨大成功背后的原因仍不清楚。在本文中,为了更好地理解这一点,我们在一个简单的下一词元预测任务上训练了一个Transformer模型,其中序列由一阶自回归过程$s_{t+1} = W s_t$生成。我们展示了训练好的Transformer如何通过首先在上下文中学习$W$,然后应用预测映射来预测下一个词元。我们将由此产生的过程称为上下文自回归学习。更准确地说,聚焦于交换正交矩阵$W$,我们首先证明,当考虑增强词元时,训练好的一层线性Transformer实现了梯度下降的一步,用于最小化内部目标函数。当词元未增强时,我们刻画了一层对角线性多头Transformer的全局最小值。重要的是,我们展示了头之间的正交性,并表明位置编码捕获了数据中的三角关系。在实验方面,我们考虑了非交换正交矩阵的一般情况,并推广了我们的理论发现。
英文摘要:
Transformers have achieved state-of-the-art performance in language modeling tasks. However, the reasons behind their tremendous success are still unclear. In this paper, towards a better understanding, we train a Transformer model on a simple next token prediction task, where sequences are generated as a first-order autoregressive process $s_{t+1} = W s_t$. We show how a trained Transformer predicts the next token by first learning $W$ in-context, then applying a prediction mapping. We call the resulting procedure in-context autoregressive learning. More precisely, focusing on commuting orthogonal matrices $W$, we first show that a trained one-layer linear Transformer implements one step of gradient descent for the minimization of an inner objective function, when considering augmented tokens. When the tokens are not augmented, we characterize the global minima of a one-layer diagonal linear multi-head Transformer. Importantly, we exhibit orthogonality between heads and show that positional encoding captures trigonometric relations in the data. On the experimental side, we consider the general case of non-commuting orthogonal matrices and generalize our theoretical findings.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。