Source-linked AI summary

Can language models learn from explanations in context?

Andrew K. Lampinen, Ishita Dasgupta, Stephanie C. Y. Chan, Kory Matthewson, Michael Henry Tessler, Antonia Creswell, James L. McClelland, Jane X. Wang, Felix Hill

arXiv:2204.02329v4cs.CLcs.AIcs.LG

TL;DR

The paper asks whether explanations attached to few-shot examples help language models infer new tasks and improve performance. It annotates challenging tasks, evaluates explanation and control prompt conditions with multilevel models, and finds benefits for large models, especially with tuned explanations. The results also indicate that matched example–explanation relationships matter, while the scope is limited by the task and model sets studied.

  • Problem

    The paper investigates whether explanations of few-shot answers improve language-model task performance and clarify the in-context learning abilities involved.

  • Method

    The study annotates 40 challenging tasks with explanations and controls, evaluates varied zero- and few-shot prompts, and analyzes results with hierarchical statistical models.

  • Results

    Explanations improve performance for large models, with tuned or jointly selected explanations producing larger benefits and untuned explanations outperforming matched controls.

  • Takeaways & Limitations

    Explanations can support in-context task inference in large language models and inform both prompt engineering and scientific understanding of in-context learning.

  • Takeaways & Limitations

    The results may generalize differently to models trained under other conditions, and only the largest evaluated model showed benefits at least from untuned explanations.

Abstract

from arXiv · show

Language Models (LMs) can perform new tasks by adapting to a few in-context examples. For humans, explanations that connect examples to task principles can improve learning. We therefore investigate whether explanations of few-shot examples can help LMs. We annotate questions from 40 challenging tasks with answer explanations, and various matched control explanations. We evaluate how different types of explanations, instructions, and controls affect zero- and few-shot performance. We analyze these results using statistical multilevel modeling techniques that account for the nested dependencies among conditions, tasks, prompts, and models. We find that explanations can improve performance -- even without tuning. Furthermore, explanations hand-tuned for performance on a small validation set offer substantially larger benefits, and building a prompt by selecting examples and explanations together substantially improves performance over selecting examples alone. Finally, even untuned explanations outperform carefully matched controls, suggesting that the benefits are due to the link between an example and its explanation, rather than lower-level features. However, only large models benefit. In summary, explanations can support the in-context learning of large LMs on challenging tasks.

1 Introduction

The paper asks whether explanations attached to few-shot examples help language models infer and perform new tasks. This question connects practical prompt performance with the scientific study of what in-context learning abilities models exhibit.

  • Motivation: Human explanations can connect terse answers to broader task principles, potentially helping models infer how questions relate to answers.The motivating contrast is between a bare answer and an explanation that makes the reasoning principle explicit.
  • Research question: The central question is whether explanations of answers improve language-model few-shot task performance, rather than whether explanations help users understand models.The paper evaluates model performance as the measure of whether explanations help the model itself.
  • Importance: This question may improve few-shot performance while also clarifying what kinds of in-context learning abilities language models exhibit.The authors frame the practical and scientific significance separately.
  • Contributions: The study annotates 40 diverse, challenging language tasks with example explanations and evaluates prompts containing examples, explanations, instructions, and controls.The contributions also include hierarchical analysis of dependencies among tasks, items, and prompt elements.

2 Methods

The methods use challenging and diverse tasks, matched language-model conditions, prompt variants, explanation controls, tuning experiments, and hierarchical evaluation. This design separates explanation effects from prompt features and estimates performance across nested sources of variation.

  • Task set: The study selects 40 BIG-Bench tasks spanning diverse reasoning types, skills, and domains, including induction, causality, goals, presupposition, metaphors, and tables.The tasks were chosen from a larger challenging benchmark with semi-adversarial sampling.
  • Explanations: A single author wrote expert explanations for 15 randomly chosen question-answer examples per task, providing untuned explanations before later validation-set tuning.The untuned evaluation estimates the benefit of adding explanations without optimization, while tuned experiments assess larger potential effects.
  • Prompt conditions: The prompts vary zero- and five-shot examples, task instructions, explanations, and matched controls including scrambled, non-explanatory, and mismatched explanations.Mismatched explanations preserve the prompt’s sentence set while breaking the relationship between each explanation and its example.
  • Evaluation design: Explanations are placed after example answers, allowing identical target-question evaluation whether explanations are present or absent.The model’s target answer is evaluated before any explanation generation would be required.
  • Evaluation design: Performance is evaluated on held-out task items using answer-option likelihoods for multiple-choice questions, without answer-length normalization.Prompt examples are excluded from evaluation, and the highest-likelihood option is selected.
  • Tuning experiments: Example-and-explanation selection and hand-tuning use small validation sets, then test tuned prompts on larger sets of remaining task examples.The selection comparison contrasts choosing examples with explanations against choosing examples alone.
  • Statistical analysis: Hierarchical or multilevel modeling accounts for dependencies among questions, tasks, prompts, and conditions when estimating prompt-component effects.This addresses shared task structure and direct comparisons between otherwise similar prompts.

