liveBook · Manning

DSPy

DSPy is a Python framework for declaratively programming, composing, evaluating, and optimizing language-model applications and pipelines.

How 3 Manning books explain it

LLMs in Production

DSPy is a framework for programming and optimizing language-model prompts and pipelines through declarative modules and evaluation-driven optimization.

How it is used
Programs language-model workflows as evaluated, compilable systems for prompt optimization, retrieval, and tool augmentation.
How deep it goes
Defines signatures, predictors, modules, validation, compilation, and optimization, while deferring broader implementation details to documentation and notebooks.
Examples
Uses a local Llama3-8B-Instruct model, GSM8K math data, zero-shot prediction, and bootstrapped few-shot chain-of-thought optimization.
What you can do after
Builds, evaluates, compiles, and saves an optimized DSPy workflow for a local language model.

Read how LLMs in Production explains DSPy →

Building LLM Applications with DSPy

The programmatic interface for defining and executing DSPy language-model operations.

How it is used
Replaces repeated manual prompt rewriting with programmatic task definitions and evaluated prompt selection for language-model applications.
How deep it goes
Works through model configuration and a Predict call, then outlines baseline evaluation and iterative optimization without optimizing the introductory example.
Examples
Uses question answering with answer and confidence fields, a scored customer-service intent classifier, and a poem-rewriting signature.
What you can do after
Apply it via DSPy to define and run an LM operation, then evaluate a baseline before optimizing prompts when quality warrants it.

Read how Building LLM Applications with DSPy explains DSPy →

How Large Language Models Work

DSPy is a programming framework for composing language-model programs while separating model, vectorization, prompt, and task-logic definitions.

How it is used
Builds maintainable language-model applications by separating model, retrieval, prompting, and task logic.
How deep it goes
Demonstrates configuration and a simple RAG pipeline but stops short of a full DSPy tutorial.
Examples
Uses GPT-3.5, Wikipedia, ColBERTv2, three retrieved passages, and a generated answer in a minimal RAG program.
What you can do after
Build it from scratch by configuring replaceable model and retrieval components around a simple RAG task.

Read how How Large Language Models Work explains DSPy →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.