Universal Self-Adaptive Prompting

Xingchen Wan, Ruoxi Sun, Hootan Nakhost, Hanjun Dai, Julian Eisenschlos, Sercan Ö. Arik, Tomas Pfister

Abstract

Large Language Models (LLMs) demonstrate significant performance improvements when provided with a few task-specific examples, a technique known as In-Context Learning (ICL). However, the reliance on human-labeled demonstrations limits the scalability and accessibility of ICL for niche or novel tasks. This paper explores Universal Self-Adaptive Prompting (USP), a novel framework that automates the generation of few-shot demonstrations using unlabeled data. By leveraging model confidence as a proxy for quality, USP selects high-quality pseudo-demonstrations that significantly enhance performance across classification, reasoning, and generation tasks without human intervention.

Introduction

The transition from zero-shot prompting to few-shot In-Context Learning (ICL) has been a cornerstone of LLM optimization. While zero-shot instructions allow models to perform tasks broadly, few-shot examples provide the structural and contextual guidance necessary for high-precision outputs. Despite its effectiveness, ICL faces a major bottleneck: the requirement for high-quality, human-curated examples. In many real-world scenarios, labeled data is scarce, expensive, or non-existent.

Universal Self-Adaptive Prompting (USP) addresses this challenge by treating the prompting process as a transductive problem. Instead of relying on external labels, USP enables the model to "teach itself" by identifying its most reliable responses to unlabeled queries and using them as demonstrations for subsequent inferences.

The USP Framework

The USP pipeline is designed to be universal, meaning it can be applied to any text-based task without task-specific engineering. The process consists of three distinct stages:

1. Candidate Generation

The process begins with a small set of unlabeled queries (typically around 64 samples). The LLM is prompted in a standard zero-shot manner to generate initial responses for these queries. These query-response pairs serve as the raw material for potential demonstrations.

2. Task-Specific Selection

The core innovation of USP lies in its selection mechanism. To ensure that only the highest-quality examples are used as demonstrations, USP categorizes tasks into three types and applies specific scoring functions:

  • Classification (CLS): Selection is based on the negative entropy of the model's logits. A lower entropy indicates higher model certainty, suggesting that the generated label is likely correct.
  • Short-form Generation (SFG): For tasks like question answering, USP employs self-consistency. The model generates multiple candidate answers; the sample with the highest frequency (majority vote) is selected, as consistency often correlates with accuracy.
  • Long-form Generation (LFG): Since exact matches are rare in long-form text (e.g., summarization), USP calculates the average pairwise ROUGE score across multiple outputs. The response that is most representative of the generated set is chosen.

3. In-Context Learning

The top-scoring query-response pairs are curated into a few-shot prompt. These "pseudo-demonstrations" are prepended to the target test queries. This transforms the original zero-shot setup into a self-generated few-shot setup, providing the model with both the desired format and reasoning patterns.

Experimental Evaluation

The researchers evaluated USP using the PaLM family of models (62B, 540B, and PaLM 2-M) across over 40 diverse NLP tasks. The benchmarks included:

  • NLU and Classification: Winogrande, PIQA, and BoolQ.
  • Short-form Generation: SQuAD, TriviaQA, and Natural Questions.
  • Long-form Generation: XSum and WikiLingua.
  • Reasoning: The BIG-bench Hard (BBH) suite, covering 23 complex logic and arithmetic tasks.

Key Insights and Results

The experimental results demonstrate that USP consistently outperforms standard zero-shot baselines and existing automated prompting techniques like AutoCoT.

Performance Gains

On the PaLM-540B model, USP achieved an average performance boost of 8.19% in classification and 15.76% in short-form generation. The most dramatic improvement was observed in long-form generation, with a 29.2% increase over zero-shot baselines. Notably, on the challenging BIG-bench Hard suite, USP improved PaLM 2 performance by 9.45% compared to standard zero-shot Chain-of-Thought (CoT).

The "Self-Correction" Phenomenon

A significant finding is that LLMs possess an inherent ability to recognize their own high-quality outputs. By selecting samples where the model is most confident or consistent, USP reinforces correct reasoning paths. Furthermore, even when a pseudo-demonstration is not perfectly accurate, the structural guidance it provides—showing the model how to answer—often suffices to improve performance on subsequent queries.

Limitations and Future Directions

While USP represents a significant step toward fully autonomous LLM optimization, it is not without limitations. The framework's success is tied to the model's calibration; if a model is "confident but wrong," it may select erroneous demonstrations that degrade performance. This is particularly relevant for smaller models that may lack the internal calibration of larger systems like PaLM-540B.

Future research may explore optimizing the "system instructions" alongside the demonstrations and extending the self-adaptive logic to multi-modal environments or autonomous agent planning.

Conclusion

Universal Self-Adaptive Prompting offers a scalable, label-free solution to the few-shot prompting challenge. By leveraging the model's own internal confidence metrics, USP bridges the gap between zero-shot and few-shot learning, making high-performance ICL accessible for any task where unlabeled data is available.

Summary updated

BibTeX
@inproceedings{wan2023universal,
  author = {Xingchen Wan and Ruoxi Sun and Hootan Nakhost and Hanjun Dai and Julian Eisenschlos and Sercan Ö. Arik and Tomas Pfister},
  title = {{Universal Self-Adaptive Prompting}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.emnlp-main.461},
}
Figure