DSPy
DSPy is a framework for programming language models rather than prompting them, by composing modular pipelines and automatically optimizing prompts and weights. Developed at Stanford, it replaces brittle prompt engineering with reproducible, testable programs that adapt across different models and tasks.
Overview
"DSPy" is a "Open Source" resource curated by AI Resource Hub, filed under the Frameworks category and suited to Advanced-level learners. It is provided by Stanford NLP, was last updated on 2026-06-26, and holds an editorial score of 4.6/5 from our team. Click "Visit Resource" on the right to open the original page.
Our Verdict
DSPy is the framework to reach for when prompt engineering stops scaling. Instead of fragile hand-tuned strings, you write composable modules and let optimizers compile them against your own eval set — prompting becomes testable, systematic engineering. The trade-off is real: the abstraction takes time to learn, and it demands labeled examples and measurable metrics. For a single stable prompt it is overkill; for multi-stage pipelines you care about improving, it is the most principled option in the ecosystem.
Tags
Key Features
- ▹Program LLMs instead of hand-writing prompts
- ▹Automatic prompt optimization
- ▹Composable, testable modules
Best For
- ▹Programmatic pipelines replacing fragile prompt engineering
- ▹Automatic optimisation of prompts and weights
- ▹Reproducible, testable language model programs
Not Ideal For
- ▪Quick prototypes without labelled examples
- ▪Simple single-call automations
Pros
- +Systematic, testable prompting
- +Optimizes prompts for you
- +Turns prompts into compiled, optimizable programs
Cons
- −Different mental model than manual prompting
- −Requires a solid eval set to optimize against
- −Abstraction takes time to learn
FAQ
Details
- Pricing
- Free and open source
- Author
- Stanford NLP
- Editorial score
- ★ 4.6 / 5
- Last updated
- Jun 26, 2026