Does In-Context Learning Really Learn? Rethinking How Large Language Models Respond and Solve Tasks via In-Context Learning

Quanyu Long, Yin Wu, Wenya Wang, Sinno Jialin Pan

TL;DR

This paper investigates the "magic" behind In-Context Learning (ICL) in Large Language Models (LLMs) by breaking down its effectiveness into three components: label space, format, and discrimination. Surprisingly, ICL's primary strength lies in guiding LLMs to use the correct output format and vocabulary, rather than significantly improving their core reasoning or discriminative abilities. This suggests ICL acts more like detailed instructions than true learning.

What Problem Does This Paper Address?

Large Language Models (LLMs) have shown remarkable capabilities through In-Context Learning (ICL), where they can perform tasks with just a few examples provided in the prompt, without any parameter updates. While ICL is widely used, the exact mechanisms behind its effectiveness remain unclear. Previous research has explored how ICL might help models "recall" knowledge or improve input-label mapping. However, there's a lack of detailed analysis on which specific aspects of the demonstrations contribute most to performance gains. This paper aims to fill this gap by dissecting ICL's impact into distinct factors to understand its true power and limitations.

Methods

The authors propose a novel decomposition of ICL's contribution into three factors:

  1. Label Space Power: How well ICL helps the model adhere to the predefined set of acceptable output labels.
  2. Label Format Power: How effectively ICL guides the model to produce outputs in the desired format (e.g., specific phrasing, structure).
  3. Discrimination Power: How much ICL improves the model's ability to distinguish between correct and incorrect predictions, essentially its core reasoning capability.

They quantify these factors by categorizing LLM outputs into three types: Out-of-Space (OOS), In-Space-Out-of-Format (ISOOF), and In-Space-In-Format (ISIF). By tracking the shifts between these categories with and without ICL, they can attribute performance gains to each factor. They also explore the role of demonstration retrieval, comparing random selection with semantically similar retrieval.

Datasets

The study uses a variety of datasets across different NLP tasks:

  • Classification: SST-2 (Sentiment Analysis), WNLI, RTE (Natural Language Inference), MedQ, MRPC (Paraphrasing), Tweet Hate, Hate 18 (Hate Detection), AG News, TREC (Multi-class Topic Classification).
  • Text Generation: ROCStories, ROCStories Ending (Story Generation), Reddit, SamSum (Text Summarization).
  • Sequence Labeling: CONLL 2003, WNUT 2017 (Named Entity Recognition - NER), SemEval 2014, 2015, 2016 (Aspect-Based Sentiment Analysis - ABSA).

Key Insights and Ideas

  • ICL as a "Format Regulator": Counter-intuitively, ICL's biggest impact isn't on improving the model's core reasoning (discrimination), but on making it follow the desired output format and use the correct labels. It's like giving the LLM a strict template.
  • "Detailed Instructions" Analogy: The ability of ICL to regulate label space and format is so strong that it functions similarly to providing explicit, detailed instructions within the prompt.
  • Discrimination is Unstable: The improvement in discriminative ability from ICL is often marginal and can even be negative, especially with random demonstrations. This suggests LLMs don't necessarily "learn" better reasoning from these examples.
  • Retrieval Boosts Discrimination (but with a catch): Retrieving semantically similar examples significantly improves the model's discriminative power. However, if these retrieved examples lack diversity (all from the same class), the benefits to label space and format regulation are weakened.
  • Incorrect Labels Have Little Impact on Format/Space: When demonstrations have incorrect labels, the LLM's ability to adhere to the correct label space and format remains largely unaffected, explaining why incorrect labels have minimal impact on overall performance in some studies.

Key Results

  • Label Space and Format Dominance: Across classification tasks, label space and format regulation account for a large portion of ICL's performance improvement. In multi-class tasks, label space alone can be more impactful than discrimination and format combined.
  • Discrimination's Weak Showing: Discrimination power is the most unstable factor, often showing negative contributions, particularly in Hate Detection and multi-class classification datasets.
  • Detailed Instructions vs. ICL: For tasks where there's significant room for improvement in OOS and ISOOF outputs, both Detailed Instructions (DI) and ICL provide comparable performance gains. The combination (DI+ICL) offers minimal additional benefit, suggesting ICL's implicit guidance is already quite effective.
  • Retrieval's Impact: Retrieval-based demonstration selection significantly boosts discrimination power compared to random selection. However, it can lead to a decrease in ISIF percentage (label space/format adherence) if demonstrations lack diversity.
  • Generation Tasks Mimic Styles: In text generation, LLMs tend to mimic the stylistic nuances (e.g., active vs. passive voice, formal tone) of the demonstrations, even without explicit instructions, impacting evaluation scores.

Limitations and Future Work

  • Unstable Discrimination: The paper highlights the instability of discrimination improvement with ICL, especially with random demonstrations. Future work could explore why this is the case and how to mitigate it.
  • "Copy Effect" Nuances: While retrieval helps, the "Copy Effect" (LLMs following demonstration labels) can be detrimental if demonstrations lack diversity. The authors suggest exploring this trade-off further.
  • Demonstration Parameters: The paper notes that demonstrations can be viewed as "additional parameters" influencing token generation probability. Further investigation into this aspect is planned.
  • Text Generation Style: The study shows LLMs mimic demonstration styles in generation tasks. Future work could delve deeper into how this style mimicry affects downstream performance and evaluation.

Summary updated

BibTeX
@inproceedings{long2024does,
  author = {Quanyu Long and Yin Wu and Wenya Wang and Sinno Jialin Pan},
  title = {{Does In-Context Learning Really Learn? Rethinking How Large Language Models Respond and Solve Tasks via In-Context Learning}},
  booktitle = {COLM},
  year = {2024},
  url = {https://openreview.net/forum?id=i2oJjC0ESQ},
}
Figure