Prompt Optimizer
The Prompt Optimizer module closes the evaluation loop: once Fair Forge measures where your agent fails, these tools automatically find the system prompt that fixes those failures.How it fits into Fair Forge
Available Optimizers
GEPA
Iteratively reads failures and generates improved prompt candidates. Best when the prompt itself is clearly wrong.
MIPROv2
Optimizes instruction AND few-shot examples simultaneously using Bayesian search. Best when format and tone matter as much as content.
When to use each
| GEPA | MIPROv2 | |
|---|---|---|
| Optimizes | Prompt instruction | Instruction + few-shot examples |
| Search strategy | Iterative, reads failures | Bayesian (Optuna/TPE) |
| Best for | Clearly bad prompts | Format-sensitive tasks |
| Speed | Fast (few iterations) | Slower (20+ trials) |
| Examples needed | No | Yes — key differentiator |
Installation
Common Pattern
Both optimizers follow the same Fair Forge pattern:The
objective is the most important parameter. Describe what a good response looks like — the optimizer uses it to evaluate candidates and guide generation.Custom Evaluator
By default both optimizers use an LLM judge based on theobjective. For structured or deterministic tasks, pass a custom evaluator for sharper signal: