Datasets:

Modalities:
Text
Formats:
parquet
ArXiv:
Libraries:
Datasets
pandas
License:
File size: 5,115 Bytes
2f848b3
e2ee5fd
2f848b3
14ad65d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19d4e4f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2f848b3
 
 
f17975c
 
2f848b3
 
02800cf
2f848b3
 
02800cf
 
2f848b3
02800cf
 
48a199a
02800cf
 
48a199a
02800cf
2f14ffa
48a199a
02800cf
2f14ffa
48a199a
02800cf
2f14ffa
48a199a
02800cf
 
e6f8b5e
02800cf
2f14ffa
d3dbc27
02800cf
 
 
 
2f848b3
14ad65d
 
 
 
 
 
 
 
19d4e4f
 
 
 
 
 
 
 
2f848b3
 
 
 
 
 
 
 
48a199a
 
 
 
 
 
 
 
 
 
e6f8b5e
 
d3dbc27
 
e2ee5fd
 
 
2f848b3
84fef18
7f2f107
84fef18
e2ee5fd
 
84fef18
7f2f107
84fef18
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
---
pretty_name: J
dataset_info:
- 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: WashingtonPost
    num_bytes: 2710348
    num_examples: 125
  - name: Snowplow
    num_bytes: 1613804
    num_examples: 403
  - name: Kubernetes
    num_bytes: 25623424
    num_examples: 1064
  - name: Github_trivial
    num_bytes: 780060
    num_examples: 444
  - name: Github_easy
    num_bytes: 1980784
    num_examples: 1943
  - name: Github_medium
    num_bytes: 7994298
    num_examples: 1976
  - name: Github_hard
    num_bytes: 20240875
    num_examples: 1240
  - name: Github_ultra
    num_bytes: 12235981
    num_examples: 164
  - name: JsonSchemaStore
    num_bytes: 22195651
    num_examples: 492
  - name: Glaiveai2K
    num_bytes: 1440707
    num_examples: 1707
  download_size: 19019152
  dataset_size: 96815932
configs:
- 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: WashingtonPost
    path: data/WashingtonPost-*
  - split: Snowplow
    path: data/Snowplow-*
  - split: Kubernetes
    path: data/Kubernetes-*
  - split: Github_trivial
    path: data/Github_trivial-*
  - split: Github_easy
    path: data/Github_easy-*
  - split: Github_medium
    path: data/Github_medium-*
  - split: Github_hard
    path: data/Github_hard-*
  - split: Github_ultra
    path: data/Github_ultra-*
  - split: JsonSchemaStore
    path: data/JsonSchemaStore-*
  - split: Glaiveai2K
    path: data/Glaiveai2K-*
license: mit
task_categories:
- text-generation
---

# JSONSchemaBench

[![Paper](https://img.shields.io/badge/Paper-arXiv-blue)](https://arxiv.org/abs/2501.10868)
[![GitHub](https://img.shields.io/badge/Code-GitHub-blue)](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.

## 📌 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.