Two days ago I wrote about Meta's Prompt Duel Optimizer. The short version: PDO runs your prompts in head-to-head matchups. An LLM judge picks the winner. Winners get mutated into new challengers. Losers get pruned. No labeled data required.

The problem? Actually using it was a pain.

You had to piece together the README, dig through source code, and figure out the PDO-specific config flags yourself. The repo had a notebook path mentioned but not shipped. The Web of Lies example existed but lacked the walkthrough depth most people need to get started.

That changed this week. Meta shipped two things that make PDO genuinely accessible for the first time: an interactive tutorial notebook and an official cookbook on llama.com.

What Shipped

The Tutorial Notebook

PR #54 landed in the prompt-ops repo. It adds notebook/pdotutorial101.ipynb, a 1115-line Jupyter notebook (46.6 KB) that walks through PDO from theory to execution. It was authored by Justin Lee (@heyjustinai on GitHub) and merged into main.

The notebook covers five sections:

  • Introduction to PDO. The problem it solves. Why pairwise comparison beats pointwise scoring. How it stacks up against DSPy MIPRO and OPRO.
  • Architecture deep dive. The six core components: instruction pool, win matrix, Thompson sampler, LLM judge, multi-ranker system, and instruction evolution. This section goes deeper than the original paper's abstract. It explains Double Thompson Sampling in detail. It breaks down the two-stage selection process: first pick a prompt using Dirichlet-weighted fusion of multiple ranking algorithms, then pick its opponent by maximizing variance in win probability.
  • Creating a PDO project. Project structure, config essentials, dataset preparation. The practical "where do the files go" stuff that was missing before.
  • Running optimization. What happens during each round. How to read the output. Common parameter tuning.
  • Analyzing results. How to interpret optimized prompts. Performance metrics. Duel statistics.

The notebook includes visualizations. There is a point-vs-pairwise comparison diagram showing why head-to-head duels produce more reliable signals than absolute scoring. There is a Beta distribution visualization explaining how Thompson Sampling decides which prompts to match up. A prompt with 2 wins and 2 losses has a wide, flat distribution. PDO picks it as an opponent because that uncertainty means the duel carries maximum information. A prompt with 15 wins and 5 losses has a narrow distribution centered at 0.73. PDO already knows that one. No point wasting a duel on it unless it faces an uncertain challenger.

The notebook also has a Colab badge. You can open it directly in Google Colab from the llama-cookbook repo. No local install needed to follow along.

The Cookbook on llama.com

Meta published an official cookbook page at llama.com/resources/cookbook/getting-started-with-pdo/. This is the canonical getting-started guide on Meta's own documentation site.

The cookbook mirrors the notebook content but lives in a place people actually look for documentation. When someone searches "how to use PDO" and lands on llama.com, they find a structured walkthrough instead of a bare GitHub README.

This matters more than it sounds. The prompt-ops repo is at github.com/meta-llama/prompt-ops with about 800 stars. That is solid for an open-source tool, but most developers discover Meta's Llama ecosystem through llama.com first. Putting the PDO guide there connects the dots between "I use Llama models" and "I want to optimize my prompts for them."

The MS-MARCO Use Case

The PR also adds a new close-ended example: MS-MARCO passage ranking. This sits alongside the existing Web of Lies example (which covers open-ended reasoning).

The MS-MARCO use case includes:

  • 100 QA pairs from the MS-MARCO dataset
  • 20 optimization rounds with 25 duels per round
  • Its own evaluation notebook (MSMARCOPDOeval.ipynb)
  • A config tuned for close-ended answer generation

This matters because PDO handles open-ended and close-ended tasks differently. The LLM judge needs different evaluation criteria for "which response is more helpful" versus "which response matches the reference answer." The notebook and meta-prompt templates now support both. The Web of Lies example tests binary reasoning (yes/no). The MS-MARCO example tests concise factual answers. Together they cover the two main flavors of LLM tasks.

What Is New in the Architecture Detail

The tutorial notebook reveals something the original paper abstracts over: the multi-ranker fusion system.

PDO does not rely on a single ranking method. It runs four ranking algorithms in parallel:

  • Copeland: Counts how many opponents each prompt beats with probability above 0.5. Classic tournament ranking.
  • Borda: Points-based system where each prompt earns points based on its position in every pairwise comparison.
  • Elo: The chess rating system adapted for prompt matchups. Rewards wins against strong opponents more than wins against weak ones.
  • TrueSkill: Microsoft's Bayesian ranking system (built for Xbox matchmaking). Models skill as a Gaussian distribution, handling uncertainty naturally.

PDO fuses these four rankings using Dirichlet-weighted combination and applies softmax with a temperature parameter for final selection. This is why the algorithm is robust. No single ranking method is perfect. Copeland struggles with transitivity violations. Elo takes time to stabilize. TrueSkill needs more data. By combining all four, PDO smooths over individual weaknesses.

