The Research Report
PromptWizard: The Prompt That Rewrites Itself
Microsoft Research's PromptWizard has 3,830 GitHub stars. That is 30x more than its closest academic competitor and 5x more than Meta's prompt-ops. The star count matters because it signals something real: prompt optimization is shifting from a manual craft to an automated loop, and PromptWizard is the framework people actually use to do it.
The core idea is simple. Instead of a human writing a prompt, testing it, and tweaking it, PromptWizard has the LLM mutate its own prompt, score the results, critique where it failed, and synthesize a better version. Then it does it again. And again. After 3 to 5 iterations, the prompt converges on something that works. The whole process takes 20 to 30 minutes and costs about $0.05 per task.
This is not a new idea. Automated prompt optimization has been around since APE (Automatic Prompt Engineer) in 2022. What PromptWizard adds is a feedback-driven mutation loop that co-optimizes instructions and examples together, then generates chain-of-thought reasoning for the selected examples. The joint optimization is the part that matters.
How it works
PromptWizard runs in two stages.
Stage 1: Iterative instruction refinement. You give it a task description, a base instruction, and an answer format. It generates multiple candidate instructions by prompting the LLM to mutate the initial instruction. Each candidate gets scored against training examples. The best one gets critiqued. The critique identifies which test cases the prompt handled well and which it failed on. Then a new instruction gets synthesized from the critique. This loop runs 3 to 5 times.
The mutation step is where PromptWizard diverges from earlier approaches. APE generates candidates from scratch. EvoPrompt uses a genetic algorithm crossover. PromptWizard asks the LLM to generate variations informed by "thinking styles," which are different problem-solving perspectives the model can adopt. This is more targeted than random mutation and cheaper than maintaining a full population.
Stage 2: Joint optimization of instructions and examples. The refined instruction from Stage 1 gets paired with a set of few-shot examples. Then the critique-and-synthesize loop runs again, but this time it modifies both the instruction and the examples in tandem. The critique identifies gaps in the current prompt by analyzing which examples the model gets wrong. The synthesis step generates new synthetic examples that target those gaps. It also refines the instruction to address the weaknesses.
This is where PromptWizard's task-awareness pays off. The synthetic examples are not random. They are generated specifically to challenge the current prompt's failure modes. If the prompt struggles with multi-step arithmetic problems that involve fractions, the next round of synthetic examples will include more fraction problems. The prompt and examples co-evolve.
Finally, PromptWizard generates chain-of-thought reasoning for each selected example. The LLM writes out step-by-step reasoning paths for the few-shot examples, which then get included in the final prompt. This is not "think step by step" bolted on as an afterthought. The CoT reasoning is generated after the examples are selected, so the reasoning chains align with the specific examples the prompt uses.
The numbers that matter
PromptWizard was evaluated on 45 tasks across the BigBench Instruction Induction dataset (BBII), GSM8k, SVAMP, AQUARAT, and others. It was published at ACL 2025 Findings.
The accuracy comparison against the three most prominent alternatives:
| Dataset | DSPy | PromptAgent | APO | PromptWizard |
|---|---|---|---|---|
| GSM8k | 78.2 | 68.8 | 25.7 | 90.0 |
| AQUARAT | 55.1 | 56.7 | 20.1 | 58.2 |
| SVAMP | 77.0 | 78.7 | 75.3 | 82.3 |
| ETHOS | 84.1 | 84.3 | 80.6 | 89.4 |
The cost comparison tells a sharper story:
| Dataset | DSPy API calls | PromptAgent API calls | APO API calls | PW API calls |
|---|---|---|---|---|
| GSM8k | 915 | 2,115 | 8,490 | 147 |
| AQUARAT | 920 | 2,200 | 8,500 | 112 |
| SVAMP | 2,300 | 2,111 | 8,000 | 178 |
| ETHOS | 660 | 2,217 | 8,200 | 80 |
PromptWizard uses 6x to 100x fewer API calls than the alternatives. On BBII, it used 69 API calls and 24k tokens total. Instinct used 1,730 calls and 115k tokens. PromptBreeder used 18,600 calls and 1,488k tokens. The efficiency gap is not marginal. It is structural. PromptWizard's critique-and-synthesize loop gets to a good prompt faster because each iteration is guided by failure analysis, not blind search.
APO's numbers are the worst across the board. This is because APO uses a gradient-based approach adapted from continuous optimization, which requires many more iterations to converge on discrete text. PromptAgent uses Monte Carlo tree search, which is thorough but expensive. DSPy uses a compiled approach with bootstrapped demonstrations, which works well for pipeline-style programs but is less efficient for pure prompt optimization. PromptWizard's feedback loop lands in a middle ground that happens to be the right one for this problem.
Resilience with few examples
Real teams do not always have 25 training examples for every task. PromptWizard was tested with as few as 5 examples. The accuracy drop was modest:
| Dataset | 5 examples | 25 examples |
|---|---|---|
| MMLU | 80.4 | 89.5 |
| GSM8k | 94.0 | 95.4 |
| Ethos | 86.4 | 89.4 |
| PubMedQA | 68.0 | 78.2 |
| MedQA | 80.4 | 82.9 |
| Average | 81.9 | 87.0 |
A 5.1-point average drop when you cut training data by 80%. The synthetic example generation absorbs most of the damage. When you only have 5 real examples, PromptWizard generates synthetic examples that target the same failure modes the real examples expose. The synthetic examples are not as good as real ones, but they are good enough to keep the prompt moving in the right direction.
This matters for practical adoption. Most teams that need prompt optimization do not have carefully curated training sets. They have a handful of examples and a vague task description. PromptWizard was designed for that reality.
Smaller models for optimization
PromptWizard also tested using Llama-70B for prompt generation instead of GPT-4. On GSM8k, Llama-70B generated prompts scored 94.6 versus GPT-4's 95.4. On Ethos, 89.2 versus 89.4. The difference is under 1% on average.
This is a practical finding. You can use a cheaper model to generate and refine prompts, then deploy those prompts on whatever model you want for inference. The optimization process does not require frontier models. The inference does, sometimes, but the optimization step can run on Llama-70B at a fraction of the cost.
The competition
PromptWizard is not the only prompt optimization framework. Three others are worth understanding because they take different approaches to the same problem.
automl/Promptolution (126 stars). Developed by the AutoML group at RWTH Aachen. Promptolution is a modular library that wraps multiple prompt optimization algorithms under a unified API. Its flagship optimizer is CAPO, Cost-Aware Prompt Optimization, which uses evolutionary algorithms with racing techniques to stop evaluating bad prompts early. Promptolution is designed for researchers who want to compare optimization methods under controlled conditions. It is clean, well-documented, and modular. But it has not cracked the adoption problem. 126 stars after months of availability suggests that modularity and correctness are not enough. People want a framework that works out of the box, not one that lets them benchmark five different optimizers.
meta-llama/prompt-ops (800 stars). Meta's prompt optimization tool is focused on a different problem: migrating prompts from one LLM to another. You give it a system prompt that works on GPT-4, along with a query-response dataset, and it produces a prompt optimized for Llama models. Its newest addition is PDO (Prompt Duel Optimizer), which uses dueling bandits and Thompson sampling for label-free optimization. Prompt-ops requires as few as 50 evaluation examples. The focus on model migration is smart. It targets a specific pain point that teams hit when they switch model providers. But prompt-ops optimizes the prompt alone. It does not co-optimize examples or generate chain-of-thought reasoning. It also ties you to Llama models. The optimization is model-specific, which is the point of the tool but also its limitation.
DSPy (separate from the comparison above). DSPy is not a prompt optimizer in the same sense. It is a programming framework where you define modules, specify signatures, and let DSPy compile the prompts for you. DSPy's prompt optimization is a side effect of its compilation pipeline. It works well when your system is a structured pipeline of LLM calls. It works less well when you just want a better prompt for a single task. DSPy and PromptWizard solve different problems. DSPy optimizes the program. PromptWizard optimizes the prompt.
The star count gap tells the story. PromptWizard at 3,830, prompt-ops at 800, Promptolution at 126. PromptWizard wins on adoption because it solves the common case directly. Give it a task description and a few examples. Get back an optimized prompt with reasoning chains. No pipeline to define. No model migration to target. No algorithm to select.
What the feedback loop actually does
The critique-and-synthesize mechanism is PromptWizard's core contribution. Most prompt optimization approaches generate candidates and select the best one. PromptWizard generates candidates, selects the best one, then asks the LLM to explain why the best one still fails on certain examples. That explanation becomes the input for the next round of synthesis.
This is a form of gradient descent in prompt space. The critique identifies the direction of improvement. The synthesis takes a step in that direction. The scoring function measures whether the step was productive. Over 3 to 5 iterations, the prompt converges.
The difference from pure evolutionary approaches like PromptBreeder is specificity. PromptBreeder maintains a population of prompts, mutates them randomly, and selects the fittest. This works but requires a large population and many generations to find good prompts. PromptWizard's feedback loop is more like hill climbing with a gradient. Each step is informed by the specific failures of the current best prompt. This is why it gets to good results in 69 API calls instead of 18,600.
The risk of any hill-climbing approach is local optima. If the initial prompt is in a bad region of prompt space, the critique-and-synthesize loop might converge on a locally optimal prompt that is still bad. PromptWizard mitigates this with the mutation step in Stage 1, which generates diverse candidates from the initial instruction. The thinking styles prompt the LLM to adopt different problem-solving perspectives, which seeds the search in different regions. But if all the initial candidates are bad, the feedback loop cannot rescue them. You still need a reasonable task description and base instruction to start.
Where it breaks down
PromptWizard has real limitations.
It optimizes single prompts, not prompt systems. If your application uses 5 prompts in a pipeline, PromptWizard can optimize each one individually but cannot optimize them jointly. It does not understand the interaction between prompts. This is the prompt architecture problem. PromptWizard is a prompt-level optimizer, not a system-level optimizer.
The chain-of-thought generation can bloat prompts. Each selected example gets a full reasoning chain. With 5 examples, you can end up with a prompt that is 2,000+ tokens of CoT alone. For tasks where latency matters or context windows are tight, this is a problem. The generate_reasoning flag can be turned off, but you lose the step-by-step reasoning quality.
It requires API access to an LLM for optimization. The mutation, scoring, critique, and synthesis steps all call the LLM. You cannot run PromptWizard offline or on a machine without API access. This is true of most prompt optimization frameworks, but it is still a constraint.
The evaluation function is task-specific. You need to write extractanswerfromoutput and extractfinal_answer functions for your specific task. Numeric tasks are easy. Open-ended generation tasks are harder. The framework supports LLM-as-a-judge evaluation for subjective tasks, but this adds cost and noise to the scoring step.
It does not handle multi-modal prompts. Text only. If your prompt includes images, structured data formats, or tool-use schemas, PromptWizard cannot optimize those components. It mutates the text instructions and the text examples.
The 3,830-star question
Why did PromptWizard get 30x more stars than Promptolution? Three reasons.
First, it comes from Microsoft Research. The brand matters for visibility. When Microsoft publishes a prompt optimization framework, people notice. When the AutoML group at RWTH Aachen publishes one, fewer people hear about it.
Second, it solves the common case well. Most people who need prompt optimization have a single task, a handful of examples, and a budget measured in dollars, not thousands of dollars. PromptWizard handles that directly. Promptolution is designed for researchers who want to run ablation studies across optimization algorithms. Different audience.
Third, it is cheap. The $0.05-per-task cost and 20-to-30-minute runtime make it accessible to individual developers. PromptBreeder's 18,600 API calls per task would cost hundreds of dollars. PromptAgent's MCTS search is even more expensive. PromptWizard's efficiency is not an incremental improvement. It changes the economics of prompt optimization from "maybe for production systems" to "cheap enough to try on a weekend project."
When to use it
Use PromptWizard when:
- You have a single task that needs a better prompt
- You have 5 to 25 training examples
- You want the prompt to include reasoning chains
- You care about cost and API call efficiency
- You need human-readable output (the synthesized prompts are natural language, not latent representations)
Do not use PromptWizard when:
- Your system has multiple interacting prompts (use DSPy or design a prompt architecture)
- You need to migrate prompts between models (use prompt-ops)
- You want to benchmark multiple optimization algorithms (use Promptolution)
- Your task requires multi-modal prompts
- You have zero training examples and cannot synthesize any (though PromptWizard's synthetic generation mode handles some of these cases)
The bigger picture
PromptWizard is evidence that prompt optimization is becoming infrastructure, not research. The paper was published at ACL 2025 Findings. The code is open source under MIT license. The framework is mature enough for production use. The cost is low enough for casual use.
The field is moving in two directions at once. One direction is prompt architecture: designing systems of prompts that work together, with routing, decomposition, and failure recovery. The other direction is prompt optimization: making individual prompts better through automated search and feedback. These are complementary. Architecture determines the structure. Optimization tunes the components.
PromptWizard handles the tuning. It does not tell you how many prompts your system needs or how to route between them. But given a well-scoped task and a reasonable starting point, it will find a prompt that works. For a lot of teams, that is the 80% solution. The remaining 20% is architecture, evaluation, and iteration. Prompt optimization is not the whole problem. But it is a problem that now has a practical answer.