arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2402.13512cs.LGcs.AIcs.CL
收藏

从自注意力到马尔可夫模型:揭示生成式Transformer的动力学

From Self-Attention to Markov Models: Unveiling the Dynamics of Generative Transformers

University of Michigan(密歇根大学);Google Research(谷歌研究院)

M. Emrullah Ildiz, Yixiao Huang, Yingcong Li, Ankit Singh Rawat, Samet Oymak

AI总结:

本文建立单层自注意力与上下文条件马尔可夫链的精确映射,提出可识别性条件和样本复杂度保证,并揭示赢者通吃现象,从数学上解释大语言模型生成重复文本的倾向。

摘要:

现代语言模型依赖Transformer架构和注意力机制来执行语言理解和文本生成。本文研究从一组提示词及从模型采样的相关输出数据中学习一个单层自注意力模型。我们首先建立了自注意力机制与马尔可夫模型之间的精确映射:向模型输入提示词时,会根据一个上下文条件马尔可夫链(CCMC)采样输出token,该链对基础马尔可夫链的转移矩阵进行加权。此外,引入位置编码会导致转移概率发生位置相关的缩放。基于这一形式化框架,我们建立了提示词分布的可识别性/覆盖条件,以保证一致估计,并在独立同分布样本下给出了样本复杂度保证。最后,我们研究了从初始提示词生成的单条输出轨迹中学习的问题。我们刻画了一种有趣的赢者通吃现象,即自注意力实现的生成过程由于其非混合性质而坍缩为对有限token子集的采样。这为现代大语言模型倾向于生成重复文本提供了数学解释。总之,与CCMC的等价性为研究自注意力及其性质提供了一个简单而强大的框架。

英文摘要:

Modern language models rely on the transformer architecture and attention mechanism to perform language understanding and text generation. In this work, we study learning a 1-layer self-attention model from a set of prompts and associated output data sampled from the model. We first establish a precise mapping between the self-attention mechanism and Markov models: Inputting a prompt to the model samples the output token according to a context-conditioned Markov chain (CCMC) which weights the transition matrix of a base Markov chain. Additionally, incorporating positional encoding results in position-dependent scaling of the transition probabilities. Building on this formalism, we develop identifiability/coverage conditions for the prompt distribution that guarantee consistent estimation and establish sample complexity guarantees under IID samples. Finally, we study the problem of learning from a single output trajectory generated from an initial prompt. We characterize an intriguing winner-takes-all phenomenon where the generative process implemented by self-attention collapses into sampling a limited subset of tokens due to its non-mixing nature. This provides a mathematical explanation to the tendency of modern LLMs to generate repetitive text. In summary, the equivalence to CCMC provides a simple but powerful framework to study self-attention and its properties.

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

↑