Why Does Structured Output Fail? An Empirical Study of Prompt-Enforced Pydantic Schemas Across Nine LLMs
Not on the map. Why?
Abstract (arXiv)
Pipelines that require structured outputs from hosted language models often specify a Pydantic schema in the prompt, validate the response, and retry when validation fails. Although native structured-output modes provide an alternative, application-side validation remains important for enforcing custom constraints. Yet pipeline reliability is often summarized by a single validity rate, which obscures why outputs fail and which interventions may help. We introduce a fine-grained taxonomy of schema-conformance failures and a deterministic classifier that assigns failure categories from model responses and Pydantic validation errors. We apply this framework to 3,997 generation attempts across nine OpenAI and Anthropic model/API configurations, using questions from HotpotQA and FinanceBench. Our results show that similar validity rates can mask different failure patterns, and that dominant failure categories vary with schema constraints and task. Markdown-fenced JSON is the most common failure: among 681 fenced failures, only 48.0% pass validation after fence removal, while the remainder conceal additional violations, predominantly field-length violations. In an exploratory prompt ablation, variants that suppress fences appear to shift failures toward length violations, but the shift is consistent with exposing violations that were already present, illustrating how aggregate validity rates can obscure changes in failure composition. We derive four engineering practices for validator, schema, retry and evaluation design, three supported by our data and one, on retry feedback, proposed but not tested, and release the classifier, completions, and annotations.
Key facts. No citing papers in the map yet (data through 26 Nov 2026). Builds on 16 of its 23 references that are in the map. Submitted 24 Oct 2026.
Builds on
16 of 23 references.
References · 16
- 2018HotpotQA: A Dataset for Diverse, Explainable Multi-hop Question Answeringcited by 3,986
- 2023Instruction-Following Evaluation for Large Language Modelscited by 1,433
- 2023Large Language Models Cannot Self-Correct Reasoning Yetcited by 1,170
- 2025Why Do Multi-Agent LLM Systems Fail?cited by 703
- 2023Large Language Models for Software Engineering: A Systematic Literature Reviewcited by 424
- 2023FinanceBench: A New Benchmark for Financial Question Answeringcited by 312
- 2023Efficient Guided Generation for Large Language Modelscited by 244
- 2019Taxonomy of Real Faults in Deep Learning Systemscited by 100
- 2024FOFO: A Benchmark to Evaluate LLMs' Format-Following Capabilitycited by 88
- 2025JSONSchemaBench: A Rigorous Benchmark of Structured Outputs for Language Modelscited by 86
- 2024SPADE: Synthesizing Data Quality Assertions for Large Language Model Pipelinescited by 22
- 2024Prompts Are Programs Too! Understanding How Developers Build Software Containing Promptscited by 20
4 more
- 2026ExtractBench: A Benchmark and Evaluation Methodology for Complex Structured Extractioncited by 12
- 2026LLMStructBench: Benchmarking Large Language Model Structured Data Extractioncited by 7
- 2026The Structured Output Benchmark: A Multi-Source Benchmark for Evaluating Structured Output Quality in Large Language Modelscited by 6
- 2026Paraphrase-Induced Output-Mode Collapse: When LLMs Break Character Under Semantically Equivalent Inputscited by 1
Built on by
Not cited yet.