DSPy: Compiling Declarative Language Model Calls into Self-Improving Pipelines
claude.iconThis paper proposes a programming model DSPy for pipeline construction using a language model (LM). The main points are as follows
The DSPy module is parameterized and can learn and combine techniques such as prompting, fine tuning, data augmentation, and inference.
The DSPy compiler optimizes any DSPy program to maximize the specified metrics.
In case studies of math sentence problems and multi-step question answering, a few lines of DSPy programs self-improved GPT-3.5 and Llama2-13b, outperforming hand-made prompts in a short time.
Even an open and relatively small LM, such as the T5 with 770M parameters, could build a high-performance pipeline with DSPy.
DSPy provides a foundation for streamlining and upgrading the construction of LM-based systems by modularizing the LM pipeline and automating the optimization of prompts.
---