Skip to main content

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

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 the objective. For structured or deterministic tasks, pass a custom evaluator for sharper signal:

Output