线性循环Transformer用少量示例高效实现多步梯度学习
Bypassing the Exponential Dependency: Looped Transformers Efficiently Learn In-context by Multi-step Gradient Descent
- 通过循环结构在前向传播中模拟多步梯度下降
- 当数据条件数恒定时,仅需O(d)个示例即可达低误差
- 为大模型推理效率优化提供新理论依据
上下文学习是大语言模型成功的关键。传统Transformer可在单次前向传播中实现单步梯度更新。近期研究发现,循环Transformer能在前向传播中实现多步梯度更新,但理论要求指数级示例数(n = exp(Ω(T)))。本文研究线性循环Transformer在向量生成任务中的上下文学习能力,证明当输入数据条件数恒定(如n = O(d))时,其可高效实现多步梯度下降并达到小误差。初步实验验证了理论分析。结果表明,Transformer架构的上下文学习能力强于此前认知,为大模型机制理解与高效推理算法设计提供新思路。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。