How to iterate on prompts
Prompt changes need baselines and measurement — manual comparison, meta-prompting, automated search, and generate-evaluate loops, with mechanisms and costs.
Prompt effect has not been tested.
A prompt is a re-runnable template, not a promise of results. Changing the model, version or input can change the outcome. Use the checkpoints on this page to verify it yourself, and treat the official sources as evidence of mechanism rather than a guarantee of effect.
What this guide covers
Changing a prompt without measuring is just guessing in a different way. There are four routes to iteration: manual comparison, meta-prompting, automated search, and runtime generate-evaluate loops. Automation increases along the list, and human judgment shifts from wording to criteria. We have not run hands-on tests; the mechanisms below come from official tutorials and papers.
Manual iteration: baseline comparison
OpenAI's meta-prompting cookbook demonstrates the full workflow: write a simple prompt as the baseline, generate an enhanced version, run both over the same dataset, and score them item by item against predefined criteria. The key to comparison is controlled variables: inputs and scoring stay fixed, so differences attribute to the prompt.
The cookbook's scoring method is an LLM judge: a model compares the two outputs against criteria such as accuracy, clarity, and relevance. Without this step, "feels better" is an impression, not a conclusion.
Meta-prompting: let the model rewrite the prompt
Meta-prompting's definition: using an LLM to generate or improve prompts. The typical setup in OpenAI's cookbook: a stronger model optimizes prompts for a weaker one. Feed the optimizer context and goals so it can produce a targeted enhancement.
A labor-saving detail: the judge prompt used for scoring can itself be meta-optimized. The iteration method applies to itself. The cost: an extra optimizer call, and whether the enhanced version is actually better still requires running the comparison.
Automated search: APE
The APE paper treats instructions as "programs" to be synthesized: an LLM proposes a pool of candidate instructions, search maximizes a chosen score function over them, and another LLM's zero-shot performance evaluates the selected instruction. The paper reports: across 24 NLP tasks, automatically generated instructions beat the zero-shot baseline by a large margin, matching or exceeding human-annotated instructions on 19 of 24 (the paper's own report, not our testing).
The mechanical point: the score function decides the search direction. If the score is misdefined, the selected instruction is misaligned — settle the criteria before searching.
Runtime loop: generator and evaluator
Anthropic's evaluator-optimizer pattern moves iteration to runtime: a generator produces an answer; an evaluator judges without solving, returning PASS / NEEDS_IMPROVEMENT / FAIL plus feedback; on failure, the generator regenerates with previous attempts and feedback until it passes. In the reference implementation, the evaluator is explicitly told to evaluate only, never attempt the task, and outputs use XML tags so code can branch on them.
Note: the reference implementation loops until PASS with no iteration cap. Production needs its own step limit and fallback exit (our view).
Failure modes
- No baseline: the change feels better but was never compared. Run the baseline first.
- Misaligned criteria: a score function or judge standard that misses the real goal optimizes you further off course.
- Shared blind spots: when evaluator and generator are the same kind of model, they may share the same blind spots (our view).
- Non-convergence: a generate-evaluate loop with no cap burns tokens without ever passing.
- Small-sample overfitting: optimizing against a few examples makes the prompt memorize them instead of learning the task (our view).
The shared premise of all four routes: define what "good" means first, then let any mechanism approach it.
Sources
- OpenAI Cookbook · Meta Prompting
- Anthropic Cookbook · Evaluator-Optimizer
- APE paper (arXiv 2211.01910)
Verified 2026-11-07; all three fetched directly with HTTP 200. The OpenAI and Anthropic doc sites were unreachable from this network; official content was taken from raw files in both vendors' official repositories.
Sources
| Source | URL |
|---|---|
| OpenAI Cookbook · Meta Prompting (official repo raw file, direct fetch 200 on 2026-11-07) | https://raw.githubusercontent.com/openai/openai-cookbook/main/examples/Enhance_your_prompts_with_meta_prompting.ipynb |
| Anthropic Cookbook · Evaluator-Optimizer (official repo raw file, direct fetch 200 on 2026-11-07) | https://raw.githubusercontent.com/anthropics/anthropic-cookbook/main/patterns/agents/evaluator_optimizer.ipynb |
| APE paper (arXiv 2211.01910, abstract page direct-fetched 2026-11-07) | https://arxiv.org/abs/2211.01910 |
Source snapshot: 2026-11-07; item-specific rechecks and their scope are recorded in the text or source notes. Features and terms may change; check the original sources before use.