liveBook · Manning

Demonstration set

As explained in Building LLM Applications with DSPy

A demonstration set is a collection of task examples selected to accompany a language-model instruction.

A demonstration set is a collection of task examples paired with a language-model instruction. MIPROv2 builds candidate sets by repeatedly selecting examples from training data, including an empty set for zero-shot prompting. It then searches combinations of demonstration sets and candidate instructions, using Bayesian optimization to choose which combinations to test. section 6.2

Figure 6.2 The MIPROv2 algorithm step 3. In steps 1 and 2, we create the candidate sets of demos and candidate instructions. In step 3, we try various ways to combine them until we find the combination that performs best. Because there are often many combinations, this step uses a Bayesian optimization method to determine which combinations to try. In this example, we try set of demos #5 and instructions #3, creating a prompt that is tested on all or part of the validation set with the task LM. The score is recorded, allowing us to track which sets of demos work well, which instructions work well, and which work well together. This helps us determine which other combinations to test in subsequent iterations.
figure

See how candidate demonstration sets and instructions are combined, tested, and scored. section 6.2

How Building LLM Applications with DSPy covers it

How deep it goes
Describes repeated example selection, an empty set, and Bayesian optimization without detailing its internals.
Examples
Illustrates candidate pools of 40 sets with 25 examples each, plus an empty set for zero-shot prompting.
What you can do after
Understand how candidate demonstration sets are paired with instructions and evaluated during prompt optimization.
How it connects
Connects few-shot prompting, BootstrapFewShot, MIPROv2, and Bayesian optimization.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building LLM Applications with DSPy. The section links point to the parts of the book it draws on.