3 Results

Explanations improve prompting performance for the largest model, with larger gains when explanations are tuned or selected jointly with examples. Benefits are variable, emerge mainly at larger scales, and depend on the relationship between each example and its explanation.

  • Adding few-shot examples substantially improves the largest model’s performance over zero-shot prompting.
  • Untuned explanations further improve performance, with about one-third the effect size of few-shot examples, while tuned explanations have larger effects.
  • Selecting examples and explanations together more consistently improves log-score over selecting examples alone.
  • Hand-tuned explanations offer more substantial benefits, although they were evaluated on only five tasks.
  • Untuned explanations modestly improve average performance for the largest model, whereas smaller models do not benefit.
  • Real explanations significantly outperform matched controls for the largest model, including controls that apply explanations to different examples.
  • Explanation benefits appear fairly consistent across eight task-type keyword clusters, but each cluster is small and results should not be interpreted strongly.

4 Related work

Prior work studies instructions, explanations, reasoning decompositions, and scaling in language-model prompting and training. This paper distinguishes post-answer explanations, evaluates them with matched controls on diverse challenging tasks, and relates their scale-dependent benefits to emergence research.

  • Prior research examines what underlies in-context learning, including implicit Bayesian inference and recovery of previously experienced tasks.
  • Task instructions can improve zero- or few-shot prompting, and explicit problem decomposition can benefit models.
  • Earlier prompting work used task descriptions and explanations but did not estimate explanations’ independent effect or compare control conditions.
  • Reasoning decompositions and external scratchpads have also improved performance, whereas this paper places explanations after the answer.
  • This study reports benefits from post-answer explanations, including on some arithmetic tasks, and uses broader tasks, controls, and statistical analyses than closely related work.
  • Training or tuning with instructions and explanations is relevant but does not directly answer how in-context explanations affect models not trained for them.
  • Explanations have also been used in computer vision, mathematical program induction, relational reasoning, and reinforcement learning.
  • The finding that explanation benefits emerge with model scale is consistent with prior observations of qualitative behavioral changes in larger models.

5 Discussion

Explanations improve few-shot performance for large language models, with stronger gains when explanations and examples are tuned jointly. Matched controls suggest the benefit depends on example–explanation relationships, although several scope and interpretation limits remain.

  • Explanation benefits: Untuned explanations modestly improve large-model few-shot performance, while tuned explanations provide substantially larger benefits.Selecting examples and explanations together outperforms selecting examples alone, and hand-tuning explanations on a small validation set can help on challenging tasks.
  • Explanation format: Post-answer explanations shape reasoning indirectly by changing task inference rather than by adding pre-answer reasoning steps.Pre-answer chains can support step-by-step reasoning, whereas post-answer explanations can only shape reasoning processes abstractly.
  • In-context learning: The largest model outperforms a control containing the same explanation sentences paired with different examples, while that control is no better than no explanations.This pattern suggests sensitivity to relationships between examples and their corresponding explanations rather than merely to prompt word distributions.
  • Interpretation: The findings do not rule out task memorization, and further investigation is needed to determine when models use higher-level relationships instead of low-level features.The tasks were adversarially sampled to be unique and challenging, making simple recall less likely but not impossible.
  • Instructions: Explanations provide similar benefits across instruction conditions, so task instructions and explanations can be complementary.The observed instruction effect was smaller than the effects of few-shot examples or explanations, although this may depend on instruction tuning and task difficulty.
  • Human comparison: Similar benefits for humans and models do not establish shared mechanisms, and model benefits are smaller than expected for humans.Differences may partly reflect language models’ impoverished experience of the broader contexts and situations to which language refers.

6 Conclusions

Including explanations with few-shot examples can improve in-context task inference in language models. Tuned explanations are especially effective, untuned explanations have modest benefits, and the capability emerges only in the largest models in these experiments.

  • Conclusion: Tuned explanations are especially effective, while untuned explanations have modest positive effects and outperform carefully matched controls.In these experiments, explanation benefits emerged only in the largest models, though smaller models might benefit with more explanations or simpler tasks.

Limitations

The study’s evidence is constrained by its task selection, annotation process, model training regimes, and modest effect size. These limits leave generalization beyond the evaluated settings unresolved.

  • Datasets: BIG-Bench’s idiosyncratic adversarially sampled tasks may not represent the tasks to which language models are usually applied.The task distribution could amplify or suppress explanation effects, so future work should test settings beyond BIG-Bench.
  • Annotations: A single author annotated a small subset of BIG-Bench because writing expert explanations was time-intensive.The dataset therefore does not include all BIG-Bench tasks.
  • Models: Matched training regimes control scaling comparisons but may limit generalization to differently trained or instruction-tuned language models.Models trained or tuned with instructions might benefit more from explanations.
  • Effect size: Explanations significantly improve performance without producing perfect or completely robust behavior, and untuned benefits are modest.The authors explicitly caution that explanations are not a panacea.

