ML//DSPy

DSPy is a Stanford NLP framework for programming language-model pipelines declaratively and optimizing their prompts or examples against data and metrics. The user defines signatures (the inputs and the outputs), composes modules, and optimizes them through few-shot examples or metrics.


DSPy is a Stanford NLP framework for programming language-model pipelines declaratively and optimizing their prompts or examples against data and metrics. The user defines signatures (the inputs and the outputs), composes modules, and optimizes them through few-shot examples or metrics.

The core move is separation of concerns: specify the inputs, outputs, modules and objective, then let a compiler search for an effective prompting strategy. Prompts stop being handwritten interface copy and become generated parameters: the manual string tuning of prompt engineering is replaced by compilation driven by evaluation. Judgment stays, moved into the training set, the metric, the module boundaries and the optimizer budget.