Skip to main content
QUICK REVIEW

[Paper Review] Prompt Engineering a Prompt Engineer

Qinyuan Ye, Maxamed Axmed|arXiv (Cornell University)|Nov 9, 2023
Manufacturing Process and OptimizationEngineering11 citations
TL;DR

PE2 constructs a meta-prompt to guide LLMs in automatic prompt engineering, achieving better prompts than prior baselines and surpassing zero-shot CoT on math reasoning benchmarks. It demonstrates strong performance across counterfactual tasks and production prompts, with interpretable prompt edits.

ABSTRACT

Prompt engineering is a challenging yet crucial task for optimizing the performance of large language models on customized tasks. It requires complex reasoning to examine the model's errors, hypothesize what is missing or misleading in the current prompt, and communicate the task with clarity. While recent works indicate that large language models can be meta-prompted to perform automatic prompt engineering, we argue that their potential is limited due to insufficient guidance for complex reasoning in the meta-prompt. We fill this gap by infusing into the meta-prompt three key components: detailed descriptions, context specification, and a step-by-step reasoning template. The resulting method, named PE2, exhibits remarkable versatility across diverse language tasks. It finds prompts that outperform "let's think step by step" by 6.3% on MultiArith and 3.1% on GSM8K, and outperforms competitive baselines on counterfactual tasks by 6.9%. Further, we show that PE2 can make targeted and highly specific prompt edits, rectify erroneous prompts, and induce multi-step plans for complex tasks.

Motivation & Objective

  • Motivate automatic prompt engineering as a complex reasoning task requiring structured guidance.
  • Develop a meta-prompt (PE2) with components that elicit step-by-step reasoning and context for prompt engineering.
  • Incorporate verbalized optimization concepts (batch size, step size, momentum) into the meta-prompt to guide prompt proposals.
  • Evaluate PE2 on mathematical reasoning datasets, counterfactual tasks, and production prompts to assess versatility.
  • Compare PE2 against baseline automatic prompt engineering methods and human-influenced initializations.

Proposed method

  • Frame prompt engineering as an optimization problem where the goal is to find a prompt that maximizes dev-set performance.
  • Introduce meta-prompt components: a step-by-step reasoning template, context specification, and a two-step task description.
  • Incorporate optimizer-inspired concepts (batch size, step size, momentum) into the meta-prompt and test variants.
  • Use prompt proposal model to generate new prompts from failures and apply a back-tracking search with top-k selections.
  • Evaluate using GPT-4 as the proposal model and text-davinci-003 as the task model across multiple datasets and settings.
  • Conduct ablations to assess the impact of each meta-prompt component and initialization strategy.

Experimental results

Research questions

  • RQ1Can a meta-prompt tailored for prompt engineering improve automatic prompt generation compared to existing baselines?
  • RQ2Which components of the meta-prompt most effectively enhance the quality of proposed prompts?
  • RQ3How does PE2 perform on mathematical reasoning benchmarks and counterfactual tasks relative to prior automatic prompt engineering methods?
  • RQ4Is PE2 robust across production prompts and real-world long prompts?
  • RQ5What limitations and failure modes does PE2 exhibit under current LLM capabilities?

Key findings

  • PE2 surpasses zero-shot chain-of-thought prompts by 6.3 percentage points on MultiArith and 3.1 points on GSM8K when using text-davinci-003 as the task model.
  • PE2 outperforms Iterative APE and APO baselines across multiple settings and tasks.
  • Three meta-prompt components (two-step task description, step-by-step reasoning template, context specification) significantly improve prompt engineering quality and reduce variance.
  • PE2 shows strong performance on counterfactual tasks and in optimizing a lengthy production prompt.
  • PE2 can generate targeted prompt edits and amend erroneous or incomplete prompts, sometimes deriving novel yet partially correct counterfactual rules.
  • Initialization quality strongly influences PE2’s performance, with induction-based initialization yielding competitive results.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.