This use case demonstrates using the PDO (Prompt Duel Optimizer) strategy to optimize prompts for the "Web of Lies" logical reasoning task.
The Web of Lies task tests logical reasoning abilities. Each example presents a chain of statements about people who either always tell the truth or always lie. The model must determine whether the final person in the chain tells the truth or lies.
Question: Sherrie tells the truth. Vernell says Sherrie tells the truth.
Alexis says Vernell lies. Michaela says Alexis tells the truth.
Elanor says Michaela tells the truth. Does Elanor tell the truth?
Answer: No
PDO (Prompt Duel Optimizer) is a dueling bandit optimization strategy that:
- Maintains a pool of prompt variations
- Runs "duels" between prompts to compare performance
- Uses Thompson sampling to intelligently select which prompts to test
- Evolves the prompt pool by generating new variations from top performers
- Uses the Copeland ranking method to determine the best prompts
-
Set your API key in a
.envfile in the project root:OPENROUTER_API_KEY=your_api_key_here
-
Run the optimization:
cd use-cases/web-of-lies-pdo prompt-ops optimize --config config.yaml
- Dataset: 1000 Web of Lies logical reasoning problems
- Answer Format: Binary ("Yes" or "No")
- Optimization Strategy: PDO with dueling bandits
- Models: Using Llama 3.3 70B via OpenRouter for both task execution and prompt generation
- Rounds: 30 optimization rounds
- Duels per Round: 25 (comparing prompt performance)
| Parameter | Value | Description |
|---|---|---|
total_rounds |
30 | Number of optimization iterations |
gen_new_prompt_round_frequency |
10 | Generate new prompts every 10 rounds |
num_duels_per_round |
25 | Prompt comparisons per round |
num_initial_instructions |
20 | Starting prompt pool size |
thompson_alpha |
1.2 | Confidence bound parameter |
ranking_method |
copeland | Method for ranking prompt performance |
web-of-lies-pdo/
├── config.yaml # PDO optimization configuration
├── prompts/
│ └── prompt.txt # Initial prompt template
├── data/
│ └── web_of_lies.json # 1000 logical reasoning examples
├── results/ # Optimization results (generated)
└── logs/ # Execution logs (generated)
The PDO optimization will:
- Start with a simple baseline prompt
- Generate variations through LLM-driven mutation
- Test prompts against each other in duels
- Identify which reasoning strategies work best
- Produce an optimized prompt that improves logical reasoning accuracy
- Reduce rounds for testing: Set
total_rounds: 5for quick experiments - Adjust concurrency: Increase
max_concurrent_threadsif you have higher rate limits - Monitor progress: Check the logs directory for detailed execution information
- Compare strategies: Try this same task with other optimization strategies (e.g., QPDO, MIPRO)