[Paper Review] Self-Adaptive In-Context Learning: An Information Compression Perspective for In-Context Example Selection and Ordering
This paper proposes self-adaptive in-context learning, a novel framework that selects and orders in-context examples at the instance level using an information compression perspective via the Minimal Description Length (MDL) principle. It achieves a 40% relative improvement over standard ICL by outperforming strong baselines across eight NLP datasets, demonstrating significant gains in robustness and performance close to fine-tuning.
Despite the surprising few-shot performance of in-context learning (ICL), it is still a common practice to randomly sample examples to serve as context. This paper advocates a new principle for ICL: self-adaptive in-context learning. The self-adaption mechanism is introduced to help each sample find an in-context example permutation (i.e., selection and ordering) that can derive the correct prediction, thus maximizing performance. To validate the effectiveness of self-adaptive ICL, we propose a general select-then-rank framework and instantiate it with new selection and ranking algorithms. Upon extensive evaluation on eight different NLP datasets, our self-adaptive ICL method achieves a 40% relative improvement over the common practice setting. Further analysis reveals the enormous potential of self-adaptive ICL that it might be able to close the gap between ICL and finetuning given more advanced algorithms. Our code is released to facilitate future research in this area: https://github.com/Shark-NLP/self-adaptive-ICL
Motivation & Objective
- To address the instability and suboptimal performance of standard in-context learning (ICL), which relies on random or fixed example organization.
- To propose a new paradigm—self-adaptive ICL—that dynamically selects and orders in-context examples per input instance to maximize performance.
- To overcome the limitations of corpus-level prompt optimization, which depends heavily on large validation sets and suffers from majority class bias.
- To develop a general two-stage framework (select-then-rank) that enables instance-level optimization without requiring a validation set.
- To demonstrate that self-adaptive ICL can significantly narrow the performance gap between ICL and fine-tuning.
Proposed method
- Proposes a general two-stage select-then-rank framework: first, heuristic selection (e.g., nearest neighbors) filters candidate examples; second, ranking algorithms identify the optimal example organization.
- Employs the Minimal Description Length (MDL) principle as a theoretical foundation for ranking, where the best example organization minimizes the total description length of the input, examples, and prediction.
- Uses semantic similarity (e.g., sentence embeddings) for initial example selection to reduce the search space before ranking.
- Applies MDL-based scoring to evaluate and rank different permutations of selected examples, favoring those that compress information most effectively.
- Introduces a search-based optimization strategy to handle the NP-hard combinatorial nature of example ordering, trading off efficiency and effectiveness.
- Employs a retrieval set of in-context examples and evaluates performance across diverse NLP tasks without requiring a validation set for adaptation.
Experimental results
Research questions
- RQ1Can instance-level example selection and ordering significantly improve in-context learning performance compared to random or fixed organization?
- RQ2How does self-adaptive ICL compare to corpus-level prompt optimization methods in terms of robustness and generalization across different models and datasets?
- RQ3To what extent can self-adaptive ICL close the performance gap between in-context learning and fine-tuning?
- RQ4Does the MDL-based ranking mechanism provide a principled and effective way to identify high-performing example organizations?
- RQ5How sensitive is the method to the quality and size of the retrieval set, and can it generalize across diverse prompting templates?
Key findings
- Self-adaptive ICL achieves a 40% relative improvement over standard ICL across eight diverse NLP datasets, significantly outperforming strong baselines.
- The method demonstrates consistent and significant gains across different model sizes (from 350M to 175B parameters), with performance improving steadily as model size increases on complex tasks.
- The approach is robust across different pre-trained language models (OPT, LLaMA, etc.) and remains effective under various prompting templates, indicating strong generalization.
- Performance gains are most pronounced on tasks with large or infinite label spaces (e.g., question answering, multi-choice), where traditional TopK selection fails.
- The method reveals that example organization is critical—increasing the number of examples without proper ordering yields diminishing returns, highlighting the importance of structural optimization.
- Despite strong performance, the method’s gains diminish when the retrieval set is small, indicating a dependency on high-quality candidate examples for optimal results.
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.