Abstract
In-Context Learning (ICL) in Large Language Models (LLMs) is a multifaceted capability emerging during pre-training. This study decomposes ICL into two primary mechanisms: Task Recognition (TR) and Task Learning (TL). By analyzing pre-training checkpoints of various open-source models, we identify a competitive dynamic between these two abilities. We demonstrate that high competition intensity correlates with lower overall ICL performance and propose an Adaptive Ensemble method that leverages specialized checkpoints to significantly enhance performance, allowing smaller models to surpass much larger counterparts.
Introduction
Large Language Models exhibit the remarkable ability of In-Context Learning (ICL), performing tasks from a few demonstrations without parameter updates. Recent literature suggests ICL is powered by two distinct internal processes: Task Recognition (TR), where the model identifies a known task and retrieves its solution, and Task Learning (TL), where the model learns new input-label mappings from the context. Despite their importance, the developmental relationship between TR and TL during pre-training remains poorly understood. This paper investigates whether these abilities develop synergistically or competitively.
Methodology
To disentangle TR and TL, we evaluate model checkpoints across three experimental settings:
- Gold: Standard ICL with correct labels, measuring the combined effect of TR and TL.
- Random Labels: Demonstrations with shuffled labels, forcing reliance on TR to identify the task despite noise.
- Abstract Labels: Replacing labels with arbitrary symbols, forcing the model to perform TL by learning new mappings.
We analyzed checkpoints from model families including Pythia, MiniCPM, and Amber across 16 classification datasets. We further introduced a Competition Intensity metric to quantify the trade-off between TR and TL improvements during the training process.
Pre-Training Dynamics: The Rivalry of TR and TL
Our analysis reveals that TR and TL often act as rivals during pre-training. As shown in Figure 1, the performance of TR and TL fluctuates significantly across checkpoints, frequently exhibiting inverse trends. This "Stable-Rise" pattern suggests that the model's internal resources are often partitioned between these two mechanisms rather than growing in tandem.
A critical finding is the strong negative correlation between the intensity of this internal competition and the final ICL accuracy. Models that manage to balance these abilities more effectively—experiencing lower competition intensity—tend to achieve higher overall performance.
Scaling and Curriculum Effects
The dynamics of TR-TL competition are influenced by model and dataset scale:
- Model Size: Larger models encounter competition earlier in training, but the overall intensity is lower, likely due to increased parameter capacity providing more "neural real estate."
- Dataset Size: Larger pre-training corpora delay the onset of competition, as the model requires more data to saturate its Task Recognition capacity.
Competitive-ICL: Boosting Performance via Adaptive Ensembles
Recognizing that different checkpoints excel at either TR or TL, we propose Competitive-ICL. This method identifies the best TR-performing and TL-performing checkpoints from a model's history and fuses their predictions at inference time.
This approach yields significant gains. For instance, an ensemble of checkpoints from Pythia-1B and MiniCPM-2B achieved 55.85% accuracy, outperforming the standalone Pythia-12B (51.74%) and Amber-7B (50.08%). This demonstrates that the inherent limitations of a single "final" checkpoint can be overcome by strategically combining specialized historical states.
Conclusion
The development of ICL is a complex interplay between task recognition and learning. By understanding and measuring the competition between these dynamics, we can better interpret LLM training and develop inference-time strategies that allow smaller models to punch well above their weight class. Future work will explore these dynamics in generative and reasoning-heavy tasks.
Summary updated