In-Context Learning Learns Label Relationships but Is Not Conventional Learning

Jannik Kossen, Yarin Gal, Tom Rainforth

In the fast-moving world of Large Language Models (LLMs), In-Context Learning (ICL)—the ability of a model to improve its performance simply by seeing a few examples in a prompt—remains one of the most mysterious "emergent" properties. Is the model actually learning a new task on the fly, or is it just using the examples to "locate" a task it already learned during pre-training?

A new paper from researchers at the University of Oxford dives deep into this question. Their verdict? ICL is a bit of both, but it definitely isn't "conventional" learning.

TL;DR

ICL is more than just "task recognition"—it actually learns specific input-label relationships, even for tasks it has never seen before. However, it is not a perfect learner: it struggles to overcome its pre-training biases and suffers from a significant "recency bias," prioritizing information closer to the end of the prompt.

What Problem Does This Paper Address?

There has been a heated debate in the AI community about how ICL works. Some researchers argue that ICL is a general-purpose learning algorithm (akin to gradient descent). Others, most notably Min et al. (2022b), famously claimed that ICL doesn't even need correct labels to work—suggesting the model just uses the context to figure out the format of the task, not the actual logic.

The authors of this paper argue that previous studies were limited because they mostly looked at accuracy and only evaluated a small number of examples (e.g., 16-shot). By looking at the model's underlying probability distributions (uncertainty) and scaling up the number of examples to the model's full context window, they aim to provide a definitive picture of ICL's learning dynamics.

Methods

The researchers moved beyond simple accuracy to study probabilistic metrics:

  • Log-Likelihood: How much probability the model assigns to the correct label.
  • Entropy: A measure of the model's "confusion" or uncertainty.

To test if ICL behaves like an "ideal" learner, they formulated and tested three Null Hypotheses (NH):

  1. NH1: ICL predictions are independent of the labels provided in the context.
  2. NH2: ICL can completely overcome the model's pre-training biases if given enough data.
  3. NH3: ICL treats all information in the context equally, regardless of its position.

Key Insights and Results

Labels Matter More Than We Thought (Rejecting NH1)

Contrary to prior claims, randomizing labels significantly hurts the model's confidence (log-likelihood) and increases its uncertainty (entropy), even if the final accuracy doesn't always plummet. ICL clearly depends on the conditional label distribution.

Log Likelihood for Default vs Randomized Labels

ICL Can Learn Truly New Tasks

The success on a novel Authorship Identification task (using private Slack messages never seen in pre-training) proves that LLMs aren't just "waking up" old knowledge; they can map novel inputs to labels entirely in-context.

Pre-training is a "Sticky" Prior (Rejecting NH2)

If you try to teach a model a "flipped" task (e.g., telling it that "happy" is a negative sentiment), it will try to learn it, but its confidence will plateau far below its performance on the "natural" version of the task. Even with 100+ examples, models remained much more uncertain on "flipped" label tasks compared to default ones. It cannot fully "unlearn" what it saw during pre-training.

Performance on Flipped and Arbitrary Label Relationships

The Recency Bias (Rejecting NH3)

ICL does not aggregate information globally. It preferentially uses information closer to the query. If the label mapping changes halfway through a prompt, the model almost immediately follows the new mapping, largely ignoring the first half of the context.

Limitations and Future Work

  • Logit-Based Evaluation: The study focused on classification tasks where performance is measured via logits. It did not explore free-form, open-ended generation.
  • RLHF Effects: The experiments primarily used base models or instruction-tuned models, but did not specifically look at how Reinforcement Learning from Human Feedback (RLHF) might alter these learning dynamics.
  • Alignment Implications: The authors suggest that because ICL struggles to overcome pre-training biases, using ICL for "alignment" (trying to change a model's behavior via prompting) might be inherently limited and less robust than fine-tuning.

Summary updated

BibTeX
@inproceedings{kossen2024context,
  author = {Jannik Kossen and Yarin Gal and Tom Rainforth},
  title = {{In-Context Learning Learns Label Relationships but Is Not Conventional Learning}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=YPIA7bgd5y},
}
Figure