IC-164Llama-3-8B and Llama-2-7B fail to learn out-of-distribution functions through in-context learning, defaulting to in-distribution predictions

Qixun Wang, Yifei Wang, Xianghua Ying, Yisen Wang

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

The paper evaluates Llama-3-8B and Llama-2-7B on a synthetic vector classification task where the model must learn a random linear mapping w from in-context examples. ICL accuracy on this OOD task is close to random guessing (10% for 10 classes), while a retrieval version of the same task is solved well. Additionally, on a reversed-label natural language task (e.g., predicting 'evitisop' instead of 'positive'), Llama-3-8B prefers to output the reversed query word—an in-distribution pattern—rather than the reversed target label. Together these results indicate that ICL in these models is confined to implementing pretraining function classes rather than learning genuinely new input-output mappings.

Evidence
correlational
Key metric
10% accuracy on OOD synthetic vector classification (random guess level for 10 classes); retrieval task accuracy significantly higher; reversed-query accuracy exceeds reversed-target-label accuracy across all four natural language tasks
Caveat
The synthetic vector classification task uses a very small effective dimension (d'=30 out of d=4096) to reduce complexity, and the reversed-label task is a narrow construction. The authors note it is challenging to assess whether larger models like GPT-4 face similar difficulties.
Model
Llama 3 8B, Llama 2 / Llama 2 base Llama 2 7B
Concepts
Failure mode
Datasets
Function Vectors Dataset [eval]
Methods
In-Context Learning / In-context learning prompt [primary]
Related findings
IC-165
Extraction
automatic-extraction