The notebook also clarifies the opponent selection strategy. After picking the first prompt, PDO selects the second by maximizing variance in the pairwise win probability. This is the "variance-driven exploration" the paper mentions. The notebook explains it with concrete numbers: a prompt with Beta(3,3) distribution (2 wins, 2 losses plus priors) has huge variance. Dueling it against a known strong prompt tells you whether that wide distribution hides a champion or a dud. Either way, you learn a lot. That is information-efficient exploration.

How to Actually Get Started Now

The onboarding path is straightforward. Three options depending on your style.

Option A: Google Colab

Open the notebook directly. No local setup.

  1. Go to the llama-cookbook repo on GitHub
  2. Navigate to getting-started/llama-tools/pdo_tutorial.ipynb
  3. Click the "Open in Colab" badge
  4. Add your API key in the first code cell
  5. Run through the sections

This is the fastest path. You get theory, code, and visualizations in a single runnable notebook.

Option B: Local Install with the Notebook

  1. Clone the repo: git clone https://github.com/meta-llama/prompt-ops.git
  2. Install from source: cd prompt-ops && pip install -e .
  3. Open the notebook: jupyter notebook notebook/pdotutorial101.ipynb
  4. Follow the five sections end to end

Option C: Use the Command-Line Tool with a Use Case

  1. Install prompt-ops (same as above)
  2. Pick a use case: cd use-cases/web-of-lies-pdo or cd use-cases/ms-marco-pdo
  3. Set your API key: echo "OPENROUTERAPIKEY=your_key" >> .env
  4. Run: prompt-ops optimize --config config.yaml

The Web of Lies example runs 30 rounds with 25 duels per round on 1000 logical reasoning problems. Budget about 15 minutes and a few dollars in API calls. The MS-MARCO example runs 20 rounds on 100 QA pairs. Faster and cheaper.

The Cookbook Page

For reference-oriented readers, the cookbook at llama.com/resources/cookbook/getting-started-with-pdo/ provides the same material in documentation form. Good for bookmarking and returning to specific sections.

Why This Matters

The original PDO release had a clear gap. The research was strong. The code worked. But the onboarding story was weak. You had to read the paper, study the source, and assemble your own mental model of how the pieces fit together. That filters out everyone who is not a researcher or a determined engineer.

The tutorial notebook and cookbook fix that gap. They give PDO three things it lacked:

  • A learning path. Theory, architecture, setup, execution, analysis. In order. With runnable code.
  • Multiple entry points. Colab for quick experimentation. Local notebook for deeper work. CLI for production runs. Documentation for reference.
  • Coverage of both task types. Open-ended reasoning (Web of Lies) and close-ended QA (MS-MARCO). Different judge criteria, different meta-prompts, different configs. Both now documented.

The multi-ranker fusion detail is also a real addition. The previous documentation mentioned Copeland scores and Thompson Sampling. The notebook explains the full four-ranker system and the Dirichlet-weighted fusion. That changes how you think about tuning. Temperature, ranking weights, and opponent selection variance are now visible knobs, not hidden implementation details.

Where Things Still Stand

The tool is at version 0.0.8 on PyPI (package name llama-prompt-ops). The repo recommends installing from source during the naming transition. Issue #60 about PDO strategy config auto-detection is still open. The TypeScript web frontend from PR #59 works but is young.

The new materials do not change the core tool. They change who can use it. That is the point. PDO was an impressive research artifact. Now it has a reasonable shot at being a practical tool.

If you read the earlier article and thought "sounds great but I don't know where to start," start with the Colab notebook. It takes 20 minutes. You will come out understanding not just what PDO does, but why the dueling bandit approach works and how each component contributes to the result.


Citations

Suggested title: Meta's PDO Finally Gets a Tutorial: What Changed and How to Start

Word count: 1,327

Fact-check notes:

  • Star count (~800) was accurate at time of research. Verify before publishing.
  • PyPI version (0.0.8) was current at research time. May have updated.
  • PR #54 author is @heyjustinai per GitHub. The notebook Colab link points to the llama-cookbook repo, not the prompt-ops repo. Verify the Colab link works.
  • The cookbook page at llama.com/resources/cookbook/getting-started-with-pdo/ exists but the llama.com site is a React SPA that blocks web scraping. The page title and URL were confirmed via search results. Content was not independently verified because the site does not render in fetch requests.
  • The multi-ranker fusion detail (Copeland, Borda, Elo, TrueSkill with Dirichlet-weighted fusion and softmax temperature) comes directly from the tutorial notebook source code. Verify these details match the published paper if the paper has been updated since the ACL 2026 camera-ready.
  • Issue #60 about PDO strategy config auto-detection was open at time of research.
  • The MS-MARCO use case config specifies 20 rounds, 25 duels per round, and 100 QA pairs. The Web of Lies config specifies 30 rounds, 25 duels per round, and 1000 problems. Both confirmed from the repo.
  • Runtime and cost estimates (15 minutes, a few dollars) are rough approximations. Actual cost depends on the model, provider, and pricing at time of use.