Index of every page on this site: llms.txt
All skills
omidzamani avatar

/dspy-optimizer-selection

@f5db3b7
by OMID Zamaniomidzamani/dspy-skills125 stars
13
Run it yourself

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

Use this Skill: https://skilld.dev/gh/omidzamani/dspy-skills/dspy-optimizer-selection

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈45 tokens for metadata: the name and description. ≈805 when used: this file.

Description uses 2.3% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈182 characters, or 2.3%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

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

Need Start with Notes
Include a few labeled examples dspy.LabeledFewShot Random labeled demos; useful as a baseline
About 10 examples dspy.BootstrapFewShot Teacher-generated demos with metric filtering
50+ examples and stronger demo search dspy.BootstrapFewShotWithRandomSearch Searches multiple demo sets; alias: dspy.BootstrapRS
Per-input nearest demos dspy.KNNFewShot Retrieves nearby examples before bootstrapping
Instruction-only hill climbing dspy.COPRO Coordinate ascent over instructions
Instruction and demo search dspy.MIPROv2 Bayesian search; install dspy[optuna]
Mini-batch introspective rules or demos dspy.SIMBA Uses output variability and self-reflection
Rich textual feedback and trace reflection dspy.GEPA Metric must accept five arguments
Distill prompts into model weights dspy.BootstrapFinetune Requires a fine-tunable LM and set_lm()
Combine candidate programs dspy.Ensemble Trades inference cost for robustness
Sequence prompt and weight optimization dspy.BetterTogether Meta-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

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts4mo3 checks · Risk SAFE
  • Gen Agent Trust Hub4mo

    The skill provides a selection guide for DSPy optimizers. It includes standard installation instructions for the well-known DSPy library from a reputable source.

  • Socket4mo

    No alerts

  • Snyk4mo

    Risk: LOW · No issues

Signed by skilld at f5db3b7. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Steadyupdated 5 months ago
What it can do
Reads files Edits files
version
1.0.0
dspy-compatibility
3.2.1
tags
[
  "optimizer"
]
All 4 allowed tools
ReadWriteGlobGrep
Other metadata
requires-extras
[]

README badge

README badge for omidzamani/dspy-skills/dspy-optimizer-selection