Learning-to-Context Slope: Evaluating In-Context Learning Effectiveness Beyond Performance Illusions

Dingzriui Wang, Xuanliang Zhang, Keyan Xu, Qingfu Zhu, Wanxiang Che, Yang Deng · DOI

TL;DR

This paper introduces the Learning-to-Context Slope (LCS), a novel metric for evaluating the effectiveness of In-Context Learning (ICL) in Large Language Models (LLMs). LCS moves beyond simple performance gains to analyze the relationship between how much a model learns from demonstrations and how relevant those demonstrations are to the task, offering a more reliable and insightful evaluation, especially in data-scarce scenarios.

What Problem Does This Paper Address?

In-context learning (ICL) is a powerful technique that allows LLMs to adapt to new tasks by providing examples within the input prompt, without requiring model retraining. However, evaluating whether ICL actually improves performance has been surprisingly tricky. Current methods often rely on comparing performance before and after applying ICL. This approach has several drawbacks:

  • Low Reliability: Performance changes can be noisy and influenced by factors other than true ICL effectiveness, like the quality of the demonstrations themselves or the specific task difficulty.
  • Poor Attribution: It's hard to pinpoint why ICL failed or succeeded. Was it the model's inability to understand the demonstrations, or its inherent ability to solve the task without them?
  • Impracticality: For tasks with limited labeled data, evaluating ICL effectiveness becomes even more challenging, leaving practitioners guessing.

The authors aim to provide a more robust and interpretable metric for ICL evaluation.

Methods

The core contribution is the Learning-to-Context Slope (LCS) metric. LCS is derived from a Bayesian perspective and models the relationship between two key components:

  1. Learning Gain (Loss Decrease): This measures how much the model's prediction loss decreases when demonstrations are provided, compared to a zero-shot setting. This is quantified as $I_p(X \rightarrow D|Q) = \log p(D|Q; X) - \log p(D|Q)$.
  2. Contextual Relevance: This quantifies how relevant a demonstration is to the user's input question. It's measured as $I_p(D \rightarrow X|Q) = \log p(X|Q; D) - \log p(X|Q)$.

LCS is essentially the slope of the line when plotting Learning Gain against Contextual Relevance. The intuition is that for effective ICL, even demonstrations with low contextual relevance should lead to significant learning gain. Conversely, if ICL is ineffective, only highly relevant demonstrations might yield a small gain.

The authors also propose using synthetic data to estimate LCS in data-insufficient scenarios, showing that while the LCS values might be lower than with real data, the trend and effectiveness can still be reliably inferred.

Datasets

The authors evaluated their LCS metric on a variety of datasets across different domains:

  • Mathematics: GSM8K, MATH
  • Code: HumanEval, MBPP
  • Reasoning: ARC-Challenge, MMLU-Pro
  • Domain-Specific: FinQA, Amazon Review

They used standard evaluation metrics for each domain (e.g., Exact Match for math/reasoning, Pass@1 for code).

Key Insights and Ideas

  • ICL Effectiveness is Nuanced: Simple performance gains are misleading. A model might show performance improvements due to factors unrelated to true ICL capability, or conversely, fail to show improvements even when ICL is fundamentally working.
  • Two Pillars of ICL Failure: LCS helps attribute ICL failures to either:
  • Weak Contextual Alignment: The model struggles to understand or utilize the information in the demonstrations relevant to the task.
  • Strong Output Calibration: The model is already very good at verifying its own outputs, making the added benefit of demonstrations minimal.
  • LCS as a Reliable Indicator: LCS consistently correlates with actual performance improvements when labeled data is available and reliably reflects effectiveness even in biased or data-scarce settings.
  • Synthetic Data is a Viable Proxy: LCS calculated on synthetic data can provide actionable insights into ICL effectiveness, reducing the need for extensive labeled datasets.
  • Actionable Thresholds: The paper identifies an empirical threshold for LCS (around 0.2) below which ICL is generally considered less effective.

Key Results

  • Strong Correlation: LCS shows a strong positive correlation (Pearson correlation of 0.737) with performance improvements observed in labeled settings.
  • Reliable Evaluation: LCS accurately reflects ICL effectiveness even in "bad cases" where performance doesn't improve, demonstrating its robustness over performance-based metrics.
  • Model Capability Insights: Experiments with different LLMs (Llama2-7b, Llama3.1-8b, Llama-R1-8b) show that LCS can differentiate their ICL capabilities and reveal how factors like contextual alignment and output calibration influence effectiveness. For instance, Llama2-7b on Amazon Review showed low contextual alignment, while Llama3.1-8b on GSM8K showed high ICL ability but diminished effectiveness due to strong output calibration.
  • Synthetic Data Validation: LCS calculated on synthetic data is consistently lower than with real data but maintains the same trend, supporting its use in data-scarce scenarios.

Limitations and Future Work

  • Limited Datasets and Models: The authors acknowledge that their experiments were conducted on a limited range of datasets and models. Future work should validate LCS on a broader spectrum to ensure its generalizability.
  • Deeper Investigation of Factors: While LCS identifies contextual alignment and output calibration as key factors, the underlying reasons for variations in these capabilities warrant further investigation.
  • Broader Application: Exploring the application of LCS to other areas beyond standard NLP tasks could be a promising future direction.

Summary updated

BibTeX
@misc{wang2025learning,
  author = {Dingzriui Wang and Xuanliang Zhang and Keyan Xu and Qingfu Zhu and Wanxiang Che and Yang Deng},
  title = {{Learning-to-Context Slope: Evaluating In-Context Learning Effectiveness Beyond Performance Illusions}},
  year = {2025},
  eprint = {2506.23146},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2506.23146},
}
Figure