Repository navigation
Byte-exact replay of DSPy LM traffic — re-running a program with the model server switched off #10365
xizhuomengcontin
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Verified against DSPy 3.3.1 today: LM traffic from a DSPy program can be recorded from outside the process and served back later, so the program runs again with no model server present.
Disclosure: I work on the tool (OrcaReplay, Apache-2.0, no paid tier).
The run
Nothing is installed into DSPy — no callback, no custom LM subclass. The origin is read from the environment, LiteLLM underneath does what it always does.
How this differs from
cache=TrueDSPy already caches, so the obvious question is why bother. Three differences that matter to me:
The last one is the reason I find it useful with optimizers: a compile run makes many LM calls, and being able to replay one for free while you change the surrounding code is worth the disk.
What I actually tested, precisely
A raw
lm(messages=[…])call, notdspy.Predict. The local model I used (a 0.8B) cannot follow DSPy's structured output format, soPredictfails at parsing — that would have been testing the model, not the capture. The request and response themselves are captured and replayed identically either way, but I would rather state the boundary than let you assume I ran a full program.Scope
egress=blockedon replay means model-provider egress. The rest of your program still runs for real — it is not a sandbox. And this sees the HTTP to the model, not DSPy's internals; it is not a substitute for MLflow-style tracing.Happy to be told there is a neater way to do this with DSPy's own machinery.
All reactions