Source-linked AI summary

Mind Your Format: Towards Consistent Evaluation of In-Context Learning Improvements

Anton Voronov, Lena Wolf, Max Ryabinin

arXiv:2401.06766v3cs.CL

TL;DR

Prompt-template sensitivity is often overlooked, and differing template choices complicate comparisons of in-context learning methods. The paper evaluates that sensitivity and proposes Template Ensembles, finding no universally best format and recommending evaluations that account for template choice.

  • Problem

    Comparisons of ICL methods can be difficult to interpret because evaluations use different template sets, while template sensitivity is not consistently accounted for.

    Source: §2.2 · p. 3, §5.5 · p. 7
  • Method

    The paper evaluates template sensitivity across models and ICL settings, and proposes Template Ensembles that average predictions over several prompt formats.

    Source: §1 · pp. 1–2, §4.3 · p. 5
  • Results

    There are no universally well-performing prompt formats, and template effects can make reported ICL-method comparisons less reliable.

    Source: §5.5 · pp. 7–8, §7 · p. 9
  • Takeaways & Limitations

    Reliable ICL evaluation requires aggregation across several templates or evaluation in each setting’s best-performing template, trading clearer comparisons against computational cost.

    Source: §5.5 · p. 8

    The study covers only four classification datasets and two example-selection methods versus a random baseline, and does not explore label mapping.

    Source: Limitations · p. 9

Abstract

from arXiv · show

Large language models demonstrate a remarkable capability for learning to solve new tasks from a few examples. The prompt template, or the way the input examples are formatted to obtain the prompt, is an important yet often overlooked aspect of in-context learning. In this work, we conduct a comprehensive study of the template format's influence on the in-context learning performance. We evaluate the impact of the prompt template across 21 models (from 770M to 70B parameters) and 4 standard classification datasets. We show that a poor choice of the template can reduce the performance of the strongest models and inference methods to a random guess level. More importantly, the best templates do not transfer between different setups and even between models of the same family. Our findings show that the currently prevalent approach to evaluation, which ignores template selection, may give misleading results due to different templates in different works. As a first step towards mitigating this issue, we propose Template Ensembles that aggregate model predictions across several templates. This simple test-time augmentation boosts average performance while being robust to the choice of random set of templates.

1 Introduction

Prompt-template choices are often overlooked, despite their influence on in-context learning results and the fairness of comparisons between methods. The paper evaluates this sensitivity and proposes Template Ensembles as a way to make performance less dependent on the chosen format.

1 Introduction

  • Different templates can make reported differences between ICL methods reflect format variation rather than the methods themselves.Prior studies often used a specific template without explaining its selection, or compared results evaluated on different template sets.Source: §1 · p. 1
  • The best template depends on the evaluation setting and does not reliably transfer across models, demonstration sets, or prediction methods.Even slight changes can make a strong template perform poorly, complicating template tuning.Source: §1 · p. 2
  • Template Ensembles average predictions across several prompt formats to improve average performance and reduce sensitivity to template choice.Source: §1 · p. 2
  • Across 21 models and 4 datasets, selecting a suitable template alone can produce gains similar to proposed ICL improvements.Source: §1 · p. 2

2 Background and Related Work

The background defines in-context learning and describes how demonstrations become model inputs through templates. It reviews prompt-robustness methods and prior work on template selection, example selection, and prediction, motivating comparisons across a broader range of templates and models.

2.1 In-Context Learning

  • In-context learning classifies a test input by choosing the label that gives the model the highest-probability sequence, with demonstrations formatted as a natural-language input.Templates use input and output verbalizers, an intra-separator, and an inter-separator.Source: §2.1 · p. 2

2.2 In-Context Learning Analysis

  • Prompt components can cause unpredictable performance changes, and prior template-robustness work studied minimal or task-specific formats and optimized templates.The paper also uses verbalizers from Gao et al. (2021) alongside minimal and universal templates.Source: §2.2 · pp. 2–3
  • Example-selection methods include ITM, which learns latent task-concept variables, and Z-ICL, which retrieves similar unlabeled examples and assigns them random labels.Both had been evaluated on different single templates, leaving method gains difficult to distinguish from template effects.Source: §2.2 · p. 3
  • Prediction approaches include CALIBRATION, which corrects predictions using a placeholder input, and CHANNEL, which maximizes P(x|y) rather than P(y|x) (Min et al., 2022b).Prior comparisons used separate template sets, motivating evaluation across broader template and model ranges.Source: §2.2 · p. 3

