← All notes

DSPy: Compiling Declarative Language Model Calls into Self-Improving Pipelines

Summary

DSPy: Compiling Declarative Language Model Calls into Self-Improving Pipelines (2023), by Omar Khattab, Arnav Singhvi, Paridhi Maheshwari, and coauthors, is at https://arxiv.org/abs/2310.03714. The authors describe DSPy as a programming model whose modules are parameterized and can learn how to combine prompting, finetuning, augmentation, and reasoning by creating and collecting demonstrations. A compiler then optimizes a pipeline for a given metric. In two case studies they report that short DSPy programs can express pipelines for math word problems, multi-hop retrieval, complex questions, and agent loops. Within minutes of compiling, they say a few lines of DSPy let GPT-3.5 and llama2 13b chat self-bootstrap pipelines that outperform standard few-shot prompting, generally by over 25% and 65% respectively, and that compiled programs on smaller open models can compete with expert prompt chains for proprietary GPT-3.5. The project is pointed to https://github.com/stanfordnlp/dspy. Title, authors, abstract, and comments were taken from the arXiv abs page. The version is v1 (5 Oct 2023), submitted 5 Oct 2023.

Claims

Pointer notes do not quote the paper. See Verification and Sources for the link and license.

Verification

When to apply

Use when you need the original DSPy paper on treating prompting, retrieval, and tool pipelines as compiled programs.

Facts

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Pointer by iinventedlight (AI-assisted). Paper license: arXiv non-exclusive distribution; this note links to it and does not reproduce it.

License: CC-BY-4.0 · Pointer note by iinventedlight (AI-assisted). Links to: Omar Khattab, Arnav Singhvi, Paridhi Maheshwari, Zhiyuan Zhang, Keshav Santhanam, et al. (13 authors), DSPy: Compiling Declarative Language Model Calls into Self-Improving Pipelines (arXiv). This note does not reproduce the paper.

Cite this

Permanent ID: iil:note:yczbpy6d

'iinventedlight (AI-assisted)'. 2026. "DSPy: Compiling Declarative Language Model Calls into Self-Improving Pipelines." iinventedlight Library, iil:note:yczbpy6d, version of 2026-11-11. https://iinventedlight.com/library/notes/2310-03714-dspy/. License: CC-BY-4.0.

@misc{iil_note_yczbpy6d,
  author = {{'iinventedlight (AI-assisted)'}},
  title = {{DSPy: Compiling Declarative Language Model Calls into Self-Improving Pipelines}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-11},
  url = {https://iinventedlight.com/library/notes/2310-03714-dspy/},
  note = {Permanent ID iil:note:yczbpy6d. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/2310-03714-dspy.md.