[Paper Review] Z-ICL: Zero-Shot In-Context Learning with Pseudo-Demonstrations
Z-icl proposes a zero-shot in-context learning method that constructs pseudo-demonstrations from a raw text corpus using nearest neighbor retrieval and synonym labeling to improve zero-shot performance. It achieves performance on par with few-shot in-context learning across nine text classification datasets, significantly outperforming prior zero-shot baselines without any prompt engineering or labeled data.
Although large language models can be prompted for both zero- and few-shot learning, performance drops significantly when no demonstrations are available. In this paper, we introduce Z-ICL, a new zero-shot method that closes the gap by constructing pseudo-demonstrations for a given test input using a raw text corpus. Concretely, pseudo-demonstrations are constructed by (1) finding the nearest neighbors to the test input from the corpus and pairing them with random task labels, and (2) applying a set of techniques to reduce the amount of direct copying the model does from the resulting demonstrations. Evaluation on nine classification datasets shows that Z-ICL outperforms previous zero-shot methods by a significant margin, and is on par with in-context learning with labeled training data in the few-shot setting. Overall, Z-ICL provides a significantly higher estimate of the zero-shot performance levels of a model, and supports future efforts to develop better pseudo-demonstrations that further improve zero-shot results.
Motivation & Objective
- To address the underestimation of large language models' zero-shot capabilities by constructing meaningful pseudo-demonstrations without labeled data.
- To improve zero-shot performance by simulating the input distribution and label space typically provided by few-shot demonstrations.
- To reduce the model's tendency to directly copy from highly similar demonstration inputs through novel construction techniques.
- To demonstrate that zero-shot performance can be significantly elevated by better-designed pseudo-demonstrations.
- To open new research directions in constructing high-quality pseudo-demonstrations that expose the full in-context learning potential of pre-trained models.
Proposed method
- Retrieves k nearest neighbors from a raw text corpus using semantic similarity to form the basis of pseudo-demonstrations.
- Pairs each retrieved sentence with a randomly selected synonym of a task label (e.g., 'great' with 'good') to reduce direct label copying.
- Uses physical neighbors (adjacent sentences in the corpus) of the nearest neighbors instead of the nearest sentences themselves to diversify input distribution.
- Applies synonym labeling to break lexical similarity between test input and demonstration labels, minimizing memorization effects.
- Conditions the language model on a sequence of input-label pairs formatted as in-context learning, maintaining a consistent demonstration structure.
- Employs a retrieval-based approach that does not require labeled training data, relying solely on an unlabeled text corpus.
Experimental results
Research questions
- RQ1Can zero-shot performance of large language models be significantly improved by constructing pseudo-demonstrations from an unlabeled corpus?
- RQ2To what extent do pseudo-demonstrations that mimic input distribution and label space improve zero-shot performance?
- RQ3How can the copying effect—where models over-rely on semantically similar demonstration inputs—be mitigated in zero-shot in-context learning?
- RQ4Does expanding the corpus coverage, even slightly, lead to measurable improvements in zero-shot generalization?
- RQ5Is the performance gain from pseudo-demonstrations due to the format of input-label pairs or simply the presence of relevant context?
Key findings
- Z-icl significantly outperforms previous zero-shot baselines across nine text classification datasets, demonstrating a substantial improvement in zero-shot capability.
- Z-icl achieves performance on par with in-context learning using actual k-shot labeled demonstrations, indicating that the model's full zero-shot potential was previously underestimated.
- The ablation study confirms that both the paired input-label format and the two proposed techniques—physical neighbor selection and synonym labeling—are essential for achieving top performance.
- Performance degrades as the corpus size decreases, with a clear drop in accuracy when the corpus is reduced to 0.03% of its original size, indicating sensitivity to corpus coverage and size.
- Expanding the corpus to include additional domains, such as adding 2% of IMDB reviews, consistently improves performance on previously uncovered datasets, showing that coverage is a key factor.
- The 'Inputs-only' variant, which conditions on retrieved sentences without labels, performs significantly worse than Z-icl, proving that the input-label pair format is crucial for performance.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.