3 Setup & Methodology

The study evaluates template sensitivity on classification tasks using a range of language models and constructed prompt formats. It examines demonstration selection and prediction methods, with repeated runs across random templates and seeds.

3.1 Models and Data

  • The evaluation uses models from frequently studied families such as OPT and BLOOM, as well as newer models such as Llama 2 and Falcon, across four classification datasets.The datasets are SST-2, DBPedia, AGNews, and TREC.Source: §3.1 · p. 4
  • Combining the template-component options yields 216 prompt formats for SST-2 and 168 for each of DBPedia, AGNews, and TREC.Evaluating all models on 10 random templates in one setup takes 17–48 hours on one NVIDIA A100-80GB GPU.Source: §3.1 · p. 4

3.2 Methods

  • For each setting, results are aggregated over 3 random seeds for example selection, with 10 random templates per seed, and reported as mean and standard deviation of accuracy.Source: §3.2 · p. 4
  • The study compares four-shot ITM and Z-ICL example selection with random selection, and evaluates DIRECT against CHANNEL and CALIBRATION prediction methods.ITM examples selected using GPT2 Large checkpoints are reused across models because training the concept model separately was considered infeasible.Source: §3.2 · pp. 4–5

4 Evaluation

Evaluation across baseline formats and ICL variants finds substantial template sensitivity: prediction and example-selection performance depends on the chosen format.

4.1 Baseline Results

  • Even the largest models show score standard deviations up to 35% of their mean values across prompt formats.The evaluation also finds that model-size and demonstration-count trends persist despite this variability.Source: §4.1 · p. 5

4.2 Prediction Methods

  • CHANNEL and CALIBRATION generally improve on DIRECT, but their scores substantially overlap DIRECT for some models and datasets.CALIBRATION achieves the highest mean accuracy more often, while being more template-sensitive than CHANNEL.Source: §4.2 · p. 5

4.3 Example Selection Methods

  • The evaluation compares ITM and Z-ICL with RANDOM using DIRECT prediction and four demonstrations.The authors note that their setup differs from the original studies and that their ten random templates may omit the templates those studies used.Source: §4.3 · pp. 5–6
  • Advanced example-selection methods often perform worse than RANDOM when template sensitivity is considered.ITM often raises average performance but has high across-template variation; Z-ICL is more consistent but performs worse.Source: §4.3 · p. 5

5 Template Transfer Evaluation

The top-performing templates transfer poorly across models, prediction methods, and demonstration sets, complicating fair comparisons of ICL improvements.

5.1 Setup

  • The top-10 templates average 90% of the best-template score, and shared membership in both setups' top tens defines successful transfer.The study compares top-template sets using Intersection-over-Union (IoU).Source: §5.1 · p. 6
  • Spearman rank correlation can rise when low-performing templates rank similarly, even while efficient-template transfer remains low.The authors provide this metric's results in Appendix I.Source: §5.1 · p. 6

5.2 Transfer Between Models

  • IoU exceeds 0.5 for only a few model pairs, indicating generally low transfer, including between models in the same family.The comparison concerns top-10 templates for base models with two random demonstrations and DIRECT prediction on DBPedia.Source: §5.2 · p. 7, Figure 4 · p. 7

5.3 Transfer Between Prediction Methods

  • IoU between prediction methods is low, so authors must tune templates for each method they combine with a new ICL modification.The reported Table 4 comparison averages results across 19 base models in the RANDOM 2-shot setup.Source: §5.3 · p. 7, Table 4 · p. 7

5.4 Transfer Between Demonstration Selection Methods

  • Adding demonstrations can significantly change the ranking of the best templates, even when they come from the same selection method.The authors conclude that example-selection methods should be evaluated across a range of templates to avoid misinterpreting results.Source: §5.4 · p. 7, Figure 5 · p. 8

5.5 Discussion

  • Using a shared format across models can underestimate a method except on the model for which that format was tuned.The authors say fair comparisons require describing and applying the format-selection procedure in every evaluated setting; alternatively, evaluation can aggregate over templates or use each setting's best template, with added variance or computational cost, respectively.Source: §5.5 · pp. 7–8

