Release2026-08-06

cmpnd and a Carnegie Mellon intern added Flex to DSPy, a component that lets the GEPA optimizer rewrite a program's own source code as well as its prompt wording. On a place-matching task it raised accuracy while cutting cost and latency, largely by handling easy cases in plain Python and calling the model only for ambiguous ones. Model-written code runs in a sandbox rather than in the host process, and a separate test on a software-fixing benchmark is described as a pilot.

What changed

DSPy optimizers could only rewrite a program's instructions, not its code.

What it unlocks

Letting an optimizer restructure a program's own Python — adding helper functions and routing easy cases away from the model — scored against a chosen cost and accuracy metric.

  • 90.4% to 95.0% accuracy
  • $0.98 to $0.70 per 1k records
  • 75% fewer model calls
  • 4 of 12 SWE-bench Pro issues fixed

What you need to act on it

  • DSPy
  • an optimizer run with a strong reflection model
  • a labeled training set and metric

Send this to someone who needs it

Shares the story and its sources. Nothing about you.

What does this mean for your job?

This is the story as everyone gets it. Once a week we send you the version written for your role — what changed, why it matters for the work you actually do, and one thing to try. Free while we tune it.