cd /news/large-language-models/dspy-program-don-t-prompt-your-llms · home › topics › large-language-models › article
[ARTICLE · art-140610] src=dspy.ai ↗ pub= topic=large-language-models verified=true sentiment=↑ positive

DSPy – Program, don't prompt, your LLMs

DSPy 3.4.0 has been released with PythonInterpreter improvements, faster GEPA optimization, and MCP v2 compatibility, according to the Stanford NLP project's release notes. The Python framework, which has 38,000 GitHub stars, 461 contributors, and more than 5.2 million monthly downloads, lets developers define tasks as typed signatures and compile them against a metric; the release notes cite a GEPA example improving retrieval-augmented generation from 0.41 F1 to 0.63 F1.

read3 min views2 publishedSep 27, 2026
DSPy – Program, don't prompt, your LLMs
Image: source

DSPy 3.4.0 — PythonInterpreter improvements, faster GEPA, and MCP v2 compatibility ·

learn more → your LLMs.

DSPy is a Python framework for building AI systems. Express your tasks as structured signatures, not prompts, to produce maintainable, modular, and optimizable programs.

extract_events.py

12345 678910

 lm = dspy.LM("openai/gpt-5.4-nano")

 class ExtractEvent(dspy.Signature):

"""Extract event details from an email."""

  email: str = dspy.InputField()

  event_name: str = dspy.OutputField()

  date: str = dspy.OutputField()

 extract = dspy.Predict(ExtractEvent)

 extract(email=inbox_message)

output

Prediction(

event_name="Team Offsite",

date="Thursday, June 5"

) 5.2M+

monthly downloads

461+

contributors

38k

github stars

in production at

Compose programs with reusable primitives. #

Signatures

Declare your task.

Define your task as typed inputs and outputs instead of managing messy prompts. Portable, maintainable, and easy to iterate on.

class Triage(dspy.Signature): """Route a support ticket."""

  ticket: str = dspy.InputField()

  urgency: Literal["low", "high"] = dspy.OutputField()

  team: str = dspy.OutputField()

Modules

Same interface, different strategy.

Modules control how your signature executes. Reason, run ensembles, use tools, add a REPL, and more without rewriting your task.

 classify = dspy.Predict(Triage)


 classify = dspy.ChainOfThought(Triage)


 classify = dspy.ReAct(Triage, tools=[search])

Optimizers

Compile your program against a metric.

Give DSPy examples and a scoring function. It tunes your prompts automatically until quality converges.

tp = dspy.GEPA(

  metric=semantic_f1,

  auto="medium")

 opt = tp.compile(rag, trainset)



 opt.save("rag.v2.json")

Define a task. Grow it into a system. #

class Extract(dspy.Signature): """Extract contact info."""

  message: str = dspy.InputField()

  name: str = dspy.OutputField()

  email: Optional[str] = dspy.OutputField()

  intent: Literal[

"meeting", "intro", "follow-up"

  ] = dspy.OutputField()

 extract = dspy.Predict(Extract)

 extract(message="I'm Sarah"

  "(sarah@acme.co). Meet Thursday?")

outputstdout

Prediction(

name="Sarah",

email="sarah@acme.co",

intent="meeting"

 )

 def search(query: str) -> list[str]:

"""Search a knowledge base."""

  return kb.query(query, k=3)

 def calc(expr: str) -> float:

"""Evaluate a math expression."""

  return dspy.PythonInterpreter({}).execute(expr)

 agent = dspy.ReAct(

  "question -> answer",

  tools=[search, calc])

 agent(question="GDP per capita of France?")

outputstdout

 Prediction(answer="$46,029")

 class FactCheck(dspy.Module):

  def __init__(self):

  self.find = dspy.ChainOfThought(

  "article -> claims: list[str]")

  self.verify = dspy.ChainOfThought(

  "claim, source -> verdict")

  def forward(self, article):

  found = self.find(article=article)

  return [

  self.verify(claim=c, source=article)

  for c in found.claims]

outputstdout

 [Prediction(verdict="supported"),

  Prediction(verdict="unsupported"),

  Prediction(verdict="supported")]

 class AnalyzeChart(dspy.Signature):

"""Describe the trend and key data points in a chart."""

  chart: dspy.Image = dspy.InputField()

  title: str = dspy.OutputField()

  trend: str = dspy.OutputField()

  data_points: list[dict] = dspy.OutputField()

 analyze = dspy.Predict(AnalyzeChart)

 analyze(chart=dspy.Image("quarterly_revenue.png"))

outputstdout

Prediction(

title="Quarterly Revenue (2024)", trend="Steady growth, Q3 dip, strong Q4 recovery",

  data_points=[{"q": "Q1", "rev": "$4.2M"}, ...]

 )

 optimizer = dspy.GEPA(

  metric=accuracy, auto="medium")

 optimized = optimizer.compile(

  extract, trainset=labeled_emails)

 optimized.save("extract_v2.json")

outputstdout

Built in the open, since Dec 2022. #

DSPy started at Stanford NLP and grew into a research community. New optimizers and module types land here first — then show up in production systems at companies you’ve heard of.

Dec 2025

Recursive Language Models

Jul 2025

GEPA: Reflective Prompt Evolution

Jul 2024

BetterTogether: Fine-Tuning + Prompt Opt.

Jun 2024

MIPROv2: Optimizing Instructions & Demos

Feb 2024

STORM: Writing Wikipedia-like Articles Oct 2023

DSPy: Compiling Declarative LM Calls

Dec 2022

Demonstrate-Search-Predict

DSPy in production

Metadata extraction across all shops; ~550× cost reduction

Optimized Dash relevance judge for ranking and evaluation

Prompt migration from larger to smaller models on Amazon Nova

Multiple chatbot use cases on Databricks

Code repair pipeline using code LLMs to synthesize diffs

LM judges, RAG, classification, and customer solutions

Evolutionary self-improvement for the Hermes agent

See all companies using DSPy in production

── more in #large-language-models 4 stories · sorted by recency
── more on @dspy 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/dspy-program-don-t-p…] indexed:0 read:3min 2026-09-27 · —