Source-linked AI summary
Complementary Explanations for Effective In-Context Learning
Xi Ye, Srinivasan Iyer, Asli Celikyilmaz, Ves Stoyanov, Greg Durrett, Ramakanth Pasunuru
TL;DR
The paper investigates what makes explanations effective for in-context learning and how LLMs use them. It probes computation traces and natural language, then selects relevant, complementary exemplars with MMR; this improves performance across three datasets.
Problem
Limited evidence explains which features make prompt explanations effective or how they function in in-context learning.
Source: §1 · p. 1Method
The paper perturbs computation traces and natural language in explanations, then uses MMR to select exemplars balancing query relevance and diversity.
Source: §1 · pp. 1–2Results
Takeaways & Limitations
Effective explanations involve both computation traces and natural language, while useful exemplar sets can combine query relevance with complementary reasoning.
Source: §1 · p. 2, §3.3 · p. 4The study focuses on substantially large, state-of-the-art models and omits smaller and vanilla-objective LLMs.
Source: §8 · p. 9
Abstract
from arXiv · showhide
Large language models (LLMs) have exhibited remarkable capabilities in learning from explanations in prompts, but there has been limited understanding of exactly how these explanations function or why they are effective. This work aims to better understand the mechanisms by which explanations are used for in-context learning. We first study the impact of two different factors on the performance of prompts with explanations: the computation trace (the way the solution is decomposed) and the natural language used to express the prompt. By perturbing explanations on three controlled tasks, we show that both factors contribute to the effectiveness of explanations. We further study how to form maximally effective sets of explanations for solving a given test query. We find that LLMs can benefit from the complementarity of the explanation set: diverse reasoning skills shown by different exemplars can lead to better performance. Therefore, we propose a maximal marginal relevance-based exemplar selection approach for constructing exemplar sets that are both relevant as well as complementary, which successfully improves the in-context learning performance across three real-world tasks on multiple LLMs.
1 Introduction
The paper investigates how explanation components shape in-context learning and how to select exemplar sets that combine complementary reasoning with query relevance. It proposes MMR-based selection and reports improved accuracy on three datasets.
1 Introduction
- The paper addresses limited understanding of which explanation features make them effective and how they function in in-context learning.It frames explanations as computation traces expressed through natural language.Source: §1 · p. 1
- Perturbation experiments indicate that both computation traces and natural language contribute to effective explanations for in-context learning.Defective explanations reduce performance, though incomplete explanations remain beneficial compared with no explanations.Source: §1 · p. 1, Figure 1 · p. 1
- The authors find that LLMs can combine different reasoning processes across exemplars, while nearest-neighbor selection also benefits explanation-based prompting.The studies examine both exemplar-exemplar complementarity and query-exemplar relevance.Source: §1 · p. 2
- MMR selection improved text-davinci-002 accuracy over random exemplars by 4.0% on GSM, 3.9% on ECQA, and 8.5% on E-SNLI.The approach selects exemplars for both relevance and diversity.Source: §1 · p. 2
2 Background
The background defines standard in-context learning, its extension with explanations, and query-specific exemplar selection. It also outlines the reasoning datasets and language models used in the experiments.
2 Background
- Standard in-context learning prompts a language model with exemplar input-output pairs to predict an answer for a test query.With explanations, exemplars become input-explanation-output triplets, and the model also generates explanations.Source: §2 · p. 2
- Because marginalizing over generated explanations is impractical, inference uses greedy decoding for an approximate prediction.The explanation-conditioned model predicts an answer and explanation given the query and exemplar triplets.Source: §2 · p. 2
- Exemplar selection chooses m examples from a pool of n for each test query, yielding query-specific prompt sets.Prior work often uses fixed manually selected exemplars, while selection from a pool can vary across queries.Source: §2 · p. 2
- The probing experiments use LET CAT, Coin Flips, and grade-school arithmetic, while selection experiments also cover ECQA and E-SNLI.The three selection datasets include human-annotated explanations and cover diverse reasoning abilities.Source: §2 · pp. 2–3
- The experiments span OPT, GPT-3, InstructGPT, text-davinci-002, and Codex models, including code-davinci-001 and code-davinci-002.The passage notes that Codex models are strong on textual reasoning tasks despite targeting code applications.Source: §2 · p. 3
3 Do LLMs Follow Explanations?
The section tests whether explanations work through their computation traces and natural-language framing. Both components contribute to effective explanations, although partial explanations can still help and sufficiently capable models can shortcut simple traces.
3 Do LLMs Follow Explanations?
- Explanations are modeled as intermediate-step computation traces wrapped by natural-language functions, probed through perturbations on three symbolic reasoning datasets.Source: §3 · p. 3
3.1 Explanations or Triggers?
- Perturbed explanations underperform complete ones across three datasets, though many still improve on standard prompting; text-davinci-002 can shortcut incomplete traces on simple tasks but is affected on GSM.Source: Table 1 · p. 4, §3.1 · p. 4
3.2 Is Natural Language Necessary?
- More than 20 in LETCAT accuracy is lost by OPT and davinci without natural language; GSM also degrades consistently.Source: §3.2 · p. 4
3.3 Discussion
- Both computation traces and natural language contribute to effective explanations; perturbing either can degrade performance, while partial explanations can remain beneficial.Source: §3.3 · p. 4
- Unlike standard prompting, where input-label mapping perturbations reportedly do not affect LLMs (Min et al., 2022c), explanation use is sensitive to input-explanation mapping and finer changes.Source: §3.3 · p. 5
4 What Makes A Good Exemplar Set?
The section tests how exemplars work together and how their relevance to a test query affects in-context learning with explanations. Its results support both complementary reasoning across exemplars and benefits from selecting relevant exemplars.
4 What Makes A Good Exemplar Set?
- The section examines exemplar-exemplar and query-exemplar interplay to test how sets of explanations work together for a particular test query.The experiments probe whether models can fuse reasoning processes specified by different exemplars.Source: §4 · p. 5, §4.1 · p. 5
4.1 Exemplar-Exemplar Interplay
- The experiments test whether LLMs can combine disjoint reasoning steps from masked exemplars or compose addition and multiplication skills from mixed GSM exemplars.The GSM test set requires both operators, although the addition and multiplication exemplars each use only one; the mixture contains exemplars from both types.Source: §4.1 · p. 5
- Mixed exemplars outperform single-reasoning sets on LETCAT and COINFLIP, while text-davinci-002 scores 52.0 with mixed GSM exemplars versus 50.3 with addition and 50.1 with multiplication exemplars.On LETCAT, mixed prompts outperform Mask2 by 6.0, 7.0, and 12.0 on OPT, davinci, and text-davinci-001, respectively.Source: Table 2 · p. 6, §4.1 · p. 6
4.2 Query-Exemplar Interplay
- Selecting nearest exemplars is also beneficial with explanations, and LM-based similarity improves performance across GSM, ECQA, and E-SNLI, with its largest impact on E-SNLI.The study uses eight exemplars per query and pools of 512 training exemplars; measuring similarity with large LLMs incurs non-negligible computation cost.Source: §4.2 · pp. 6–7
- BERTScore-based selection improves performance across all three datasets, reaches 66.7 accuracy on GSM with code-002, and avoids the heavy overhead of LLM-based scoring.It lags LM-based selection on ECQA and E-SNLI but still outperforms random and CLS-based selection there.Source: Table 3 · p. 7, §4.2 · p. 7
5 MMR for Exemplar Selection
The paper proposes MMR selection to balance query relevance with exemplar diversity. Results show benefits over nearest-neighbor selection across much of the tested settings, while analyses examine the relevance-diversity trade-off and exemplar order.
5 MMR for Exemplar Selection
- The section motivates MMR by arguing that nearest-neighbor selection can yield mostly similar exemplars and limit their collaboration.The intended set combines query-relevant examples that collectively cover the reasoning skills needed for the query.Source: §5 · p. 7
- MMR selects exemplars that are relevant to the query while using diversity as a proxy for complementary reasoning, because categorical complementarity is difficult to determine.The selection iterates over the exemplar pool; λ controls the balance between relevance and diversity, and scoring requires pairwise exemplar similarities.Source: §5 · pp. 7–8
- MMR with BERTScore generally selects better exemplars than nearest neighbors across datasets, while LM-based MMR improves GSM and ECQA across LMs and only marginally underperforms nearest neighbors on E-SNLI.With BERTScore and MMR, accuracy is 68.2 on GSM and 78.1 on ECQA, outperforming the LM-based method that requires many LM queries.Source: Table 4 · p. 8, §5 · p. 8
5.1 Analysis
- Across five random exemplar orders, MMR remains substantially better than nearest-neighbor and random selection.The order analysis uses code-davinci-002 with BERTScore and one training-exemplar pool per dataset.Source: Table 6 · p. 8, §5.1 · pp. 8–9
- MMR typically works well with λ of 0.6 or 0.5, while performance degrades as λ decreases from 0.4 to 0 because exemplars become insufficiently relevant.With λ at 0.8, performance is similar to nearest-neighbor selection at λ = 1.0; this analysis uses code-davinci-002, BERTScore, and one training-exemplar pool.Source: §5.1 · p. 8, Table 5 · p. 8
6 Related Work
Related work spans methods for improving in-context learning, analyses of how it works, and prompting with explanations. This paper focuses on explanation use in ICL and on selecting complementary exemplars.
6 Related Work
- Prior ICL work includes meta-tuning, calibration, exemplar ordering, PMI and noisy-channel formulations, and analyses of ICL as Bayesian inference or of what makes it work.The paper distinguishes its focus on explanation use from standard prompting with input-output pairs.Source: §6 · p. 9
- Earlier exemplar-selection work primarily targets relevant examples in standard prompting, whereas this work studies complementary exemplars for explanation-based prompts.The paper proposes MMR selection and reports it is more effective than nearest-neighbor selection across various LLMs and three tasks.Source: §6 · p. 9
- Prior work finds that scratchpads and chain-of-thought help multi-step reasoning, while free-text rationales help less structured QA and NLI tasks.This paper instead analyzes the role of explanations in ICL and what makes them effective.Source: §6 · p. 9
7 Conclusion
The paper investigates what makes explanations effective for in-context learning and finds that both computation traces and natural language matter. It also finds benefits from selecting complementary explanations relevant to the query, with an MMR-based strategy improving performance across three datasets.
7 Conclusion
- The proposed MMR-based exemplar selection strategy improved end-task performance across three important datasets.The strategy selects complementary explanations relevant to the query.Source: §7 · p. 9
- Selecting complementary explanations relevant to the query benefited prompt construction.The analysis examined interplay among exemplars and between exemplars and the query.Source: §7 · p. 9
- LLMs relied on both computation traces and natural language to learn effectively from explanations.This conclusion followed probing experiments on the impacts of those two factors.Source: §7 · p. 9
8 Limitations
The study focuses on state-of-the-art models and a subset of English NLP reasoning tasks, while noting computational costs and uncertainty about transfer to other language varieties and genres. Its appendix describes adaptations to explanations used with OPT on LETCAT and COINFLIP.
8 Limitations
- The study focuses on state-of-the-art models, omitting smaller and vanilla-objective LMs whose evaluation could inform effects of scale or instruction fine-tuning.The model choices represent the state of the art when the work was conducted, and some weaker models were omitted.Source: §8 · p. 9
- The approach can be computationally intensive, particularly when using LM-based similarity scores.The authors consider upfront computation feasible for practitioners deploying real-world systems.Source: §8 · p. 9
- The experiments cover a subset of English NLP reasoning tasks, leaving performance on other languages, dialects, and text genres unknown.The authors mention social media data as an example of an untested genre.Source: §8 · p. 9
A Details of the Explanations Used for LETCAT and COINFLIP on OPT
- For OPT, the authors used gold GSM explanations and manually engineered LETCAT and COINFLIP explanations because the originals were suboptimal.The original explanations did not yield credible gains over standard prompting on OPT.Source: A Details of the Explanations Used for… · p. 13
- For LETCAT, the adapted explanation adds a tokenization step; for COINFLIP, it changes the problem decomposition.The adapted explanations led to more substantial performance improvements over standard prompting.Source: A Details of the Explanations Used for… · p. 13, Table 7 · p. 13
B Details of the Choice of Masks
The mask experiments compared several tokens for partially perturbed explanations. Every mask degraded performance relative to gold explanations, but LLMs could still learn from partial explanations, with the empty string producing the least degradation.
B Details of the Choice of Masks
- Preliminary LETCAT experiments with davinci compared five candidate mask tokens.The results of the different masks are presented in Table 8.Source: B Details of the Choice of Masks · p. 13, Table 8 · p. 13
- All tested masks degraded performance compared with gold explanations, while LLMs could still learn from partially complete explanations.The tested masks were N/A, [mask], ?, an underscore, and the empty string.Source: B Details of the Choice of Masks · p. 13
- The empty string as mask token led to the least performance degradation across the datasets.It was the mask used in the study.Source: B Details of the Choice of Masks · p. 13
C Details of the Setup for Exemplar-Exemplar Interplay Experiments
The exemplar-interplay experiments compare prompts with different reasoning-step coverage and mixtures of exemplar types. The setups differ across LETCAT, COINFLIP, and GSM, including the exemplar pools and the number of combinations tested.
C Details of the Setup for Exemplar-Exemplar Interplay Experiments
- LETCAT used four exemplars with first steps perturbed, four with second steps perturbed, or a mixture of two from each type; COINFLIP used eight exemplars under the same setup.These perturbations formed the two exemplar types used in the mixture.Source: C Details of the Setup for… · p. 13
- For GSM, the three prompt types used eight addition-only exemplars, eight multiplication-only exemplars, or a mixture of four from each type.Unlike LETCAT and COINFLIP, the GSM exemplar sets came from different pools.Source: C Details of the Setup for… · p. 13
- The study averaged four randomly drawn GSM exemplar sets, and its test set requiring addition-multiplication composition contained 1,150 data points.Four random combinations were also tested for mixing the two types of masked exemplars.Source: C Details of the Setup for… · p. 13
D Details of the Setup for MMR-Based Exemplar Selection Experiments
The appendix specifies MMR-experiment settings, shows prompt formats for three real-world datasets, and lists the datasets’ licenses.
D Details of the Setup for MMR-Based Exemplar Selection Experiments
- MMR-based exemplar selection is evaluated on three realistic datasets; text-davinci-002 uses similarity scores from code-davinci-002 for the LM-based method because of the cost of running those experiments.λ is 0.5 across datasets and methods, except for the LM-based method with code-davinci-001, where it is 2/3 due to higher variance in exemplar diversity.Source: D Details of the Setup for MMR-Based… · pp. 13–14
E Details of Prompts for Real-world Datasets
- Figure 5 shows one-exemplar prompt formats for GSM, ECQA, and E-SNLI; the E-SNLI format is taken from PromptSource.Source: E Details of Prompts for Real-world… · p. 14, Figure 5 · p. 14
F License of Datasets
- GSM and E-SNLI use MIT licenses, while ECQA uses the Community Data License Agreement—Sharing, Version 1.0; LETTER CONCATENATION and COINFLIP use MIT licenses.Source: F License of Datasets · p. 14
Related papers
This paper cites
- BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding2018
- Language Models are Few-Shot Learners2020
- Training language models to follow instructions with human feedback2022
- Self-Consistency Improves Chain of Thought Reasoning in Language Models2022
- Measuring and Narrowing the Compositionality Gap in Language Models2022
- Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?2022