github stanfordnlp/dspy 3.5.0

2 hours ago

DSPy 3.5: A Lighter, Faster Foundation

DSPy 3.5 brings a lighter LM layer, graduated core modules, and new History and image capabilities for RLM.

Upgrading from 3.4.1

This release changes prompts, defaults and APIs. Read the upgrade guide for breaking changes, migration steps and compatibility limits, and re-evaluate optimized programs.

Highlights

RLM, Flex and GEPA graduate

dspy.RLM, dspy.Flex and dspy.GEPA are no longer experimental.

ReActV2 now replaces ReAct

ReActV2 is now simply dspy.ReAct, with structured History and a typed submit tool; the old name is deprecated until 3.6.

Rich tool results

Tools can return images, files and other DSPy content parts on supported provider routes.

RLM History — authored by Matt Mannucci (@mannuch)

RLM can save and reload conversation History for later calls; it does not restore live interpreter variables.

A lighter LM foundation — lm15 work by Maxime Rivest (@MaximeRivest), integration by Isaac Miller (@isaacbmiller)

LiteLLM and OpenAI’s Python library are now optional: DSPy calls supported providers through the lightweight lm15 engine.

Measured default install 3.3.0 3.5 development snapshot
Installed package files, including bytecode 206.7 MiB 30.9 MiB
Dependencies, excluding DSPy 65 25
Fresh-process import, best of ten 1.01 s 0.49 s

Automatic API-family routing

model_type="auto" is the default, rather than explicitly selecting chat or responses.

XMLAdapter is now the default Adapter

XMLAdapter now formats and parses predictor calls by default, changing prompts and the output contract even when your Signature stays the same.

Native reasoning and explicit plans

Prefer native reasoning; request an explicit plan when planning before acting helps the task or it needs a human-auditable plan.

Disk caches: secure by default

Restricted loading is now the default, and plain NumPy arrays are stored without pickle.

Image-capable RLM

RLM can crop images with Pillow and send mixed text/image subqueries from its Python REPL.

With DSPy imported, an image-capable LM configured and the default Deno runtime available:

rlm = dspy.RLM("photo: dspy.Image, question: str -> answer: str")
result = rlm(photo=dspy.Image.from_path("photo.png"), question="What is written on the smallest sign?")
print(result.answer)

Prewarmed Interpreters

Real DSPy now runs inside RLM and Flex interpreters, with a precompiled standard library, cached startup snapshots and InterpreterPool for prewarming.

Measured path 3.4.1 3.5 development snapshot
Cached Deno startup + first execution 1.59 s 0.45 s
DummyLM Flex forward 1.61 s 0.63 s
Flex with a ready size-one pool — 0.10 s

Medians of nine fresh processes per path, with prepared runtime caches; pool readiness costs another 0.55 s, excluded from the pooled forward. First-use preparation can be slower.

Full PR List

All 99 PRs in the verified range appear once in the list below. Earlier intermediate bundled-lm15 and metadata updates are included for completeness; the cutoff contains bundled lm15 2.2.0 and metadata sourced from released LiteLLM 1.108.3.

Language Models, Adapters, and Reasoning

Agents, History, Tools, Images, and Interpreters

Optimization, Evaluation, Core APIs, and Caching

Documentation

Dependencies, Metadata, CI, Typing, and Release Engineering

Contributors

Thank you to @Aditya17-bot, @Blacksujit, @dbreunig, @divakantpandey, @emme1t, @fredheir, @isaacbmiller, @kausthubhk, @michaelisaac-dev, @SaiMouli3, @shaikn6, @shi-felix, @tomron, @Virtuoso461, @Zhuoxi2000, @Zsanz3, @mannuch and @MaximeRivest. Automation contributions: @dependabot and @github-actions.

Full Changelog: 3.4.1...471b3fb

Don't miss a new dspy release

NewReleases is sending notifications on new releases.