揭示Transformer在非线性回归中实现上下文学习的理论机制
Provable In-Context Learning of Nonlinear Regression with Transformers
- 分析注意力动态,发现关键特征注意力快速上升并收敛至1
- 证明Lipschitz常数决定收敛速度,不同函数类有不同时间保证
- 首次严格证明Transformer对未见非线性函数具有一致相关注意力
Transformer通过处理输入序列生成查询输出,其核心能力之一是无需参数更新即可利用特定提示完成新任务,即上下文学习(ICL)。现有研究多聚焦于线性回归等简单任务,本文深入探讨更复杂的非线性回归场景。我们分析训练中注意力的分阶段动态:查询与目标特征的注意力在初期迅速增长,随后趋于1;无关特征注意力衰减较慢且呈现振荡。提出新证明方法,揭示一般非退化$L$-Lipschitz任务函数如何影响注意力权重。明确指出函数类的Lipschitz常数$ L $是决定ICL收敛动力学的关键因素。基于$ L $是否低于阈值,推导出两种不同时间界以保证近零预测误差。尽管收敛时间依赖任务函数,仍证明在收敛时查询始终关注提示中高度相关特征,证实Transformer对未见非线性函数具备有效的上下文学习能力。
原文摘要 · Abstract (English)
The transformer architecture, which processes sequences of input tokens to produce outputs for query tokens, has revolutionized numerous areas of machine learning. A defining feature of transformers is their ability to perform previously unseen tasks using task specific prompts without updating parameters, a phenomenon known as in-context learning (ICL). Recent research has actively explored the training dynamics behind ICL, with much of the focus on relatively simple tasks such as linear regression and binary classification. To advance the theoretical understanding of ICL, this paper investigates more complex nonlinear regression tasks, aiming to uncover how transformers acquire in-context learning capabilities in these settings. We analyze the stage-wise dynamics of attention during training: attention scores between a query token and its target features grow rapidly in the early phase, then gradually converge to one, while attention to irrelevant features decays more slowly and exhibits oscillatory behavior. Our analysis introduces new proof techniques that explicitly characterize how the nature of general non-degenerate $L$-Lipschitz task functions affects attention weights. Specifically, we identify that the Lipschitz constant $L$ of nonlinear function classes as a key factor governing the convergence dynamics of transformers in ICL. Leveraging these insights, for two distinct regimes depending on whether $L$ is below or above a threshold, we derive different time bounds to guarantee near-zero prediction error. Notably, despite the convergence time depending on the underlying task functions, we prove that query tokens consistently attend to prompt tokens with highly relevant features at convergence, demonstrating the ICL capability of transformers for unseen functions.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。