JSONSchemaBench:语言模型结构化输出的严谨基准
JSONSchemaBench: A Rigorous Benchmark of Structured Outputs for Language Models
AI总结:
提出JSONSchemaBench基准,含10K真实JSON模式,评估六种约束解码框架在效率、覆盖度和质量上的表现,为结构化生成提供改进方向。
摘要:
可靠地生成结构化输出已成为现代语言模型(LM)应用的关键能力。约束解码已成为各行业在生成过程中强制执行结构化输出的主导技术。尽管其应用日益广泛,但对约束解码的行为和性能的系统性评估却很少。约束解码框架已围绕JSON Schema作为结构化数据格式实现标准化,大多数用途在给定模式的情况下保证约束合规性。然而,对这些方法在实际中的有效性缺乏理解。我们提出了一个评估框架,从三个关键维度评估约束解码方法:生成符合约束输出的效率、对多样约束类型的覆盖度以及生成输出的质量。为促进此评估,我们引入了JSONSchemaBench,一个包含10K个真实世界JSON模式的约束解码基准,涵盖各种复杂度的广泛约束。我们将该基准与现有的官方JSON Schema测试套件配对,并评估六个最先进的约束解码框架,包括Guidance、Outlines、Llamacpp、XGrammar、OpenAI和Gemini。通过大量实验,我们深入了解了约束解码在真实世界JSON模式上结构化生成的能力和局限性。我们的工作为改进约束解码框架和结构化生成任务提供了可操作的见解,为评估约束解码和结构化生成设定了新标准。我们在https://github.com/guidance-ai/jsonschemabench发布了JSONSchemaBench。
英文摘要:
Reliably generating structured outputs has become a critical capability for modern language model (LM) applications. Constrained decoding has emerged as the dominant technology across sectors for enforcing structured outputs during generation. Despite its growing adoption, little has been done with the systematic evaluation of the behaviors and performance of constrained decoding. Constrained decoding frameworks have standardized around JSON Schema as a structured data format, with most uses guaranteeing constraint compliance given a schema. However, there is poor understanding of the effectiveness of the methods in practice. We present an evaluation framework to assess constrained decoding approaches across three critical dimensions: efficiency in generating constraint-compliant outputs, coverage of diverse constraint types, and quality of the generated outputs. To facilitate this evaluation, we introduce JSONSchemaBench, a benchmark for constrained decoding comprising 10K real-world JSON schemas that encompass a wide range of constraints with varying complexity. We pair the benchmark with the existing official JSON Schema Test Suite and evaluate six state-of-the-art constrained decoding frameworks, including Guidance, Outlines, Llamacpp, XGrammar, OpenAI, and Gemini. Through extensive experiments, we gain insights into the capabilities and limitations of constrained decoding on structured generation with real-world JSON schemas. Our work provides actionable insights for improving constrained decoding frameworks and structured generation tasks, setting a new standard for evaluating constrained decoding and structured generation. We release JSONSchemaBench at https://github.com/guidance-ai/jsonschemabench
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。