Understanding In-Context Learning via Supportive Pretraining Data

Xiaochuang Han, Daniel Simig, Todor Mihaylov, Yulia Tsvetkov, Asli Celikyilmaz, Tianlu Wang

In-context learning (ICL) is one of the most significant emergent properties of Large Language Models (LLMs). It allows models to adapt to new tasks using only a few examples provided in the prompt, without any parameter updates. However, the specific components of massive pretraining datasets that cultivate this ability have remained a mystery. This research, presented at ACL 2023, identifies a tiny subset of pretraining data that directly supports ICL and analyzes its unique qualitative features.

The Search for Supportive Data

To move beyond theoretical proofs, the researchers asked a fundamental question: Which specific instances in a pretraining corpus are responsible for a model's ICL capabilities? They developed ORCA-ICL, an iterative, gradient-based selection method designed to find "supportive" data points.

Comparison of standard pretraining data versus in-context learning (ICL) prompts.

The method relies on Gradient Matching, identifying pretraining instances that produce parameter gradients similar to those produced by an ICL task. By iteratively selecting a small subset (fewer than 2,000 instances) and performing perturbative verification—continued pretraining on this subset—the authors confirmed that these instances specifically improve ICL performance without affecting zero-shot capabilities.

Methodology and Datasets

The study utilized a 5-billion token subset of the data used for OPT-6.7B. Evaluation was conducted across 48 classification tasks from Natural Instructions v2, with a deep dive into six representative source tasks: SST-2, AG News, Story Cloze, SMS Spam, Sentiment 140, and TweetQA.

Key Insights: What Makes Data "Supportive"?

The analysis revealed that supportive data is not defined by its domain relevance. Instead, it possesses structural characteristics that force the model to rely more heavily on context:

  • The "Long-Tail" Effect: Supportive data contains a significantly higher frequency of rare, long-tail tokens. Learning to predict these tokens requires the model to utilize surrounding context rather than relying on simple frequency-based guessing.
  • ICL as a Response to Challenge: Perhaps the most counterintuitive finding is that supportive data exhibits lower Information Gain (IG) from long-range context compared to average data. This suggests that these examples are inherently more "challenging"—the relationship between the context and the target token is non-obvious or noisy.
Supportive data exhibits lower information gain from long-range context compared to random data across various tasks.

The researchers hypothesize that struggling to incorporate this difficult context is precisely what trains the model's "ICL muscles," enabling it to better recognize and apply patterns in few-shot prompts.

Results and Implications

Continued pretraining on the identified supportive subset yielded substantial results:

  • Performance Boost: ICL accuracy improved by up to 18% on specific tasks despite the miniscule size of the supportive data subset.
  • Cross-Task Transfer: Data selected for one task often improved performance on others, suggesting that the structural features of supportive data (rare tokens and challenging context) are universal drivers of the ICL mechanism.

While the computational cost of identifying these instances is currently high, these findings suggest a path toward more efficient pretraining. Future work may focus on synthesizing data with these specific "challenging" properties to create models that are better in-context learners from the start.

Summary updated

BibTeX
@inproceedings{han2023understanding,
  author = {Xiaochuang Han and Daniel Simig and Todor Mihaylov and Yulia Tsvetkov and Asli Celikyilmaz and Tianlu Wang},
  title = {{Understanding In-Context Learning via Supportive Pretraining Data}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2023},
  doi = {10.18653/v1/2023.acl-long.708},
}
Figure