| --- |
| license: apache-2.0 |
| task_categories: |
| - text2text-generation |
| language: |
| - en |
| tags: |
| - json-repair |
| - schema-validation |
| - structured-output |
| - tool-calling |
| - agent-workflows |
| - constraint-dsl |
| size_categories: |
| - 100K<n<1M |
| --- |
| |
| # StructFix-Bench |
|
|
| A benchmark for **schema-aware structured output recovery** — repairing broken outputs from agents, tool calls, and LLM workflows. |
|
|
| ## What it tests |
|
|
| Unlike JSON syntax repair benchmarks, StructFix-Bench focuses on **semantic and schema-level recovery**: |
|
|
| - Replacing invalid enum values with valid ones |
| - Adding missing required fields |
| - Correcting type mismatches |
| - Recovering tool call arguments from Python syntax |
| - Reconstructing outputs from truncated agent chains |
| - Extracting JSON from markdown/text wrappers |
|
|
| ## Dataset splits |
|
|
| | Split | Examples | Field names | Enums | |
| |-------|---------|-------------|-------| |
| | `train` | 200,000 | Mixed (semantic + shuffled) | Mixed (realistic + synthetic) | |
| | `validation` | 20,000 | Semantic | Realistic | |
| | `test_seen` | 10,000 | Semantic | Realistic | |
| | `test_unseen` | 10,000 | Semantic | Realistic | |
| | `test_random_fields` | 10,000 | **Random hex** (`f_8f31a7`) | Synthetic | |
|
|
| ## Corruption types (28 total) |
|
|
| ### Syntactic (10) |
| `single_quotes`, `unquoted_keys`, `trailing_comma`, `markdown_fences`, `extra_text_before`, `extra_text_after`, `truncated_object`, `truncated_array`, `missing_bracket`, `missing_brace` |
|
|
| ### Semantic (9) |
| `wrong_type`, `invalid_enum`, `missing_required`, `null_required`, `extra_field`, `boolean_as_string`, `number_with_unit`, `synonym_enum`, `date_format_error` |
|
|
| ### LLM-like (3) |
| `markdown_explanation`, `partial_structure`, `thought_process` |
|
|
| ### Tool/Agent (6) |
| `tool_call_bad_format`, `tool_call_text_mix`, `tool_call_python_syntax`, `tool_call_partial_args`, `tool_call_wrong_param`, `agent_chain` |
|
|
| ## Input format |
|
|
| Each example uses **ConstraintDSL** to represent the schema: |
|
|
| ``` |
| TASK repair_structured_output |
| |
| SPEC |
| FIELD priority TYPE string VALUES low|medium|high REQUIRED yes |
| FIELD description TYPE string REQUIRED yes |
| |
| BROKEN_OUTPUT |
| {"priority":"urgent"} |
| ``` |
|
|
| Target: `{"priority":"high","description":""}` |
|
|
| ## Key results |
|
|
| | Method | Schema Success (unseen) | Schema Success (random fields) | |
| |--------|:----------------------:|:----------------------------:| |
| | json-repair | 65.2% | 64.0% | |
| | CodeT5+ + JSON Schema | 55.0% | — | |
| | **CodeT5+ + ConstraintDSL** | **96.3%** | **91.9%** | |
|
|
| ## Schema ablation study |
|
|
| Full ablation results are included in `results/all_results.json`: |
|
|
| | DSL variant | Schema Success | |
| |------------|:--------------:| |
| | Full ConstraintDSL | 96.3% | |
| | No DSL at all | 78.4% | |
| | Dummy DSL | 75.0% | |
| | Conflicting DSL | 88.3% | |
| | Shuffled field names | 73.4% | |
| | Shuffled enum values | 89.8% | |
| | Shuffled required flags | 93.2% | |
| | Minimal DSL | 82.5% | |
| | Field names only | 72.2% | |
|
|
| ## Known limitations |
|
|
| The benchmark uses synthetically generated schemas and corruptions. A showcase validation with 25 hand-crafted real-world examples revealed that model performance degrades when field names overlap with training vocabulary — the model may substitute field names (e.g., `action` → `active`, `contract_id` → `consign_id`). See the model card for details. |
|
|
| ## Files |
|
|
| - `train.jsonl` / `validation.jsonl` / `test_seen.jsonl` / `test_unseen.jsonl` / `test_random_fields.jsonl` |
| - `results/all_results.json` — all experiment results including ablations |
|
|
| ## Each example contains |
|
|
| ```json |
| { |
| "input": "TASK repair_structured_output\n\nSPEC\n...", |
| "target": "{\"priority\":\"high\",\"description\":\"\"}", |
| "corruption_type": "invalid_enum", |
| "schema": {"type": "object", "properties": {...}, "required": [...]}, |
| "invalid_json": "{\"priority\":\"urgent\"}", |
| "error": "Field 'priority' has invalid enum value 'urgent'", |
| "target_json": "{\"priority\":\"high\",\"description\":\"\"}" |
| } |
| ``` |
|
|
| ## Citation |
|
|
| ```bibtex |
| @software{structfix_bench, |
| title = {StructFix-Bench: A Benchmark for Schema-Aware Structured Output Recovery}, |
| author = {Ottema}, |
| year = {2026}, |
| url = {https://huggingface.co/datasets/ottema/structfix-bench} |
| } |
| ``` |
|
|
| ## License |
|
|
| Apache-2.0 |
|
|