arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2411.10830cs.LGcs.AImath.OC
收藏

单层Transformer可证明地在上下文中学习最近邻

One-Layer Transformer Provably Learns One-Nearest Neighbor In Context

Princeton University(普林斯顿大学);The University of Hong Kong(香港大学);Northwestern University(西北大学)

Zihao Li, Yuan Cao, Cheng Gao, Yihan He, Han Liu, Jason M. Klusowski, Jianqing Fan, Mengdi Wang

AI总结:

本文从理论上证明,使用梯度下降训练的单层Transformer能学会在上下文中实现最近邻分类器,揭示了其实现非参数机器学习算法的机制及softmax注意力的作用。

摘要:

Transformer近年来取得了巨大成功。有趣的是,Transformer展现出了极强的上下文学习能力——即使无需微调,它们仍能仅基于特定任务的提示很好地解决未见任务。本文研究单层Transformer学习最经典非参数估计器之一(即最近邻预测规则)的能力。在提示包含一系列带标签训练数据和未带标签测试数据的理论框架下,我们证明,尽管使用梯度下降训练时损失函数是非凸的,单个softmax注意力层仍能成功学会表现得像最近邻分类器。我们的结果给出了Transformer如何被训练以实现非参数机器学习算法的具体示例,并阐明了softmax注意力在Transformer模型中的作用。

英文摘要:

Transformers have achieved great success in recent years. Interestingly, transformers have shown particularly strong in-context learning capability -- even without fine-tuning, they are still able to solve unseen tasks well purely based on task-specific prompts. In this paper, we study the capability of one-layer transformers in learning one of the most classical nonparametric estimators, the one-nearest neighbor prediction rule. Under a theoretical framework where the prompt contains a sequence of labeled training data and unlabeled test data, we show that, although the loss function is nonconvex when trained with gradient descent, a single softmax attention layer can successfully learn to behave like a one-nearest neighbor classifier. Our result gives a concrete example of how transformers can be trained to implement nonparametric machine learning algorithms, and sheds light on the role of softmax attention in transformer models.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