What In-Context Learning "Learns" In-Context: Disentangling Task Recognition and Task Learning

Jane Pan,Tianyu Gao,Howard Chen,Danqi Chen
2023-05-17
Abstract:Large language models (LLMs) exploit in-context learning (ICL) to solve tasks with only a few demonstrations, but its mechanisms are not yet well-understood. Some works suggest that LLMs only recall already learned concepts from pre-training, while others hint that ICL performs implicit learning over demonstrations. We characterize two ways through which ICL leverages demonstrations. Task recognition (TR) captures the extent to which LLMs can recognize a task through demonstrations -- even without ground-truth labels -- and apply their pre-trained priors, whereas task learning (TL) is the ability to capture new input-label mappings unseen in pre-training. Using a wide range of classification datasets and three LLM families (GPT-3, LLaMA and OPT), we design controlled experiments to disentangle the roles of TR and TL in ICL. We show that (1) models can achieve non-trivial performance with only TR, and TR does not further improve with larger models or more demonstrations; (2) LLMs acquire TL as the model scales, and TL's performance consistently improves with more demonstrations in context. Our findings unravel two different forces behind ICL and we advocate for discriminating them in future ICL research due to their distinct nature.
Computation and Language,Machine Learning
What problem does this paper attempt to address?
This paper aims to explore the working mechanisms of large language models (LLMs) in In-Context Learning (ICL). Specifically, the authors distinguish between two different capabilities: 1. **Task Recognition (TR)**: The model can recognize tasks through examples and apply prior knowledge learned during pre-training to complete tasks, even making predictions without being provided with actual label information. 2. **Task Learning (TL)**: The model can learn new input-label mappings when given input-label pairs. By using multiple classification datasets and three families of large language models (GPT-3, LLaMA, and OPT), the researchers designed a series of controlled experiments to dissect these two capabilities and found the following points: - **Task recognition does not depend on model size and the number of examples**: Smaller models already possess a certain level of task recognition ability, which does not significantly improve with an increase in model parameters or the number of examples. - **Task learning improves with model scale**: Larger models can utilize more examples to enhance task learning performance; particularly, when the model is sufficiently large and the number of examples is substantial, the performance under abstract label settings significantly surpasses that of relying solely on task recognition. - **Performance differences under different conditions**: The paper demonstrates the specific performance forms of task recognition and task learning under different model sizes and numbers of examples, and suggests that future research should clearly distinguish between these two phenomena and their applicable conditions. In summary, the main goal of this paper is to better understand the different behaviors exhibited by large language models during in-context learning and to provide a theoretical foundation and technical guidance for subsequent research.