Automatic Prompt Engineering (APE) and Optimization by PROmpting (OPRO) use the LLM itself to generate, evaluate, and optimize prompt variants.
By feeding a set of test cases and an evaluation metric to an optimizer model, the system iteratively refines the prompt template to maximize accuracy, outperforming human-written prompts on complex tasks.