ACL Findings2024
Batch-ICL: Effective, Efficient, and Order-Agnostic In-Context Learning
Kaiyi Zhang, Ang Lv, Yuhan Chen, Hansen Ha, Tao Xu, Rui Yan
Abstract
In this paper, by treating in-context learning (ICL) as a meta-optimization process, we explain why LLMs are sensitive to the order of ICL examples. This understanding leads us to the development of Batch-ICL, an effective, efficient, and order-agnostic inference algorithm for ICL. Differing from the standard N-shot learning approach, Batch-ICL employs N separate 1-shot forward computations and aggregates the resulting meta-gradients. These aggregated meta-gradients are then applied to the forward computation of a zero-shot query to generate the final prediction. This batch processing approach renders the LLM agnostic to the order of ICL examples. Through extensive experiments and analysis, we demonstrate that Batch-ICL consistently outperforms most permutations of ICL examples. In some cases, it even exceeds the performance of the best order for standard ICL, all while reducing the computational resources required. Furthermore, we develop a novel variant of Batch-ICL featuring multiple "epochs" of meta-optimization. This variant implicitly explores permutations of ICL examples, further enhancing ICL performance. 1
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.
9 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
- Hierarchical Demonstration Order Optimization for Many-shot In-Context Learning cites Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivity
- Eliminating Position Bias of Language Models: A Mechanistic Approach cites Calibrate Before Use: Improving Few-shot Performance of Language Models
- Disentangling Latent Shifts of In-Context Learning with Weak Supervision cites Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivity
- Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivity cites True Few-Shot Learning with Language Models
- Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivity cites Calibrate Before Use: Improving Few-shot Performance of Language Models
- An Explanation of In-context Learning as Implicit Bayesian Inference cites Calibrate Before Use: Improving Few-shot Performance of Language Models
- Mixture of In-Context Experts Enhance LLMs' Long Context Awareness cites Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivity
- True Few-Shot Learning with Language Models cites Calibrate Before Use: Improving Few-shot Performance of Language Models
Cited by top-tier papers9
- Mixture of In-Context Experts Enhance LLMs' Long Context AwarenessHongzhan Lin, Ang Lv, Yuhan Chen, Chen Zhu et al.NeurIPS 2024 · 25 citations
- More is not always better? Enhancing Many-Shot In-Context Learning with Differentiated and Reweighting ObjectivesXiaoqing Zhang, Ang Lv, Yuhan Liu, Flood Sung et al.ACL 2025 · 9 citations
- Disentangling Latent Shifts of In-Context Learning with Weak SupervisionJosip Jukic, Jan SnajderNeurIPS 2025 · 3 citations
- Hierarchical Demonstration Order Optimization for Many-shot In-Context LearningYinhan He, Wendy Zheng, Song Wang, Zaiyi Zheng et al.NeurIPS 2025 · 2 citations
- Eliminating Position Bias of Language Models: A Mechanistic ApproachZiqi Wang, Hanlin Zhang, Xiner Li, Kuan-Hao Huang et al.ICLR 2025
Builds on12
- Calibrate Before Use: Improving Few-shot Performance of Language ModelsZihao Zhao, Eric Wallace, Shi Feng, Dan Klein et al.ICML 2021 · 1,843 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
- An Explanation of In-context Learning as Implicit Bayesian InferenceSang Michael Xie, Aditi Raghunathan, Percy Liang, Tengyu MaICLR 2022 · 1,030 citations
- Transformers Learn In-Context by Gradient DescentJohannes von Oswald, Eyvind Niklasson, Ettore Randazzo, João Sacramento et al.ICML 2023 · 729 citations
- True Few-Shot Learning with Language ModelsEthan Perez, Douwe Kiela, Kyunghyun ChoNeurIPS 2021 · 547 citations
Related papers
- What Makes a Good Order of Examples in In-Context LearningQi Guo, Leiyu Wang, Yidong Wang, Wei Ye et al.ACL Findings 2024 · 8 citations
- Batch Calibration: Rethinking Calibration for In-Context Learning and Prompt EngineeringHan Zhou, Xingchen Wan, Lev Proleev, Diana Mincu et al.ICLR 2024 · 90 citations
- OptiSeq: Ordering Examples On-The-Fly for In-Context LearningRahul Atul Bhope, Praveen Venkateswaran, K. R. Jayaram, Vatche Isahagian et al.EMNLP Findings 2025 · 2 citations
- Feature-Adaptive and Data-Scalable In-Context LearningJiahao Li, Quan Wang, Licheng Zhang, Guoqing Jin et al.ACL 2024
- Rethinking Invariance in In-context LearningLizhe Fang, Yifei Wang, Khashayar Gatmiry, Lei Fang et al.ICLR 2025
