Skip to content

Learning path · Programmatic Prompting · 29

DSPy

Framework treating LLM pipelines as optimizable programs—signatures, modules, and teleprompters search for better prompts and weights.

Why it matters

  • Moves prompt tuning from artisanal guessing toward measurable compilation.
  • Pairs naturally with RAG and agent module graphs.
  • Reported industry case studies show strong gains on structured tasks.

Key ideas

  • Programs not strings
  • Automatic prompt search
  • Composable modules

DSPy reframes prompts as parameters in a program you can optimize. Define signatures for inputs and outputs, compose retrieval or tool modules, then let teleprompters propose improved instructions or demonstrations against a metric. It shines when you have labeled or LLM-judge evals and repetitive pipeline structure. Start small—one signature, one metric—before compiling entire agent graphs. Invest in metric design before optimizer runs—a teleprompter will happily overfit a vague score that rewards verbosity over correctness. Ship only after eval gates pass on representative production failures.

Updated 2026-08-09 · Full learning path