dspy-ensemble

Installation
SKILL.md

Combine Programs with dspy.Ensemble

Guide the user through using DSPy's Ensemble optimizer to combine multiple optimized programs into a single ensemble that aggregates their outputs. This is useful when you've run several optimization passes (different optimizers, different hyperparameters, different random seeds) and want to combine them for more robust predictions.

What is Ensemble

dspy.Ensemble is an optimizer (teleprompter) that takes a list of DSPy programs and returns a single EnsembledProgram. When you call the ensembled program, it runs each constituent program on the same inputs and aggregates the results using a reduce function you provide.

Program A ──┐
Program B ──┼──> Run all ──> reduce_fn ──> Single output
Program C ──┘

Unlike other optimizers that tune prompts or weights, Ensemble doesn't change the programs themselves. It combines their outputs at inference time.

When to use Ensemble

  • You ran multiple optimization passes (e.g., several BootstrapFewShot runs with different seeds) and want to combine the best of each
Related skills

More from lebsral/dspy-programming-not-prompting-lms-skills

Installs
3
GitHub Stars
5
First Seen
Mar 17, 2026