Source-linked AI summary
Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivity
Yao Lu, Max Bartolo, Alastair Moore, Sebastian Riedel, Pontus Stenetorp
TL;DR
Few-shot in-context learning can vary dramatically with the order of training samples, but selecting a good order is difficult because performant permutations are not reliably transferable and labeled development data is undesirable. The paper constructs an artificial probing set from the language model itself and applies entropy statistics to candidate prompts, achieving an average 13% relative improvement across eleven text-classification tasks. Smaller models still face challenges on sentence-pair tasks such as CB and RTE.
Problem
In-context learning performance can range from near supervised accuracy to random guessing depending on sample order, while good permutations are not transferable and development-set selection requires additional labeled data.
Method
The paper generates an unlabelled artificial probing set from the language model and uses entropy-based statistics over candidate permutations to select performant prompts.
Results
13% relative improvement is achieved on average across eleven established text-classification tasks compared with prompts without probing.
Takeaways & Limitations
Prompt-order selection can improve in-context learning across model sizes and tasks without requiring additional annotated data.
Takeaways & Limitations
Sentence-pair tasks such as CB and RTE remain challenging for smaller-sized models even after performant permutation selection.
Abstract
from arXiv · showhide
When primed with only a handful of training samples, very large, pretrained language models such as GPT-3 have shown competitive results when compared to fully-supervised, fine-tuned, large, pretrained language models. We demonstrate that the order in which the samples are provided can make the difference between near state-of-the-art and random guess performance: essentially some permutations are "fantastic" and some not. We analyse this phenomenon in detail, establishing that: it is present across model sizes (even for the largest current models), it is not related to a specific subset of samples, and that a given good permutation for one model is not transferable to another. While one could use a development set to determine which permutations are performant, this would deviate from the true few-shot setting as it requires additional annotated data. Instead, we use the generative nature of language models to construct an artificial development set and based on entropy statistics of the candidate permutations on this set, we identify performant prompts. Our method yields a 13% relative improvement for GPT-family models across eleven different established text classification tasks.
1 Introduction
In-context learning can be highly sensitive to the order of training samples in a prompt, with some permutations approaching supervised performance and others near random. The paper analyzes this sensitivity and introduces generation-based probing with entropy statistics to select effective prompts without additional labeled data.
- The paper studies order sensitivity across GPT-family models and classification settings, using four-shot prompts with alternative sample permutations.
- Few-shot language models can match fully supervised text-classification results when conditioned on only a handful of training examples.
- Sample ordering is an overlooked prompt component, although template structure is already known to affect in-context learning performance.
- Some sample permutations exceed 85% accuracy while others reach around 50%, showing that order can rival the effect of choosing the right template.
- Performant permutations lack a common pattern and are not transferable across model sizes or tasks, making development-set selection unsuitable for the true few-shot setting.
- The proposed probing method generates an artificial unlabelled development set and uses entropy-based statistics to identify performant prompts without additional data.
- 13% relative improvement is achieved on average across eleven established text-classification tasks.
2 Order Sensitivity and Prompt Design
Few-shot prompt performance is highly sensitive to training-sample order: adding samples or increasing model size does not reliably eliminate variance, and performant permutations do not transfer across models. Label-order permutations likewise lack a consistently transferable pattern, while calibration improves performance without removing variance.
- Model-size effects: GPT2-XL can exceed 90% accuracy with four samples, yet another ordering can reduce the same model to near-random performance.The reported high-performance result is comparable to supervised models trained on more than 60,000 samples.
- Sample-count effects: Order sensitivity remains high as training-sample count increases, and variance can even increase despite overall performance gains.The experiment samples at most 24 orderings, with up to 64! possible orders for larger sample counts.
- Cross-model transfer: A permutation’s performance can fall from 88.7% to 51.6% when changing from GPT2-XL (1.5B) to GPT2-Large (0.8B).Across models, permutation behavior is seemingly random rather than strongly correlated.
- Cross-model transfer: The 175B and 2.7B models have permutation-performance correlation of 0.05, so a good order for one is not guaranteed to work for the other.Figure 4 examines training-sample permutation performance correlation across different models.
- Label-order effects: Label-order permutations are also seemingly random across model sizes, preventing identification of one ordering that performs consistently across models.The analysis considers six label patterns formed from the four-sample permutations.
- Prompt failure modes: Calibration produces much higher performance for bad prompts, but performance variance remains high across all possible GPT2-XL permutations.Figure 6 contrasts predicted SST-2 label distributions with two-shot calibrated performance.
3 Methodology
The method generates an unlabeled probing set from every candidate ordering of randomly selected training samples, then ranks those orderings with entropy-based metrics to select performant prompts without additional labels.
- The method addresses automatic prompt-order selection without requiring an annotated development set.
- Each training sample is transformed into a template-based natural-language sequence, such as “input:xi type:yi”.
- All n! permutations of the transformed samples are treated as candidate prompt orderings; four sampled training examples yield up to 24 candidates.
- 3.1 Sampling from the Language Model to Construct a Probing Set: For every candidate ordering, the language model generates a sequence, whose extracted samples are concatenated into an unlabeled probing set.Generated labels are discarded because their correctness is not guaranteed; the probing set is intended to reflect the input distribution.
- 3.2 Probing Metrics: GlobalE ranks prompts by the entropy of their aggregate predicted-label distribution, targeting orderings that avoid extremely unbalanced predictions.
- 3.2 Probing Metrics: LocalE ranks prompts by average per-example prediction entropy, motivated by avoiding models that are overly confident across probing inputs.The selected orderings are ranked by GlobalE or LocalE performance.
4 Experimental Setup
Experiments evaluate GPT-2 and GPT-3 models on eleven text-classification datasets using multiple prompt permutations, with entropy-ranked prompts compared against permutation baselines.
- Experiments use four GPT-2 sizes from 0.1B to 1.5B parameters and two GPT-3 sizes, including 175B parameters.
- Each sampled training set uses 24 permutations, with five sets per experiment except for GPT-3 175B, which uses two sets and 12 permutations because of cost.
- LocalE and GlobalE select the top four highest-entropy context permutations, while baseline results average across five random seeds and all 24 permutations.
- The study evaluates eleven text-classification datasets spanning sentiment classification to textual entailment.
- Evaluation uses 256 validation samples per dataset to control GPT-3 API inference costs.
5 Results
Entropy-based probing consistently improves prompt selection across tasks, templates, and model sizes, while remaining robust to different top-K choices. Gains are largest when baseline prompt variance is high, but smaller models still struggle on some sentence-pair tasks.
- Entropy-based probing: 13% relative improvement: GlobalE outperforms the unprobed baseline across eleven sentence-classification tasks.LocalE achieves a 9.6% relative improvement, and selected prompts show considerably lower variance than using all candidate prompts.
- Entropy-based probing: Entropy-based ranking remains effective as the number of selected prompt orderings changes, with negative performance slopes across all datasets.K = 24 is equivalent to the baseline using all sampled orders; experiments use K = 4.
- Across templates: Entropy-based probing consistently improves performance across four SST-2 templates, indicating that it is not tied to a specific prompt template.The experiments also report similar randomness across templates.
- Robustness: Up to 30% relative improvement occurs for models with high prompt variance, while performance is not negatively affected when initial variance is low.The method provides marginal improvement at worst and averages a 13% relative improvement in most cases.
- Limitations: Smaller models remain challenged on CB and RTE despite performant permutation selection.For some GPT-2 model-task settings, performance is not significantly different from a random baseline, limiting the benefit of prompt optimization.
- Validation comparison: Entropy-based probing outperforms selecting prompts by splitting limited training data into training and development subsets.The comparison uses four-shot SST-2 samples, and entropy-based methods perform better across all model sizes.
6 Related Work
Related work frames in-context learning as a unified text-based interface and studies prompt templates, retrieval, and few-shot evaluation. This paper addresses the distinct problem of sample-order sensitivity without relying on held-out examples.
- Unified Interface Design for NLP: Unified NLP interfaces use language-modeling formulations to support zero-shot or few-shot task performance without separate task-specific fine-tuning.GPT-3 showed that scaling can make task-agnostic few-shot performance competitive with prior fine-tuning approaches.
- Prompt Design for PLMs: Prompt-design research primarily improves compatibility between training data and language models through handcrafted, automatically generated, or searched templates.Prior methods include cloze-style construction, external-language-model generation, gradient-guided search, and mining-based template creation.
- Order Sensitivity of Prompt Design: Prior order-sensitivity work contrasts fine-tuning and retrieval settings, where standard-size data or nearest-neighbor retrieval can reduce the apparent role of ordering.The present study focuses on in-context learning with only a handful of examples.
- True Few-shot Learning: True few-shot-learning studies question evaluations that depend on held-out validation data when such data are unavailable.This paper constructs a probing set from the generative nature of language models and reports better performance than relying on held-out examples.
7 Conclusion
The paper shows that few-shot prompt performance is highly sensitive to sample order and introduces entropy-based probing to identify stronger permutations without additional labeled data. Across eleven text-classification tasks, this yields an average 13% improvement.
- Conclusion: Few-shot prompts can range from state-of-the-art to random performance solely because the sample order changes.The paper establishes order sensitivity across tasks, model sizes, prompt templates, samples, and numbers of training samples.
- Conclusion: Entropy-based probing constructs an artificial development set and uses entropy statistics to identify performant prompt permutations.The method exploits the generative nature of language models rather than requiring additional annotated data.
- Conclusion: 13% improvement: entropy-based prompt selection delivers this average gain across eleven text-classification tasks.This is the paper’s reported aggregate outcome for the proposed probing method.