|
Download README.md from PoyrazDemir/closebench: direct link, hf CLI and curl.
- Browser
- Download file 16.5 kB
-
https://huggingface.co/datasets/PoyrazDemir/closebench/resolve/main/README.md
- Command line
-
hf download hf://datasets/PoyrazDemir/closebench/README.md
-
curl -L -o README.md https://huggingface.co/datasets/PoyrazDemir/closebench/resolve/main/README.md
16.5 kB
| license: mit | |
| language: | |
| - en | |
| - ru | |
| task_categories: | |
| - other | |
| tags: | |
| - accounting | |
| - bookkeeping | |
| - agents | |
| - evaluation | |
| - synthetic | |
| pretty_name: closebench | |
| size_categories: | |
| - n<1K | |
| configs: | |
| - config_name: worlds | |
| default: true | |
| data_files: | |
| - split: en | |
| path: data/worlds-en.jsonl | |
| - split: ru | |
| path: data/worlds-ru.jsonl | |
| - config_name: truth | |
| data_files: | |
| - split: en | |
| path: data/truth-en.jsonl | |
| - split: ru | |
| path: data/truth-ru.jsonl | |
| # closebench | |
| Deterministic, seeded double-entry ledgers with planted month-end closing errors, plus | |
| the answer key a programmatic grader needs. 100 worlds x 2 locales, generated by | |
| [`closebench`](https://github.com/poyraz-demir/closebench) 0.1.1 | |
| ([PyPI](https://pypi.org/project/closebench/)). Built for testing bookkeeping agents: | |
| the agent reads the books and documents, posts adjusting entries, and `grade()` scores | |
| them against the planted errors by account and amount -- no rubric, no judge model. | |
| - **Code:** https://github.com/poyraz-demir/closebench | |
| - **Package:** `pip install closebench==0.1.1` (Python >= 3.10, zero dependencies) | |
| - **Licence:** MIT (data and code) | |
| ## Contents | |
| | file | rows | what | | |
| |---|---|---| | |
| | `data/worlds-en.jsonl` | 100 | agent-visible world, English text | | |
| | `data/worlds-ru.jsonl` | 100 | the same 100 worlds, Russian text | | |
| | `data/truth-en.jsonl` | 100 | planted errors for each English world (the grader's answer key) | | |
| | `data/truth-ru.jsonl` | 100 | same, Russian descriptions | | |
| | `build.py` | | regenerates `data/` from the package, byte for byte | | |
| | `verify.py` | | rebuilds random worlds from the package and checks them against `data/` | | |
| Seeds **1..50** are `hard` worlds, seeds **1001..1050** are `absence` worlds. The mode is a | |
| function of the seed (`seed >= 1000` -> `absence`), exactly as the package CLI does it, so | |
| the mode never has to be passed to an agent as a flag that would hint at the task. | |
| For one seed the `en` and `ru` rows have identical numbers -- dates, accounts, amounts, | |
| planted errors, gap months -- and differ only in text (memos, document bodies, account | |
| names, error descriptions). So the dataset holds **100 distinct worlds**, not 200. | |
| | | worlds | entries / world | documents / world | errors / world | errors total | | |
| |---|---|---|---|---|---| | |
| | `hard` (seeds 1..50) | 50 | 143-150 | 27 | 6-9 | 376 | | |
| | `absence` (seeds 1001..1050) | 50 | 141-144 | 24 | 4-6 | 250 | | |
| Total size 9.4 MB uncompressed (~4.2 MB and ~4.7 MB for the two `worlds` files, ~0.25 MB | |
| each for `truth`). | |
| ### Row schema | |
| `worlds-{lang}.jsonl`, one JSON object per line: | |
| ``` | |
| seed int 1..50 or 1001..1050 | |
| mode str "hard" | "absence" | |
| lang str "en" | "ru" | |
| company str "Ridge Ltd" / "ООО «Ридж»" | |
| period {start, end} closing period, always 2026-11-01 .. 2026-11-30 | |
| accounts [{code, name, type}] 26 accounts; type in asset|liability|equity|income|expense | |
| entries [{eid, date, memo, source, ref, lines}] ~145 balanced journal entries, Jan-Nov 2026 | |
| lines [{account, debit, credit}] decimal strings with two places, e.g. "7800.00" / "0.00" | |
| documents [{doc_id, kind, date, title, body, meta}] kind in vendor_invoice|contract|email|bank_statement|policy; | |
| meta is a flat str->str dict (vendor, amount, currency, ...) | |
| ``` | |
| `truth-{lang}.jsonl`, one JSON object per line, paired with the world of the same seed: | |
| ``` | |
| seed, mode, lang as above | |
| errors [{err_id, kind, description, entry_ids, accounts, amount, fix}] | |
| err_id "E1".."E17", stable per kind | |
| kind one of the 17 kinds below | |
| description human-readable statement of what went wrong (grader/debugging only) | |
| entry_ids ledger entries involved (empty when the error is a missing entry) | |
| accounts accounts the error touched | |
| amount decimal string | |
| fix {type: "require_entry" | "require_reversal", | |
| period: [start, end], the adjusting entry must be dated inside it | |
| debit_account, credit_account, the correct adjusting entry | |
| amount} | |
| ``` | |
| Everything an agent may see is in `worlds-*`. Nothing in `worlds-*` reveals which errors were | |
| planted: every error kind has a legitimate "decoy" twin, so the document inventory looks the | |
| same whether or not the error is present. | |
| ## How a world is built | |
| `World(seed, lang, difficulty).build()` in the package produces one small company, eleven | |
| months of operations (January to November 2026), a 26-account chart, ~25 supporting | |
| documents (vendor invoices, contracts, a bank statement, an intercompany e-mail, an FX rate | |
| certificate, the accounting policy `POL-01`) and a fixed set of closing errors chosen by | |
| the seed. The trial balance always balances; cash and inventory are never negative. The task | |
| is to close **November 2026**: find every planted error and post the adjusting entries. | |
| Two modes: | |
| - **`hard`** (seeds < 1000): 6-9 errors sampled from all 17 kinds. Journal memos are terse | |
| and reference document codes rather than meaning, as in real books. The closing month also | |
| contains **distractors** -- legitimate transactions that look like errors (e.g. two | |
| half-month invoices from the same vendor, a large one-off expense). "Correcting" a | |
| distractor costs points. | |
| - **`absence`** (seeds >= 1000): 4-6 errors sampled from the six absence-only kinds. Memos | |
| are plain. The error exists only as a gap in a monthly series (a missing accrual, a missing | |
| depreciation charge...) and is hidden in a **random month of the year** (2..11; the | |
| inventory-receipt gap in 5..11), not in the closing month, so mechanical comparison of the | |
| last two months does not solve it. | |
| In both modes every error kind that was *not* planted leaves a decoy: a similar but | |
| legitimate document or transaction. Amounts are seeded so that no two planted errors in one | |
| world share the same account pair and amount, so one adjusting entry can satisfy at most one | |
| error. | |
| ## Error taxonomy | |
| **Document-backed** (the evidence is in a document the agent can read): | |
| | kind | what went wrong | correct fix | | |
| |---|---|---| | |
| | `unrecorded_invoice` | subcontractor act never posted | Dr 5000 / Cr 2000 | | |
| | `duplicate_invoice` | one invoice posted twice under two refs | Dr 2000 / Cr 6300 | | |
| | `capex_expensed` | fixed asset above the policy limit expensed | Dr 1500 / Cr 6900 | | |
| | `prepaid_not_deferred` | 12-month licence expensed in full | Dr 1300 / Cr 6500 | | |
| | `revenue_cutoff` | customer prepayment for next year booked as revenue | Dr 4000 / Cr 2400 | | |
| | `unrecorded_bank_fee` | fee on the bank statement, not in the books | Dr 6900 / Cr 1000 | | |
| | `misclassified_expense` | warehouse rent booked to professional services | Dr 6100 / Cr 6300 | | |
| | `intercompany_mismatch` | subsidiary's services never recorded | Dr 6900 / Cr 2500 | | |
| | `fx_revaluation` | open EUR payable not revalued at period-end rate | Dr 6700 / Cr 2000 | | |
| | `depreciation_prorata` | new asset in service mid-month, no depreciation (day-prorated) | Dr 6400 / Cr 1590 | | |
| | `service_span_cutoff` | 60-day contract straddling period end, expensed in full (day-prorated) | Dr 1300 / Cr 6300 | | |
| **Absence-only** (no document points at them -- the error exists only as a gap in a series, | |
| hidden in a random month of the year, not the closing month): | |
| | kind | what went wrong | correct fix | | |
| |---|---|---| | |
| | `missing_recurring` | one month's security-services accrual missing | Dr 6600 / Cr 2100 | | |
| | `payroll_cutoff` | one month's end-of-month payroll accrual missing | Dr 6000 / Cr 2200 | | |
| | `depreciation_stopped` | one month's depreciation missing | Dr 6400 / Cr 1590 | | |
| | `prepaid_amort_stopped` | one month's insurance amortisation missing | Dr 6800 / Cr 1300 | | |
| | `accrual_not_released` | prior-month accrual not released at payment; expense double-counted | Dr 2200 / Cr 6000 | | |
| | `inventory_receipt_gap` | goods received never posted although COGS was | Dr 1200 / Cr 2000 | | |
| How often each kind appears across the 100 worlds (identical for `en` and `ru`): | |
| | kind | worlds | kind | worlds | | |
| |---|---|---|---| | |
| | `prepaid_amort_stopped` | 68 | `capex_expensed` | 26 | | |
| | `accrual_not_released` | 64 | `service_span_cutoff` | 25 | | |
| | `missing_recurring` | 62 | `depreciation_prorata` | 25 | | |
| | `depreciation_stopped` | 62 | `prepaid_not_deferred` | 24 | | |
| | `inventory_receipt_gap` | 62 | `duplicate_invoice` | 22 | | |
| | `payroll_cutoff` | 61 | `unrecorded_invoice` | 21 | | |
| | `revenue_cutoff` | 29 | `unrecorded_bank_fee` | 21 | | |
| | | | `intercompany_mismatch` | 21 | | |
| | | | `fx_revaluation` | 18 | | |
| | | | `misclassified_expense` | 15 | | |
| The six absence kinds are frequent because they are the only kinds in `absence` mode and | |
| also part of the pool in `hard` mode. | |
| ## Grading | |
| The package grader compares the agent's adjusting entries with the planted errors: | |
| ```python | |
| grade(world, session) -> { | |
| "passed": bool, # every error found (exact or partial), TB balanced, nothing spurious | |
| "score": float, # (exact + 0.5*partial) / total - 0.1*spurious, floored at 0 | |
| "found": [...], # exact account pair and amount | |
| "partial": [...], # right amount, economically equivalent account (e.g. 6300 for 6900) | |
| "missed": [...], | |
| "spurious_entries": [...], # adjustments matching no planted error | |
| "tb_balanced": bool, | |
| "adjustments_posted": int, | |
| "tool_calls": int, | |
| } | |
| ``` | |
| An adjustment must be dated inside `fix.period`, and can satisfy at most one planted error. | |
| Equivalence groups are small and explicit (`closebench.grader.EQUIV`); a defensible account | |
| choice earns half credit, never a penalty. The agent's only interface is | |
| `closebench.tools.Session`: `chart_of_accounts`, `trial_balance`, `journal`, `account_detail`, | |
| `list_documents`, `read_document`, `pnl`, `post_entry`. It never sees `world.errors`. | |
| ### Example: load one row, run an agent, score it | |
| The dataset rows are enough to rebuild a gradeable `World` without replaying the generator. | |
| With `pip install closebench==0.1.1` and this directory as the working directory: | |
| ```python | |
| import json | |
| from closebench.world import World, Document, PlantedError | |
| from closebench.ledger import Entry, Line, D | |
| from closebench.tools import Session | |
| from closebench.grader import grade | |
| w, t = (json.loads(open(f"data/{f}-en.jsonl", encoding="utf-8").readline()) for f in ("worlds", "truth")) | |
| world = World(seed=w["seed"], lang=w["lang"], difficulty=w["mode"]) # empty shell: no .build() | |
| for e in w["entries"]: | |
| world.ledger.post(Entry(e["eid"], e["date"], e["memo"], [Line(l["account"], D(l["debit"]), D(l["credit"])) for l in e["lines"]], e["source"], e["ref"])) | |
| world.documents = [Document(**d) for d in w["documents"]] | |
| world.errors = [PlantedError(**err) for err in t["errors"]] # grader only -- never show the agent | |
| agent = Session(world) # the only surface the agent sees | |
| agent.post_entry("2026-11-30", "capitalise equipment", [{"account": "1500", "debit": "85000.00"}, {"account": "6900", "credit": "85000.00"}]) | |
| print(grade(world, agent)) | |
| ``` | |
| Output for seed 1 (`hard`, seven planted errors, one of them fixed): | |
| ``` | |
| {'passed': False, 'score': 0.143, 'found': ['E3'], 'partial': [], 'missed': ['E2', 'E8', 'E9', 'E12', 'E13', 'E14'], | |
| 'spurious_entries': [], 'tb_balanced': True, 'adjustments_posted': 1, 'tool_calls': 1} | |
| ``` | |
| Replace the `post_entry` line with your agent's tool loop over `agent`. To sanity-check the | |
| grader, post the `fix` of every error in the truth row (an "oracle"): `score` must be `1.0` | |
| and `passed` `True` -- `verify.py` does exactly that. | |
| Equivalently, `World(seed=w["seed"], lang=w["lang"], difficulty=w["mode"]).build()` recreates | |
| the very same world from the seed; `verify.py` checks that the result is byte-identical to the | |
| stored row. Use whichever is more convenient. | |
| With the `datasets` library: | |
| ```python | |
| from datasets import load_dataset | |
| worlds = load_dataset("json", data_files="data/worlds-en.jsonl", split="train") | |
| truth = load_dataset("json", data_files="data/truth-en.jsonl", split="train") | |
| ``` | |
| (or `load_dataset("PoyrazDemir/closebench", "worlds", split="en")` once the dataset is on | |
| the Hub -- the YAML header above declares the `worlds` and `truth` configs with `en` and `ru` | |
| splits). | |
| One caveat with `datasets`: Arrow type inference turns the ISO date strings in `fix.period` | |
| (and `entries[].date`, `documents[].date`) into timestamps. The grader compares dates as | |
| `YYYY-MM-DD` strings, so convert back with `.date().isoformat()` before calling `grade`, | |
| or read the JSONL with the standard-library `json` module as in the example above, which | |
| keeps every field exactly as stored. | |
| Over a set of seeds, report `pass_rate` (share of worlds with `passed == True`) and | |
| `mean_score`. Keep `en` and `ru` separate: they are the same worlds, so pooling them | |
| double-counts. | |
| ## Reproducing | |
| ```bash | |
| pip install closebench==0.1.1 | |
| python build.py # rewrites data/ deterministically | |
| python verify.py # 5 random seeds, both locales: byte-identical rebuild + oracle score 1.0 | |
| python verify.py --n 100 --sample-seed 0 # every seed, fixed sample | |
| ``` | |
| Both scripts accept `--src /path/to/closebench-checkout` when the package is not installed. | |
| SHA-256 of the shipped files (closebench 0.1.1): | |
| ``` | |
| 68a76532552584d445f365603823e4f98336c30227050e79c44fcaeb7e9f7b07 worlds-en.jsonl | |
| 2a758aac55628dfe0e36943b66b42d420dccd1da79b45f73424ca7d4b7d5f2f4 worlds-ru.jsonl | |
| b4e8f5410f6bd62f6ed4cb3cecb8f696d2b2c762125263bcfffba5052296780e truth-en.jsonl | |
| c340bcd9e7a89e624260feb80f27ef4162e9b9f0d1ca45529fcfc764e5a9e26f truth-ru.jsonl | |
| ``` | |
| Rows are written with `json.dumps(obj, ensure_ascii=False, separators=(",", ":"))` in the | |
| key order shown above; the package's `World.snapshot()` and `World.truth()` are the source | |
| of every field except `mode`, which is added by `build.py`. | |
| ## Limitations -- read before drawing conclusions | |
| - **Synthetic.** One fictional company, one chart of 26 accounts, one fiscal year, one | |
| closing month (November 2026), round-ish amounts, no VAT or income tax, no sub-ledgers, | |
| no multi-entity consolidation beyond a single intercompany e-mail. Real closes are | |
| messier and larger. Passing here says an agent can do the mechanics, not that it can | |
| close real books. | |
| - **One period per world.** The agent closes November; the ten earlier months are context. | |
| There is no multi-period drift, no reopening, no prior-year adjustments. | |
| - **The answer key is public.** `truth-*` ships alongside `worlds-*`, and the generator is | |
| open source, so any model that has seen this data (or the package) can memorise it. | |
| Use it as a regression suite for *your own agent*, not as a leaderboard. For a held-out | |
| set, run `build.py` with seeds nobody has published (edit `HARD_SEEDS` / | |
| `ABSENCE_SEEDS`). | |
| - **Grading is exact-match on account pair, amount and period**, with a small explicit | |
| equivalence table for partial credit. A correct fix expressed through a different but | |
| defensible route (e.g. two entries, or a compound entry) scores as missed plus spurious. | |
| Adjustments dated outside the closing period are ignored. | |
| - **Not a hard benchmark.** In the package author's runs a frontier model with a neutral | |
| prompt closed `hard` worlds with a **83 %** pass rate and `absence` worlds with **58 %** | |
| (**92 %** if you accept the agent's refusal to book an undocumented goods receipt). | |
| Distractors caught nobody. The one systematic failure: two errors that cancel in the | |
| balances (a missing accrual and an unreleased accrual of the same amount) are still two | |
| errors, and models tend to book one. See the package README and `runs/` in the repository. | |
| - **Two locales, same numbers.** `ru` is a translation layer over the same seeds, not an | |
| independent sample; it tests whether text language changes an agent's behaviour, nothing | |
| more. Both locales were generated from the same `strings.py` tables and may carry the | |
| same wording quirks. | |
| - **Scale.** 100 worlds. Enough to catch a regression in an agent; not enough to rank | |
| models with tight confidence intervals. | |
| ## Links | |
| - Repository: https://github.com/poyraz-demir/closebench | |
| - PyPI: https://pypi.org/project/closebench/ (`closebench==0.1.1`) | |
| - Issues: https://github.com/poyraz-demir/closebench/issues | |
| ## Licence | |
| MIT, same as the package. See `LICENSE`. | |