Skip to content
Last Dictionary

prompt optimization

nounAlso: automatic prompt optimization, automated prompt engineering, Automatic Prompt Engineer, APE, OPRO, GEPA

In plain wordsUsing software, often another AI model, to search automatically for the wording and examples that make an AI model perform best on a task, instead of tweaking prompts by hand.

  1. The automated search for instructions, prompt text and few-shotfew-shot learning, n.: Getting an AI system to handle a new task or recognize a new kind of thing from just a handful of examples, the way a person can learn a new word after hearing it once or twice. demonstrations that maximize a model's score on a task metric, treating the prompt as the parameters to optimize while the model's weightsweights, n.: The learned numbers inside a neural network that set how strongly each part influences the next. The finished set of weights is, in effect, the trained model itself. stay fixed. Methods differ in how they propose candidates: generating and scoring many instruction variants with a language model (Automatic Prompt Engineer, 2022); asking a model to propose improvements given the history of earlier prompts and their scores (OPRO, 2023); bootstrapping demonstrations from successful runs and searching over combinations of instructions and examples (the optimizers in DSPyDSPy, prop. n.: A free software framework in which programmers describe what each step of an AI pipeline should do, and the framework automatically works out good prompts and examples instead of hand-writing them., such as MIPRO); treating natural-language critiques as 'textual gradients' (TextGrad, 2024); and reflective evolutionary search guided by execution traces (GEPA, 2025). All need a development set and a reliable metric or grader, and without held-out evaluation they overfitoverfitting, n.: When a model learns its training examples too well — quirks and noise included — so it does great on data it has seen but poorly on anything new, like a student who memorizes answers without understanding. small datasets.

    Prompt optimization lifted extraction accuracy from 81 to 89 percent on the dev set, and most of the gain held on the test set.

Origin

Early automatic prompt search used gradients to choose discrete trigger tokens (AutoPrompt, Taylor Shin and colleagues, 2020). Using language models themselves as the optimizer began with Automatic Prompt Engineer (Yongchao Zhou and colleagues, 2022) and OPRO (Chengrun Yang and colleagues at Google DeepMindGoogle DeepMind, prop. n.: Google's main artificial intelligence laboratory, formed in 2023 by joining DeepMind and Google Brain. It builds the Gemini models and scientific AI systems such as AlphaFold., 2023), and DSPyDSPy, prop. n.: A free software framework in which programmers describe what each step of an AI pipeline should do, and the framework automatically works out good prompts and examples instead of hand-writing them. made it a routine engineering step.

Usage note

Also used loosely for improving prompts by hand. Optimized prompts can be unintuitive and model-specific, and usually need re-optimizing when the model changes. Distinct from prompt tuningprompt tuning, n.: Teaching a frozen language model a new task by learning a few made-up 'words' — lists of numbers rather than real text — that are placed before the input to steer the model., which learns continuous 'soft prompt' vectors by gradient descent.

Related

See also
  • DSPyDSPy, prop. n.: A free software framework in which programmers describe what each step of an AI pipeline should do, and the framework automatically works out good prompts and examples instead of hand-writing them.
  • prompt engineeringprompt engineering, n.: The skill of writing requests to an AI — picking the words, examples, format and background information it receives — so that it reliably gives the result you want, without retraining it.
  • prompt tuningprompt tuning, n.: Teaching a frozen language model a new task by learning a few made-up 'words' — lists of numbers rather than real text — that are placed before the input to steer the model.
  • few-shot learningfew-shot learning, n.: Getting an AI system to handle a new task or recognize a new kind of thing from just a handful of examples, the way a person can learn a new word after hearing it once or twice.
  • evals-driven developmentevals-driven development, n.: Building an AI product by first writing tests that show what good answers look like, then accepting changes to prompts, models or code only when the test scores improve.
  • prompt managementprompt management, n.: Treating the written instructions given to AI models like valuable code: storing them in one place, tracking every change, testing new versions and rolling back bad ones.
Contrast with
  • prompt tuningprompt tuning, n.: Teaching a frozen language model a new task by learning a few made-up 'words' — lists of numbers rather than real text — that are placed before the input to steer the model.

Sources

  1. Zhou, Y. et al. (2022). Large Language Models Are Human-Level Prompt Engineers. arXiv:2211.01910.
  2. Yang, C. et al. (2023). Large Language Models as Optimizers. arXiv:2309.03409. arxiv.org/abs/2309.03409

Mentioned in

prompt engineeringprompt engineering, n.: The skill of writing requests to an AI — picking the words, examples, format and background information it receives — so that it reliably gives the result you want, without retraining it., DSPyDSPy, prop. n.: A free software framework in which programmers describe what each step of an AI pipeline should do, and the framework automatically works out good prompts and examples instead of hand-writing them., evals-driven developmentevals-driven development, n.: Building an AI product by first writing tests that show what good answers look like, then accepting changes to prompts, models or code only when the test scores improve., prompt managementprompt management, n.: Treating the written instructions given to AI models like valuable code: storing them in one place, tracking every change, testing new versions and rolling back bad ones.