Download docs/grading.md from pooria/benchmark-schema-mutation: direct link, hf CLI and curl.
- Browser
- Download file 5.93 kB
-
https://huggingface.co/datasets/pooria/benchmark-schema-mutation/resolve/main/docs/grading.md
- Command line
-
hf download hf://datasets/pooria/benchmark-schema-mutation/docs/grading.md
-
curl -L -o grading.md https://huggingface.co/datasets/pooria/benchmark-schema-mutation/resolve/main/docs/grading.md
Grading design and failure modes
Written before the grader, per the fleet rule: state the ways it can fail first.
Each task asks for one JSON tool call: {"name": "<tool>", "arguments": {...}}.
The grader extracts that object from the raw answer, unwraps common wire
formats, normalises it, canonicalises it (object keys sorted recursively;
arrays keep order), and compares the result to the expected string stored
on the task after the same normalisation. A canonical match against
metadata.stale (the call that was correct under the pre-migration schema)
scores 0 and is flagged staleSchemaUsed in the reason and details.
Normalisation applies two equivalences on string values: parts of
comma-separated lists are trimmed ("web, hero" == "web,hero"), and
ISO-8601 durations are compared by length ("PT0H45M" == "PT45M").
Unwrapping accepts the OpenAI tool-call wire format: an answer may be
{"tool_calls": [{"name": ..., "arguments": ...}]} or nest each call under
function, and arguments may be a JSON-encoded string. The last usable
call in a tool_calls array wins, matching the last-object-wins rule below.
Ways the grader can fail
- Answer echoes the schema or another object. A model may paste back the
{"tools": [...]}block or wrap the call in prose. Mitigation: the extractor scans every top-level balanced{...}span, parses each, keeps the last object that carries anamekey, and requiresargumentsto be an object when present. Residual risk: a model that prints two calls is graded on the last one — documented, not special-cased. - Markdown fences or prose around the JSON. Mitigation: the extractor
never requires the whole answer to be JSON; it works on balanced spans, so
- Envelope drift.
{"tool": "...", "args": {...}}, a bare arguments object, or a bare array of calls must not pass. Onlyname(string) plusarguments(object or JSON-encoded object string, default{}) are read;tool_callsarrays andfunctionwrappers are unwrapped because OpenAI-compatible adapters emit them, while other envelope keys are ignored rather than rejected. This keeps the contract "did you call the right tool with the right arguments" instead of "did you match our wire format". An answer with no usablenamescores 0. - Number representation and value forms.
4550vs4550.0vs"4550".JSON.parsealready folds the first two to the same double; canonicalisation re-serialises it, so they compare equal."4550"as a string does not equal4550— that is a genuine type error under the schema and scores 0. Edge case:-0serialises as0; accepted, and harmless at our scale. Two further equivalences: whitespace inside a comma-separated string is dropped per part ("a, b"=="a,b"), and ISO-8601 durations with equal length compare equal ("PT0H45M"=="PT45M"; only the W/D/H/M/S form is recognised —"P1M"month ambiguity is left strict). - Key order and formatting. Both sides go through the same
canonicaliser, so object key order and whitespace never matter. Array
order does matter (
labels: ["a","b"]!=["b","a"]) — ordered lists are ordered in the schema semantics, so this is intended, but it is a known strictness the benchmark accepts. - Near-stale answers.
staleSchemaUsedonly fires on an exact canonical match with the recorded stale call. A memorizer that half-adapts (new enum value but old field name) scores 0 with a plain mismatch reason, not the stale flag. The flag therefore undercounts stale behaviour; the e2e report treats it as a lower bound. - Drift between generator and grader canonicalisation. The generator
(plain JS,
scripts/gen-tasks.mjs) and the grader (TypeScript,src/grader.ts) each implementcanon. If they diverge, every task breaks at once, which the e2e good-answers pass (all 60 canonical expected strings must score 1) catches immediately. - Duplicate JSON keys in the answer.
JSON.parsekeeps the last value; the schema for grading accepts that semantics. A pathological answer that relies on duplicate keys is handled deterministically. - Unicode and escapes. Canonicalisation emits
JSON.stringifyoutput; equivalent escape sequences (e.g.évsé) normalise identically on both sides. No Unicode normalisation (NFC/NFKC) is applied — strings must match code-point for code-point, which is intentional strictness. - Non-JSON answers. Empty strings, apologies, refusal text, or tool calls written in Python/TypeScript syntax fail extraction and score 0 with an "answer has no parseable {"name","arguments"} object" reason.
- Non-string answers.
submission.answeris typedstring, but the SDK surface (score()) accepts untyped JSON —null, numbers, objects. The grader type-checks before parsing and scores 0. (POST /v1/scorealready rejects non-string answers with a request error.) - Pathological nesting. A very deeply nested
argumentsvalue can exhaust the stack inside canonicalisation; it is caught and scores 0 rather than crashing the scorer.
What scores what
1— canonical{name, arguments}equality withexpected.0withstaleSchemaUsed— canonical equality withmetadata.stale.0with a diff reason — otherwise; the reason names the first differing path (name,arguments.<field>missing, unexpected, or value mismatch).
Per-mutation-kind breakdowns and the stale rate ride on every run report
(perMutationKind, staleSchemaUsedRate, and per-row details) on the
CLI, SDK, API and MCP surfaces. The e2e gate recomputes them independently
from task.metadata.mutationKind plus the row reasons and writes them to
artifacts/e2e-report.json.