Upload folder using huggingface_hub
Browse files- .gitattributes +5 -0
- README.md +134 -0
- results/all_results.json +0 -0
- test_random_fields.jsonl +3 -0
- test_seen.jsonl +3 -0
- test_unseen.jsonl +3 -0
- train.jsonl +3 -0
- validation.jsonl +3 -0
.gitattributes
CHANGED
|
@@ -58,3 +58,8 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
test_random_fields.jsonl filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
test_seen.jsonl filter=lfs diff=lfs merge=lfs -text
|
| 63 |
+
test_unseen.jsonl filter=lfs diff=lfs merge=lfs -text
|
| 64 |
+
train.jsonl filter=lfs diff=lfs merge=lfs -text
|
| 65 |
+
validation.jsonl filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
task_categories:
|
| 4 |
+
- text2text-generation
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
tags:
|
| 8 |
+
- json-repair
|
| 9 |
+
- schema-validation
|
| 10 |
+
- structured-output
|
| 11 |
+
- tool-calling
|
| 12 |
+
- agent-workflows
|
| 13 |
+
- constraint-dsl
|
| 14 |
+
size_categories:
|
| 15 |
+
- 100K<n<1M
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# StructFix-Bench
|
| 19 |
+
|
| 20 |
+
A benchmark for **schema-aware structured output recovery** — repairing broken outputs from agents, tool calls, and LLM workflows.
|
| 21 |
+
|
| 22 |
+
## What it tests
|
| 23 |
+
|
| 24 |
+
Unlike JSON syntax repair benchmarks, StructFix-Bench focuses on **semantic and schema-level recovery**:
|
| 25 |
+
|
| 26 |
+
- Replacing invalid enum values with valid ones
|
| 27 |
+
- Adding missing required fields
|
| 28 |
+
- Correcting type mismatches
|
| 29 |
+
- Recovering tool call arguments from Python syntax
|
| 30 |
+
- Reconstructing outputs from truncated agent chains
|
| 31 |
+
- Extracting JSON from markdown/text wrappers
|
| 32 |
+
|
| 33 |
+
## Dataset splits
|
| 34 |
+
|
| 35 |
+
| Split | Examples | Field names | Enums |
|
| 36 |
+
|-------|---------|-------------|-------|
|
| 37 |
+
| `train` | 200,000 | Mixed (semantic + shuffled) | Mixed (realistic + synthetic) |
|
| 38 |
+
| `validation` | 20,000 | Semantic | Realistic |
|
| 39 |
+
| `test_seen` | 10,000 | Semantic | Realistic |
|
| 40 |
+
| `test_unseen` | 10,000 | Semantic | Realistic |
|
| 41 |
+
| `test_random_fields` | 10,000 | **Random hex** (`f_8f31a7`) | Synthetic |
|
| 42 |
+
|
| 43 |
+
## Corruption types (28 total)
|
| 44 |
+
|
| 45 |
+
### Syntactic (10)
|
| 46 |
+
`single_quotes`, `unquoted_keys`, `trailing_comma`, `markdown_fences`, `extra_text_before`, `extra_text_after`, `truncated_object`, `truncated_array`, `missing_bracket`, `missing_brace`
|
| 47 |
+
|
| 48 |
+
### Semantic (9)
|
| 49 |
+
`wrong_type`, `invalid_enum`, `missing_required`, `null_required`, `extra_field`, `boolean_as_string`, `number_with_unit`, `synonym_enum`, `date_format_error`
|
| 50 |
+
|
| 51 |
+
### LLM-like (3)
|
| 52 |
+
`markdown_explanation`, `partial_structure`, `thought_process`
|
| 53 |
+
|
| 54 |
+
### Tool/Agent (6)
|
| 55 |
+
`tool_call_bad_format`, `tool_call_text_mix`, `tool_call_python_syntax`, `tool_call_partial_args`, `tool_call_wrong_param`, `agent_chain`
|
| 56 |
+
|
| 57 |
+
## Input format
|
| 58 |
+
|
| 59 |
+
Each example uses **ConstraintDSL** to represent the schema:
|
| 60 |
+
|
| 61 |
+
```
|
| 62 |
+
TASK repair_structured_output
|
| 63 |
+
|
| 64 |
+
SPEC
|
| 65 |
+
FIELD priority TYPE string VALUES low|medium|high REQUIRED yes
|
| 66 |
+
FIELD description TYPE string REQUIRED yes
|
| 67 |
+
|
| 68 |
+
BROKEN_OUTPUT
|
| 69 |
+
{"priority":"urgent"}
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
Target: `{"priority":"high","description":""}`
|
| 73 |
+
|
| 74 |
+
## Key results
|
| 75 |
+
|
| 76 |
+
| Method | Schema Success (unseen) | Schema Success (random fields) |
|
| 77 |
+
|--------|:----------------------:|:----------------------------:|
|
| 78 |
+
| json-repair | 65.2% | 64.0% |
|
| 79 |
+
| CodeT5+ + JSON Schema | 55.0% | — |
|
| 80 |
+
| **CodeT5+ + ConstraintDSL** | **96.3%** | **91.9%** |
|
| 81 |
+
|
| 82 |
+
## Schema ablation study
|
| 83 |
+
|
| 84 |
+
Full ablation results are included in `results/all_results.json`:
|
| 85 |
+
|
| 86 |
+
| DSL variant | Schema Success |
|
| 87 |
+
|------------|:--------------:|
|
| 88 |
+
| Full ConstraintDSL | 96.3% |
|
| 89 |
+
| No DSL at all | 78.4% |
|
| 90 |
+
| Dummy DSL | 75.0% |
|
| 91 |
+
| Conflicting DSL | 88.3% |
|
| 92 |
+
| Shuffled field names | 73.4% |
|
| 93 |
+
| Shuffled enum values | 89.8% |
|
| 94 |
+
| Shuffled required flags | 93.2% |
|
| 95 |
+
| Minimal DSL | 82.5% |
|
| 96 |
+
| Field names only | 72.2% |
|
| 97 |
+
|
| 98 |
+
## Known limitations
|
| 99 |
+
|
| 100 |
+
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.
|
| 101 |
+
|
| 102 |
+
## Files
|
| 103 |
+
|
| 104 |
+
- `train.jsonl` / `validation.jsonl` / `test_seen.jsonl` / `test_unseen.jsonl` / `test_random_fields.jsonl`
|
| 105 |
+
- `results/all_results.json` — all experiment results including ablations
|
| 106 |
+
|
| 107 |
+
## Each example contains
|
| 108 |
+
|
| 109 |
+
```json
|
| 110 |
+
{
|
| 111 |
+
"input": "TASK repair_structured_output\n\nSPEC\n...",
|
| 112 |
+
"target": "{\"priority\":\"high\",\"description\":\"\"}",
|
| 113 |
+
"corruption_type": "invalid_enum",
|
| 114 |
+
"schema": {"type": "object", "properties": {...}, "required": [...]},
|
| 115 |
+
"invalid_json": "{\"priority\":\"urgent\"}",
|
| 116 |
+
"error": "Field 'priority' has invalid enum value 'urgent'",
|
| 117 |
+
"target_json": "{\"priority\":\"high\",\"description\":\"\"}"
|
| 118 |
+
}
|
| 119 |
+
```
|
| 120 |
+
|
| 121 |
+
## Citation
|
| 122 |
+
|
| 123 |
+
```bibtex
|
| 124 |
+
@software{structfix_bench,
|
| 125 |
+
title = {StructFix-Bench: A Benchmark for Schema-Aware Structured Output Recovery},
|
| 126 |
+
author = {Ottema},
|
| 127 |
+
year = {2026},
|
| 128 |
+
url = {https://huggingface.co/datasets/ottema/structfix-bench}
|
| 129 |
+
}
|
| 130 |
+
```
|
| 131 |
+
|
| 132 |
+
## License
|
| 133 |
+
|
| 134 |
+
Apache-2.0
|
results/all_results.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
test_random_fields.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6832382131e946bcf2a8a555d3b48d31f9870d251700015790297de805bbc1a5
|
| 3 |
+
size 22088565
|
test_seen.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1cd41b3455c7eb2e839b02c145234553281bc26548ff6c0c998e3f72ff46ac30
|
| 3 |
+
size 22155271
|
test_unseen.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8d818c1812185d9386576d3937507dccb548b55b624d4abcbe158b55ef8ec8bb
|
| 3 |
+
size 21691682
|
train.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d91462dd071f8a42601cb2eea97098ebef05ee2a55d60d4969371e52e9ed90a6
|
| 3 |
+
size 438707655
|
validation.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fdd0cb9c11d053610413a9fe960bdadd11264b7755064efb2e0e2eccaf1d3a86
|
| 3 |
+
size 44163129
|