Optimization
Optimizers search over supported program parameters, including instructions and few-shot examples. You supply examples, a metric, and a budget; the optimizer returns the best candidate it found.
Optimization does not define quality for you. Build and inspect the metric first, preserve a held-out test set, and record the model and dataset used for each run.
Choose an Evaluation or Optimization Task
Evaluation
Build metrics and evaluation frameworks to measure and improve your modules systematically.
Score Reporting
Attach typed metric results to executions and, when configured, export them to Langfuse.
Benchmarking Raw Prompts
Compare an existing prompt with a DSPy module under the same models, examples, and measurements.
Choose an Optimizer
Revise instructions and examples immutably, measure a baseline, and choose an optimizer from the measured failure and feedback shape.
GEPA
Use reflective feedback to evolve supported program parameters after establishing an evaluation baseline.
MIPROv2
Use Bayesian search to select instructions and demonstrations for single- or multi-predictor programs.
Establish Evidence Before Optimizing
- Define and test an evaluation metric.
- Compare against a raw-prompt baseline when replacing an existing prompt.
- Read Choose an Optimizer, then select GEPA or MIPROv2 from the evidence each requires.