Ethical implications

The study expects no immediate ethical impacts, but explanation-driven performance improvements could have downstream effects related to large language models’ existing risks.

  • Ethical implications: Improving language-model performance with explanations could potentially exacerbate existing negative impacts, although downstream effects may also be beneficial.The authors frame these consequences as possible rather than established.

A Task details

The study uses 40 diverse, challenging multiple-choice language tasks sampled from BIG-bench, with prompts constrained by model context and explanation suitability.

  • The task set was sampled from BIG-bench and includes 40 diverse, challenging language tasks.
  • Tasks were multiple choice and represented in JSON to simplify evaluation.
  • A five-shot prompt with instructions and explanations plus a target question had to fit within the models’ 2048-token context window.
  • Tasks had to support natural-language explanations conveying more than a restatement of the answer.
  • Arithmetic and goal_step_wikihow included multiple subtasks representing distinct challenges.

B Explanation & prompt details

The authors constructed and evaluated explanation annotations alongside matched controls, quality ratings, and hand-tuned variants, while documenting dataset and task-specific limitations.

  • B.1 Dataset and code: The released dataset includes explanation annotations, prompt-building code, and a README describing the data format.
  • B.2 Dataset creation and limitations: A single author created the annotations, making the dataset expert-informed but small because annotation was time-intensive.
  • B.2 Dataset creation and limitations: Scrambled explanations preserve word content and length while removing syntactic structure, whereas true non-explanations are valid relevant statements without explanatory content.
  • B.3 Explanation quality manipulation check: An independent condition-blind rater scored explanations and true non-explanations from -3 to 3 for how helpful and explanatory they were.
  • B.3 Explanation quality manipulation check: Explanations received mean 2.37, while true non-explanations received mean -0.82 on the explanatory-quality scale.
  • B.4 Example explanations: The prompt examples include answers, explanations, true non-explanations, other-item explanations, and scrambled explanations across several tasks.
  • B.5 Lost explanations: The causal_judgment annotations were lost, so that task was analyzed only without tuning and only for the largest model.
  • B.6 Hand-tuning explanations:: Hand-tuning often made explanations more explicit about task principles or more language-like and pedagogical.

C Evaluation details

The evaluation compares prompt components using likelihood-based scoring and multilevel models that account for dependencies across tasks, prompts, and inputs. Explanations help mainly at larger model scales, with stronger gains from tuning and joint example selection, and they outperform matched controls.

  • C Evaluation details: The evaluation selected the highest-likelihood answer choice for each target question and excluded the five prompt examples from scoring.
  • C Evaluation details: Multilevel logistic models accounted for task difficulty, task-specific effects, prompt variation, and input-level dependencies.
  • D.1 Evaluation results: Hand-tuned explanations produced larger benefits on the five tasks evaluated with tuning.
  • D.1.2 Effects across model scales: β = 0.077; larger models benefited more from explanations, whereas smaller models did not benefit.
  • D.1.3 Untuned explanations vs. control conditions: All other tested conditions performed significantly worse than explanations, with all β ≤ −0.13 and p ≤ 0.005.
  • D.2 Explanation effects in different instruction conditions: The improvement from explanations did not vary substantially across instruction conditions.
  • D.3 Explanation effects by baseline score: The possible relationship between explanation gains and baseline scores showed a moderate-score bump, but differing answer-option counts confounded this pattern.

D.5 Explanation effects by task cluster

Explanation effects were examined across task clusters and model scales, alongside instruction and non-instruction effects. Overall patterns appeared similar across task types, although small cluster sizes limited confidence in differences.

  • Task clusters were defined by applying regular expressions to task keywords, with an additional “other” cluster for unmatched tasks.
  • Overall patterns appeared fairly similar across task types, but small cluster sizes made observed differences unlikely to be significant.
  • Explanation benefits varied across clusters and model scales, with logic, mathematics, and negation showing substantial benefits in the largest model.
  • Instruction and non-instruction effects were summarized using average effects across zero-shot and few-shot prompts.

D.7 Effects by task

The paper presents average performance and task-level effects for explanations, controls, instructions, and their comparisons across model scales. Task-level patterns should be interpreted cautiously because each condition used only three prompts.

  • Individual task results should not be interpreted too strongly because three prompts per condition are insufficient to quantify variation accurately.Broader patterns may still motivate future exploration.
  • Average few-shot performance with and without explanations was compared across task clusters and model scales.Larger models performed better across all task types, but clusters overlapped and varied in size.
  • Task-level plots report explanation and control effects across model scales.
  • Task-level plots also report instruction and non-instruction effects across model scales.
Loading 2204.02329v4…