‹ 首页

dspy-optimizer-selection

@omidzamani · 收录于 1 周前

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

适合你,如果正在用DSPy框架开发语言模型应用,需要挑选合适的优化器。

/ 下载安装
dspy-optimizer-selection.skill双击,或拖进 Claude 桌面版 / Cowork,即完成安装↓ .skill↓ .zip
用别的 agent?下载 .zip 解压,把文件夹放进它的技能目录
Claude Code~/.claude/skills/(项目级 .claude/skills/)
Codex CLI~/.codex/skills/
Cursor自动读取上面两处目录
其他工具见其文档的「skills」目录;两个下载是同一份文件,只是名字不同
/ 通过 npx 安装 校验哈希
npx oh-my-skill add omidzamani/dspy-skills/dspy-optimizer-selection
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- omidzamani/dspy-skills/dspy-optimizer-selection
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify omidzamani/dspy-skills/dspy-optimizer-selection
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
113GitHub stars
~690最小装载
~690含声明引用
~787文本包总量
镜像托管

怎么用

技能原文 SKILL.md作者撰写 · MIT · f5db3b7

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](../dspy-evaluation-suite/SKILL.md).
  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](../dspy-bootstrap-fewshot/SKILL.md) for the first optimization pass. Move to BootstrapFewShotWithRandomSearch when enough examples are available to search multiple demo sets.

Prompt Search

Use [dspy-miprov2-optimizer](../dspy-miprov2-optimizer/SKILL.md) 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](../dspy-gepa-reflective/SKILL.md) when failures can be described with actionable text. Use [dspy-simba-optimizer](../dspy-simba-optimizer/SKILL.md) for a smaller mini-batch introspective loop with numeric metrics.

Prompt Plus Weight Optimization

Use [dspy-better-together](../dspy-better-together/SKILL.md) 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
  • Optimizer guide: https://dspy.ai/learn/optimization/optimizers/
  • Optimizer API index: https://dspy.ai/api/optimizers/
  • DSPy releases: https://github.com/stanfordnlp/dspy/releases
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。