arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2410.09695cs.LGcs.AI
收藏

上下文学习真的能泛化到分布外任务吗?

Can In-context Learning Really Generalize to Out-of-distribution Tasks?

Peking University(北京大学);Massachusetts Institute of Technology(麻省理工学院);Institute for Artificial Intelligence, Peking University(北京大学人工智能研究院)

Qixun Wang, Yifei Wang, Yisen Wang, Xianghua Ying

AI总结:

本文通过 GPT-2 合成函数实验与理论分析,考察 ICL 对 OOD 任务的泛化机制,发现其倾向于复用低测试误差的预训练函数,而非真正学习新任务。

摘要:

在本研究中,我们探究了上下文学习(ICL)在训练期间未曾遇到的分布外(OOD)任务上的机制。为此,我们开展了合成实验,目标是使用 GPT-2 模型通过 ICL 学习 OOD 数学函数。我们揭示,Transformer 可能难以通过 ICL 学习 OOD 任务函数。具体而言,ICL 的表现类似于在预训练假设空间内实现一个函数,并根据上下文中的示例用梯度下降对其进行优化。此外,我们研究了 ICL 已被充分记录的、在上下文中学习未见过的抽象标签的能力。我们证明,这种能力只会在不存在分布偏移的场景中表现出来,因此不能作为学习新任务能力的证据。此外,我们评估了模型在多个任务上进行预训练时 ICL 在 OOD 任务上的表现。实证和理论分析均证明 ICL 存在“低测试误差偏好”,即它倾向于实现能在测试上下文中产生低测试误差的预训练函数。我们通过数值实验验证了这一点。这一新的理论结果与我们的实证发现相结合,阐明了 ICL 处理 OOD 任务的机制。

英文摘要:

In this work, we explore the mechanism of in-context learning (ICL) on out-of-distribution (OOD) tasks that were not encountered during training. To achieve this, we conduct synthetic experiments where the objective is to learn OOD mathematical functions through ICL using a GPT-2 model. We reveal that Transformers may struggle to learn OOD task functions through ICL. Specifically, ICL performance resembles implementing a function within the pretraining hypothesis space and optimizing it with gradient descent based on the in-context examples. Additionally, we investigate ICL's well-documented ability to learn unseen abstract labels in context. We demonstrate that such ability only manifests in the scenarios without distributional shifts and, therefore, may not serve as evidence of new-task-learning ability. Furthermore, we assess ICL's performance on OOD tasks when the model is pretrained on multiple tasks. Both empirical and theoretical analyses demonstrate the existence of the \textbf{low-test-error preference} of ICL, where it tends to implement the pretraining function that yields low test error in the testing context. We validate this through numerical experiments. This new theoretical result, combined with our empirical findings, elucidates the mechanism of ICL in addressing OOD tasks.

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

↑