# Prompt Optimization via Adversarial In-Context Learning

Source: [Prompt Optimization via Adversarial In-Context Learning](<https://www.sota2.com/research/paper/68fa73b61e209131cea5e103>)

Collection index: [llms.txt](<https://www.sota2.com/research/llms.txt>)

Data updated: 2026-01-04T04:40:48.789Z

Authors: Xuan Long Do, Yiran Zhao, Hannah Brown, Yuxi Xie, James Xu Zhao, Nancy F. Chen, Kenji Kawaguchi, Michael Shieh, Junxian He

Published: 2023-12-05T09:44:45.000Z

## Abstract

We propose a new method, Adversarial In-Context Learning (adv-ICL), to optimize prompt for in-context learning (ICL) by employing one LLM as a generator, another as a discriminator, and a third as a prompt modifier. As in traditional adversarial learning, adv-ICL is implemented as a two-player game between the generator and discriminator, where the generator tries to generate realistic enough output to fool the discriminator. In each round, given an input prefixed by task instructions and several exemplars, the generator produces an output. The discriminator is then tasked with classifying the generator input-output pair as model-generated or real data. Based on the discriminator loss, the prompt modifier proposes possible edits to the generator and discriminator prompts, and the edits that most improve the adversarial loss are selected. We show that adv-ICL results in significant improvements over state-of-the-art prompt optimization techniques for both open and closed-source models on 11 generation and classification tasks including summarization, arithmetic reasoning, machine translation, data-to-text generation, and the MMLU and big-bench hard benchmarks. In addition, because our method uses pre-trained models and updates only prompts rather than model parameters, it is computationally efficient, easy to extend to any LLM and task, and effective in low-resource settings.

## Recorded benchmark results

A research result applies to its stated dataset, split, metric and evaluation configuration. Compare like-for-like settings, preserve the metric's unit and direction, and distinguish paper-reported results from independent reproduction. The best result recorded here is not a claim of exhaustive, current global coverage.

- [Language Understanding on MMLU (test)](<https://www.sota2.com/research/sota/language-understanding-on-mmlu-test.md>): Language Understanding; MMLU (test); MMLU Average Accuracy: 74.

## Original sources and implementation

[Original paper](<https://arxiv.org/abs/2312.02614>)

[PDF](<https://arxiv.org/pdf/2312.02614.pdf>)

[Implementation](<https://github.com/zhaoyiran924/Adv-In-Context-Learning>)
