迈向理解 Transformer 在下一词元预测中的普适性
Towards Understanding the Universality of Transformers for Next-Token Prediction
AI总结:
本文研究因果 Transformer 在下一词元预测中的逼近能力,通过显式构造基于因果核下降方法的 Transformer,证明其能仅依赖历史观测学习上下文相关的映射,并在理论上与 Hilbert 空间中的 Kaczmarz 算法建立联系。
摘要:
因果 Transformer 被训练用于在给定上下文的情况下预测下一个词元。尽管人们普遍认为自注意力机制对编码序列的因果结构至关重要,但这种基于上下文的自回归学习能力背后的精确潜在机制仍不清楚。在本文中,我们通过研究 Transformer 在下一词元预测上的逼近能力,向理解这一现象迈出了一步。具体而言,我们探索了因果 Transformer 在给定自回归序列 $(x_1, \dots, x_t)$ 作为提示时预测下一个词元 $x_{t+1}$ 的能力,其中 $x_{t+1} = f(x_t)$,且 $f$ 是随每个序列变化的上下文相关函数。在理论方面,我们关注特定实例,即当 $f$ 为线性或 $(x_t)_{t \geq 1}$ 为周期性时。我们显式构造了一个 Transformer(具有线性、指数或 softmax 注意力),它通过因果核下降方法在上下文中学习映射 $f$。我们提出的因果核下降方法可证明仅基于过去和当前的观测值 $(x_1, \dots, x_t)$ 来估计 $x_{t+1}$,并与 Hilbert 空间中的 Kaczmarz 算法存在联系。我们给出了验证理论发现的实验结果,并表明其适用于更一般的映射 $f$。
英文摘要:
Causal Transformers are trained to predict the next token for a given context. While it is widely accepted that self-attention is crucial for encoding the causal structure of sequences, the precise underlying mechanism behind this in-context autoregressive learning ability remains unclear. In this paper, we take a step towards understanding this phenomenon by studying the approximation ability of Transformers for next-token prediction. Specifically, we explore the capacity of causal Transformers to predict the next token $x_{t+1}$ given an autoregressive sequence $(x_1, \dots, x_t)$ as a prompt, where $ x_{t+1} = f(x_t) $, and $ f $ is a context-dependent function that varies with each sequence. On the theoretical side, we focus on specific instances, namely when $ f $ is linear or when $ (x_t)_{t \geq 1} $ is periodic. We explicitly construct a Transformer (with linear, exponential, or softmax attention) that learns the mapping $f$ in-context through a causal kernel descent method. The causal kernel descent method we propose provably estimates $x_{t+1} $ based solely on past and current observations $ (x_1, \dots, x_t) $, with connections to the Kaczmarz algorithm in Hilbert spaces. We present experimental results that validate our theoretical findings and suggest their applicability to more general mappings $f$.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。