Prompt Optimization via Adversarial In-Context Learning
Do Xuan Long, Yiran Zhao, Hannah Brown, Yuxi Xie, James Xu Zhao, Nancy F. Chen, Kenji Kawaguchi, Michael Shieh, Junxian He
Abstract
We propose a new method, Adversarial In-Context Learning (adv-ICL 1 ), to optimize prompts for in-context learning (ICL). Inspired by adversarial learning, adv-ICL is implemented as a two-player game between a generator and discriminator, with LLMs acting as both. In each round, given an input prefixed by task instructions and several exemplars, the generator produces an output. The discriminator then classifies the generator's input-output pair as model-generated or real data. Based on the discriminator's loss, a prompt modifier LLM proposes possible edits to the generator and discriminator prompts, and the edits that most improve the adversarial loss are selected. We show that applying adv-ICL results in significant improvements over state-of-theart prompt optimization techniques for both open and closed-source models on 13 generation and classification tasks including summarization, arithmetic reasoning, machine translation, data-to-text generation, and the MMLU and big-bench hard benchmarks. In addition, our method is computationally efficient, easily extensible to other LLMs and tasks, and effective in low-resource settings 1 Our codes will available at https://github.com/ zhaoyiran924/Adv-In-Context-Learning .
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
- Teach Better or Show Smarter? On Instructions and Exemplars in Automatic Prompt Optimization cites Measuring Massive Multitask Language Understanding
- Teach Better or Show Smarter? On Instructions and Exemplars in Automatic Prompt Optimization cites Language Models are Few-Shot Learners
- Teach Better or Show Smarter? On Instructions and Exemplars in Automatic Prompt Optimization cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- Measuring Massive Multitask Language Understanding cites Language Models are Few-Shot Learners
- Knowledge Boundary of Large Language Models: A Survey cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- Accelerating Greedy Coordinate Gradient and General Prompt Optimization via Probe Sampling cites Measuring Massive Multitask Language Understanding
- Accelerating Greedy Coordinate Gradient and General Prompt Optimization via Probe Sampling cites Language Models are Few-Shot Learners
- What Makes a Good Natural Language Prompt? cites Teach Better or Show Smarter? On Instructions and Exemplars in Automatic Prompt Optimization
- What Makes a Good Natural Language Prompt? cites Measuring Massive Multitask Language Understanding
- What Makes a Good Natural Language Prompt? cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- Beyond Output Matching: Bidirectional Alignment for Enhanced In-Context Learning cites Measuring Massive Multitask Language Understanding
- Beyond Output Matching: Bidirectional Alignment for Enhanced In-Context Learning cites Language Models are Few-Shot Learners
- Beyond Output Matching: Bidirectional Alignment for Enhanced In-Context Learning cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- Language Models are Few-Shot Learners cites The Curious Case of Neural Text Degeneration
Cited by top-tier papers9
- Accelerating Greedy Coordinate Gradient and General Prompt Optimization via Probe SamplingYiran Zhao, Wenyue Zheng, Tianle Cai, Do Xuan Long et al.NeurIPS 2024 · 46 citations
- Teach Better or Show Smarter? On Instructions and Exemplars in Automatic Prompt OptimizationXingchen Wan, Ruoxi Sun, Hootan Nakhost, Sercan Ö. ArikNeurIPS 2024 · 35 citations
- Knowledge Boundary of Large Language Models: A SurveyMoxin Li, Yong Zhao, Wenxuan Zhang, Shuaiyi Li et al.ACL 2025 · 33 citations
- What Makes a Good Natural Language Prompt?Do Xuan Long, Duy Dinh, Ngoc-Hai Nguyen, Kenji Kawaguchi et al.ACL 2025 · 13 citations
- Beyond Output Matching: Bidirectional Alignment for Enhanced In-Context LearningChengwei Qin, Wenhan Xia, Fangkai Jiao, Chen Chen et al.ACL 2025 · 7 citations
Builds on22
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
- Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
- Towards Evaluating the Robustness of Neural NetworksNicholas Carlini, David A. WagnerS&P 2017 · 9,786 citations
- Measuring Massive Multitask Language UnderstandingDan Hendrycks, Collin Burns, Steven Basart, Andy Zou et al.ICLR 2021 · 7,905 citations
- The Curious Case of Neural Text DegenerationAri Holtzman, Jan Buys, Li Du, Maxwell Forbes et al.ICLR 2020 · 4,112 citations
Related papers
- SEE: Strategic Exploration and Exploitation for Cohesive In-Context Prompt OptimizationWendi Cui, Jiaxin Zhang, Zhuohang Li, Hao Sun et al.ACL 2025
- TABGEN-ICL: Residual-Aware In-Context Example Selection for Tabular Data GenerationLiancheng Fang, Aiwei Liu, Hengrui Zhang, Henry Peng Zou et al.ACL Findings 2025 · 2 citations
- Tutor-ICL: Guiding Large Language Models for Improved In-Context Learning PerformanceIkhyun Cho, Gaeul Kwon, Julia HockenmaierEMNLP Findings 2024 · 1 citation
- In-context Mixing (ICM): Code-mixed Prompts for Multilingual LLMsBhavani Shankar, Preethi Jyothi, Pushpak BhattacharyyaACL 2024
- Large Language Models Might Not Care What You Are Saying: Prompt Format Beats DescriptionsChenming Tang, Zhixiang Wang, Hao Sun, Yunfang WuEMNLP Findings 2025 · 2 citations
