AI Logo
AI Exporter Hub
Tips & Tricks

The Automatic Prompt Engineer (APE) Framework

J
Jack
June 30, 2025
prompts
The Automatic Prompt Engineer (APE) Framework

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

  1. Generation of Instruction Candidates: A large reasoning model receives output demonstrations to generate instruction candidates for tasks, guiding the search process.
  2. 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.

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).

Want to read more?

Explore our collection of guides and tutorials.

View All Articles