JSONSchemaBench

June 12, 2025 Β· View on GitHub

ArXiv Hugging Face

Reliably generating structured outputs is a key capability for modern LLM applications. Despite its growing adoption, a systematic evaluation of structured output generation is still lacking. With JSON Schema emerging as the standard format for structured data, we introduce JSONSchemaBench a benchmark of around 10,000 real-world JSON schemas that capture a wide range of constraints and complexities. JSONSchemaBench helps to measure efficiency and coverage of a given structured output engine.


Figure 1: Comparison across various constrained-decoding frameworks by efficiency (speed of output generation), coverage (support for JSON Schema features), and quality (effects on underlying task accuracy).

πŸ”” News

– JSONSchemaBench is now supported in the EleutherAI/lm-evaluation-harness!
While originally designed to benchmark the performance of constrained decoding engines, JSONSchemaBench can also be used to assess an LLM's native ability to generate structured outputs that conform to a given JSON schema β€” without any constrained decoding. We also have a leaderboard to track the πŸ“Š Benchmark results for several popular models

JsonSchemaBench

Visit epfl-dlab/jsonschemabench for the codebase of JSONSchemaBench.

MaskBench

On top of JSONSchemaBench's view on real world JSON schema, we also develop a purely performance-oriented benchmark MaskBench targeting mask computation times. This benchmark emphasizes results relevant to server-side deployments of constrained decoding.


Figure 2: Isolated performance of token mask computation (for server-side scenarios). See MaskBench folder.

Dataset Details

JSONSchemaBench is built from a collection of real-world JSON schemas drawn from diverse sources, including GitHub, Kubernetes configurations, and API specifications. The benchmark consists of schemas categorized into datasets based on complexity and domain. We start from collections from json-schema-corpus and did heavy curation to ensure the schemas are standard-compliant and satisfiable. We also added schemas from other sources to increase the diversity of the benchmark, such as GlaiveAI function call schemas and kubernetes schemas. We then categorized the schemas into datasets based on complexity and domain. The datasets are as follows:

DatasetCategoryCount
GlaiveAI-2KFunction Call1707
Github-TrivialMisc444
Github-EasyMisc1943
SnowplowOperational API403
Github-MediumMisc1976
KubernetesKubernetes API1064
Washington PostResource Access API125
Github-HardMisc1240
JSONSchemaStoreMisc492
Github-UltraMisc164
Total9558

For statistics on the datasets and an overview of schema constraint features, please refer to the paper(link coming soon).

View Statistics on the Datasets

πŸ“₯ Accessing the Dataset on Hugging Face

JSONSchemaBench is now available on the Hugging Face Hub. You can load it directly using the datasets library:

from datasets import load_dataset

dataset = load_dataset("epfl-dlab/JSONSchemaBench")
print(dataset)  

Each dataset split contains:

  • "json_schema": The schema definition.
  • "unique_id": A unique identifier for the schema.

Data files

data
β”œβ”€β”€ Github_easy
β”œβ”€β”€ Github_hard
β”œβ”€β”€ Github_medium
β”œβ”€β”€ Github_trivial
β”œβ”€β”€ Github_ultra
β”œβ”€β”€ Glaiveai2K
β”œβ”€β”€ JsonSchemaStore
β”œβ”€β”€ Kubernetes
β”œβ”€β”€ Snowplow
└── WashingtonPost

JSON Schema Test Suite

For more details about the JSON Schema Test Suite used in the paper, visit the official repository. The results of the test suite coverage are shown below

View Test Suite Coverage

Feature Checklist

We provide a feature checklist for each Structured Output Generation Engine based on their documentation and implementation. This provides a comprehensive overview of the supported JSON Schema features.

View Feature Checklist

Citation

@misc{geng2025jsonschemabench,
      title={Generating Structured Outputs from Language Models: Benchmark and Studies}, 
      author={Saibo Geng and Hudson Cooper and MichaΕ‚ Moskal and Samuel Jenkins and Julian Berman and Nathan Ranchin and Robert West and Eric Horvitz and Harsha Nori},
      year={2025},
      eprint={2501.10868},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2501.10868}, 
}