ProTeGi / Gradient Descent for Prompts (2023)
FreeTextual gradient descent — source paper for many auto-optimization methods
About ProTeGi / Gradient Descent for Prompts (2023)
Automatic Prompt Optimization (APO) is a nonparametric method inspired by numerical gradient descent that automatically improves prompts for Large Language Models (LLMs) given training data and an LLM API. The algorithm uses minibatches of data to form natural language 'gradients' that criticize the current prompt, then edits the prompt in the opposite semantic direction of the gradient. These gradient descent steps are guided by a beam search and bandit selection procedure for efficiency. In preliminary experiments across three benchmark NLP tasks and the novel problem of LLM jailbreak detection, APO outperformed prior prompt editing techniques and improved an initial prompt's performance by up to 31%. The paper was presented at EMNLP 2023.
Key Features
Pros & Cons
- Data-driven optimization eliminates manual trial-and-error
- Outperforms prior prompt editing techniques
- Significant performance gains (up to 31% improvement) across benchmarks
- Nonparametric and simple approach with broad applicability
- Effective on novel tasks like jailbreak detection
- Requires access to training data and an LLM API
- Preliminary results are limited to three benchmark NLP tasks
- Computational cost from beam search and multiple API calls
- May not generalize well to highly creative or open-ended prompts