Datasets:
Download code/README.md from ahkamboh/stepmold-bench: direct link, hf CLI and curl.
- Browser
- Download file 19.2 kB
-
https://huggingface.co/datasets/ahkamboh/stepmold-bench/resolve/main/code/README.md
- Command line
-
hf download hf://datasets/ahkamboh/stepmold-bench/code/README.md
-
curl -L -o README.md https://huggingface.co/datasets/ahkamboh/stepmold-bench/resolve/main/code/README.md
stepmold-bench
Runs every gold case in stepmold's example packs against one real model, twice: once through stepmold, and once through a plain pipeline that walks the same graph with the same prompts. It writes one JSONL record per model request and one per case-run. Those files are the raw data for the public Hugging Face dataset.
Standard library only, Python 3.9 or newer. It never downloads or runs a model. It talks to an OpenAI-compatible server (vLLM, llama.cpp-server, SGLang, a hosted API).
What it measures
stepmold says four mechanisms keep a small model reliable over many steps:
- The node's JSON schema is sent to the server as a decoding grammar.
- Every answer is checked before it is committed: it must parse, fit the schema, and pass
the node's optional
assert:. - A rejected answer is drawn again, up to the node's
retries(default 2). Each new draw gets a new seed, a higher temperature and a description of what was wrong, never the rejected answer itself. When the retries run out, the node'son_failedge is taken. - A gate node (
samples:,agree:) draws several answers and only commits when enough of them match.
The bench switches all four off in the plain arm and keeps everything else, so the difference between the arms is what the four are worth on that model.
The gold cases are the 86 in stepmold's examples/ (7 packs). A case passes when
stepmold.eval passes it: every expected field matches, and the run ends at the expected
end node when the case names one.
Two things to know about the gold before reading any number:
- The labels were written by one person, to make a scripted model pass. stepmold's own
docs/BENCHMARKS.mdfound two unrelated models agreeing with each other against the gold on 4 of 12 support_triage cases. A pass rate here is agreement with that gold. - refund_desk's case "approve burns its ladder -> nothing is issued" only passes when
approvefails three times in a row or its draws disagree. A capable model rarely does that, so expect this case to fail in every arm.
The arms
Both arms run stepmold's own walker (stepmold.graph.run) through stepmold's own scoring
(stepmold.eval.evaluate), one case at a time. Prompts are rendered by the same stepmold
code from the same templates, so for the same state the prompt text is identical, byte
for byte. Both keep two_stage think passes, which are prompt design, not checks.
The stepmold arm is stepmold eval exactly. The plain arm is the "unverified arm" of
stepmold's tests/production/test_longhorizon.py, pointed at a real model: a copy of the
pack with the checks taken out, run behind a small adapter.
| stepmold arm | plain arm | |
|---|---|---|
| Grammar in the request | the node's schema, sent the --grammar-mode way (default response_format) |
none. The backend runs in grammar mode none, and the request has no response_format or json_schema field |
| Reading the answer | stepmold.verify.extract_json: the whole reply, a code fence, then the last {...} |
the first JSON object in the reply. A { that does not start valid standard JSON is skipped |
| Schema check | yes | no |
A generate node's assert: |
checked before the commit | dropped |
| Retries | the node's retries (default 2) |
none |
Gate (samples, agree) |
as the pack says | one draw |
on_fail, on_unsure on a generate node |
taken when retries run out, draws disagree, or the prompt cannot be rendered | removed |
| An answer with no JSON object | rejected and drawn again | commits nothing; the walk goes on along whatever edge the state allows |
| A prompt that needs a field nobody wrote | on_fail |
the case ends as crashed |
Assert nodes, tool nodes, end nodes, edges, when: routing, max_steps |
as the pack says | the same |
In code: bench.plain_pack gives every generate node grammar: {"type": "object"}, no
assert:, retries: 0, no samples or agree, and no on_fail or on_unsure.
bench.PlainModel sits between stepmold and the server. It never forwards a grammar,
returns the think pass as it came, and turns each answer into its first JSON object (or
{} when there is none) before stepmold's verify sees it. That verify then only checks
"is an object", which always holds, so nothing is ever rejected or retried.
What the plain arm still gets from stepmold
Running the plain arm on stepmold's walker keeps the comparison paired. It also brings a few things a hand-written pipeline would not have:
- The walker refuses a commit that would overwrite a run input (
StateCollision). If a plain answer repeats an input key such asticket, the case ends as crashed, where a pipeline doingstate.update(answer)would overwrite it and carry on. - verify still refuses a value nested more than 64 levels deep, which crashes the case.
- A generate node with
output:(commit under one key) would get{}under that key for an answer with no JSON object, instead of nothing. None of the seven packs has one. - Assert nodes and tool nodes keep their
on_failedges. content_moderation'sgateand invoice_extract's four checks still divert bad state to their review paths in the plain arm. - Both arms get stepmold's decomposition: small nodes, each with its own fresh prompt. That is structure, and the longhorizon test keeps it in its naive arm too.
The format problem, and the plain_schema arm
None of the packs' answer prompts asks for JSON, and some never name the keys. support_triage's classify prompt ends "Answer with the category only." The grammar is what tells the model the shape. With identical prompts and no grammar, the plain arm's model is never told the format.
The first live run shows it. gpt-oss-120b answered classify with the right word in plain
text ("billing", "technical"). Nothing was committed, the next prompt could not be rendered
(MissingVariable: {category}), and both cases crashed after one call. Some servers also
show the schema to the model: on Cerebras the same rendered classify prompt cost 305 prompt
tokens with response_format and 168 without it.
So the plain arm mostly measures "the model was never told the format", and that will
hide what verification, retries and the gate add. The opt-in arm plain_schema separates
the two. It is the plain arm with the node's schema added to the end of each answer prompt,
in the exact words stepmold's own json_object grammar mode uses ("Reply with JSON matching
this schema:" and the schema). The text is built by stepmold's backend code. Nothing else
changes and no constraint is sent. Run it with --arms stepmold,plain,plain_schema.
First live check
2 November 2026, Cerebras gpt-oss-120b, response_format, reasoning reserve 600,
support_triage, first 2 gold cases, 1 run, stepmold at 38235ab:
| Arm | Case 1 | Case 2 | Calls per case | Tokens per case (prompt / completion / reasoning) |
|---|---|---|---|---|
| stepmold | passed, 7 of 7 fields | silently wrong, 4 of 7 | 5 | 1564 / 652 / 442 |
| plain | crashed after classify | crashed after classify | 1 | 164 / 40 / 28 |
| plain_schema | silently wrong, 6 of 7 | silently wrong, 4 of 7 | 5 | 1214 / 577 / 355 |
No retries in any arm. Median call latency was 618 ms over 22 calls. In case 2 both arms that finished called a crash on launch p0 and escalated it, where the gold says p1. That is the kind of label disagreement described above.
Running it
The bench imports stepmold from --stepmold PATH (default ~/Documents/GitHub/stepmold
when it exists), otherwise from the installed package. pip install does not ship
examples/, so with an installed copy pass --examples pointing at a clone of the same
commit. Each results file records the stepmold version and commit it ran.
vLLM on Kaggle
git clone https://gitlab.com/ahkamboh/stepmold /kaggle/working/stepmold
git -C /kaggle/working/stepmold checkout 38235ab
pip install /kaggle/working/stepmold # or: pip install git+https://gitlab.com/ahkamboh/stepmold@38235ab
vllm serve Qwen/Qwen2.5-7B-Instruct --port 8000 & # wait until http://localhost:8000/v1/models answers
python3 bench.py --stepmold /kaggle/working/stepmold \
--model 'openai:http://localhost:8000/v1#Qwen/Qwen2.5-7B-Instruct' \
--label qwen2.5-7b-instruct --concurrency 8
python3 summarize.py results/qwen2.5-7b-instruct.jsonl
vLLM needs no key, so leave STEPMOLD_API_KEY unset. For Qwen3, turn its thinking off
with --extra-body '{"chat_template_kwargs": {"enable_thinking": false}}'.
Cerebras
export STEPMOLD_API_KEY=... # the Cerebras key; the bench never prints or writes it
python3 bench.py --model 'openai:https://api.cerebras.ai/v1#gpt-oss-120b' \
--grammar-mode response_format --reasoning-reserve 600 \
--label gpt-oss-120b --concurrency 4
python3 summarize.py results/gpt-oss-120b.jsonl
gpt-oss-120b thinks before it answers, and its thinking counts against the same
max_tokens as the answer. Nodes budget 24 to 512 tokens for the answer alone, so without
headroom a node can spend its whole budget thinking and come back empty.
--reasoning-reserve 600 adds 600 to every request, the value stepmold's BENCHMARKS.md
used for this model. Lower --concurrency or raise --http-retries if the account is
rate limited; stepmold honours Retry-After up to 60 seconds.
Options
| Flag | Default | What it does |
|---|---|---|
--model |
required | a stepmold model spec, openai:<base_url>#<model>[#<grammar_mode>[#<reasoning_reserve>]], or fake:<script> for an offline run with each pack's scripted model |
--label |
the model name | the name results are filed under |
--grammar-mode |
response_format |
how the stepmold arm sends its grammar: response_format, json_schema (llama.cpp-server), json_object, none. The plain arms always use none |
--reasoning-reserve |
0 | tokens added to every request's max_tokens |
--arms |
stepmold,plain |
any of stepmold, plain, plain_schema |
--runs |
3 | runs per case |
--packs |
all |
or a comma list such as support_triage,refund_desk |
--limit |
none | only the first N gold cases of each pack |
--concurrency |
8 | case-runs in flight at once. Each case-run is sequential inside |
--extra-body |
none | a JSON object merged into every request (see below) |
--out |
results/<label>.jsonl |
the results file, appended to |
--tools |
refund_desk's own | PACK=FILE.py[:ATTR] host tools for a pack |
--timeout, --http-retries |
120 s, 2 | per HTTP request |
--record-prompts, --record-reasoning |
off | also store each prompt, and the server's reasoning text |
--dry-run |
off | print the plan and what is already done |
--extra-body goes through stepmold's own extra_body, which already refuses fields the
grammar mode writes. The bench changes two things. A temperature there becomes the
backend's base temperature instead of being merged last, because merged last it would also
overwrite the temperatures stepmold asks for when it draws again (0.5, 0.8, 1.0, and 0.5 for
gate draws). And it refuses seed (stepmold gives every new draw its own seed), max_tokens,
model, messages, n, stream, and any constraint field (response_format,
json_schema, vLLM's guided_*), which would constrain the plain arm too.
With --grammar-mode json_object the stepmold arm's prompt also carries the schema text,
so its prompts match plain_schema instead of plain.
refund_desk needs its host tools. The bench loads examples/refund_desk/tools.py:registry
for it, fresh for every case-run: the tool keeps an order store that refuses a second
refund of the same order, and a shared store would let one case-run change another.
Resuming
A case-run (one gold case, one arm, one run) is written in one go when it finishes: its
call records, then its case record. Run the same command again and every (label, arm,
pack, case, run) that already has a case record is skipped. The file is only ever
appended to. A case-run that was cut off has no case record, so it runs again, and
summarize.py ignores the call records it left behind.
A case-run that says nothing about the model gets an infra_error record and no case
record, so the next run retries it. That covers a server that could not be reached or kept
failing after its retries, and a bug in the bench itself. A crash inside one case-run never
stops the others.
The bench refuses to add results to a label whose earlier results used a different model,
grammar mode, extra body, reserve, temperature, stepmold commit, or changed pack files.
Adding packs, runs or cases later is fine. Use a new --label, or --allow-config-change.
Outcomes
Every case record has an outcome:
passed:stepmold.evalpasses it.escalated: it failed, but the run took anon_failoron_unsureedge on the way (any node, assert nodes included), so the workflow flagged it for a human.silently_wrong: the run reached an end node normally, took no escalation edge, and the answer does not match the gold.crashed: the run stopped before any end node.
python3 summarize.py results/*.jsonl writes summary.csv and summary.md. For every
model and arm, overall and per pack, it gives the pass rate with a Wilson 95% interval, the
outcome split, the mean share of expected fields matched, calls, retries and rejected calls
per case-run, tokens, the median call latency and the top reject reasons. The interval
treats every case-run as independent. Repeated runs of the same case are not, so the real
interval is wider.
How calls are recorded
The stepmold arm's model is stepmold's OpenAICompatModel with its two-line generate
wrapped, so the request on the wire is exactly the one stepmold builds. Which node and stage
a request served, its attempt and gate draw, and stepmold's verdict on it come from
stepmold's own log events (node.think, node.emit, node.retry, node.rejected,
node.sample, edge.on_fail and others). The bench turns them on at DEBUG and routes each
one to its case-run by thread. Nothing in stepmold is patched or modified.
Record format
Every line is a JSON object with a kind. All records except run carry invocation,
case_run_id, label, model, arm, pack, case (the gold case's name),
case_index (from 1) and run (from 1).
run, one per invocation: model, base_url, model_spec, arms, runs, packs,
limit, concurrency, grammar_mode, reasoning_reserve, temperature, extra_body,
timeout_s, http_retries, api_key_set (true or false, never the key), setup,
pack_digests, stepmold (version, commit, dirty, path, source), bench (version and a
hash of bench.py), python, platform, started.
call, one per model request:
| Field | Meaning |
|---|---|
seq |
order inside the case-run |
node, stage |
the node, and think or answer |
attempt |
1 for the first try, 2 and up for stepmold's new draws after a rejection |
draw |
the gate draw, 1 when the node has no gate |
corrected |
the prompt carried stepmold's description of the last rejection |
grammar_sent |
the request carried a constraint field |
max_tokens, temperature, seed |
as sent |
prompt_sha256, prompt_chars |
first 16 hex digits of the SHA-256 of the prompt as sent, and its length |
prompt_tokens, completion_tokens, reasoning_tokens, total_tokens, finish_reason |
as the server reported them, null when it did not |
latency_ms, http_attempts |
time for the request, HTTP retries included, and how many HTTP attempts it took |
output, output_chars |
the raw reply text, null when the reply had no content |
reasoning_chars |
length of the server's reasoning text, when it sends one |
parsed_ok |
an object was found (stepmold's parser in the stepmold arm, the first-object parser in the plain arms) |
schema_ok |
the object fits the node's schema. In the plain arms this is what stepmold would have said, and nothing acts on it |
assert_ok |
the node's assert: held. Stepmold arm only; null when the node has none |
accepted |
stepmold arm: verification passed. Plain arms: something was committed |
reject_kind, reject_reason |
empty, parse, schema or assert, and stepmold's own words, which never quote the model |
error |
the exception, when the request itself failed |
timestamp |
when the request started, UTC |
The check fields are null for think calls.
case, one per case-run:
| Field | Meaning |
|---|---|
outcome, passed |
see Outcomes; passed is stepmold.eval's verdict |
tier |
stepmold.eval's own split: auto, escalated (a node failed and was diverted) or failed |
end_node, expected_end, end_ok |
where the run ended, and where the gold says it should |
rescued_expected |
the gold case expects an on_fail rescue |
input, output, expected |
the gold input, what the run returned (null if it crashed), the gold fields |
fields_total, fields_matched |
expected fields, and how many came back right (0 if it crashed) |
mismatches |
stepmold.eval's list: field, expected, actual, and the node that wrote it |
blame_node, error |
the node stepmold.eval blames, and its error text |
escalated, escalations |
whether any on_fail or on_unsure edge was taken, and each one: node, node type, edge, target, reason |
path, steps |
the nodes visited, in order |
generations |
stepmold's own count of answer generations |
calls, think_calls, answer_calls, rejected_calls |
model requests, by kind, and answers not committed |
retries |
stepmold's new draws after a rejection |
extra_draws, gates |
gate draws past the first, and each gate's verdict |
prompt_tokens, completion_tokens, reasoning_tokens |
sums over the case-run's calls |
grammar_mode |
the stepmold arm's grammar mode, none for the plain arms |
wall_ms, timestamp |
time for the case-run, and when it finished |
infra_error: error, calls, wall_ms, timestamp. That case-run has no case record
and runs again next time.
Tests
python3 -m unittest
They run offline against a stepmold checkout (STEPMOLD_PATH, default
~/Documents/GitHub/stepmold). They cover all three arms over the 86 gold cases with each
pack's scripted fakes/script.json, the plain arm's parsing and walking rules on a copy of
support_triage, the requests on the wire through a fake HTTP opener, resuming, setup
refusals, and the summary maths.
A pack's scripted model is keyed by a phrase in each node's prompt and mostly hands out one
answer per case in evalset order, the way stepmold eval consumes it. So with fake: the
bench keeps one scripted model per (arm, pack, run) and runs those cases in order. With the
scripts, the stepmold arm passes 86 of 86 and the plain arm 85 of 86. The miss is
refund_desk's order R-1010, where the script answers "approved": "yes". stepmold's schema
refuses it three times and sends the refund to a human. The plain arm commits it and
finishes at done.