Rethinking the Evaluation of In-Context Learning for LLM s (2024)

Abstract: In-context learning (ICL) has demonstrated excellent performance across various downstream NLP tasks, especially when synergized with powerful large language models (LLMs). Existing studies evaluate ICL methods primarily based on downstream task performance. This evaluation protocol overlooks the significant cost associated with the demonstration configuration process, i.e., tuning the demonstration as the ICL prompt. However, in this work, we point out that the evaluation protocol leads to unfair comparisons and potentially biased evaluation, because we surprisingly find the correlation between the configuration costs and task performance. Then we call for a two-dimensional evaluation paradigm that considers both of these aspects, facilitating a fairer comparison.Finally, based on our empirical finding that the optimized demonstration on one language model generalizes across language models of different sizes, we introduce a simple yet efficient strategy that can be applied to any ICL method as a plugin, yielding a better trade-off between the two dimensions according to the proposed evaluation paradigm.

## introduction recent years have witnessed a great success on incontext learning (icl) @xcite for a range of downstream natural language processing (nlp) tasks, such as text classification, sentiment analysis, and question answering @xcite @xcite . its main idea is to configurate a demonstration (i.e., selecting examples and organizing * corresponding authors. notable icl methods in task performance typically consume a significant cost to configure their demonstrations, and such cost may even hinder their deployment in real-world applications. despite the important role of the demonstration configuration cost, all prior studies surprisingly overlook it in their evaluations. more importantly, our pilot study reveals that the demonstration configuration cost of an icl method is correlated with its performance: increasing the cost usually leads to gains in performance. as a result, this finding indicates that the standard evaluation based on task performance induces unfair comparisons and biased evaluation results when evaluating different icl methods ( §3). in this paper, we thereby call for a twodimensional evaluation paradigm considering task performance and demonstration configuration cost, which provides a more comprehensive perspective to compare diverse icl methods. under the new evaluation paradigm, we employ two variants to reevaluate existing icl methods for fair comparison, in terms of task performance as well as configuration cost ( §4). moreover, drawing inspiration from the new evaluation results, we propose a simple strategy to optimize the icl methods towards zero configuration cost: it resorts to a very small language model for demonstration configuration even if conducting inference on a super-large language model. the strategy is effective because of the empirically verified property on the demonstration transferability that the optimized demonstration on one language model is transferable to another language model. our strategy is applicable to any demonstration configuration methods and we apply it to several strong icl methods for both open-source (e.g., opt) and closed-source (e.g., chatgpt) large language models (llms). our experiments show that our strategy indeed achieves better trade-offs between the two dimensions considered in the proposed evaluation paradigm ( §5). our contributions could be summarized as follows: ## a call for two-dimensional evaluation as analyzed in §3.2, the higher dc cost might result in improved accuracy and thus it would be unfair to compare different icl methods solely in terms of accuracy as in standard evaluation. therefore, to ensure fair comparison and unbiased evaluation, we call for a two-dimensional evaluation for icl methods, which takes into account both accuracy and dc cost. in this section, we employ two different implementations of the two-dimension evaluation to re-evaluate several icl methods. ## towards zero configuration cost since the dc cost is also important when configurating icl for very large language models (especially commercial llm apis such as chatgpt and gpt-4) as presented in previous sections, we seek better icl configuration methods that attain better trade-offs between accuracy and dc cost according to our two-dimensional evaluation. to this end, we first justify a nice property about the transferability across different llms. then, based on the property we propose a strategy to achieve zero dc cost and implement variant icl methods under this strategy. ## related work current research on icl primarily concentrates on example selection, example ordering, demonstration formats @xcite , etc. this paper focuses on the evaluation of demonstration configuration and introduces a two-dimensional evaluation for a fair comparison of these methods. studies for demonstration example selection aim to retrieve examples of high quality for a given test instance. existing methods mainly concentrate on the similarity @xcite and diversity @xcite @xcite of selected examples @xcite . some of them select demonstration example according to off-the-shell metric, such as bm25 @xcite ), text vector similarity @xcite @xcite @xcite , mutual information @xcite , determinantal point process @xcite , perplexity @xcite , and skillbased knn @xcite . to better adapt to various downstream tasks, different loss functions are proposed to train more effective example retrievers tailored to specific downstream objectives, including contrastive loss @xcite and negative loss @xcite . moreover, reinforcement learning techniques @xcite are also adopted for more adaptive training. @xcite trains datamodels to select based on feedback from llms specific to certain tasks. @xcite trains an example retriever and considers the interaction among them. @xcite ; li and qiu (2023a); @xcite distill representative examples from the corpra. @xcite treats llms as latent variables and pre-trains concept tokens for demonstration selection. @xcite selects demonstrations with the lowest cross-entropy difference with a test example. more recently, @xcite prompts large language models to generate demonstration examples instead of relying on retrieval methods. @xcite trains dense retrievers by distilling the knowledge from a reward model to identify high-quality examples. since @xcite demonstrates that the order of demonstration significantly influences the performance of icl, numerous methods have emerged to determine the optimal order for different tasks. to name some, @xcite evaluate various permutations of demonstrations through the lens of information compression. @xcite arrange examples based on their similarities with the input instance. xu et al. (2024) additionally, context extension methods could also be used to enhance icl by incorporating more demonstration examples into the context. for example, @xcite designs structured prompt-ing to scale in-context learning to thousands of examples. @xcite introduces parallel context windows to carve a long context to windows and breaks the context restriction typically encountered in llms. @xcite proposes a naive bayes-based context extension approach and significantly expands the context size. these methods aim to increase the number of demonstration examples, but the methods in this paper focus on demonstration configuration. consequently, context extension remains orthogonal to our study and is not considered further. ## conclusion although existing icl methods have succeeded across various downstream nlp tasks, they overlook the evaluation of the demonstration configuration cost, which induces an unfair comparison of icl methods. in this paper, we first illustrate the positive co-relationship between the performance and the dc cost. then we call for a two-dimension evaluation considering both of the aspects. based on the new evaluation results, a simple yet effective strategy is proposed to reduce the dc cost. experiments proved such a strategy achieves better trade-offs between the proposed two dimensions.