arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2304.13276cs.CLcs.LG
收藏

Softmax 回归中上下文学习与权重偏移的接近性

The Closeness of In-Context Learning and Weight Shifting for Softmax Regression

Shanghai Jiao Tong University(上海交通大学);Adobe Research(奥多比研究院);University of Michigan(密歇根大学);University of California San Diego(加利福尼亚大学圣迭戈分校)

Shuai Li, Zhao Song, Yu Xia, Tong Yu, Tianyi Zhou

AI总结:

本文针对 Transformer 注意力机制建立 softmax 回归模型,证明单自注意力层诱导的数据变换与梯度下降更新的上界接近,从而解释上下文学习与权重偏移的内在等价性。

摘要:

大型语言模型(LLM)以其在自然语言处理中的卓越性能而闻名,这使其在许多与人类生活甚至工作相关的任务中都非常有效。Transformer 架构中的注意力机制是 LLM 的关键组成部分,因为它允许模型有选择地关注输入的特定部分。作为注意力机制关键部分的 softmax 单元会对注意力分数进行归一化。因此,LLM 在各种 NLP 任务中的性能在很大程度上依赖于带有 softmax 单元的注意力机制所发挥的关键作用。上下文学习是近期 LLM 备受赞誉的能力之一,也是查询 ChatGPT 等 LLM 时的一个重要概念。无需进一步更新参数,Transformer 就能够基于少量上下文中的示例学习进行预测。然而,Transformer 为何会成为上下文学习者,目前仍未得到充分理解。最近,若干工作 [ASA+22, GTLV22, ONR+22] 基于线性回归形式 $\min_x\\|Ax-b\\|_2$,从数学角度研究了上下文学习,展示了 Transformer 在上下文中学习线性函数的能力。在本文中,我们基于 Transformer 注意力机制的 softmax 回归形式 $\min_x \\|\langle\exp(Ax),{\bf 1}_n\rangle^{-1}\exp(Ax)-b\\|_2$ 来研究上下文学习。我们给出了由单个自注意力层所诱导的数据变换,以及在 softmax 预测函数的 $\ell_2$ 回归损失上进行梯度下降所诱导的数据变换的上界;这些上界表明,当为基础回归任务训练仅含自注意力的 Transformer 时,通过梯度下降学到的模型与 Transformer 表现出很强的相似性。

英文摘要:

Large language models (LLMs) are known for their exceptional performance in natural language processing, making them highly effective in many human life-related or even job-related tasks. The attention mechanism in the Transformer architecture is a critical component of LLMs, as it allows the model to selectively focus on specific input parts. The softmax unit, which is a key part of the attention mechanism, normalizes the attention scores. Hence, the performance of LLMs in various NLP tasks depends significantly on the crucial role played by the attention mechanism with the softmax unit. In-context learning, as one of the celebrated abilities of recent LLMs, is an important concept in querying LLMs such as ChatGPT. Without further parameter updates, Transformers can learn to predict based on few in-context examples. However, the reason why Transformers becomes in-context learners is not well understood. Recently, several works [ASA+22,GTLV22,ONR+22] have studied the in-context learning from a mathematical perspective based on a linear regression formulation $\min_x\| Ax - b \|_2$, which show Transformers' capability of learning linear functions in context. In this work, we study the in-context learning based on a softmax regression formulation $\min_{x} \| \langle \exp(Ax), {\bf 1}_n \rangle^{-1} \exp(Ax) - b \|_2$ of Transformer's attention mechanism. We show the upper bounds of the data transformations induced by a single self-attention layer and by gradient-descent on a $\ell_2$ regression loss for softmax prediction function, which imply that when training self-attention-only Transformers for fundamental regression tasks, the models learned by gradient-descent and Transformers show great similarity.

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

↑