Transformers pretrained on diverse tasks exhibit remarkable in-context learning (ICL) capabilities, enabling them to solve unseen tasks solely based on input contexts without adjusting model parameters. In this paper, we study ICL in one of its simplest setups: pretraining a linearly parameterized single-layer linear attention model for linear regression with a Gaussian prior. We establish a statistical task complexity bound for the attention model pretraining, showing that effective pretraining only requires a small number of independent tasks. Furthermore, we prove that the pretrained model closely matches the Bayes optimal algorithm, i.e., optimally tuned ridge regression, by achieving nearly Bayes optimal risk on unseen tasks under a fixed context length. These theoretical findings complement prior experimental research and shed light on the statistical foundations of ICL.
翻译:基于多样化任务预训练的Transformer展现出卓越的上下文学习(ICL)能力,使其能够仅依赖输入上下文解决未见任务,而无需调整模型参数。本文研究了ICL在一种最简设置中的表现:采用线性参数化的单层线性注意力模型,在高斯先验下进行线性回归的预训练。我们推导了注意力模型预训练的统计任务复杂度界,表明有效的预训练仅需少量独立任务。进一步地,我们证明在固定上下文长度下,预训练模型的风险逼近贝叶斯最优算法(即最优调参的岭回归),在未见任务上达到近乎贝叶斯最优风险。这些理论结果补充了先前的实验研究,阐明了ICL的统计基础。