Abstract
In-context learning (ICL) is the ability of a large language model (LLM) to learn a new task from a few demonstrations presented as part of the context. Past studies have attributed a large portion of the success of ICL to the way these in-context demonstrations are represented, particularly to how labels are represented in classification tasks. On the other hand, observations of the learning capacity of ICL have been mixed. We hypothesize that representation and learning are largely independent: representation determines the baseline accuracy, while learning from additional demonstrations improves on top of this baseline. We validate this by developing an optimization algorithm to enumerate label sets of varying semantic relevance. We observe that learning happens regardless of label set quality, though its efficiency depends on both quality and model size. The relative quality of label sets is largely maintained throughout learning, confirming our hypothesis of orthogonality.
Introduction
Large Language Models (LLMs) possess the remarkable ability to learn new tasks simply by observing examples in a prompt—a phenomenon known as In-Context Learning (ICL). However, the underlying mechanism remains a subject of debate. Does the model truly "learn" the task from the provided examples, or do the examples merely "activate" pre-existing capabilities?
Previous research has yielded conflicting results. Some studies suggest that models only learn when using semantically meaningful "gold" labels (e.g., "Positive/Negative") and fail with abstract labels (e.g., "A/B"). Others argue that learning is a property emergent only in very large models. This paper seeks to disentangle these variables, investigating whether the choice of label representation and the process of learning from demonstrations are independent (orthogonal) mechanisms.
Methodology
To test the hypothesis of orthogonality between representation and learning, the researchers developed a structured framework:
- Label Optimization: A "Hill Climbing" optimization algorithm was used to generate a spectrum of label sets. By varying the number of sentences ($K$) used for optimization, the researchers produced labels ranging from nonsensical strings (low semantic relevance) to highly descriptive category names (high semantic relevance).
- Controlled Experiments: These label sets were evaluated on 3-way and 5-way sentiment classification tasks using a synthetic dataset.
- Scaling Variables: The study systematically varied the quality of the representation (optimized label sets) and the number of demonstrations ($N$) provided in the prompt (up to 100).
- Model Diversity: Experiments were conducted across the Llama 3 family: 1B, 8B, and 70B parameters.
Key Insights and Results
The experimental results strongly support the hypothesis that representation and learning are independent forces in ICL.
The Baseline Effect and Orthogonality
The choice of label representation determines the "starting line" or zero-shot accuracy. Crucially, the relative ranking of label sets remains remarkably consistent as more demonstrations are added. A label set that outperforms another at zero-shot typically maintains that advantage at 40-shot. This suggests that learning from examples does not "correct" a poor representation but rather builds upon it.
Universality of Learning
Contrary to some previous findings, learning was observed even with low-quality or abstract labels, provided the model was sufficiently large or given enough examples. Previous reports of "failure to learn" may have been due to low baselines masking incremental improvements. For label sets with medium semantic relevance, ICL provided a 15%–25% improvement over the baseline.
Model Size and Efficiency
While learning occurs across different model sizes, larger models (e.g., 70B) are significantly more efficient. Their accuracy curves are steeper, indicating they derive more knowledge from fewer examples compared to 1B or 8B models. In 5-way classification, the 1B model's performance remained relatively flat, while the 70B model showed substantial gains even with suboptimal labels.
Discussion and Limitations
This study reveals a previously underexplored aspect of ICL: the independent effects of representation and learning. However, several limitations exist:
- Task Scope: The findings are currently limited to classification tasks; generative tasks like summarization or coding require further investigation.
- Data Nature: The use of synthetic sentiment data may not fully capture the nuances of real-world language.
- Computational Constraints: Testing for the 70B model was limited to 40 demonstrations due to resource costs.
Future work could explore automating "representation engineering" to maximize ICL performance or investigating these independent effects in complex reasoning tasks.
Summary updated