-
Notifications
You must be signed in to change notification settings - Fork 0
DSPy
title: DSPy radar_quadrant: Languages & Frameworks radar_ring: Assess radar_position: inner created: 2026-05-26 last_updated: 2026-05-26 tags: [llm, prompt-optimization, python, stanford, rag, agents] source_url: https://github.com/stanfordnlp/dspy
A Stanford-developed Python framework for programming language models by defining typed input/output signatures rather than hand-crafting prompts. DSPy compiles those signatures into optimised prompts or fine-tuned weights automatically, treating LLM pipelines as differentiable programs rather than prompt templates. 23,000+ stars; used in production RAG and agent pipelines.
Conventional LLM development involves writing and tuning prompts manually, then retuning whenever the model, context, or requirements change. DSPy decouples the program structure (what you want the LLM to do) from the prompt implementation (how it is asked). A dspy.Predict or dspy.ChainOfThought module receives typed fields; the optimizer (e.g. BootstrapFewShot, MIPROv2) generates and selects prompts by running the pipeline against a small training set and scoring outputs.
Signatures define the contract: question: str -> answer: str. Modules are composed into pipelines. The optimizer searches the prompt space to maximise a metric over a dev set. Weight fine-tuning is supported when the task warrants it.
Teleprompters/optimizers are the core innovation: rather than the developer writing few-shot examples by hand, DSPy bootstraps them from demonstrations or searches over candidate prompts. This makes pipelines robust to model upgrades — rerun the optimizer rather than rewriting prompts.
Complements the RAG pipeline blips (RagChunkingStrategies, SearchBasedRAG, EnterpriseRAGLessons) as the composition and optimization layer. Contrasts with raw prompting assumed by Building Effective Agents and LLM System Patterns. Pairs with evaluation approaches from LLMEvaluationMethodology and AIEvalsFAQ — DSPy optimizers require a metric and a dev set, making evals a prerequisite.
Placed in Languages & Frameworks / Assess / inner. DSPy represents a genuine paradigm shift: most LLM pipeline blips on this radar assume manual prompting, and DSPy directly challenges that assumption. Inner position reflects broad applicability to any team building non-trivial LLM pipelines. Trial gate: one pipeline with at least two chained modules optimised via a DSPy optimizer, with measurable metric improvement over the hand-prompted baseline.