Saved in:
Bibliographic Details
Main Authors: Wang, Qixun, Wang, Yifei, Wang, Yisen, Ying, Xianghua
Format: Preprint
Published: 2024
Subjects:
Online Access:https://arxiv.org/abs/2410.09695
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866916506750681088
author Wang, Qixun
Wang, Yifei
Wang, Yisen
Ying, Xianghua
author_facet Wang, Qixun
Wang, Yifei
Wang, Yisen
Ying, Xianghua
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2410_09695
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Can In-context Learning Really Generalize to Out-of-distribution Tasks?
Wang, Qixun
Wang, Yifei
Wang, Yisen
Ying, Xianghua
Machine Learning
Artificial Intelligence
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.
title Can In-context Learning Really Generalize to Out-of-distribution Tasks?
topic Machine Learning
Artificial Intelligence
url https://arxiv.org/abs/2410.09695