The Automatic Prompt Engineer (APE) Framework
The Automatic Prompt Engineer (APE) is a framework for automatic instruction generation and selection. It formulates the instruction generation problem as a natural language synthesis task, using large language models (LLMs) as black-box optimization solutions to generate and search for candidate solutions.
Core Steps
- Generation of Instruction Candidates: A large reasoning model receives output demonstrations to generate instruction candidates for tasks, guiding the search process.
- Instruction Execution and Evaluation: The target model executes the instructions, and the most appropriate instruction is selected based on calculated evaluation scores.
Key Findings
APE identified a zero-shot CoT prompt superior to the manually designed “Let’s think step by step” prompt (Kojima et al., 2022). The prompt “Let’s solve this problem step by step to ensure we have the correct answer.” triggers chain-of-thought reasoning and improves performance on the MultiArith and GSM8K benchmarks.
Related Research on Prompt Engineering
This article mentions key papers on automatic prompt optimization:
- Prompt-OIRL: Uses offline inverse reinforcement learning to generate query-related prompts.
- OPRO: Introduces the idea of optimizing prompts with LLMs (e.g., making LLMs “take a deep breath” to improve performance on math problems).