dspy-gepa
Installation
SKILL.md
Instruction Optimization with dspy.GEPA
Guide the user through using dspy.GEPA to automatically discover better instructions for their DSPy programs through reflective evolution.
Step 1 — Gather context
Before generating code, ask (skip questions already clear from context):
- Task type - Classification, generation, extraction, or multi-step pipeline? Multi-step pipelines can leverage per-predictor feedback via
pred_name, which significantly improves optimization quality. - Data size - How many labeled examples are available? GEPA needs 20-100 examples. Fewer examples favor
auto="light"; more favorauto="medium"or"heavy". - Failure mode - What does "wrong" output look like? GEPA's power comes from textual feedback — knowing the failure pattern lets you write a metric that explains errors to the reflection LM, not just scores them.
- Budget - Rough API cost tolerance?
auto="light"costs a few dollars;auto="heavy"can reach $20-50+ depending on validation set size and model choice. Thereflection_lmmodel has the biggest cost impact.
What is dspy.GEPA
Experimental:
dspy.GEPAis marked@experimentalas of DSPy v3.0.0. The API may change in future releases. Included inpip install dspyvia thegepa[dspy]package.
dspy.GEPA is a DSPy optimizer that evolves the instruction text in your program's predictors. Rather than adding few-shot examples (like BootstrapFewShot) or tuning model weights (like BootstrapFinetune), GEPA iteratively proposes, evaluates, and refines the natural-language instructions that guide each LM call.