The Research Report
Meta's Prompt Duel Optimizer: When Prompts Fight Each Other to Get Better
You have a prompt. It's okay. Not great. Not terrible. You tweak a word here, shuffle an instruction there. Maybe it gets a little better. Maybe it doesn't. You run another test. Different result. You change something else. Now it's worse.
This is prompt optimization for most people. Trial and error, run by hand, judged by vibes.
Meta released an open-source tool that does this differently. It's called prompt-ops, and its centerpiece is the Prompt Duel Optimizer (PDO). PDO runs your prompts in head-to-head matchups. An LLM judge picks the winner. The winner gets mutated into new challengers. The losers get pruned. Repeat until you converge on the best prompt, no labeled data required.
The paper behind it — "LLM Prompt Duel Optimizer: Efficient Label-Free Prompt Optimization" by Yuanchen Wu, Saurabh Verma, Justin Lee, Fangzhou Xiong, Poppy Zhang, Amel Awadelkarim, Xu Chen, Yubai Yuan, and Shawndra Hill — was accepted to Findings of ACL 2026. The code lives at github.com/meta-llama/prompt-ops with ~800 stars and an MIT license.
Here's what PDO does, why it matters, and how to use it.
The Problem PDO Solves
Most prompt optimization methods need labeled data. You give them a validation set with ground-truth answers, and they score candidate prompts by how well outputs match those answers. This works if you have clean labels sitting around.
Most people don't.
Getting labeled data is expensive and slow. In production settings, you often need a working prompt before you can collect the data that would validate it. It's a chicken-and-egg problem.
PDO drops the label requirement entirely. Instead of scoring each prompt against ground truth, it pairs prompts against each other and asks an LLM judge which output is better. This is pairwise preference feedback. No labels. No ground truth. Just relative judgments.
This matters because pairwise comparisons are more reliable than absolute scoring. An LLM judge asked "rate this output 1-5" produces noisy, poorly calibrated scores. The same judge asked "which of these two outputs is better?" gives a much more stable signal. Research from Liu et al. (2024) confirms this: pairwise preference beats pointwise scoring for calibration.
How PDO Works
PDO combines two mechanisms: Double Thompson Sampling and top-performer guided mutation.
Double Thompson Sampling
Thompson Sampling is a classic bandit algorithm. You maintain probability estimates for each arm, sample from those estimates, and pull the arm most likely to win. It balances exploration and exploitation without manual tuning.
Double Thompson Sampling (D-TS) extends this to dueling bandits. Instead of pulling one arm, you pick two arms to face off. Each round:
- Compute optimistic Copeland scores for every prompt. The Copeland score counts how many opponents a prompt beats with probability above 0.5. An optimistic score uses upper confidence bounds, so you favor prompts that might be good but haven't been tested enough yet.
- Select the first prompt by sampling from the candidates with the highest optimistic scores. Thompson draws from Beta posteriors on each pairwise matchup give you stochastic exploration.
- Select the second prompt from the remaining uncertain opponents. If the first prompt already clearly beats opponent j (lower confidence bound above 0.5), there's no point dueling them again. Focus on matchups where the outcome is still unclear.
- Run the duel. The LLM judge compares outputs from both prompts on the same input. Record the winner. Update the win counts and posterior distributions.
This gives you O(K² log T) expected Copeland regret, meaning the average regret vanishes as the comparison budget grows. In plain terms: the more duels you run, the closer you get to the true best prompt, and the algorithm concentrates comparisons on informative matchups rather than wasting budget on obvious outcomes.
Top-Performer Guided Mutation
D-TS finds the best prompt in a fixed pool. But the prompt space is combinatorially large. You need to discover new candidates, not just rank old ones.
Every M rounds, PDO mutates the current top-performing prompt. The mutation can take several forms:
- Template edits: Structured changes to prompt wording, like swapping "analyze" for "evaluate" or reordering instruction blocks.
- Text-gradient guided changes: Using LLM feedback on what's wrong with the current prompt to generate targeted fixes. Think of it as gradient descent, but the gradient is natural language feedback.
- LLM-assisted rewrites: Asking the LLM to rewrite the prompt with specific improvements in mind.
The mutated prompt joins the pool. Weak prompts get pruned. The pool stays lean and competitive.
This is inspired by evolutionary prompt optimization (like Evoprompt from Fernando et al., 2023), but PDO steers mutations toward the neighborhood of the current best rather than exploring randomly. The intuition: small edits near a good prompt are more likely to yield improvements than wild jumps into untested territory.
Why Both Together
D-TS handles selection efficiently. Top-performer mutation handles discovery efficiently. Together, they form a two-level loop:
- Selection level: D-TS identifies the best prompt among current candidates with minimal comparisons.
- Discovery level: Mutation generates new candidates in promising regions of the search space.
You can think of it as a zooming algorithm. The selection step narrows in on the current winner. The mutation step explores nearby, finding slightly better variants. Over time, the algorithm converges on a strong local optimum.
What the Benchmarks Show
The paper evaluates PDO on two benchmarks: BIG-bench Hard (BBH) and MS MARCO.
BBH tests multi-step reasoning across 27 challenging tasks. MS MARCO tests passage ranking for search and retrieval. Both are standard benchmarks for prompt optimization research.
Key findings:
- PDO consistently outperforms label-free baselines on both benchmarks under fixed judge budgets. Baselines include random search, single-prompt evaluation, and exhaustive pairwise comparison with random selection.
- Quality-cost trade-offs are favorable. PDO achieves competitive results with fewer total comparisons than exhaustive evaluation. This matters because each comparison requires an LLM API call, and those calls cost money.
- Results hold across judge families. The researchers tested with different LLM judges (Llama 3.1 8B, Llama 3.1 70B) and found that PDO's improvements persist regardless of which model serves as judge. This addresses the natural concern that an LLM judging LLM outputs might be circular or self-serving.
- Cross-family re-evaluation confirms robustness. Prompts selected by PDO when judged by one model family still outperform baselines when re-evaluated by a different model family. The optimization isn't gaming the judge. It's finding genuinely better prompts.
The paper also includes runtime and budget analysis. PDO's sample efficiency means you can get good results in minutes on a single GPU, not hours on a cluster.
The prompt-ops Tool
The GitHub repo at github.com/meta-llama/prompt-ops packages PDO into a practical Python tool. Here's what you need to know.
Installation
# Create environment
conda create -n prompt-ops python=3.10
conda activate prompt-ops
# Install from source (recommended)
git clone https://github.com/meta-llama/prompt-ops.git
cd prompt-ops
pip install -e .
# Alternative: PyPI (may have naming transition issues, v0.0.8)
# pip install llama-prompt-ops
The PyPI package is llama-prompt-ops, currently at version 0.0.8. The repo recommends installing from source to avoid naming conflicts during the transition period.
Quick Start
# Create a project scaffold
prompt-ops create my-project
cd my-project
# Add your API key
echo "OPENROUTER_API_KEY=your_key_here" >> .env
# Run optimization (~5 minutes)
prompt-ops migrate
You need three things:
- An existing system prompt. This is your starting point. The one you're already using, or a draft you want to improve.
- A query-response dataset. A JSON file with query-response pairs. As few as 50 examples. This is for evaluation, not training. No labels required for PDO.
- A YAML config file. Specifies the model, dataset, and optimization settings.
What You Get
After running prompt-ops migrate, you get:
- An optimized prompt tailored to your target LLM
- Performance metrics comparing the original and optimized versions
- A results directory with full logs
The tool uses LiteLLM as a unified API client, so it works with any supported provider. OpenRouter, vLLM, NVIDIA NIMs, local models. Your choice.
The PDO-Specific Workflow
For PDO specifically, the repo includes:
- A dedicated tutorial notebook (
notebook/pdotutorial101.ipynb) - Use cases including "Web of Lies" (logical reasoning) and MS MARCO (passage ranking)
- Configuration options for judge model selection, comparison budget, and mutation strategy
The PDO workflow differs from the base migrate command. You configure the optimizer to use PDO strategy, set your judge model, and specify the comparison budget. The tool handles the rest: initializing the prompt pool, running duels, mutating winners, and returning the final optimized prompt.
Web Frontend
The repo includes a web frontend (merged in PR #59, October 2025) for visual prompt comparison. You can see duels happening in real time, compare outputs side by side, and inspect which prompts won which matchups. This is a practical improvement over command-line-only tools.
Why This Matters
No Labels Needed
This is the headline feature. Every other prompt optimization tool requires labeled validation data. DSPy needs examples with ground-truth outputs. APE (Automatic Prompt Engineer) needs reference answers. TextGrad needs a loss function based on correct labels.
PDO needs none of that. You provide unlabeled inputs, and the LLM judge handles evaluation through pairwise comparison. This opens prompt optimization to scenarios where labeled data is unavailable, expensive, or impractical to collect.
It Comes from Meta
This isn't a weekend side project. Meta employs the research team. The code ships under the meta-llama organization alongside Llama models. There's an official Llama cookbook tutorial. The paper was accepted to ACL 2026 Findings.
The signal: Meta is investing in systematic prompt optimization as infrastructure, not just research. When one of the biggest AI companies open-sources a tool for prompt optimization, it legitimizes the practice for production teams.
It Connects to a Broader Trend
PDO fits into the larger movement from ad-hoc prompt crafting to engineering-grade optimization:
- DSPy brought declarative, programmatic prompt optimization with gradient-free methods.
- Microsoft PromptKit treats prompts as version-controlled, composable artifacts.
- promptqc applies static analysis and linting to system prompts.
- PDO adds competitive, label-free optimization to the stack.
These tools are complementary. You lint with promptqc. You compose with PromptKit. You optimize with PDO. Each addresses a different failure mode in the prompt lifecycle.
Practical Considerations
Judge Choice Matters
PDO requires choosing an LLM judge. The paper shows results are consistent across judge families, but judge quality still affects optimization. A weak judge produces noisy preferences, which slows convergence. Use the strongest judge you can afford for the evaluation step, even if the target model is smaller.
Budget Constraints Are Real
Each duel costs an API call. PDO's sample efficiency means you need fewer calls than exhaustive comparison, but you still need a budget. The paper shows good results with moderate budgets (hundreds of comparisons). Plan your budget before running optimization.
The Mutation Strategy Affects Results
PDO's mutation step can use template edits, text-gradient feedback, or LLM-assisted rewrites. The choice affects the search trajectory. Template edits are conservative and safe. LLM-assisted rewrites explore more broadly. For production use, start with template edits and escalate to LLM-assisted mutations if you hit a plateau.
Current Limitations
The tool is at version 0.0.8. There's an open bug report about the PDO strategy config being ignored in favor of auto-detection (issue #60). The TypeScript frontend is new. The PyPI package naming is still in transition. These are early-stage rough edges, not deal-breakers, but worth knowing about.
Getting Started
If you want to try PDO today:
- Clone the repo:
git clone https://github.com/meta-llama/prompt-ops.git - Install from source:
pip install -e . - Prepare your dataset: a JSON file with query-response pairs (50+ examples)
- Write a YAML config pointing to your dataset and model
- Run:
prompt-ops migrate --config your_config.yaml
For the PDO-specific workflow, check the tutorial notebook at notebook/pdotutorial101.ipynb and the Web of Lies use case in use-cases/web-of-lies-pdo/.
The official Llama cookbook tutorial at llama.com/resources/cookbook/getting-started-with-pdo/ walks through the full setup.
The Bottom Line
Meta's Prompt Duel Optimizer turns prompt optimization from a manual guessing game into a structured, measurable process. You don't need labeled data. You don't need to hand-evaluate every candidate. You set up a pool of prompts, let them fight, and converge on the winner through principled Bayesian sampling.
The research is solid. The tool is usable. The timing aligns with a broader shift toward engineering-grade prompt management. PDO is not the only tool you'll need for prompt work, but it fills a specific gap: systematic, label-free optimization that scales without human annotation overhead.
If you're still optimizing prompts by hand, this is worth a look.
Citations
- Wu, Y., Verma, S., Lee, J., Xiong, F., Zhang, P., Awadelkarim, A., Chen, X., Yuan, Y., & Hill, S. (2025). LLM Prompt Duel Optimizer: Efficient Label-Free Prompt Optimization. arXiv:2510.13907. Accepted to Findings of ACL 2026. https://arxiv.org/abs/2510.13907
- Meta Llama. (2025). prompt-ops: An open-source tool for LLM prompt optimization. GitHub. https://github.com/meta-llama/prompt-ops
- Llama Cookbook: Getting Started with PDO. https://www.llama.com/resources/cookbook/getting-started-with-pdo/
- Wu, H. & Liu, Y. (2016). Double Thompson Sampling for Dueling Bandits. NeurIPS.
- Fernando, C., et al. (2023). PromptBreeder: Self-Referential Self-Improvement via Prompt Evolution. arXiv.
- Liu, Y., et al. (2024). LLM-as-a-Judge: Quality and Biases. ICML Workshop on Trustworthy Foundation Models.
- PyPI: llama-prompt-ops v0.0.8. https://pypi.org/project/llama-prompt-ops/
Suggested title: Meta's Prompt Duel Optimizer: No Labels, No Problem
Word count: 1,849
Fact-check notes:
- Star count (~800) was accurate at time of research but may change. Verify before publishing.
- PyPI version (0.0.8) was current at time of research. May have been updated.
- Issue #60 about PDO strategy config auto-detection was open at time of research.
- The paper was accepted to Findings of ACL 2026. The camera-ready version is dated April 9, 2026 on arXiv (v3).
- The claim about O(K² log T) regret comes directly from the paper's Theorem section citing Wu & Liu (2016).
- Cross-family re-evaluation robustness is stated in the paper abstract and contributions. Specific quantitative results should be verified in the full paper tables before publishing.
- The web frontend PR (#59) was merged October 28, 2025 per GitHub commit history.