
Dueling Bandits (PDO’s Approach):
Benefits:
The diagram below shows Beta distributions representing our belief about each prompt’s win probability. This is the heart of how PDO decides which prompts to compare in duels:
The Three Scenarios:
PDO’s Smart Strategy:
The Key Insight: By choosing C as the opponent, PDO maximizes information gain. After this duel:
This is why PDO converges faster than naive approaches – it strategically explores high-uncertainty regions rather than randomly sampling prompts.
optimization.judge_requirementpythonoptimization:strategy: "pdo"task_type: open_endedjudge_requirement: |- Key points coverage (40%): Captures major decisions, actions, owners, dates.- Faithfulness (30%): No invented details or attributions.- Structure (15%): Logical, grouped bullets or sections.- Brevity & clarity (10%): Minimal fluff; readable.- Tie-Breaker (5%): Better prioritization of actionable items.
PDO will evolve this through competitive testing to discover:
Round 20: Adds role specification (‘knowledgeable researcher’)
Round 30: Converges on optimal prompt through competition
PDO achieves a higher average LLM judge score (4.64) than the Initial Prompt (4.48) on the MS MARCO Description, indicating a measurable improvement in answer quality.
pythonimport matplotlib.pyplot as pltplt.figure(figsize=(8, 4.5))bars = plt.bar(results.keys(), results.values(), color="#4e79a7", edgecolor="#2e4a62", linewidth=1.5, width=0.55)plt.title("LLM Judge Avg Score (1–5) on MS MARCO Description", fontsize=15, fontweight="bold", pad=14)plt.ylabel("Avg Score (1–5)", fontsize=13)plt.ylim(4, 5.1)plt.xticks(rotation=15, fontsize=11)plt.yticks(fontsize=11)plt.grid(axis='y', linestyle='--', alpha=0.25)for bar, v in zip(bars, results.values()):plt.text(bar.get_x() + bar.get_width() / 2, v + 0.10, f"{v:.2f}", ha="center", va="bottom", fontsize=12, fontweight="bold", color="#34495e")ax = plt.gca()ax.spines['top'].set_visible(False)ax.spines['right'].set_visible(False)plt.tight_layout()plt.show()
The paper demonstrates PDO’s effectiveness:
PDO represents an important advance in prompt optimization by bringing dueling bandit algorithms to LLM prompt engineering. Its competitive approach, combined with sophisticated exploration strategies and multi-ranker fusion, creates a powerful framework for discovering high-quality prompts through natural selection in a tournament setting.
The key insight is that asking “which is better?” is often more reliable than asking “how good is this?” – PDO leverages this principle throughout its design.
For more details, refer to the full paper and implementation documentation.
This tutorial covered the theoretical foundations and practical implementation of PDO based on dueling bandits and the research paper. For hands-on practice, try the web of lies tutorial or adapt PDO to your own classification or generation tasks.