Abstract
In-context learning (ICL) has become the defining characteristic of large language models (LLMs), yet the underlying mechanism—whether models are simply "locating" pre-trained tasks or "learning" new mappings—has remained a subject of intense debate. This research disentangles ICL into two distinct components: Task Recognition (TR) and Task Learning (TL). Through controlled experiments using standard, random, and abstract label mappings, the study demonstrates that while Task Recognition is a broad capability present even in smaller models, Task Learning is an emergent property that scales significantly with model size and the number of demonstrations.
Introduction
Since the emergence of GPT-3, the ability of LLMs to perform tasks based solely on a few examples in a prompt—without any parameter updates—has revolutionized natural language processing. However, researchers have struggled to define what is actually happening during this process. Two primary theories have emerged: the "Locating" theory, which suggests ICL helps the model identify a task it already mastered during pre-training, and the "Learning" theory, which posits that the model performs a form of implicit gradient descent to learn specific mappings on the fly.
Previous research indicated that LLMs often maintain high performance even when provided with incorrect labels, lending weight to the Locating theory. This paper seeks to reconcile these views by demonstrating that ICL is not a monolithic phenomenon but a combination of Task Recognition (TR) and Task Learning (TL) that behaves differently across model scales.
Experimental Framework
To isolate these two mechanisms, the authors designed three distinct experimental settings applied to 16 classification datasets across four categories (Sentiment Analysis, Toxicity Detection, NLI, and Topic Classification):
- GOLD (Standard ICL): Uses natural language prompts with correct labels. This setting represents the synergy of both TR and TL.
- RANDOM (Isolating TR): Uses natural language prompts but assigns labels randomly to the demonstrations. Success here indicates the model has recognized the task from the input text and is relying on its pre-trained priors, effectively ignoring the provided (and incorrect) mapping.
- ABSTRACT (Isolating TL): Uses "minimal prompts" without task instructions and replaces labels with abstract symbols (e.g., "0/1" or "A/B") that carry no semantic relevance to the task. To succeed, the model must learn the mapping purely from the provided examples, as there are no pre-trained priors for these arbitrary symbols.
The study evaluated these settings across the GPT-3, LLaMA, and OPT model families, with parameters ranging from 350M to 175B, and varied the number of demonstrations ($K$) from 8 to 32.
The Emergence of Task Learning
The results reveal a stark contrast in how TR and TL manifest across different model scales.
Task Recognition: A Broad Capability
Task Recognition appears to be a relatively low-level capability. Even small models (e.g., 350M parameters) show a performance boost in the RANDOM setting compared to zero-shot baselines. However, this capability is remarkably "flat"; increasing the model size or the number of demonstrations does not significantly improve the model's ability to recognize a task it already knows from pre-training.
Task Learning: An Emergent Property
In contrast, Task Learning is an emergent capability. Small models perform near random guess levels in the ABSTRACT setting, showing an inability to grasp the relationship between inputs and arbitrary symbols. However, as models scale—particularly beyond the 30B to 60B parameter range—TL performance improves dramatically. In the largest models, such as GPT-3 Davinci (175B), the ability to learn from abstract mappings can actually surpass the performance of the RANDOM (TR-only) setting.
Scaling Dynamics
The study highlights two critical scaling vectors:
- Model Size: For GPT-3, the ABSTRACT accuracy for the 350M "ada" model was approximately 40% (near random), while the 175B "davinci" model reached nearly 60%. This suggests that the capacity for implicit learning is tied to the increased representational power of larger architectures.
- Number of Demonstrations ($K$): While TR performance remains nearly constant as $K$ increases from 8 to 32, TL performance shows a steady, steep upward trend. With 32 demonstrations, the 175B Davinci model achieved accuracy in the ABSTRACT setting nearly identical to its performance in the GOLD setting. This proves that at sufficient scale and with enough context, the model becomes a highly capable learner of entirely new mappings.
Conclusion and Future Directions
This research provides a nuanced view of in-context learning, showing that the debate between "locating" and "learning" is a matter of scale. While smaller models primarily rely on task recognition and pre-trained priors, larger models possess a genuine capacity for task learning.
However, limitations remain. The study focused on classification tasks; the dynamics of TR and TL in generative tasks like summarization or translation remain unexplored. Furthermore, while the paper proves that Task Learning occurs, the underlying mechanics—whether it is truly implicit gradient descent or a sophisticated form of pattern matching—remain a frontier for future investigation. Understanding these mechanics is essential for optimizing prompt engineering and further scaling the capabilities of LLMs.
Summary updated