TL;DR
Researchers have discovered that the two core engines of In-Context Learning (ICL)—Task Recognition (using pre-trained knowledge) and Task Learning (learning from new examples)—actually compete for a model's limited internal resources during pre-training. By measuring this "competition intensity" and using a simple logit-fusion technique at inference time, the authors show that combining two small, specialized model checkpoints can outperform models more than twice their size.
What Problem Does This Paper Address?
Large Language Models (LLMs) possess the "magical" ability of In-Context Learning: they can solve new tasks just by looking at a few examples, without any parameter updates. Previous research suggests this happens via two distinct mechanisms:
- Task Recognition (TR): The model recognizes the task from the examples and retrieves a solution it already learned during pre-training (relying on "priors").
- Task Learning (TL): The model actually learns the mapping between inputs and labels directly from the provided demonstrations.
While we know both exist, we haven't understood how they develop together during the long months of pre-training. Do they help each other, or are they at odds? This paper investigates the pre-training dynamics of these two abilities to see how their relationship affects the final emergence of ICL.
Methods
To study these hidden dynamics, the authors first had to "disentangle" TR and TL using three specific evaluation settings:
- Gold: Standard ICL with correct labels (measures overall performance).
- Random: Labels in the demonstrations are shuffled. If a model still performs well, it’s likely using TR (it recognized the task and didn't need the labels to be right).
- Abstract: Labels are replaced with semantically neutral symbols (like numbers or random letters). If a model succeeds here, it’s using TL (it learned the mapping on the fly).
By tracking these metrics across checkpoints, the authors introduced Competition Intensity ($C^S_i$), a metric that tracks when the performance of TR and TL moves in opposite directions between training steps. They also proposed Adaptive Ensemble Learning, a method to fuse the outputs (logits) of two different checkpoints—one strong in TR and one strong in TL—using weights based on their individual accuracies.
Datasets
The study evaluated 16 datasets across four categories:
- Sentiment Analysis: e.g., SST-2, financial_phrasebank.
- Topic/Stance Classification: e.g., TREC, tweet_eval.
- Toxicity Detection: e.g., tweet_eval_hate, ethos.
- Natural Language Inference (NLI): e.g., SICK, SNLI, WNLI.
They analyzed a wide range of open-source model suites, including Pythia (410M to 12B), MiniCPM-2B, Amber-7B, OLMo-7B, and K2-65B.
Key Insights and Ideas
- ICL is a Tug-of-War: TR and TL are inherently competitive during pre-training. When one ability surges, the other often plateaus or dips. This competition is negatively correlated with final ICL performance—the more they "fight," the worse the model performs.
- Model Size Reduces Friction: Larger models experience competition earlier in training, but the average intensity of that competition is lower. This suggests bigger models have more "neural real estate" (neurons/layers) to allocate to both abilities simultaneously.
- Data Matters: Increasing the dataset size postpones the onset of competition. Furthermore, a "quality curriculum" (moving from low-quality to high-quality data) can reduce competition intensity and boost ICL.
- The "Best" Model Isn't One Model: Because TR and TL compete, a single checkpoint at the end of training is often a compromise. The authors found that the "TR-best" checkpoint and "TL-best" checkpoint occur at different times.
Key Results
The most striking result is the effectiveness of Logit Fusion:
- Beating the Giants: By fusing a 1B TR-specialized model with a 1B TL-specialized model, the resulting ensemble achieved an accuracy of 56.25%, significantly outperforming the Pythia-12B model (52.77%) despite having far fewer active parameters during inference.
- Efficiency: Two small models working together (e.g., Pythia-1B + MiniCPM-2B) consistently outperformed larger 7B models like Amber or Baichuan2, often with lower total computational overhead (TFLOPs).
- Consistency: This "collaboration at inference time" worked across various model families and sizes, proving that the competition identified during training can be mitigated after the fact.
Limitations and Future Work
- Pre-training Control: The authors relied on existing intermediate checkpoints from open-source models. Because they didn't train these models from scratch themselves, they couldn't perfectly control for variables like data mixture or optimization hyper-parameters.
- Resource Allocation: While the paper hypothesizes that competition stems from limited "neurons or layers," they haven't yet pinpointed exactly which parts of the transformer architecture are being fought over.
- Future Direction: The authors suggest that future work should focus on designing loss functions that explicitly encourage TR and TL to collaborate during training, rather than just fixing the competition at the end.
Reference: Wang, X., et al. (2025). Investigating the Pre-Training Dynamics of In-Context Learning: Task Recognition vs. Task Learning. ICLR 2025. Link to Code
Summary updated