The DSPy programming model plays a crucial role in LM optimization by providing a systematic approach to developing and optimizing LM pipelines1. It abstracts LM pipelines as text transformation graphs, allowing LMs to be invoked through declarative modules1. DSPy modules are parameterized, meaning they can learn how to apply compositions of prompting, finetuning, augmentation, and reasoning techniques1. This enables more effective and efficient optimization of multi-stage LM pipelines, maximizing a given metric.
Multi-stage LM programs face challenges primarily due to the absence of gold labels or evaluation metrics for individual LM calls, making it difficult to assess and optimize each stage independently. This hinders overall efficiency and effectiveness of LM programs. Existing optimization approaches often fall short in addressing the complexities of multi-stage LM programs, particularly when dealing with diverse LM architectures and an arbitrary number of modules.
MIPRO optimizes LM program prompts by factorizing the optimization problem into refining free-form instructions and few-shot demonstrations for each module in the LM program3. It employs innovative strategies such as program- and data-aware techniques for generating effective instructions, a stochastic mini-batch evaluation function for learning a surrogate model of the objective, and a meta-optimization procedure that improves the LM's proposal construction over time. This enables MIPRO to navigate the complexities of credit assignment across modules and craft task-grounded instructions.