Automatic Prompt Engineer (APE)

This Research Paper proposes an automatic prompt engineer (APE) a framework for automatic instruction and generation and selection in Prompt Engineering .The idea is to give the LLM the query in normal text and expressed as a black box optimization problem where the LLM is to generate and search over candidate solutions.
The first step is to provide the LLM with the given output demonstrations to generate instruction (prompt) candidates for a task. These candidate solutions will guide the search procedure. The instructions are executed using a target model the best possible prompt / instruction is selected over Evaluation scores.
APE discovers a better ZeroShot Chain Of Thought (COT) prompt than human generated prompt.
The prompt “Let’s work this out in a step by step way to be sure we have the right answer.” elicits chain-of-thought reasoning and improves performance on the MultiArith and GSM8K benchmarks:

This paper touches on an important topic related to prompt engineering which is the idea of automatically optimizing prompts. While we don’t go deep into this topic in this guide, here are a few key papers if you are interested in the topic:
- Prompt-OIRL - proposes to use offline inverse reinforcement learning to generate query-dependent prompts.
- OPRO - introduces the idea of using LLMs to optimize prompts: let LLMs “Take a deep breath” improves the performance on math problems.
- AutoPrompt - proposes an approach to automatically create prompts for a diverse set of tasks based on gradient-guided search.
- Prefix Tuning - a lightweight alternative to fine-tuning that prepends a trainable continuous prefix for NLG tasks.
- Prompt Tuning - proposes a mechanism for learning soft prompts through backpropagation.
Source: promptingguide.ai
References