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.
Introduction: The Dual Nature of In-Context Learning
Ever since the emergence of GPT-3, researchers have debated how Large Language Models (LLMs) learn from a few examples without weight updates. Two conflicting theories have emerged: the "Recall" Hypothesis, suggesting LLMs simply locate tasks they already know (Task Recognition), and the "Implicit Fine-tuning" Hypothesis, suggesting they learn specific new mappings (Task Learning). This paper reconciles these views by demonstrating that both forces are at play but behave differently as models scale.
Methodology: Isolating TR and TL
To isolate these mechanisms, the researchers designed three specific experimental settings across 16 classification datasets and three model families (GPT-3, LLaMA, and OPT):
- GOLD (Standard ICL): Uses natural language prompts and correct labels to test total ability (TR + TL).
- RANDOM (Isolating TR): Uses natural language prompts but assigns labels randomly. Because the labels provide no signal, the model must rely on task recognition from the prompt and input distribution.
- ABSTRACT (Isolating TL): Removes task-specific words and replaces labels with abstract symbols (e.g., "0/1"). Since the model has never seen these mappings, it must perform Task Learning to succeed.
Key Results: Scaling and Emergence
The study reveals fundamental differences in how these two mechanisms respond to model size and the number of demonstrations ($K$).
Task Recognition as a Baseline
Task Recognition (TR) is a broad capability present even in small models (e.g., 350M parameters). However, TR performance is relatively stagnant; it does not improve significantly as models grow or as more examples are added. This suggests that once a task is recognized, additional demonstrations provide diminishing returns for TR alone.
Task Learning as an Emergent Property
In contrast, Task Learning (TL) is highly sensitive to scale. In small models, TL is almost non-existent. However, as models grow, the performance in the "Abstract" setting slopes upward sharply. For large models like GPT-3 Davinci, once more than 16 demonstrations are provided, the model's ability to learn new mappings (TL) can actually begin to outperform its ability to simply recognize old ones (TR).
The Role of Task Difficulty
Task complexity also influences this balance. For simple tasks like sentiment analysis, models learn mappings quickly. For complex tasks like Natural Language Inference (NLI), the learning curve is much flatter, suggesting the model relies more heavily on its pre-trained priors for difficult reasoning.
Conclusion
This research disentangles ICL into two distinct forces: TR provides a performance "floor" that is easily reached, while TL provides a "ceiling" that rises with scale. These findings suggest that future ICL research should explicitly distinguish between these two mechanisms, as they represent fundamentally different ways LLMs interact with prompted data.
Summary updated