绕过指数依赖:循环 Transformer 通过多步梯度下降高效实现上下文学习
Bypassing the Exponential Dependency: Looped Transformers Efficiently Learn In-context by Multi-step Gradient Descent
AI总结:
本文研究了线性循环 Transformer 在上下文学习中的表现,证明其在常数条件数下能通过多步梯度下降高效达到低误差,绕过了先前理论对样本量的指数级依赖,揭示了 Transformer 更强的学习能力。
摘要:
上下文学习已被认为是大型语言模型(LLMs)成功的关键因素。它指的是模型在推理过程中,能够根据提示中提供的上下文样本即时学习模式的能力。先前的研究表明,LLMs 中使用的 Transformer 架构可以通过在单次前向传播中处理上下文样本,来实现单步梯度下降更新。最近的研究进一步表明,在上下文学习期间,循环 Transformer 可以在前向传播中实现多步梯度下降更新。然而,他们的理论结果需要指数级的上下文样本数量,即 $n = \exp(Ω(T))$(其中 $T$ 为循环或传播次数),才能达到较低的误差。在本文中,我们研究了线性循环 Transformer 在线性向量生成任务上的上下文学习。我们证明,线性循环 Transformer 能够高效地实现多步梯度下降以进行上下文学习。我们的结果表明,只要输入数据具有常数条件数(例如 $n = O(d)$),线性循环 Transformer 就能在上下文学习期间通过多步梯度下降达到较小的误差。此外,我们的初步实验验证了我们的理论分析。我们的发现揭示了 Transformer 架构具备比以往认知更强的上下文学习能力,为 LLMs 背后的机制提供了新见解,并有望指导 LLMs 高效推理算法的更好设计。
英文摘要:
In-context learning has been recognized as a key factor in the success of Large Language Models (LLMs). It refers to the model's ability to learn patterns on the fly from provided in-context examples in the prompt during inference. Previous studies have demonstrated that the Transformer architecture used in LLMs can implement a single-step gradient descent update by processing in-context examples in a single forward pass. Recent work has further shown that, during in-context learning, a looped Transformer can implement multi-step gradient descent updates in forward passes. However, their theoretical results require an exponential number of in-context examples, $n = \exp(Ω(T))$, where $T$ is the number of loops or passes, to achieve a reasonably low error. In this paper, we study linear looped Transformers in-context learning on linear vector generation tasks. We show that linear looped Transformers can implement multi-step gradient descent efficiently for in-context learning. Our results demonstrate that as long as the input data has a constant condition number, e.g., $n = O(d)$, the linear looped Transformers can achieve a small error by multi-step gradient descent during in-context learning. Furthermore, our preliminary experiments validate our theoretical analysis. Our findings reveal that the Transformer architecture possesses a stronger in-context learning capability than previously understood, offering new insights into the mechanisms behind LLMs and potentially guiding the better design of efficient inference algorithms for LLMs.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。