Datasets:
File size: 11,351 Bytes
2f848b3 e2ee5fd 2f848b3 3155702 f50f4d3 3155702 f50f4d3 3155702 bb31bba 83df923 bb31bba 8e70ecf 700286c 8e70ecf 700286c 8e70ecf 700286c a92d43a 06cfa01 a92d43a 06cfa01 a92d43a 06cfa01 1f7569e 3d8dd61 34f1f0f e0d6002 db37cfd 14ad65d 19d4e4f 2f848b3 f17975c 2f848b3 7d5c73d d863dde 7d5c73d d863dde 7d5c73d d863dde 2f848b3 3155702 8e70ecf a92d43a 1f7569e 3d8dd61 34f1f0f e0d6002 db37cfd 14ad65d 19d4e4f 2f848b3 7d5c73d e2ee5fd 2f848b3 84fef18 7f2f107 84fef18 e2ee5fd 84fef18 7f2f107 84fef18 aba52f7 5bd0f46 aba52f7 5ba58f8 7f2f107 84fef18 7f2f107 84fef18 7f2f107 84fef18 7f2f107 84fef18 7f2f107 84fef18 7f2f107 84fef18 7f2f107 84fef18 7f2f107 42f9ff9 84fef18 7f2f107 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 |
---
pretty_name: J
dataset_info:
- config_name: Github_easy
features:
- name: json_schema
dtype: string
- name: unique_id
dtype: string
splits:
- name: train
num_bytes: 1208636
num_examples: 1170
- name: val
num_bytes: 182688
num_examples: 191
- name: test
num_bytes: 539656.0
num_examples: 577
download_size: 540610
dataset_size: 1930980.0
- config_name: Github_hard
features:
- name: json_schema
dtype: string
- name: unique_id
dtype: string
splits:
- name: train
num_bytes: 12816152
num_examples: 746
- name: val
num_bytes: 1607525
num_examples: 122
- name: test
num_bytes: 5754647.483870967
num_examples: 368
download_size: 3562146
dataset_size: 20178324.48387097
- config_name: Github_medium
features:
- name: json_schema
dtype: string
- name: unique_id
dtype: string
splits:
- name: train
num_bytes: 4990832
num_examples: 1189
- name: val
num_bytes: 557390
num_examples: 194
- name: test
num_bytes: 2417201.5784148397
num_examples: 586
download_size: 1580336
dataset_size: 7965423.57841484
- config_name: Github_trivial
features:
- name: json_schema
dtype: string
- name: unique_id
dtype: string
splits:
- name: train
num_bytes: 467333.24324324325
num_examples: 266
- name: val
num_bytes: 77303.24324324324
num_examples: 44
- name: test
num_bytes: 235423.51351351352
num_examples: 134
download_size: 158044
dataset_size: 780060.0
- config_name: Github_ultra
features:
- name: json_schema
dtype: string
- name: unique_id
dtype: string
splits:
- name: train
num_bytes: 7311744.743902439
num_examples: 98
- name: val
num_bytes: 1193754.243902439
num_examples: 16
- name: test
num_bytes: 3730482.012195122
num_examples: 50
download_size: 2221455
dataset_size: 12235981.0
- config_name: Glaiveai2K
features:
- name: json_schema
dtype: string
- name: unique_id
dtype: string
splits:
- name: train
num_bytes: 865943.3989455184
num_examples: 1026
- name: val
num_bytes: 141791.9015817223
num_examples: 168
- name: test
num_bytes: 432971.6994727592
num_examples: 513
download_size: 284264
dataset_size: 1440707.0
- config_name: JsonSchemaStore
features:
- name: json_schema
dtype: string
- name: unique_id
dtype: string
splits:
- name: train
num_bytes: 13308367.977642277
num_examples: 295
- name: val
num_bytes: 2210542.4776422763
num_examples: 49
- name: test
num_bytes: 6676740.544715447
num_examples: 148
download_size: 4019966
dataset_size: 22195651.0
- config_name: Kubernetes
features:
- name: json_schema
dtype: string
- name: unique_id
dtype: string
splits:
- name: train
num_bytes: 15388503.69924812
num_examples: 639
- name: val
num_bytes: 2528627.3684210526
num_examples: 105
- name: test
num_bytes: 7706292.932330827
num_examples: 320
download_size: 6819424
dataset_size: 25623424.0
- config_name: Snowplow
features:
- name: json_schema
dtype: string
- name: unique_id
dtype: string
splits:
- name: train
num_bytes: 969083.2952853598
num_examples: 242
- name: val
num_bytes: 160179.0570719603
num_examples: 40
- name: test
num_bytes: 484541.6476426799
num_examples: 121
download_size: 298277
dataset_size: 1613804.0
- config_name: WashingtonPost
features:
- name: json_schema
dtype: string
- name: unique_id
dtype: string
splits:
- name: train
num_bytes: 1604526.016
num_examples: 74
- name: val
num_bytes: 281876.192
num_examples: 13
- name: test
num_bytes: 823945.792
num_examples: 38
download_size: 565170
dataset_size: 2710348.0
- config_name: default
features:
- name: json_schema
dtype: string
- name: unique_id
dtype: string
splits:
- name: train
num_bytes: 54520620
num_examples: 5754
- name: val
num_bytes: 15255546
num_examples: 937
- name: test
num_bytes: 27031812.394351464
num_examples: 2867
download_size: 20765998
dataset_size: 96807978.39435147
configs:
- config_name: Github_easy
data_files:
- split: train
path: Github_easy/train-*
- split: val
path: Github_easy/val-*
- split: test
path: Github_easy/test-*
- config_name: Github_hard
data_files:
- split: train
path: Github_hard/train-*
- split: val
path: Github_hard/val-*
- split: test
path: Github_hard/test-*
- config_name: Github_medium
data_files:
- split: train
path: Github_medium/train-*
- split: val
path: Github_medium/val-*
- split: test
path: Github_medium/test-*
- config_name: Github_trivial
data_files:
- split: train
path: Github_trivial/train-*
- split: val
path: Github_trivial/val-*
- split: test
path: Github_trivial/test-*
- config_name: Github_ultra
data_files:
- split: train
path: Github_ultra/train-*
- split: val
path: Github_ultra/val-*
- split: test
path: Github_ultra/test-*
- config_name: Glaiveai2K
data_files:
- split: train
path: Glaiveai2K/train-*
- split: val
path: Glaiveai2K/val-*
- split: test
path: Glaiveai2K/test-*
- config_name: JsonSchemaStore
data_files:
- split: train
path: JsonSchemaStore/train-*
- split: val
path: JsonSchemaStore/val-*
- split: test
path: JsonSchemaStore/test-*
- config_name: Kubernetes
data_files:
- split: train
path: Kubernetes/train-*
- split: val
path: Kubernetes/val-*
- split: test
path: Kubernetes/test-*
- config_name: Snowplow
data_files:
- split: train
path: Snowplow/train-*
- split: val
path: Snowplow/val-*
- split: test
path: Snowplow/test-*
- config_name: WashingtonPost
data_files:
- split: train
path: WashingtonPost/train-*
- split: val
path: WashingtonPost/val-*
- split: test
path: WashingtonPost/test-*
- config_name: default
data_files:
- split: train
path: data/train-*
- split: val
path: data/val-*
- split: test
path: data/test-*
license: mit
task_categories:
- text-generation
---
# JSONSchemaBench
[](https://arxiv.org/abs/2501.10868)
[](https://github.com/guidance-ai/jsonschemabench)
JSONSchemaBench is a benchmark of **real-world JSON schemas** designed to evaluate **structured output generation** for Large Language Models (LLMs). It contains approximately **10,000 JSON schemas**, capturing diverse constraints and complexities.
```python
import datasets
from datasets import load_dataset
def main():
# Inspect the available subsets of the dataset
all_subsets = datasets.get_dataset_config_names("epfl-dlab/JSONSchemaBench")
print("Available subsets:", all_subsets)
# Example output: ['Github_easy', 'Github_hard', 'Github_medium', 'Github_trivial', 'Github_ultra', 'Glaiveai2K', 'JsonSchemaStore', 'Kubernetes', 'Snowplow', 'WashingtonPost', 'default']
# Access a specific subset of the dataset
subset_name = "Github_easy"
github_easy = load_dataset("epfl-dlab/JSONSchemaBench", subset_name)
print(f"Loaded subset '{subset_name}':", github_easy)
# Load the entire dataset as a whole
entire_dataset = load_dataset("epfl-dlab/JSONSchemaBench", "default")
print("Loaded entire dataset:", entire_dataset)
if __name__ == "__main__":
main()
```
## Update (March 31st, 2025)
To improve inference efficiency and streamline data collation, weβve decided to drop a small number of exceptionally long samples from the dataset.
Weβre using the `meta-llama/Llama-3.2-1B-instruct` tokenizer, and the filtering criteria are as follows:
- Github_easy: Samples longer than 1024 tokens β 5 out of 582 removed
- Github_medium: Samples longer than 2048 tokens β 7 out of 593 removed
- Github_hard: Samples longer than 8192 tokens β 4 out of 372 removed
- Other subsets are not touched
Since the number of discarded samples is minimal, this change is expected to have at most a 1% impact on results.
## β οΈ Important Update (March 10th, 2025)
We have restructured the dataset to include train/val/test splits. If you downloaded the dataset before this date, you might encounter errors like `KeyError: 'Github_easy'`.
To fix this issue, please follow one of the options below:
1. Update How Subsets Are Accessed:
If you previously used:
```python
from datasets import load_dataset, concatenate_datasets, DatasetDict, Dataset
subset: DatasetDict = load_dataset("epfl-dlab/JSONSchemaBench")
subset["Github_easy"]
```
You can update it to:
```python
from datasets import load_dataset, concatenate_datasets, DatasetDict, Dataset
subset: DatasetDict = load_dataset("epfl-dlab/JSONSchemaBench", name="Github_easy")
subset: Dataset = concatenate_datasets([subset["train"], subset["val"], subset["test"]])
```
2. Load the Dataset in the Old Structure:
If you need the previous structure, you can use a specific revision:
```python
dataset = load_dataset("epfl-dlab/JSONSchemaBench", revision="e2ee5fdba65657c60d3a24b321172eb7141f8d73")
```
We apologize for the inconvenience and appreciate your understanding! π
## π Dataset Overview
- **Purpose:** Evaluate the **efficiency** and **coverage** of structured output generation.
- **Sources:** GitHub, Kubernetes, API specifications, curated collections.
- **Schemas:** Categorized based on complexity and domain.
### π Dataset Breakdown
| Dataset | Category | Count |
| --------------- | ------------------- | ----- |
| GlaiveAI-2K | Function Call | 1707 |
| Github-Trivial | Misc | 444 |
| Github-Easy | Misc | 1943 |
| Snowplow | Operational API | 403 |
| Github-Medium | Misc | 1976 |
| Kubernetes | Kubernetes API | 1064 |
| Washington Post | Resource Access API | 125 |
| Github-Hard | Misc | 1240 |
| JSONSchemaStore | Misc | 492 |
| Github-Ultra | Misc | 164 |
| **Total** | | 9558 |
## π₯ Loading the Dataset
```python
from datasets import load_dataset
dataset = load_dataset("epfl-dlab/JSONSchemaBench")
print(dataset)
```
## π Data Structure
Each dataset split contains:
- `"json_schema"`: The schema definition.
- `"unique_id"`: A unique identifier for the schema.
π **For more details, check out the [paper](https://arxiv.org/abs/2501.10868).**
## π Citation
```bibtex
@misc{geng2025jsonschemabench,
title={Generating Structured Outputs from Language Models: Benchmark and Studies},
author={Saibo Geng et al.},
year={2025},
eprint={2501.10868},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2501.10868}
}
```
## License
This dataset is provided under the [MIT License](https://opensource.org/licenses/MIT). Please ensure that you comply with the license terms when using or distributing this dataset.
## Acknowledgements
We would like to thank the contributors and maintainers of the JSON schema projects and the open-source community for their invaluable work and support. |