Choosing an optimizer
Match your optimization problem to the right optimizer algorithm.
Six optimizers, one signal each
What separates the six optimizers isn’t their name, it’s the signal each one reads to decide what to try next.
flowchart TD accTitle: The six optimizers grouped by the signal each reads accDescr: Random Search reads random variation on the wording. Bayesian Search reads a score surface over examples and settings. ProTeGi and Meta-Prompt both read textual feedback from failures. PromptWizard reads mutation plus critique-and-refine. GEPA reads evolutionary search across generations. ROOT["Which signal writes the next prompt?"] ROOT --> R1["Random variation on wording"] ROOT --> R2["Score surface over examples and settings"] ROOT --> R3["Textual feedback from failures"] ROOT --> R4["Mutation plus critique-and-refine"] ROOT --> R5["Evolutionary search across generations"] R1 --> RS["Random Search"] R2 --> BS["Bayesian Search"] R3 --> PT["ProTeGi"] R3 --> MP["Meta-Prompt"] R4 --> PW["PromptWizard"] R5 --> GP["GEPA"]
Random variation: Random Search
Random Search’s only lever is how many wording variations it tries. It has no model of the score surface behind which variation to try next, so each candidate prompt is an unguided guess rather than a targeted edit. That’s exactly why it’s cheap: its budget is the smallest of the six.
Modeling the score surface: Bayesian Search
Bayesian Search is steered by how many optimization trials it runs and how large a slice of your examples each trial can draw on. Instead of touching the instructional wording, it models how the score responds to which few-shot examples get included, how many, and under what settings, and searches that surface directly rather than guessing at edits.
It costs more than Random Search’s cheaper read, because each trial is a modeled choice over the example range rather than one flat guess, and Bayesian Search runs more trials by default than Random Search runs variations.
Reading failures as text: ProTeGi and Meta-Prompt
ProTeGi and Meta-Prompt split off the same branch of the signal tree: both read textual feedback from the failures and use it to write targeted fixes, but they structure the search differently.
ProTeGi keeps a beam, the set of candidate prompts carried forward and edited in parallel, alive across rounds (each round is one pass through the search loop). It computes textual gradients (descriptions of what’s failing) from the errors, and edits every beam member from those gradients. ProTeGi pays for that breadth: because each beam member generates multiple candidates every round rather than one, its true cost runs well past a flat beam-times-rounds count.
Meta-Prompt carries a single evolving prompt through more rounds than ProTeGi rather than maintaining parallel candidates, so its fix comes from depth of iteration on one line instead of breadth across a beam. It has no beam to multiply against, so its cost tracks its round count directly, trading ProTeGi’s parallel breadth for depth on a single candidate.
Mutate, then critique and refine: PromptWizard
PromptWizard mutates the prompt’s wording directly, then critiques and refines the mutations that survive. Because mutation departs from the original wording entirely rather than patching specific failures, it’s suited to prompts where the wording itself, not any one instruction inside it, has become the ceiling. It carries a narrower beam than ProTeGi, so it isn’t paying for parallel candidates, but its mutate rounds and refine iterations per retained mutation still add up before scoring.
Evolutionary search against a budget: GEPA
GEPA is steered by a single budget: how many metric calls, each one a candidate prompt scored against your dataset, it’s allowed to spend. Rather than budgeting in rounds, trials, or beam size, it runs evolutionary search across generations and caps the search directly in metric calls, the widest single budget of the six. GEPA reads failures through a separate reflection model, distinct from the generator model the optimized prompt will actually run on.
Which optimizer fits your situation
Start from your own situation, not the algorithm list. The bullets below run from a cheap first look to the widest, most expensive search, and the choice isn’t final: you can rerun the same prompt with a different optimizer later.
- If you’re not sure yet, or just need a cheap read on how much room the prompt has before committing to anything heavier, use Random Search
- If the wording already works but the few-shot examples feel arbitrary, use Bayesian Search
- If you already know where the prompt fails and want the algorithm to act on that feedback, use ProTeGi for several fixes explored in parallel, or Meta-Prompt for fewer paths iterated longer
- If targeted edits have stopped moving the score and the wording itself seems to be the ceiling, use PromptWizard
- If there’s budget for the widest search, use GEPA
Keep exploring
Questions & Discussion