EMNLP Findings2023
In-Context Demonstration Selection with Cross Entropy Difference
Dan Iter, Reid Pryzant, Ruochen Xu, Shuohang Wang, Yang Liu, Yichong Xu, Chenguang Zhu
Abstract
Large language models (LLMs) can use incontext demonstrations to improve performance on zero-shot tasks. However, selecting the best in-context examples is challenging because model performance can vary widely depending on the selected examples. We present a cross-entropy difference (CED) method for selecting in-context demonstrations. Our method is based on the observation that the effectiveness of in-context demonstrations negatively correlates with the perplexity of the test example by a language model that was finetuned on that demonstration. We utilize parameter efficient finetuning to train small models on training data that are used for computing the cross-entropy difference between a test example and every candidate in-context demonstration. This metric is used to rank and select incontext demonstrations independently for each test input. We evaluate our method on a mixdomain dataset that combines 8 benchmarks, representing 4 text generation tasks, showing that CED for in-context demonstration selection can improve performance for a variety of LLMs over baseline selection methods. 1 pages 355-362, Edinburgh, Scotland, UK. Association for Computational Linguistics.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
11 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Topic Coverage-based Demonstration Retrieval for In-Context Learning cites Revisiting Demonstration Selection Strategies in In-Context Learning
- Topic Coverage-based Demonstration Retrieval for In-Context Learning cites Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivity
- Revisiting Demonstration Selection Strategies in In-Context Learning cites Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivity
- Revisiting Demonstration Selection Strategies in In-Context Learning cites Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?
- Knowledge Boundary of Large Language Models: A Survey cites Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivity
- Lever LM: Configuring In-Context Sequence to Lever Large Vision Language Models cites Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivity
- Rethinking the Role of Demonstrations: What Makes In-Context Learning Work? cites Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivity
- Rethinking the Role of Demonstrations: What Makes In-Context Learning Work? cites UnifiedQA: Crossing Format Boundaries With a Single QA System
Cited by top-tier papers11
- Knowledge Boundary of Large Language Models: A SurveyMoxin Li, Yong Zhao, Wenxuan Zhang, Shuaiyi Li et al.ACL 2025 · 33 citations
- Lever LM: Configuring In-Context Sequence to Lever Large Vision Language ModelsXu Yang, Yingzhe Peng, Haoxuan Ma, Shuo Xu et al.NeurIPS 2024 · 13 citations
- Topic Coverage-based Demonstration Retrieval for In-Context LearningWonbin Kweon, SeongKu Kang, Runchu Tian, Pengcheng Jiang et al.EMNLP 2025 · 4 citations
- Revisiting Demonstration Selection Strategies in In-Context LearningKeqin Peng, Liang Ding, Yancheng Yuan, Xuebo Liu et al.ACL 2024
- Reasoning in Flux: Enhancing Large Language Models Reasoning through Uncertainty-aware Adaptive GuidanceZhangyue Yin, Qiushi Sun, Qipeng Guo, Zhiyuan Zeng et al.ACL 2024
Builds on13
- LoRA: Low-Rank Adaptation of Large Language ModelsEdward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu et al.ICLR 2022 · 18,833 citations
- Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order SensitivityYao Lu, Max Bartolo, Alastair Moore, Sebastian Riedel et al.ACL 2022 · 1,494 citations
- Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?Sewon Min, Xinxi Lyu, Ari Holtzman, Mikel Artetxe et al.EMNLP 2022 · 634 citations
- UnifiedQA: Crossing Format Boundaries With a Single QA SystemDaniel Khashabi, Sewon Min, Tushar Khot, Ashish Sabharwal et al.EMNLP Findings 2020 · 514 citations
- Large language models are few-shot clinical information extractorsMonica Agrawal, Stefan Hegselmann, Hunter Lang, Yoon Kim et al.EMNLP 2022 · 285 citations
Related papers
- On the Noise Robustness of In-Context Learning for Text GenerationHongfu Gao, Feipeng Zhang, Wenyu Jiang, Jun Shu et al.NeurIPS 2024 · 20 citations
- Why is a Bird's Caption a Good Demonstration? Towards Effective Multimodal In-Context Learning without Dedicated DataJunlin Fang, Wenya Wang, Lingli Zhang, Fengmao LvACM MM 2025 · 3 citations
- Selecting Demonstrations for Many-Shot In-Context Learning via Gradient MatchingJianfei Zhang, Bei Li, Jun Bai, Rumei Li et al.ACL Findings 2025
- Demonstration Augmentation for Zero-shot In-context LearningYi Su, Yunpeng Tai, Yixin Ji, Juntao Li et al.ACL Findings 2024 · 4 citations
- Disentangling Latent Shifts of In-Context Learning with Weak SupervisionJosip Jukic, Jan SnajderNeurIPS 2025 · 3 citations