6 Template Ensembles

Template Ensembles average predictions across prompt formats; they increase accuracy across evaluated models and methods while reducing template-driven variance in most setups.

  • Template Ensembles average label probabilities across N templates and predict the label with the highest average probability.This test-time approach uses pretrained-model predictions without additional training, unlike a cited approach that trains a boosting algorithm on model outputs.Source: §6 · p. 8
  • Ensembles of size 4 or 5 achieve the best accuracy for most models and prediction methods; further expansion is less effective.Smaller ensembles can be unstable, and using N templates requires N times as many model runs as single-format evaluation.Source: §6 · p. 8
  • Ensembles increase accuracy for all evaluated models and prediction methods, while significantly reducing template-choice variance in most setups.The authors conclude that this preserves accuracy gains from ICL modifications while mitigating template sensitivity.Source: §6 · p. 9

7 Conclusion

The conclusion emphasizes that template sensitivity can affect ICL evaluation substantially, while Template Ensembles are only an initial mitigation.

  • Template selection can affect prediction accuracy as much as the choice of demonstrations or prompting methods.Source: §7 · p. 9
  • Template Ensembles do not yet address language models' general sensitivity to minor prompt variations.Source: §7 · p. 9

Limitations

The section bounds the study’s scope and reports that template effects interact across components, while their underlying mechanisms remain unanalyzed.

Limitations

  • Evaluation covers four classification datasets, compares only two example-selection methods against random, and leaves label mapping, including random labels, unexplored.Source: Limitations · p. 9
  • The study examines template-selection effects and transfer, not why templates affect performance; explaining those effects remains future work.Source: Limitations · p. 9

A Templates from Prior Work

  • Templates used by the evaluated methods’ original works had no intersection, complicating comparisons such as CHANNEL outperforming CALIBRATION in Min et al. (2022b).Source: A Templates from Prior Work · p. 14

B Model Selection

  • The final model pool retained models with at least eight 2-shot wins over 0-shot, selecting for models that demonstrated an ICL performance boost.Source: B Model Selection · p. 14

C Full Baseline Results

  • Template sensitivity appeared across all 19 models regardless of size and was not efficiently mitigated by increasing the number of demonstrations.Source: C Full Baseline Results · p. 14

D Template Parts Analysis

  • Template components interact: a verbalizer that ranks poorly alone can appear in a best-performing combination, and component rankings differ across models.Source: D Template Parts Analysis · p. 14

E Prediction Methods

Advanced prediction strategies did not consistently reduce template sensitivity, and their apparent advantages over DIRECT diminished when template-driven accuracy spread was considered.

E Prediction Methods

  • Accounting for template-driven accuracy spread makes the advantages of advanced prediction strategies over DIRECT less apparent, and neither consistently reduces sensitivity across models and datasets.Source: E Prediction Methods · p. 14

F Reproduction of Results for Advanced Selection Methods

Across these evaluations, template choice affects reported gains from example selection, template rankings transfer imperfectly, and ensembles often improve performance over single templates.

F Reproduction of Results for Advanced Selection Methods

G Example Selection Methods

  • Advanced example-selection techniques often performed comparably to random choice across templates, while finding each setup’s best format was costly and difficult.Source: G Example Selection Methods · p. 20

H Accuracy as a Function of Template Rank

I Transfer Evaluation with Spearman Rank Correlation

  • Spearman rank correlation gave higher template-transfer correlations than IoU over the top ten formats, but transfer remained far from perfect on datasets including SST-2 and TREC.Source: I Transfer Evaluation with Spearman… · p. 20

J IoU Transfer For All Datasets

K Additional Results For Template Ensembles

L Evaluation of Instruct Models

Instruction-tuned models retain template sensitivity as demonstrations increase, while template-robust evaluation changes method comparisons and ensembles improve accuracy while reducing variance.

L Evaluation of Instruct Models

L.1 Ensemble Results

  • Template Ensembles improved mean classification accuracy and significantly reduced variance across templates in every tested instruction-tuned configuration.Source: §L.1 · p. 21, Table 20 · p. 24
Loading 2401.06766v3…