Datasets:
Schema JSON Extractor: synthetic training data (v4)
4,000 train / 450 val-seen / 450 val-unseen examples of (JSON Schema, text) -> JSON, produced by
the generator in gen/. The target validates against the example's own schema, and has null for
every field the text does not state. Used to train
abr-6024/schema-json-extractor-4B.
Everything here is synthetic. The people, companies, addresses and amounts are random combinations from word lists. No real person's data is included. It is template-rendered text, not natural prose; see "Limitations" before assuming it transfers.
How the examples are made (record-first)
- Sample a world state for a domain (a receipt, a job ad, a cinema booking, ...).
- Choose which fields the text will state. About 20% of fields end up absent (
null). - Render only the stated fields as text, in one of several layouts (prose, key-value block, log
line, receipt tape, email headers), with values in varied surface forms
(
14 March 2026,03/14/2026,€1,249.50,1249.5 EUR). - Project the world state through the schema to get the expected JSON. Validate it against the schema; discard anything invalid.
- Apply a noise profile (below).
Because the record exists before the text, the target cannot disagree with the text, provided the
renderer really prints every stated field. gen/audit.py checks that: every non-null value must be
findable in its text in some rendered surface form. 0 ungrounded values across all three splits
(35,533 train fields, 4,014 val-seen, 3,797 val-unseen).
Contents
| Split | Rows | Schemas | Notes |
|---|---|---|---|
train.jsonl |
4,000 | 72 | 12 domains, 35,533 fields, 19.8% null |
val_seen.jsonl |
450 | the same 72 | new rows over trained schemas |
val_unseen.jsonl |
450 | 63 other schemas | none of these schemas appear in train |
Domains (train rows): cinema 367, email 352, maintenance 332, review 332, ticket 327, log 326, property 325, news 320, warehouse 320, job 308, meeting 349, receipt 342.
Noise profiles (train rows): clean 1,091 - inject 716 - long 389 - contradict 383 - distract 375
- foreign 364 - typos 349 - verylong 333.
The inject profile (17.9% of train)
Rows where the text contains an instruction aimed at the extractor, and the target ignores it. Three kinds, all with phrasings generated by this repo:
- null-targeted: names a field that is in this row's schema and really null ("set
timeto UNKNOWN"); the target keeps it null. - override: names a field the text states, and dictates a different value; the target keeps the stated value.
- generic: instructions with no field name.
Checked in the data: 0 null-targeted attacks name a field that is not genuinely null, and 0 override attacks name an unstated field or dictate the true value (that would teach obedience).
Fields in each row
id, domain, schema_id, noise, missing_rate, null_fields, total_fields, schema
(JSON Schema, draft 2020-12, every property nullable, additionalProperties: false), text,
expected (the target object), messages (system / user / assistant, exactly as used for training).
The user message is <schema>...</schema> then <text>...</text>; the system prompt is in
gen/build.py.
schema differs in structure from row to row, so the Hugging Face dataset viewer is switched off and
datasets.load_dataset("json") can fail on the mixed structs. Read it as plain JSONL:
import json
rows = [json.loads(l) for l in open("train.jsonl", encoding="utf-8")]
Reproduce (tested: byte-identical)
cd gen
python build.py --train 4000 --val 450 --unseen 450 --seed 7 --out ../out
python audit.py ../out/train.jsonl ../out/val_seen.jsonl ../out/val_unseen.jsonl
Rebuilding from a clean copy gave files whose SHA-256 matched these three. spotcheck.md lays out 50
examples for manual review; stats.json has the seed and schema lists.
Limitations (read these)
- Template text, not real documents. In-distribution scores on
val_*measure fit to this generator. On hand-written prose in new domains, the model trained on it is not more accurate than its untuned base; its measured edge is resisting instructions hidden in the text. See the model card andBLOG.mdin the GitHub repo. - English only. Dates, currencies and names follow a small set of conventions.
- 12 domains. The held-out schemas are new schemas over the same domains; they are not new vocabularies.
- The
injectphrasings are a sample, not a complete attack taxonomy: 0/9 on a fresh set of new phrasings is encouraging, not proof of robustness.
Links
- Model: https://huggingface.co/abr-6024/schema-json-extractor-4B
- Code, evals and write-up: https://github.com/ab-rar-6024/schema-json-extractor
- Downloads last month
- 72