PythonHub: post #50910 — TG.ME

Introducing Flex: Let the Model Write the Code

DSPy’s new Flex module allows optimizers like GEPA to improve programs by rewriting both their instructions and underlying Python code. This lets the optimizer route easy cases to fast deterministic code while reserving model calls for ambiguity, significantly reducing cost and latency while improving accuracy.

https://www.cmpnd.ai/blog/let-the-model-write-the-code.html
www.cmpnd.ai
Introducing Flex: Let the Model Write the Code — cmpnd
Introducing Flex, a DSPy module that exposes its own source code to the optimizer. On a location conflation task, GEPA rewrote the program to be more accurate, 28% cheaper, and 40% faster than the baseline.
August 17, 2026 119 1