ACL 2024long6 citations

Prompt Optimization via Adversarial In-Context Learning

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

Abstract

We propose a new method, Adversarial In-Context Learning (adv-ICL), 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-the-art 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.

BibTeX
@inproceedings{long-etal-2024-prompt,
    title = "Prompt Optimization via Adversarial In-Context Learning",
    author = "Do, Xuan Long  and
      Zhao, Yiran  and
      Brown, Hannah  and
      Xie, Yuxi  and
      Zhao, James Xu  and
      Chen, Nancy F.  and
      Kawaguchi, Kenji  and
      Shieh, Michael  and
      He, Junxian",
    editor = "Ku, Lun-Wei  and
      Martins, Andre  and
      Srikumar, Vivek",
    booktitle = "Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)",
    month = aug,
    year = "2024",
    address = "Bangkok, Thailand",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2024.acl-long.395/",
    doi = "10.18653/v1/2024.acl-long.395",
    pages = "7308--7327"
}
Prompt Optimization via Adversarial In-Context Learning · ACL 2024