dgn-math-problems / BENCHMARKING.md
ORCHORDS's picture
Republish the benchmark with one unified id namespace and one headline total
2cb99f0 verified
|
Raw History Blame Contribute Delete
35.4 kB
# Benchmarking the DGN Math Benchmark
This document describes what the dataset contains, how the scoring harness
(`evaluate_benchmark.py`) decides that an answer is correct, and how to run and
report results. It is written for an engineer who has not seen this project
before.
---
## 1. What the dataset is
`ORCHORDS/dgn-math-problems` is an **English-language mathematics benchmark**
with worked solutions. Every answer in it has been checked with a real symbolic
engine (SymPy), and the dataset says, row by row, how much trust each answer has
earned.
### Collections
| `collection` | Subject | What it is |
|---|---|---|
| `core` | Entrance mathematics, part 1: algebra | The main collection: 11 chapters, ~3,600 problems with worked solutions. |
| `algebra` | Entrance examination algebra | University entrance algebra: polynomials, equations, inequalities, logarithms. |
| `syllabus` | Entrance mathematics: the full syllabus | The whole pre-university syllabus: equations, trigonometry, derivatives, integrals, geometry. |
| `parameters` | Problems with parameters | Problems depending on a parameter, induction and stereometry. |
| `trigonometry` | Trigonometry | Trigonometry from first principles: functions, identities, equations, graphs. |
| `planimetry` | Plane geometry | Plane geometry: similar triangles, circles, areas and metric relations. |
| `circles` | Geometry with circles | Geometry built around circles: radical axes, power of a point, extremal properties. |
| `exercises` | Machine-made exercises | Items whose answers are computed and re-checked by SymPy. |
The collections are separated **only by the `collection` column**; they share one
schema, one `source` (`dgn_math`) and one id namespace (`"dgn.core.1.001"` for the
main collection, `"dgn.algebra.320"` for the extended collections,
`"dgn.exercises.0001"` for the machine-made rows). Every scoring command
therefore filters on `collection` if you want a single subset.
### Configs
| config | rows | what it is |
|---|---|---|
| `full` | 12,592 | every problem, every column, including the unverified ones |
| `qa` | 12,592 | the minimal MATH-style columns: problem, answer, metadata |
| `verified` | 2,755 | **the scored split** - only rows whose answer the engine confirmed |
| `core` | 3,617 | the main collection |
| `extended` | 8,455 | the six extended collections |
| `exercises` | 520 | the machine-made exercises |
The published repository splits the rows **85 % train / 15 % test, stratified by
collection and chapter, with a fixed seed (42)**; a row keeps the same split in
every config. The harness does not care about the split - it scores whatever file
you point it at - but you must say in your report which split you scored, because
a test score and a train score are not comparable.
### Schema
| Field | Type | Meaning |
|---|---|---|
| `id` | string | stable identifier, e.g. `dgn.core.1.122` |
| `problem_id` | string | the problem number as given in the source |
| `collection` | string | which collection the problem comes from (`core`, `algebra`, ...) |
| `source` | string | the benchmark the problem belongs to (`dgn_math`) |
| `source_title` | string | the name of the benchmark |
| `chapter` | int | chapter / topic number |
| `chapter_title` | string | chapter / topic name |
| `group` | string | group of the problem inside its chapter as given in the source: `"A"`, `"B"`, `"C"`, or `""` |
| `difficulty` | string | difficulty mark of the problem (`"□"` easy, `"■"` hard) or `""` when the source prints none |
| `problem` | string | English statement, LaTeX in `$...$` / `$$...$$` |
| `solution` | string | English worked solution, ending in the boxed answer |
| `final_answer` | string | short gold answer as bare LaTeX (no `$`, no `\boxed`) |
| `final_answer_boxed` | string | `\boxed{...}` form of `final_answer` - **the canonical gold field** |
| `answer_status` | string | `verified` / `corrected` / `refuted` / `suspected` / `disputed` / `unverifiable` / `no-gold` |
| `verification_note` | string | free text; what the engine checked and what it found |
| `page` | int | page in the source |
### Size of the current snapshot
| | count |
|---|---|
| rows | 12,592 |
| rows with a gold answer | 7,407 |
| rows with **no** gold answer | 5,185 |
| rows in the `verified` config (the scored split) | 2,755 |
| rows by collection | `algebra` 2,327, `circles` 853, `core` 3,617, `exercises` 520, `parameters` 1,287, `planimetry` 2,000, `syllabus` 1,751, `trigonometry` 237 |
| rows by `answer_status` | `corrected` 50, `disputed` 85, `no-gold` 5,185, `refuted` 68, `suspected` 271, `unverifiable` 4,228, `verified` 2,705 |
Rows without a gold answer are rows where the source page prints the result only
inside the worked solution, or not at all (`answer_status = "no-gold"`). They are
**skipped** by the harness (counted as `skipped_no_gold`), never scored as wrong.
---
## 2. How every answer was checked
The dataset is not a raw dump: **every answer was put through a real
computational engine, and the ones the engine could not confirm are labelled
rather than quietly dropped.** The check has four independent legs.
### Leg 1 - symbolic engine (SymPy)
A LaTeX-to-SymPy parser turns each statement and each source answer into an
expression tree, and the engine then does the actual mathematics:
* *equations and systems* - the claimed solution is substituted back into the
equation; the solution is accepted only if the residual is exactly zero;
* *identities* - both sides are simplified symbolically and at random points;
* *inequalities* - the claimed solution set is probed with points inside and
outside it, and every boundary case is re-checked at 40-digit precision;
* *values, limits, integrals, extrema, factorisations* - each has its own
checker.
The parser used for this leg is written for this dataset, because the two
general-purpose LaTeX parsers available for Python both misread the notation
these sources use:
| notation in the sources | general parsers | correct reading |
|---|---|---|
| `A : B` (Russian division) | `A / (B * C)` - the following product is swallowed | `(A / B) * C`, left to right |
| `X \left(...\right)^{-1}` | the exponent is **silently dropped** | reciprocal of the group |
| `[x]` (integer part) | read as a bracket | `floor(x)` |
| `\sin^22\alpha` | `(sin alpha)^22` | `(sin 2 alpha)^2` |
| `{}^4\sqrt{x}` (4th root) | read as a power times a root | 4th root |
| `\tanx` (no space) | mis-lexed as one control word | `tan(x)` |
One concrete consequence: the row `dgn.core.1.019` evaluates to **8** under
the off-the-shelf parsers and to **1/4** - the value the source gives - under the
notation the source actually uses. A checker built on the wrong reading would have
reported a correct source answer as wrong.
### Leg 2 - independent parsers as a cross-check
Every expression is *also* parsed by the two third-party parsers
(`latex2sympy2_extended` and SymPy's own ANTLR grammar). The two readings are
compared numerically on random sample points. Where they disagree, the
disagreement is reported rather than averaged away; the disagreements are
exactly the places where the off-the-shelf parsers misread the notation above.
### Leg 3 - an online calculator (math.js)
The rows that carry an answer are re-checked by the **public web calculator at
`api.mathjs.org`**, a JavaScript computer-algebra engine that shares no code
with SymPy and evaluates with 64-digit exact decimal arithmetic. The expression
tree is serialised into math.js syntax and the engine does all the arithmetic.
This leg confirms the answers on a completely different implementation, on a
different language, on a different machine.
The leg follows the same rules as leg 1, so that the two engines are compared
on the same question: an indicated substitution (`x = a^{2/3}b^{-1/2}`) is
carried out before the comparison, and a sample point that lies outside the
real domain of the expression - a negative radicand, a point that breaks the
declared condition `a>b>0` - is never used, because on such a point the two
engines can take different branches and the comparison would mean nothing.
Answers that the sources give rounded (a common habit - `0.98` for
`0.979999...`) are compared with the rounding tolerance that the source
precision allows, so a rounded answer is not mistaken for a wrong one.
### Leg 4 - a third read of the page
The engine can only refute an answer that is attached to the statement that was
transcribed. If the statement itself was misread, the refutation is worthless.
So **every flagged answer gets a third, independent read of the page image**
(a separate vision pass over the source page, with no access to the first
transcription), and the page that carries the source answer is read as well.
* if the third read agrees with the transcription and the engine still refutes
the source answer, the source really gives a wrong answer (`refuted`);
* if the third read disagrees, the corrected row is re-checked by the engine and
the row becomes `disputed` or is corrected when the correction verifies;
* if the engine cannot decide, the row stays `unverifiable` - never `refuted`.
A row whose engine verdict changed but whose page has **not** been read again
is published as `suspected`, never as `refuted`: until the page is looked at,
it is not settled whether the source or the transcription is at fault, and the
dataset does not claim that the source is wrong when it does not know.
### What the status column means
| `answer_status` | meaning | counted as correct? |
|---|---|---|
| `verified` | the engine confirmed the source answer | **yes** |
| `corrected` | the source answer was refuted and replaced by an engine-verified recomputation | **yes** |
| `refuted` | the source answer is wrong, with a concrete counterexample and a third page read | no |
| `suspected` | the engine found a difference, but it is not settled whether the source or the transcription is at fault | no |
| `disputed` | a third read of the page disagrees with the bulk transcription | no |
| `unverifiable` | the engine could not decide (unsupported notation, no closed form, ...) | no |
| `no-gold` | the source gives no separate answer | skipped, never wrong |
Only `verified` and `corrected` are in the `verified`
config, so **a score computed on the `verified` config is a score over answers
that a computer has confirmed**. Scores over `full` include the `unverifiable`
rows and must be reported as such.
### What the four legs actually found
The numbers below are the outcome of running all four legs over this snapshot,
not a description of the method.
| leg | what it covered | outcome |
|---|---|---|
| 1 - SymPy | 7,407 published rows that carry an answer | 2,755 confirmed, the rest labelled |
| 2 - independent parsers | 61,152 LaTeX fragments of the published dataset | **0 disagreements** with the third-party parser |
| 3 - math.js web calculator | 6,703 published rows that carry an answer | 1,114 could be evaluated; **805 of the 2,755 scored rows were independently confirmed and 6 were contradicted** |
| 4 - third page read | every one of the 336 flagged answers | 336 covered |
The cross-check was not a formality - it changed the dataset:
* **seven source answers that we had called wrong turned out to be right.** Three
refutations were withdrawn (a fractional part read as a set, a Russian mixed
number read as a product, a log argument read as a factor) and four
recomputed "repairs" were reverted to the source answer once the parser was
fixed. The source was right in all seven cases.
* **a defect in the checker itself was found and fixed.** One comparison returned
a symbolic truth value instead of a plain boolean, and the caller tested it by
identity, so a failed back-substitution was silently swallowed: rows could be
published as confirmed without a check ever having succeeded. The defect was
found by reading the engine's output, a regression test was added, and **every
row was re-checked from scratch**. 46 rows changed their
verdict because of it.
* **two bugs in the machine-made exercises were found and fixed.** One template
solved `(x - 9)/3 = 1` while computing the answer for `(x + 9)/3 = 1`, and
one template had the strictness of an inequality swapped. The generator now
re-parses its own source output and solves it, so a row whose statement and
answer disagree can no longer be published.
* **68 source answers are reported as wrong.** Each of those has a
concrete counterexample from the engine *and* a third, independent read of the
page that agrees with our transcription of the source answer. They are published
as `refuted`, not silently replaced.
---
## 3. Answer-format convention
Everything mathematical is LaTeX:
* **inline** math is delimited by `$...$`,
* **display** math is delimited by `$$...$$`,
* the **gold answer is stored twice**: `final_answer` (bare LaTeX, e.g. `\frac{3}{4}`)
and `final_answer_boxed` (`\boxed{...}`).
### Why `\boxed{}` matters
Standard MATH-style graders (`hendrycks/math`, `minerva`, and most evaluation
servers built on them) do one of two things: they look for the **last**
`\boxed{...}` in the completion, or they parse `\boxed{}` out of the gold
answer and compare that string. If the gold is only `$...$` without a
`\boxed{}` wrapper, those harnesses either score everything wrong or fall back
to a heuristic "last number" extraction that is easy to game. Storing the gold
in `\boxed{}` form means the same code path works for the gold and for the
model output, so a comparison measures mathematics, not formatting.
### Invariants the dataset guarantees
These are the properties that make automatic extraction safe:
1. **Balanced delimiters.** Every `$` has a partner; `$$` blocks are closed.
2. **No `$` inside a display block.** `$$ ... $$` never contains a single `$`.
3. **No `\(...\)` / `\[...\]` mixing.** The normalisation pass rewrites
`\(...\)` to `$...$` and `\[...\]` to `$$...$$`; the two styles never
coexist in one field.
4. **Decimal points, not decimal commas.** Russian decimal commas are
converted (`0{,}02` → `0.02`, `1,5` → `1.5`), so a `.` in a number is
always a decimal point.
**A stray or unbalanced `$` breaks extractors.** A single missing `$` turns the
rest of the solution into one long math span, the last `$...$` extraction
returns the wrong substring, and the score collapses for reasons that have
nothing to do with the model. If you add data, re-run the normalisation pass
rather than hand-editing fields.
Two residuals are worth knowing about, both handled by the harness:
* **9 rows still contain a LaTeX decimal comma** (`0{,}5\ln 2`,
`x = -1{,}25`, `(-0{,}5; 2)` …). The harness rewrites `{,}` between digits
to `.` on **both** sides before parsing, so `0{,}5` and `0.5` compare equal.
* **Some rows have no gold answer at all** (3,164 of them). They are skipped,
not scored wrong.
---
## 4. The scoring model
`evaluate_benchmark.py` does two things: extract the answer from the model's
response, then compare it with the gold.
### 3.1 Answer extraction
The response is searched for an answer in this order; the first rule that
produces something wins.
| # | Rule | Example response | Extracted |
|---|---|---|---|
| 1 | Content of the **last** `\boxed{...}` (brace-balanced, not a regex) | `so $\boxed{\frac{1}{2}}$` | `\frac{1}{2}` |
| 2 | Content of the **last** `$...$` / `$$...$$` math span | `the value is $\frac{\pi}{3}$` | `\frac{\pi}{3}` |
| 3 | The whole response, when it *is* one bare expression (no prose, no delimiters) | `x=\frac{\pi}{4}(4k+1)` | `x=\frac{\pi}{4}(4k+1)` |
| 4 | Text after the last answer marker — `final answer is`, `the answer is`, `answer:`, `result is`, `therefore`, `=`, `:` | `The answer is 42.` | `42` |
| 5 | The **last number** in the response (integer, decimal, or `a/b`) | `I get 3/4` | `3/4` |
Rule 3 is an addition to the classic MATH precedence. Models often answer with
raw LaTeX and no `$` delimiters; without rule 3 such a response falls through
to rule 5 and the answer is truncated to a fragment (`(-1,2)\cup(3,6)` becomes
`6`), which is a formatting artefact, not a mathematical mistake.
The extracted candidate is then cleaned: markdown `**bold**` / `*italic*`
wrappers, `the answer is` / `answer:` / `result:` prefixes, outer `$`
delimiters, a `\boxed{}` wrapper, `\text{...}` wrappers, the LaTeX decimal
comma, trailing periods and surrounding whitespace.
A prediction that yields **no candidate at all** (empty response, no answer, no
number) is counted as *unparsed* — see §3.4.
### 3.2 The comparison tiers
Three tiers are tried in order. Each tier returns *accept*, *reject* or
*undecided*:
* **accept** → the item is **correct**, and this tier is recorded as the tier
that decided it;
* **reject** → the tier has *proved* the two answers differ (both parse as
numbers and are not equal, or both parse as expressions and are not
mathematically equal) → the item is **incorrect** and this tier is recorded;
* **undecided** → the tier cannot compare the two sides → the item falls
through to the next tier.
| Tier | Rule | Accepts, for example |
|---|---|---|
| `exact` | Normalised **string** equality: lowercase; remove all whitespace; remove `$`; remove `\left`, `\right`, `\!`, `\,`, `\;`; `\dfrac`/`\tfrac` → `\frac`; `\cdot`/`\times` → `*`; strip a trailing `.` | `0.1` ≡ `0.1`; `x = 2` ≡ `x=2` |
| `numeric` | Both sides parse as a **number**: plain decimal, `a/b`, LaTeX `\frac{a}{b}` (optional sign), a percentage (candidates `50` *and* `0.5`), or a number with a known unit (`70 kg`). Equal within a relative tolerance of `1e-6` (absolute `1e-9` near zero) | `0.040` ≡ `0.04`; `-0.75` ≡ `-\frac{3}{4}`; `7.1%` ≡ `7,1%` |
| `symbolic` | Both sides convert to **sympy** expressions (`latex2sympy2_extended.latex2sympy` first, then `sympy.parsing.latex.parse_latex`) and are mathematically equal: `simplify(lhs-rhs)==0`, or agreement at 8 sample points evaluated with `sympy.lambdify` | `\frac{\pi}{4}(4n+1)` ≡ `\frac{\pi}{4}(4k+1)`; `-\frac{3}{4}` ≡ `-0.75` |
The tier order is significant and is configurable with `--tiers`. The default
is `exact,numeric,symbolic`.
**A response that reproduces the gold answer in full is accepted before the
tiers run.** The extractor can pick a fragment out of a correct answer — a
single number, or the tail after a comma — and a fragment is then compared
against the *whole* gold string, which would mark a verbatim-correct answer
wrong. So the harness first compares the entire response, cleaned and
normalised, with the gold answer; if the two are identical the item is
accepted at the `exact` tier, whatever fragment the extractor happened to
choose. The same normalised form is used, so `x=2` and `x = 2` still match.
This rule only ever accepts an answer that is *equal* to the gold answer, so
it cannot make a wrong answer score as correct.
### 3.3 Answer shapes the dataset forces you to handle
The gold answers are not all single numbers. The harness handles these shapes
explicitly, at every tier:
* **Answer lists** — `"x=1, x=2"`, `"1; 2; 3"`, `"a) 1 b) 2"`, `"48; 80; 12; 12"`.
Both sides are split into items (separators that are not nested in brackets
or in `$...$`; a comma between two digits is treated as a decimal comma, not
a separator) and compared as an **unordered multiset**: the match must pair
every predicted item with a distinct gold item. A set match counts only if
the multisets agree, so `1; 1; 2` does **not** match `1; 2`.
* **Interval sets** — `"(-1,2)\cup(3,6)"`, `"[0,1)"`, `"(-\infty,1)"`,
`"[-9;-1]\bigcup[0;1]"`, and discrete sets `"{1,2,3}"`. Both sides are
parsed into intervals (with open/closed flags) and compared as sets: every
interval on one side must be covered by the other side and vice versa, with
endpoints compared within a tolerance and open/closed flags respected.
`"(-2,-1)\cup(-1,2)"` and `"(-1,2)\cup(-2,-1)"` are the same set; `[0,1]` and
`(0,1]` are not.
* **`\pm` answers** — `"x=\frac{\pi}{6}(2k\pm1)"`. `\pm` is expanded into its
two alternatives and the prediction is accepted if it matches **either**
alternative, or if it states the same solution set with a different integer
multiplier (`\frac{\pi}{6}(4k+2)` ≡ `\frac{\pi}{6}(2k+1)`).
* **Equations with a parameter** — `"x=\frac{\pi}{4}(4k+1)"`. `k` is treated as
a free symbol: the two sides are compared after substituting several integer
values of it. When the prediction uses a different symbol name for the same
parameter (`n` for `k`), the free symbols are aligned by position, so
`\frac{\pi}{4}(4n+1)` is accepted.
* **A leading assignment** — `"x=2"` and `"2"` describe the same answer, so a
leading single-symbol `lhs=` is stripped before the numeric and symbolic
comparisons. An equation such as `"2x+3=7"` is left alone.
### 3.4 What counts as correct, and what "strict" means
* An item is **correct** when some tier accepts it. The tier that accepted it
is reported, so you can see *how* the answer matched.
* An item is **incorrect** when a tier rejects it, or when no tier can decide
it (then the last tier reached is recorded).
* **strict accuracy** is the fraction of items accepted by the `exact` tier
only. It is a string-identity proxy: model outputs are often mathematically
equivalent but not string-identical, so the main accuracy is always the
higher of the two. Note that for list and interval answers the `exact` tier
applies the dataset's unordered-multiset and interval-set rules with
string-level equality of the elements — it is not raw byte equality.
* An **unparsed** prediction (present, but containing no interpretable
mathematics) is **incorrect**, and is reported separately so that a harness
can exclude it. "Unparsed" means *not interpretable at all* — a prose answer
that contains a maths span inside it is not unparsed.
* A **missing** prediction (the dataset id has no line in the predictions
file) is **incorrect**, and is counted separately from `unparsed`.
* An item whose **gold answer is empty** is **skipped**: it is not in the
denominator. `skipped_no_gold` reports how many were skipped.
The denominator (`scored`) is therefore: *dataset rows with a gold answer*.
---
## 5. Running the harness
The project virtualenv already contains everything needed (sympy 1.14,
latex2sympy2_extended 1.5.4, antlr4-python3-runtime 4.11.0, numpy, pyarrow,
datasets). Use its interpreter explicitly; do not create another environment.
```bash
VENV=/Users/orchords/.minimax/sessions/mvs_c6fe6be7d0754d3580408fa064908e8b/workspace/.venv/bin/python
```
### 4.1 Score a predictions file
```bash
$VENV /Users/orchords/.minimax/sessions/mvs_c6fe6be7d0754d3580408fa064908e8b/workspace/evaluate_benchmark.py \
--dataset /Users/orchords/.minimax/sessions/mvs_c6fe6be7d0754d3580408fa064908e8b/workspace/dataset/normalized.jsonl \
--predictions /path/to/predictions.jsonl \
--out /path/to/report.json
```
| Flag | Meaning |
|---|---|
| `--dataset` | `.jsonl` or `.parquet`; rows are indexed by `id` (required) |
| `--predictions` | `.jsonl`, one JSON object per line (required) |
| `--out` | write the full JSON report (totals, breakdowns, per-item table) to this file |
| `--tiers` | comma separated tiers in order, default `exact,numeric,symbolic` |
| `--quiet` | do not print the report to stdout (`--out` is still written) |
| `--show-items` | `auto` (default: all items for ≤ 500 rows, else the failures), `all`, `failures`, `none` |
Exit code `0` on success, `2` on a usage error, `1` on a missing or unreadable
file or an invalid tier name. A malformed dataset row or prediction line never
aborts the run: it is counted (`dataset_errors`, `malformed_prediction_lines`)
and the rest of the evaluation continues.
### 4.2 Predictions file format
One JSON object per line, at minimum `{"id": ..., "response": ...}`:
```json
{"id": "1.001", "response": "0.1"}
{"id": "1.002", "response": "The final answer is 2."}
{"id": "1.003", "answer": "2"}
```
* `response` may also be spelled `prediction`, `output`, `answer`, `pred` or
`text`; the first one present is used.
* Prediction ids that are **not** in the dataset are ignored and counted
(`unknown_prediction_ids`).
* Dataset ids with **no** prediction are counted as incorrect
(`missing_predictions`).
* If an id appears twice, the **last** line wins and the duplicate is counted.
### 4.3 Minimal prediction loop
```python
import json
from datasets import load_dataset
ds = load_dataset("parquet", data_files={"test": "data/full/test-*.parquet"})["test"]
client = your_client # <- your model / API client
n = 0
with open("predictions.jsonl", "w") as fh:
for row in ds:
prompt = f"Solve this problem. Put the final answer in \\boxed{{}}.\n\n{row['problem']}"
response = client.complete(prompt) # <- your model call
fh.write(json.dumps({"id": row["id"], "response": response}) + "\n")
n += 1
print(f"wrote {n} predictions")
```
```bash
$VENV evaluate_benchmark.py --dataset data/full/test-00000-of-00001.parquet \
--predictions predictions.jsonl --out report.json
```
### 4.4 A worked example
A 20-line demo predictions file ships with the harness at
`_eval_demo_predictions.jsonl` (19 dataset ids plus one unknown id). It covers
an exact match, a re-formatted number, a fraction written as a decimal, a
percentage, a comma-separated list, an interval answer written with a
different union glyph, a `\pm` answer, a parametric answer with a renamed
parameter and with a different multiplier, a `\boxed{}` answer, two wrong
answers and one unparseable answer.
Scored against a 19-row subset of the dataset, it gives:
```
-- overall --
scored items : 19
correct : 16
accuracy : 84.21% (16/19)
strict accuracy (exact) : 47.37% (9/19)
unparsed predictions : 1
missing predictions : 0
skipped (no gold answer): 0
unknown prediction ids : 1
-- decided by tier --
tier decided correct accuracy
exact 9 9 100.00%
numeric 6 4 66.67%
symbolic 3 3 100.00%
(none) 1
-- per-item --
id tier ok par pred | gold
1.001 exact yes ok 0.1 | 0.1
1.002 exact yes ok 2 | 2
1.004 numeric yes ok 0.040 | 0.04
1.007 - NO no | 1+3x^2
1.013 numeric NO ok 21 | 20
1.014 exact yes ok 2a+3 | 2a+3
1.026 exact yes ok \sqrt{2}(m+3) | \sqrt{2}\,(m+3)
1.138 numeric yes ok -0.75 | -\frac{3}{4}
2.009 symbolic yes ok x_1=0; x_{2,3}=-3+\frac{2}{3}\sqrt{3} | x_1=0;\ x_{2,3}=-3\pm\frac{2}{3}\sqrt{3}
3.001 exact yes ok 12, 80, 48, 12 | 48; 80; 12; 12
3.022 numeric yes ok 20\% | x=20\%
3.023 numeric yes ok 7.1% | 7,1%
5.046 symbolic yes ok x=\frac{\pi}{6}(4k+2) | x=\frac{\pi}{6}(2k+1)
5.081 symbolic yes ok x=\frac{\pi}{4}(4n+1) | x=\frac{\pi}{4}(4k+1)
8.016 exact yes ok (-1,2)\cup(2,3) | (-1,2)\cup(2,3)
8.021 exact yes ok (-1, 2) ∪ (3, 6) | (-1,2)\cup(3,6)
8.033 exact yes ok (-2, -1) ∪ (-1, 2) | (-2,-1)\cup(-1,2)
8.041 exact yes ok 7; 6; 5; 4; 3; 2; 1 | 1; 2; 3; 4; 5; 6; 7
11.114 numeric NO ok 0.6 | 0.5
```
Note the two shapes of "right": `1.004` (`0.040` vs `0.04`) and `1.138`
(`-0.75` vs `-\frac{3}{4}`) are wrong under string equality and right under
the numeric tier, which is exactly the difference between the strict and the
main accuracy. `1.013` and `11.114` are wrong numbers and score 0 at the
numeric tier; `1.007` contains no mathematics and is counted as unparsed.
---
## 6. Reading the numbers
### Which number to quote
**Quote the main accuracy (all tiers) as the headline metric, and the strict
accuracy next to it.** The main accuracy is what a user cares about: the model
produced the right mathematics. Strict accuracy is the diagnostic that says how
much of that depends on the model reproducing the source's exact formatting; a
model with 60 % main accuracy and 20 % strict accuracy is answering in a
different notation, not failing.
Always state, in the same sentence: the **config** (full / verified / core / extended / exercises),
the **split** (train / test / full), the **tier policy** (default
`exact,numeric,symbolic`), and the **number of unparsed and missing
predictions**.
### Per-chapter accuracy
Always print the per-chapter breakdown. A single number hides the most
important failure mode of a benchmark: a model can score well overall while
failing an entire chapter. Chapter 4 (trigonometric identities, 500 rows) and
chapter 11 (beginning of analysis, 275 rows) are much harder than chapter 9
(combinatorics, 90 rows); an overall score that is the average of an 80 %
chapter and a 5 % chapter says very little about either.
The same applies to the `group` (`A`/`B`/`C` difficulty) and `difficulty`
breakdowns: if accuracy collapses on the `C` items, the model has not learned
the harder material, whatever the average says.
### Reporting responsibly
* State the subset and split, the tier policy, and the unparsed/missing counts
every time. An accuracy without them is not reproducible.
* Report the number of items that were skipped for want of a gold answer
(`skipped_no_gold`) when you score the full dataset — 3,164 of 9,229 rows
are skipped in the current snapshot.
* Do not silently drop `unparsed` items to inflate the score. If you exclude
them, say so and give both numbers.
* When comparing two systems, use the same tier policy for both.
* Report the per-tier breakdown: it shows whether a system fails at
formatting (many items decided late, low strict accuracy) or at
mathematics (items rejected outright).
---
## 7. Known limitations
### What `answer_status` means
`answer_status` records how much the gold answer was checked, not how hard the
problem is:
| Value | Meaning |
|---|---|
| `verified` | the engine substituted the answer back into the statement and it held |
| `corrected` | the original answer was refuted and replaced by a recomputed answer that the engine then re-verified |
| `refuted` | the engine produced a **concrete counterexample** - the root fails the equation, the tuple satisfies no equation of the system, or the interval misses a point that satisfies the inequality; `verification_note` names it |
| `suspected` | the recomputed answer differs from the original one, but no counterexample was found. A difference in a radical's scope or in a notational convention looks the same, so these are **not** counted as errors in the source |
| `disputed` | a third independent read of the source disagreed with the bulk transcription, so the row is not trusted |
| `unverifiable` | the item could **not** be checked automatically (free-form answers, answers that depend on a diagram, prose answers, ...) |
| `no-gold` | the source carries no answer for this problem |
**`unverifiable`, `suspected` and `no-gold` do not mean the answer is wrong.**
`unverifiable` means nobody checked it; `suspected` means the check was inconclusive;
`no-gold` means there was no answer to check. **`refuted` and `disputed` do mean the
answer cannot be trusted** - which is why they are excluded from the
`verified` config. The `verified` config is the honest scored split: every item in
it has been checked by a symbolic engine.
### The source contains a small number of wrong answers
A number of items have an answer that is **incorrect in the source**. These are
flagged as `refuted`, with the counterexample in `verification_note`. They are a
floor on the achievable score: no model can be scored correct on them. When
reporting, either exclude those rows and say so, or report accuracy on the
`verified` subset as well - which is what the `verified` config is for.
Rows flagged `suspected` are deliberately *not* presented as errors in the source.
The engine's recomputation differs there, but without a counterexample
the difference is as likely to come from how the radical scope or a notational
convention was read as from a wrong answer. They are still excluded
from the scored split, because an item whose gold answer nobody can vouch for
does not belong in a score.
### Other limitations of the harness
* The symbolic tier samples 8 integer points for expressions with free
symbols. For pathological expressions this can miss an inequality, but it
cannot produce a false *accept* unless the two expressions coincide at all
sampled points.
* Answers that are prose (`"70 kg."`, `"In 6 and 8 h."`) are compared as
strings only. A model that writes the same words in a different order is
scored incorrect. The `exact` tier is the only tier that can decide them.
* The `\pm` and integer-multiplier rules compare *solution sets*, not
expressions, so two answers that are written differently but select the same
values are accepted. That is intentional, but it means the symbolic tier is
slightly more generous than a pure expression comparison.
* The dataset is transcribed from page images, so an isolated symbol may differ
from the print. This is a data-quality issue, not a scoring issue, and it is
the main reason a handful of items are hard to match.
---
## 8. Results reporting template
Copy, fill in, and keep it with the raw report JSON.
```
Model: <model name and version>
Decoding: <temperature, max tokens, prompt/chat template>
Dataset: dgn-math-benchmark, <config: full | verified | core | extended | exercises>
Split: <test | train | full> (<N> rows scored, <M> skipped: no gold answer)
Tier policy: exact,numeric,symbolic (default)
Extraction: last \boxed{} > last $...$ > bare LaTeX > answer marker > last number
Accuracy: <correct>/<scored> = <x.xx>%
Strict accuracy: <correct>/<scored> = <x.xx>% (exact tier only)
Unparsed: <n> Missing predictions: <n> Errors: <n>
By chapter:
ch1 <x.xx>% ch2 <x.xx>% ch3 <x.xx>% ch4 <x.xx%>
ch5 <x.xx>% ch6 <x.xx>% ch7 <x.xx>% ch8 <x.xx%>
ch9 <x.xx>% ch10 <x.xx>% ch11 <x.xx>%
By difficulty group: A <x.xx>% B <x.xx>% C <x.xx>% (unlabelled <x.xx>%)
By answer status: verified <x.xx>% corrected <x.xx%> refuted <x.xx%> disputed <x.xx%>
Decided by tier: exact <n> (<x.xx>%) numeric <n> (<x.xx>%) symbolic <n> (<x.xx>%)
Command:
<venv>/bin/python evaluate_benchmark.py --dataset <path> \
--predictions <path> --out <path>
```
---
## 9. Files
| File | What it is |
|---|---|
| `evaluate_benchmark.py` | the scoring harness described above |
| `BENCHMARKING.md` | this document |
| `_eval_demo_predictions.jsonl` | demo predictions file used in §4.4 |
| `hf_dataset/benchmark_full.jsonl` | the dataset in JSONL form (one row per line) |
| `hf_dataset/data/*` | the parquet configs published to the Hub |
`evaluate_benchmark.py` is dependency-light: it needs `sympy` (always) and
`latex2sympy2_extended` (for the symbolic tier; `sympy.parsing.latex` is used
as a fallback), and `pyarrow` only when the dataset is a parquet file.