Automatic Prompt Optimization with "Gradient Descent" and Beam Search

By Reid Pryzant, Dan Iter, Jerry Zheng Li, Yin Tat Lee, Chenguang Zhu, Michael Zeng. Conference on Empirical Methods in Natural Language Processing, 2023

730 citations recorded by the source corpus.

Large Language Models (LLMs) have shown impressive performance as general purpose agents, but their abilities remain highly dependent on prompts which are hand written with onerous trial-and-error effort. We propose a simple and nonparametric solution to this problem, Automatic Prompt Optimization (APO), which is inspired by numerical gradient descent to automatically improve prompts, assuming access to training data and an LLM API. The algorithm uses minibatches of data to form natural language"gradients"that criticize the current prompt. The gradients are then"propagated"into the prompt by editing the prompt in the opposite semantic direction of the gradient. These gradient descent steps are guided by a beam search and bandit selection procedure which significantly improves algorithmic efficiency. Preliminary results across three benchmark NLP tasks and the novel problem of LLM jailbreak detection suggest that Automatic Prompt Optimization can outperform prior prompt editing techniques and improve an initial prompt's performance by up to 31%, by using data to rewrite vague task descriptions into more precise annotation instructions.

Subfields: Artificial Intelligence, Information Systems

View Paper: https://www.semanticscholar.org/paper/c76dd4a70361c3afd2e19d046343e2dedd16ecc3

How researchers see this paper

The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.

In Artificial Intelligence

  1. Mohit Bansal
  2. Quoc V. Le
  3. Yejin Choi
  4. Jianfeng Gao
  5. Percy Liang
  6. Luke S. Zettlemoyer
  7. Graham Neubig
  8. Noah A. Smith

In Information Systems

  1. Christopher Potts
  2. Omar Khattab
  3. Matei A. Zaharia
  4. Keshav Santhanam
  5. Denny Zhou
  6. Xinyun Chen
  7. Chrisantha Fernando
  8. Karthik Narasimhan

Citations in the corpus