Choosing an optimizer

Compare six prompt search strategies by what they change, what feedback they use, and which controls determine the size of your search.

About

Suppose a support router explains what to do instead of returning RETURNS. If the problem is wording, you could try several rewrites. If the instructions are clear but exchanges still go to the wrong queue, better examples might help more. The six prompt optimizers below differ in what they change between trials. You can use them from a dataset or from Agent Learning Kit in Python.

When to use

  • Start with Meta-Prompt if there’s one starting instruction and your row scores and reasons can guide a rewrite. This is the search in the Python walkthrough.
  • Try Random Search if you want a quick comparison of wording variants without using one trial’s results to write the next.
  • Try Bayesian Search if the variable you want to change is which labeled examples the model sees, rather than the instruction itself.

What each search changes

OptimizerHow it proposes candidatesWhat controls the search
Random SearchA teacher proposes wording variations of the starting prompt. Each variation is scored independently.Number of variations.
Bayesian SearchOptuna tries combinations of few-shot examples with the starting instruction. Each trial gets a score for that combination.Minimum and maximum example count, and number of trials.
Meta-PromptA teacher sees the current prompt, examples, scores, and reasons. It proposes a new instruction for the next round.Number of rounds; in Python you can also set how many rows to score per round.
ProTeGiA teacher describes mistakes in words, then proposes edits based on those descriptions. The highest-scoring candidates form the beam, the prompts carried into the next round.Beam size, gradients, errors per gradient, prompts per gradient, and rounds.
PromptWizardGenerates mutations, scores them, then critiques and refines promising instructions.Mutation rounds, refinement iterations, and beam size.
GEPAA reflection model uses scored examples to propose new candidates. The generator model produces the answers being evaluated.Metric-call budget, rather than a fixed number of rewrite rounds.

Make the comparison useful

Keep the generator model, rows, and scoring rule the same when comparing algorithms. For Ridgeline, a run with twenty easy return tickets is not a fair comparison with a run containing delayed shipments and ambiguous exchanges. Judge both winning prompts on the same held-out tickets.

A round is not a unit of price: scoring four candidates on ten rows entails more generations than scoring one candidate on ten rows. A row-evaluation budget in the SDK also doesn’t count teacher calls. Set limits using the Python reference or the fields in the dataset drawer, depending on where you run the search.

Next steps

Was this page helpful?

Questions & Discussion