# DSPy

> DSPy is a framework that treats language-model pipelines as programs of declarative modules, and compiles them by automatically optimizing the prompts and few-shot demonstrations for each module against a metric.

- Identifier: PTL-0075
- Category: Prompt Optimization
- Canonical URL: https://protologue.com/t/dspy/
- Also known as: Declarative Self-improving Python
- Introduced: 2023

## Description

Rather than hand-tuning prompt strings, developers specify input-output signatures and let optimizers bootstrap demonstrations or search instructions, making pipelines portable across models.

## Related terms

- [Automatic Prompt Engineer](https://protologue.com/t/automatic-prompt-engineer/)
- [Optimization by Prompting](https://protologue.com/t/opro/)
- [Prompt Template](https://protologue.com/t/prompt-template/)

## Sources

- Khattab et al. (2023). DSPy: Compiling Declarative Language Model Calls into Self-Improving Pipelines. https://arxiv.org/abs/2310.03714

## Cite this entry

Protologue. (2026). DSPy. In Protologue: A Taxonomy of Prompting and LLM Techniques (v1.0.0, PTL-0075). https://protologue.com/t/dspy/

License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
