Learning to Retrieve Iteratively for In-Context Learning
Yunmo Chen, Tongfei Chen, Harsh Jhamtani, Patrick Xia, Richard Shin, Jason Eisner, Benjamin Van Durme
Abstract
We introduce iterative retrieval, a novel framework that empowers retrievers to make iterative decisions through policy optimization. Finding an optimal portfolio of retrieved items is a combinatorial optimization problem, generally considered NP-hard. This approach provides a learned approximation to such a solution, meeting specific task requirements under a given family of large language models (LLMs). We propose a training procedure based on reinforcement learning, incorporating feedback from LLMs. We instantiate an iterative retriever for composing in-context learning (ICL) exemplars and apply it to various semantic parsing tasks that demand synthesized programs as outputs. By adding only 4M additional parameters for state encoding, we convert an offthe-shelf dense retriever into a stateful iterative retriever, outperforming previous methods in selecting ICL exemplars on semantic parsing datasets such as SMCALFLOW, TREEDST, and MTOP. Additionally, the trained iterative retriever generalizes across different inference LLMs beyond the one used during training.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Cited by top-tier papers8
- Optimizing Decomposition for Optimal Claim VerificationYining Lu, Noah Ziems, Hy Dang, Meng JiangACL 2025 · 5 citations
- Topic Coverage-based Demonstration Retrieval for In-Context LearningWonbin Kweon, SeongKu Kang, Runchu Tian, Pengcheng Jiang et al.EMNLP 2025 · 4 citations
- TACO: Enhancing Multimodal In-context Learning via Task Mapping-Guided Sequence ConfigurationYanshu Li, Jianjiang Yang, Tian Yun, Pinyuan Feng et al.EMNLP 2025 · 2 citations
- Improving Context Fidelity via Native Retrieval-Augmented ReasoningSuyuchen Wang, Jinlin Wang, Xinyu Wang, Shiqi Li et al.EMNLP 2025 · 1 citation
- Auto-regressive In-context Demonstration SelectionYunzhe Qi, Sirui Chen, Jiaru Zou, Jingrui HeICML 2026
Builds on14
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 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
- On Layer Normalization in the Transformer ArchitectureRuibin Xiong, Yunchang Yang, Di He, Kai Zheng et al.ICML 2020 · 1,388 citations
- Efficient Memory Management for Large Language Model Serving with PagedAttentionWoosuk Kwon, Zhuohan Li, Siyuan Zhuang, Ying Sheng et al.SOSP 2023 · 1,016 citations
- Compositional Exemplars for In-context LearningJiacheng Ye, Zhiyong Wu, Jiangtao Feng, Tao Yu et al.ICML 2023 · 188 citations
Related papers
- STARE at the Structure: Steering ICL Exemplar Selection with Structural AlignmentJiaqian Li, Qisheng Hu, Jing Li, Wenya WangEMNLP 2025
- Compositional Semantic Parsing with Large Language ModelsAndrew Drozdov, Nathanael Schärli, Ekin Akyürek, Nathan Scales et al.ICLR 2023 · 39 citations
- Inference Scaling for Long-Context Retrieval Augmented GenerationZhenrui Yue, Honglei Zhuang, Aijun Bai, Kai Hui et al.ICLR 2025
- Iteratively Prompt Pre-trained Language Models for Chain of ThoughtBoshi Wang, Xiang Deng, Huan SunEMNLP 2022 · 62 citations
- MemCoRL: Alternating Co-Optimization of Memory Retrieval and Utilization via Collaborative Reinforcement LearningYuewen Liu, Peng Xu, Muxi Diao, Anyi Zhang et al.ACL 2026
