agentsclimarketplace

Dspy optimizer selection

Skill OmidZamani/dspy-skills/skills/dspy-optimizer-selection

Collection of Claude Skills for DSPy framework - program language models, optimize prompts, and build RAG pipelines systematically

Install
npx -y skills add OmidZamani/dspy-skills --skill dspy-optimizer-selection

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

What its author says it does

Copied from the file, not written here

Use to choose or compare DSPy optimizers including LabeledFewShot, BootstrapFewShot, MIPROv2, SIMBA, GEPA, BootstrapFinetune, Ensemble, and BetterTogether.

SKILL.md

3.5 KB, as published. Nobody here has run it

DSPy Optimizer Selection

Goal

Choose the smallest DSPy optimizer that matches the data, budget, and artifact being tuned. Establish a baseline before compiling anything.

Selection Matrix

NeedStart withNotes
Include a few labeled examplesdspy.LabeledFewShotRandom labeled demos; useful as a baseline
About 10 examplesdspy.BootstrapFewShotTeacher-generated demos with metric filtering
50+ examples and stronger demo searchdspy.BootstrapFewShotWithRandomSearchSearches multiple demo sets; alias: dspy.BootstrapRS
Per-input nearest demosdspy.KNNFewShotRetrieves nearby examples before bootstrapping
Instruction-only hill climbingdspy.COPROCoordinate ascent over instructions
Instruction and demo searchdspy.MIPROv2Bayesian search; install dspy[optuna]
Mini-batch introspective rules or demosdspy.SIMBAUses output variability and self-reflection
Rich textual feedback and trace reflectiondspy.GEPAMetric must accept five arguments
Distill prompts into model weightsdspy.BootstrapFinetuneRequires a fine-tunable LM and set_lm()
Combine candidate programsdspy.EnsembleTrades inference cost for robustness
Sequence prompt and weight optimizationdspy.BetterTogetherMeta-optimizer for configurable optimizer chains

Workflow

  1. Split data into train and validation sets.
  2. Evaluate the uncompiled program with dspy-evaluation-suite.
  3. Start with the least expensive optimizer that matches the need.
  4. Save the compiled program and compare it against the baseline.
  5. Escalate only when the measured gain justifies extra LM calls, fine-tuning, or inference cost.

Common Paths

Fast Demo Optimization

Use dspy-bootstrap-fewshot for the first optimization pass. Move to BootstrapFewShotWithRandomSearch when enough examples are available to search multiple demo sets.

Prompt Search

Use dspy-miprov2-optimizer for instruction and demonstration search. Install its optional dependency first:

pip install -U "dspy[optuna]>=3.2.1,<3.3"

Reflective Optimization

Use dspy-gepa-reflective when failures can be described with actionable text. Use dspy-simba-optimizer for a smaller mini-batch introspective loop with numeric metrics.

Prompt Plus Weight Optimization

Use dspy-better-together when a fine-tunable LM is available and prompt optimization alone has plateaued.

Best Practices

  1. Keep a held-out validation set.
  2. Track optimization cost and inference cost separately.
  3. Use reproducible seeds where supported.
  4. Avoid claiming one optimizer is universally best; compare measured results.
  5. Save intermediate candidates for expensive runs.

Official Documentation

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.