What is DSPy? Declarative Self-improving Language Programs
I have collected the best DSPy resources that will bootstart you.
DSPy stands for Declarative Self-improving Language Programs in Python. It provides a framework for algorithmically optimizing LM prompts and weights, particularly when LMs are employed multiple times in a pipeline.[1]
Introduction
To employ LMs to design a complicated system without DSPy, you typically must[1]:
- Break down the problem into steps.
Prompt your LM so that each process works well in isolation.
Adjust the steps to work effectively together.
Create synthetic examples to tweak each step,
Use these examples to fine-tune tiny LMs to save money. Currently, this is difficult and messy: whenever you alter your pipeline, LM, or data, all prompts (or finetuning processes) may need to change.
To make this more methodical and powerful, DSPy does two tasks. First, it separates your program’s flow (modules) from the parameters (LM prompts and weights) for each step. Second, DSPy includes new optimizers, which are LM-driven algorithms that can adjust the prompts and/or weights of your LM calls based…