Lesson 2 of 5 in Prompt Tuning, Fine-Tuning & Reasoning · 8m
Automatic prompt optimisation
Hand-tuning prompts is slow and biased toward what the author happens to try. Two lines of research automate it. Automatic Prompt Engineer (APE) has an LLM generate candidate instructions and keeps the one that scores best on a set of examples; its instructions matched or beat human-written ones on most of the tasks tested [1]. OPRO treats the LLM as an optimiser: each round, a meta-prompt lists earlier prompts with their scores, and the model proposes better ones. OPRO's prompts beat human-designed prompts by up to 8% on GSM8K and up to 50% on Big-Bench Hard tasks [2].
The loop
-
Start from a baseline prompt and score it.
-
Propose variations, informed by which examples failed.
-
Score each variation with a judge or exact match.
-
Keep the best, repeat for several rounds.
-
Confirm the winner on held-out examples the loop never saw.
Key takeaways
- LLMs can propose and score prompt edits faster than people can.
- Feed failures back into each round.
- Trust only the held-out score.
Sources
- Zhou, Y. et al. (2022). Large Language Models Are Human-Level Prompt Engineers. ICLR 2023 · arXiv:2211.01910.
- Yang, C. et al. (2023). Large Language Models as Optimizers. ICLR 2024 · arXiv:2309.03409.