Imp is a port of DSPy to Elixir and the BEAM: you declare what a language-model call takes and returns, Imp writes the prompt and checks the reply, and an optimizer rewrites the program against examples of what good looks like. This site is one outside look at it — a series of runs across four models, every number reproducible from a committed rig, and everything that went wrong along the way.
GEPA teaches a model what it was never told
The task is Imp's own matched experiment (research/matched_instruction_optimizers_trec):
route a TREC question to one of two opaque codes, K11 or K47.
The program is never told what the codes mean. During optimization the metric's feedback on 20 training
questions names the meanings; 40 selection questions return a score and nothing else; 80 held-out
questions are scored at the end. A model that does not know the codes is at a coin flip, however strong
it is — so whatever it gains is what GEPA taught it. GEPA runs the program, reads the failed runs,
and has a second model (here DeepSeek V4 Pro) rewrite the instruction.
The same numbers as a table
A correction, and what it taught us. This page first reported DeepSeek V4 Flash going from
6.3% to 93.8%, and called most of the baseline misses format failures — replies with no
route field. That was wrong. Every call then had a 2,048-token reply budget, and the DeepSeek
models reason out of sight before they answer: on a question with no obvious answer the reasoning used the
whole budget and nothing was left for the reply. Re-run with 8,192 tokens (run imp-10), Flash's baseline
failures fell from 64 of 80 to 9 and its baseline rose to 46% — a coin flip, as it should be — and GEPA
took it to 95%. The chart now shows those runs for both DeepSeek models.
The honest reading is the same for every model: a baseline at chance, and GEPA teaching it what the codes
mean. Kimi K3 (50% → 94%) and DeepSeek Flash (46% → 95%) agree with the +40 Imp itself
reports for gpt-5.4-mini (Imp RESULTS.md, R3). DeepSeek Pro reached 80 of 80; its
baseline still lost 26 calls to time-outs and a crowded connection pool, so its starting point is
understated.
Claude Sonnet 5 (47.5% → 96.3%, run imp-14) ran with no API key at all. Imp's language-model
interface is one callback, so the rig gives it a model that shells out to the Claude Code CLI on the same
subscription credential the build-a-bot runs on (bakeoff/imp/lib/claude_code.ex, about a
hundred lines). Sonnet answered the questions and also wrote the reflections GEPA learned from.
What the optimizer wrote
The whole of what changed, per model: the instruction before, and the instruction GEPA selected. Nothing else in the program moved — no examples were added.
The same task, on a model that only decides
Jev (TypeSafe AI) generates no
text. It takes a JSON state and a typed question — here a choice between K11 and
K47 — and returns the pick with a confidence, in about 150 ms. Its whole program is two
strings: the question's instructions and each option's description. So the question worth asking is
whether the program GEPA wrote for an LLM transfers.
Jev's program after Optimize Anything
Tools: the part that already works
Imp.react/3 builds an agent from a signature and a list of tools. A tool is an ordinary Elixir
function with a JSON schema; Imp checks the model's arguments against the schema before the
function runs, and a failed check goes back to the model as an error it can correct:
Imp.tool(:refund_policy,
"Refund window (days) and percent refunded for a product category and customer tier.",
fn %{"category" => cat, "tier" => tier} ->
%{"window_days" => window(cat), "percent" => percent(cat, tier)}
end,
schema: %{"type" => "object",
"properties" => %{"category" => %{"type" => "string", "enum" => ~w(electronics apparel books furniture)},
"tier" => %{"type" => "string", "enum" => ~w(standard gold)}},
"required" => ["category", "tier"]})
agent =
"question -> answer: string, work: string"
|> Imp.signature(instructions)
|> Imp.react(tools, lm: lm, max_iters: 12)
We built two refund desks the agent can only see through such tools — customers, orders, a refund policy,
dates, currency — and asked questions with exactly one right answer, computed by a reference solver from
the same data the tools read. desk has six tools and 16 held-out questions;
desk_hard has seven and adds the traps a real policy has: the policy version follows the
order date, windows run from delivery, undelivered orders cancel for 100%, opened electronics pay a
restocking fee, some questions scan every customer, and five currencies including yen.
Every model answered every question once the rules were stated (see findings for the one that wasn't). That is a result in itself — tool use over a well-specified policy is solved for these models — and the reason the optimizer test above had to find a task with something to learn. Here is one agent turn, as recorded: DeepSeek V4 Flash, asked for a customer's total refund. Steps with two calls are parallel tool calls the model made in one step.
1. find_customer({"email":"ben@example.com"}) → tier standard, country GB
2. list_orders({"customer_id":"C2"}) → ["O-103","O-104"]
3. get_order(O-103) ‖ get_order(O-104) → $500 electronics · $30 books
4. days_since ×2 ‖ refund_policy ×2 → 26 d, 7 d · 30 d / 90% · 14 d / 100%
5. convert({"amount_usd":480,"to":"GBP"}) → 379.20
6. submit({"answer":"379.20 GBP", "work":"…"}) ✓ expected 379.20 GBP
Every turn of every run:
A long task: the build-a-bot's requests
On Bluesky, a mention to the build-a-bot becomes a small website at minomobi.com/<name>/,
built by an agent with file tools, no network and the lab's shared kit. Here an Imp ReAct agent gets eight of
minormobius's own requests — "odyssey trail where it's a terminal game you're sailing around the Aegean", a
Kansas City history, a Stirling-engine applet — the same constraints, and a check_site tool that
runs the factory's real smoke test (a headless browser under the production CSP) and content gate. A build
scores 0–1: the page exists (0.15), passes the gate (0.20), loads clean (0.35), and Jev judges that it does
what was asked (0.30). The sites stay private: model-written HTML is not published here.
What a long task costs, and why it needs repeats. A build is dozens of tool calls and minutes of wall clock, and the history is re-sent every step, so input tokens dominate. Two harness fixes between runs (a way to write long files in pieces; resuming a turn that stalled on a cut-off reply) moved DeepSeek Flash from 0.34 to 0.56 — while DeepSeek Pro, on the same fixes, went from 0.63 to 0.41. The same request can score 0 in one run and 0.97 in the next. One run of eight builds measures the harness as much as the model; an optimizer pointed at this task will need repeats, and a hard budget.
Jev earned its place as the judge. In an early run a bug scored real builders on a page the test model had left behind: the smoke test and the gate passed it, and only Jev's "does this do what was asked" (0.01) said it was the wrong page.
Findings
GEPA crashes on an improper list anywhere in a trajectory
Against real providers, GEPA died a minute in with FunctionClauseError in
Enum.find_value_list/3 — twice, with and without generous timeouts. After every batch, GEPA
walks all trajectories looking for an Imp.OperationalSafetyError.
find_operational_safety/1 (in gepa/engine.ex and gepa/program_adapter.ex)
recurses into anything is_list/1 accepts with Enum.find_value/2 — and
is_list/1 is true for an improper list, which Enum.find_value/2 cannot walk. Real
provider data carries one; a scripted model never does, which is why it passes offline.
It reproduces deterministically with no model at all — put an improper list in a metric's metadata:
metric = fn ex, pred -> base.(ex, pred) |> Map.put(:metadata, %{iodata: ["a" | "b"]}) end
Imp.optimize!(agent, Imp.Optimizer.GEPA.new(metric, reflection_lm: lm, max_metric_calls: 30), train, val)
#=> ** (Imp.Error) {:optimizer_failed, Imp.Optimizer.GEPA, %FunctionClauseError{module: Enum, function: :find_value_list, arity: 3}}
The fix is to walk cons cells, so an improper tail falls through to the catch-all clause:
- defp find_operational_safety(list) when is_list(list),
- do: Enum.find_value(list, &find_operational_safety/1)
+ defp find_operational_safety([head | tail]),
+ do: find_operational_safety(head) || find_operational_safety(tail)
+
+ defp find_operational_safety([]), do: nil
Every GEPA number on this site ran with that patch applied, and with the reproduction as a check that must pass
first. Both are in the rig (bakeoff/imp/patch_imp.exs, checks/gepa_improper_list.exs).
Worth knowing too: GEPA's default per-row and per-reflection time budgets are 30 seconds each, short for an
agent whose run makes a dozen tool calls; we used five minutes.
A rule the answer key used and nobody was told
On its first run, desk_hard scored a returned order against "returned orders are not eligible" —
a rule stated in desk's instructions and dropped from desk_hard's. Both models that
ran lost that point. The rule now sits in the refund_policy tool's description, and the run
that followed put all three models at 18/18. The lesson the bake-off already teaches: every rule the key
applies must be written down where the agent can read it.
Kimi K3 thinks, always
On the first run every Kimi call failed within seconds. Kimi K3 has thinking always on; sent
temperature: 0 and a 2,048-token budget, it answered nothing. Without a temperature and with
16k tokens it scored 20/20 on routing and 18/18 on the hard desk — at roughly six times DeepSeek Flash's
wall-clock time. Per-model options live in bakeoff/imp/models.json.
Runs
Each run is one commit of a sentinel file; one GitHub Actions runner per model; the evidence lands on a results branch and is imported here unedited.
How it's measured
- Where it runs.
.github/workflows/imp-bench.ymlin minormobius/agent01: one runner per model, OTP 28 and Elixir 1.19, Imp~> 0.5.0from Hex. Nothing deploys from a run. - Models. DeepSeek V4 Flash and V4 Pro at
api.deepseek.com, Kimi K3 atapi.moonshot.ai, all through their OpenAI-compatible endpoints — the same ids the repo's agent-harness bake-off uses. - Before any live call, every cell runs the whole rig against a scripted model and against a local fake OpenAI endpoint (Imp's real HTTP path, no key), and the GEPA patch's reproduction.
- Answer keys are computed, never typed: the tool tasks' reference solver reads the same data the tools do; TREC's rows come from Imp's repository at a pinned commit and are sha256-checked.
- Not in this repository: the TREC rows themselves. Imp records the corpus license as unknown, so they are fetched at run time, not republished. The three sample questions inside GEPA's rewritten instructions are the model's quotation.
- Limits. Single runs; 16–80 held-out questions each;
temperature: 0is requested, not guaranteed; token counts come from the providers and cover the tool tasks only.
Which year did I write this?
The tasks that moved were the ones with something private to learn. So the last one is as private as it gets: minormobius's own Bluesky posts — 51,120 of them, 2023 to 2026 — and a model is shown one post and asked which year it was written. Chance is 25%. The labels are the posts' own timestamps; nothing is hand-labelled. The only way to beat chance is to know how one person's topics, jokes, projects and phrasing drift — which is exactly what GEPA gets the chance to write down, from 32 posts whose years it is told.
Top-level posts only, at least 60 characters, no @-mentions, and none that state a year. 120 held-out posts, 30 per year, chosen by hash.
Where the guesses land
Rows are the year a post was written, columns the year guessed; darker is more posts. A good dater lights the diagonal.
The eras, as GEPA wrote them down
Some held-out posts, and what the best dater said
Next
More runs of the same tasks to put error bars on single-run numbers, and other models as the bake-off adds them.