揭示初始化如何决定上下文学习是否等同于梯度下降
The Initialization Determines Whether In-Context Learning Is Gradient Descent
- 引入初始猜测机制,改进多头线性自注意力的逼近能力
- 实验验证:多头注意力仍存在与单步梯度下降的性能差距
- 新模型yq-LSA提升线性回归与语义相似度任务表现
大型语言模型中的上下文学习(ICL)现象引人注目,但其内在机制仍不清晰。先前研究将线性自注意力(LSA)与梯度下降(GD)关联,但仅在零均值高斯先验和零初始化条件下成立。后续研究指出该假设过于严格,表明在多层或非线性注意力下,自注意力表现出类似优化的推断行为,但不同于标准梯度下降。本文在更现实的线性回归设定中,引入非零高斯先验均值,研究多头LSA对GD的逼近能力。我们扩展了多头LSA的嵌入矩阵,加入查询的初始估计(称为初始猜测)。理论证明了实现良好逼近所需的头数上界,并通过实验验证。进一步发现,单步梯度下降与多头LSA间仍存在性能差距。为此,提出yq-LSA,一种带可训练初始猜测yq的单头LSA推广形式。理论上阐明其能力,并在线性回归任务上实验验证。最后,基于线性回归的发现,为广泛LLM引入初始猜测能力,显著提升其在语义相似度任务上的表现。
原文摘要 · Abstract (English)
In-context learning (ICL) in large language models (LLMs) is a striking phenomenon, yet its underlying mechanisms remain only partially understood. Previous work connects linear self-attention (LSA) to gradient descent (GD), this connection has primarily been established under simplified conditions with zero-mean Gaussian priors and zero initialization for GD. However, subsequent studies have challenged this simplified view by highlighting its overly restrictive assumptions, demonstrating instead that under conditions such as multi-layer or nonlinear attention, self-attention performs optimization-like inference, akin to but distinct from GD. We investigate how multi-head LSA approximates GD under more realistic conditions specifically when incorporating non-zero Gaussian prior means in linear regression formulations of ICL. We first extend multi-head LSA embedding matrix by introducing an initial estimation of the query, referred to as the initial guess. We prove an upper bound on the number of heads needed for ICL linear regression setup. Our experiments confirm this result and further observe that a performance gap between one-step GD and multi-head LSA persists. To address this gap, we introduce yq-LSA, a simple generalization of single-head LSA with a trainable initial guess yq. We theoretically establish the capabilities of yq-LSA and provide experimental validation on linear regression tasks, thereby extending the theory that bridges ICL and GD. Finally, inspired by our findings in the case of linear regression, we consider widespread LLMs augmented with initial guess capabilities, and show that their performance is improved on a semantic similarity task.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。