Manuscript Offprint
arXiv:2610.33949Why Does Structured Output Fail? An Empirical Study of Prompt-Enforced Pydantic Schemas Across Nine LLMs
Abstract
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.
Keywords: Large language models, Structured output, Schema validation, Pydantic, Failure taxonomy, Empirical study
1 Introduction
A practitioner building an entity-extraction pipeline needs canonical identifiers and writes an unremarkable constraint: ~[a-z][a-z0-9_]{2,30}$, a 3-31-character lowercase identifier beginning with a letter and containing letters, digits, or underscores. Asked for the identifier of an entity whose name is a street address, a GPT-5.6 model in our study returns 888_7th_avenue. The rendering is faithful to the name and fails the anchor ~[a-z]. A conforming identifier exists (building_888_7th_avenue), but the task does not specify which conforming normalisation to use.
Under the evaluation practice common for structured output, this failure is indistinguishable from a model that emitted no JSON, a model that returned the schema definition instead of an instance, and a model that produced a conformant object inside a markdown fence. All four increment the same counter, although they have different causes and call for different remedies.
Constrained decoding and vendor structured-output modes prevent many syntactic failures, but they do not remove the need to validate and repair. Support for JSON Schema features varies between implementations (Geng et al. 2025), and Pydantic model validators, such as cross-field agreement and membership checks, have no JSON Schema counterpart and cannot be enforced at decoding time. A pipeline that must run across vendors, model generations, or endpoints therefore keeps the schema in the prompt and validates afterwards, and its validate-and-retry loop stays in place even where decoding is constrained. How that loop fails is an engineering question, and a single validity rate cannot answer it.
We treat failure diagnosis as part of pipeline design. A validation log records whether an output passed and the errors Pydantic raised for it. That record does not separate a formatting failure from a schema violation it may hide, does not say whether a pattern violation came from the character class or from a length ceiling written into the pattern, and does not say whether a change to the prompt or schema removed a failure or exposed one that was already present. Each distinction changes what an engineer should fix: the parser, the schema, the retry feedback, or the way the pipeline is evaluated.
We study the prompt-and-validate paradigm: the schema is stated in the prompt, the completion is validated with Pydantic, and failures are retried with the validation error appended. We do not evaluate constrained decoding (Section 2). We ask three questions.
RQ1 Do configurations with similar failure rates fail in the same way?
RQ2 Does a failure profile stay stable when the schema's constraints or the task domain change?
RQ3 What do formatting failures conceal, and how does that change the reading of repairs and prompt ablations?
We define a taxonomy of conformance failures, assign each failing attempt a category with a deterministic classifier, and apply it to 3,997 attempts across 18 configurations of nine models from two vendors, one baseline schema and two targeted variants, and two task domains. A configuration is a model endpoint called through its vendor's
API with the request parameters in Appendix A, so comparisons are between these configurations, not between model capabilities in general.
The answer to all three questions is that the validity rate hides what an engineer needs. Configurations with overlapping failure rates fall into four profiles defined by their dominant category (RQ1). Raising length caps changes which category dominates for the same model, and revalidating the same stored outputs against the relaxed schema shows that the caps alone account for the removed length violations; the same model also shows different profiles on the two domains (RQ2). Only 48.0% of fenced failures validate once the fence is removed. The rest conceal a length or pattern violation that the returned parse error never mentions, and ignoring this makes a prompt ablation appear to move failures from one mode to another (RQ3).
-
A reproducible diagnostic taxonomy and deterministic classifier, with an explicit precedence rule, a development check and a pre-registered, blind held-out check against human labels, and released code that relabels the corpus from stored completions (Section 3.3).
-
Evidence that visible formatting failures conceal underlying violations: the parse error returned for a fenced output never names the violation beneath it, and ignoring concealment misreads both repair loops and prompt ablations (Section 4.4).
-
Targeted schema interventions that separate failure causes: an offline revalidation that holds model output fixed attributes the removed length violations to the relaxed caps, and in a small, unmatched comparison, loosening an identifier's character class was followed by no leading-digit violations while the length overflow encoded in the same pattern remained (Section 4.3).
-
Engineering guidance for validator, schema, retry and evaluation design, each practice tied to the finding that supports it (Section 5).
The results across the nine model configurations (Sections 4.1 and 4.2) are the evidence base for these contributions, not a ranking of models: similar failure rates hide different failure profiles, which is why a single rate cannot guide the design decisions above.
Artifact
The classifier, harness, locked results database, raw completions, annotations, and the scripts that regenerate every table and figure are available at https://github.com/amitvermaknw/schema-enforcement; the version described in this paper (release emse-submission) is archived at https://doi.org/10.5281/zenodo.23586834 (see also the Statements and Declarations).
2 Related Work
Constrained decoding and the scope of this study.
The main technical alternative to prompt enforcement is constrained decoding, which masks tokens so that only grammar-conformant continuations remain. Willard and Louf (2023) compile regular expressions into finite-state machines and Dong et al. (2025) use pushdown automata for context-free grammars; Geng et al. (2025) evaluate six frameworks over ten thousand real-world JSON Schemas and find that support for schema features varies substantially between implementations. Our exclusion of this paradigm is a statement about what is deployed, not about what is enforceable: character classes, string lengths and enumerations are expressible in these formalisms, and we make no claim that decoder enforcement could not prevent the failures we report. Vendor structured-output facilities are excluded for the same reason. They differ by vendor and version in how, and how strictly, they enforce a schema, and none is the prompt-only configuration we study.
Structured-output benchmarks
Tenckhoff et al. (2026) evaluate open-weight models, with GPT-4o as a closed-weight reference, under five prompting configurations on email-to-JSON extraction. Four of the five set the inference API's format parameter, to json or to a JSON Schema, and so add API-level enforcement; only their prompt-only condition is comparable to ours. They recover JSON from surrounding text as preprocessing, which makes wrapping visible in their pipeline but not a category. Singh et al. (2026) also draw on HotpotQA but score value accuracy behind a binary schema gate, grouping conformance failures into parse failures and schema violations rather than distinguishing them further. Ferguson et al. (2026) score extracted values against gold labels with field-dependent correctness. Their unit is the fidelity of a value; ours is the conformance failure, and we do not evaluate whether extracted content is correct.
Format adherence
Liu and Meng (2026) show that content-preserving paraphrases can push a model out of a requested response mode into conversational prose even at temperature zero, the phenomenon our prose_preamble and markdown_wrap categories measure under a schema. Xia et al. (2024) and Zhou et al. (2023) measure format-following separately from content quality, and Tam et al. (2024) find that format restrictions degrade reasoning even when parse errors are rare. Their question is what adherence costs; ours is how adherence fails.
Repair and failure taxonomies
Huang et al. (2024) find that self-correction without an external signal does not reliably improve reasoning. A Pydantic validation error is an external, localised signal naming the field and constraint, so our repair loop is not intrinsic self-correction. Cemri et al. (2025) build an empirically grounded taxonomy of multi-agent system failures validated by multiple annotators. We work at the level of a single node attempt, with categories assigned by deterministic predicates and human labels used only to check the classifier.
Software-engineering perspective
A Pydantic schema applied to a model's reply is a runtime contract in the sense of design by contract (Meyer 1992): a postcondition checked at a component boundary. What changes with a language-model component is the response to a violation. The component cannot be corrected, only re-invoked, so the information the contract check returns becomes the input to the next attempt, and its diagnostic content matters for repair as well as for reporting. Prompts in such systems are themselves software artifacts: Liang et al. (2025) find that developers treat prompts as programs but build them less systematically than code, and the literature review of Hou et al. (2024) catalogues the use of language models across software-engineering tasks. Closest to our setting, Shankar et al. (2024) synthesize data-quality assertions for language model pipelines from a developer's prompt history; their question is which checks to write, ours is how to read the failures a fixed set of checks reports. Fault taxonomies are an established empirical instrument; Humbatova et al. (2020) derive one for real faults in deep learning systems. Our taxonomy is narrower and operational, assigned by deterministic predicates to runtime conformance failures rather than by annotators to reported faults. On diagnosis, Yuan et al. (2012) find that developers often do not get log messages right the first time and later spend effort revising them. A parse error recorded for a fenced output raises a related problem: the record is accurate but omits the violation an engineer would need to act on (Section 4.4).
Relation to extract-then-validate practice
A common engineering response to these failures is to extract the first JSON object from the completion, validate it, and report syntax errors separately from schema errors. As usually reported, that split is coarser than ours in two ways that matter for the results below. When only the post-extraction result is kept, a fenced payload that also violates a length cap counts as a schema error and the extraction status is lost, so wrapper-constraint co-occurrence is not recorded (Section 4.4); and when schema errors are reported as one class, a pattern violation caused by length cannot be told from one caused by the character class (Section 4.3). A pipeline that retains both is doing the layered analysis of Section 4.4; what we add is evidence that discarding either changes the conclusions drawn. Our categories refine the schema-error class and keep the formatting layer visible beneath it. The contribution is therefore not a finer error vocabulary on its own. It is keeping both the visible formatting failure and the schema violation beneath it, and showing on one corpus that discarding either changes an engineering conclusion: counting fence removal as a repair would report the compound remainder as solved (Section 4.4), reading primary labels alone makes a prompt ablation appear to move failures between modes (Section 4.4), and a single schema-error class hides that loosening a character class leaves a length overflow encoded in the same pattern untouched (Section 4.3).
3 Study Design
3.1 Pipeline, schemas and enforcement
Figure 1 summarises the design. Each run processes one question through a three-node sequential pipeline. identify extracts entities with canonical identifiers and types and designates a primary entity; gather produces facts keyed to those identifiers with a coverage summary; answer returns the answer, a numeric confidence, its categorical bucket and supporting identifiers. Each node has its own Pydantic model. The system prompt states the schema and asks for JSON only; the completion is validated with model_validate_json in Pydantic's default lax mode (type coercion allowed, extra fields ignored; no model sets model_config); on failure the node is retried with the validation error appended, up to three further times. An attempt is one generation against one node's schema, including retries, so attempts per run vary with failure rate: on HotpotQA, from 3.04 for Opus 4.8 to 7.96 for Haiku 4.5.
The medium schema tier carries the constraints analysed throughout: the identifier pattern ~[a-z][a-z0-9_]{2,30}, keeping the 31-character ceiling, rewords the canonical_id description to match, and is run on gpt-5.6-sol and gpt-5.6-terra only. The design is therefore not fully crossed; Appendix A lists every cell.
3.2 Models, data and reporting basis
Nine models from two vendors: gpt-4o, gpt-4o-mini, gpt-5.6-luna, gpt-5.6-sol, gpt-5.6-terra, claude-haiku-4-5-20251001, claude-sonnet-4-6, claude-sonnet-5 and claude-opus-4-8, all called through the vendors' own APIs between 2026-08-09 and 2026-08-28. Only the Haiku request names a dated snapshot; the two gpt-4o models resolved to dated snapshots, and the remaining endpoints returned the requested alias, which identifies the endpoint but not an immutable model version (Appendix A). HotpotQA (Yang et al. 2018) questions are the first records of the validation split (distractor configuration) and FinanceBench (Islam et al. 2023) questions the first records of the public sample released as PatronusAI/financebench, which is a subset of the full FinanceBench question set and has a single train split, with evidence truncated

invalid: retry with validation error appended (up to 3 further attempts)
Classifier: each failed attempt receives one primary category
Stage 1: predicates on raw text y, in order markdown_wrap: starts with a ... fence prose_preamble: prose before the JSON schema_mirroring: returns schema keywords
first match wins; precedence over Stage 2
Stage 2: if no predicate fires,
map the Pydantic error type
regex_pattern, length_bound,
enum_violation, missing_field,
range_bound, parse_error,
cross_field_ref, catch-all
several errors: plurality category
Fig. 1 Study design. Each question passes through three nodes, each with its own Pydantic schema stated in the prompt; a failed validation is retried with the error appended. Every failed attempt is assigned one primary category, first by behavioural predicates on the raw completion and otherwise by the Pydantic error type (Section 3.3).
to 2,000 characters; neither is shuffled, so results describe these fixed question sets. Most cells contain about one run per question; the Haiku cells repeat questions, and its FinanceBench cell covers 18 distinct questions (Appendix A). Claude Sonnet 4.6 and gpt-4o were run on HotpotQA only. We request temperature=0 where supported; the GPT-5.6 family, Sonnet 5 and Opus 4.8 reject the parameter and run at provider defaults. The Anthropic branch sets max_tokens to 4,096 and the OpenAI branch sets none. Resolved model versions and sampling details are in Appendix A.
A cell, or configuration, is one combination of model, schema tier and task domain under the baseline prompt. Table A1 has one row per cell plus one row for each of the two prompt variants, which share the Haiku HotpotQA cell and add no cells.
Two conventions define the reporting basis. Cells with fewer than 30 baseline runs are excluded as pilots, a threshold fixed before analysis, and the 60 prompt-variant runs, which share the Haiku HotpotQA configuration, are excluded everywhere except Section 4.4. The basis contains 3,997 attempts and 1,126 failures in 18 configurations, from a full corpus of 4,396 attempts in 20 cells. Classifier validation (Section 3.3) uses the full corpus and says so.
Uncertainty
Attempts are not independent: retries follow failures, questions repeat in some cells, and later nodes are reached only after earlier ones succeed. Intervals are therefore from a question-clustered bootstrap (2,000 replicates, percentile 95%) that resamples questions within each dataset and carries every run and attempt of a selected question. They describe variability over the observed question set and do not make the fixed prefixes representative of the benchmarks. Because a failure adds an attempt under retry-until-valid, failures and attempts co-vary within a question, so for high-failure models the clustered interval on the failure rate can be narrower than a binomial interval over attempts. Where every replicate gives the same value, as for a share of 0 or 1, we report no interval.
3.3 Taxonomy and classifier
The classifier runs only on attempts that failed validation and assigns one primary category in two stages. Stage 1 applies behavioural predicates to the raw completion y, in order: markdown_wrap if y begins, after leading whitespace, with a triple-backtick fence; prose_preamble if y begins with neither a brace, a bracket nor a fence, contains a brace-delimited span, and has at least 20 characters of prose before it; and schema_mirroring if y parses to an object whose root keys include at least two JSON Schema meta-keywords such as properties and required. Stage 2, reached only if no predicate fires, maps Pydantic error types: pattern mismatches to regex_pattern, length violations to length_bound, literal errors to enum_violation, missing fields to missing_field, numeric bounds to range_bound and json_invalid to parse_error. The map sends int_type and float_type to range_bound and the string, list, dict and boolean type errors to missing_field; any unmapped type, including the lax-mode parsing errors such as float_parsing, falls to the catch-all other_validation_error. These type assignments are a coarse fallback in the released classifier, not a claim that a type error is a range or missing-field violation. No type or parsing error occurs in the corpus, in stored error details or beneath stripped fences, so no reported label depends on this part of the map and it is untested here; a dedicated type_mismatch category is left to future work. Validator errors arrive as value_error; the supporting-identifier check routes to regex_pattern and cross-field messages to cross_field_ref. With several errors, the primary category is the plurality, ties broken by first occurrence. Labels follow how a constraint is encoded, not what it intends: an identifier longer than 31 characters violates the quantifier in ^[a-z][a-z0-9]{2,30}$ and is labelled regex_pattern, whereas the same limit expressed as max_length would be labelled length_bound.
We give Stage-1 predicates precedence to preserve behaviours that are invisible to Pydantic, which sees only their downstream symptoms. The precedence has a consequence we exploit in Section 4.4: a fenced output that also violates a constraint is labelled markdown_wrap, so that category measures strict-parsing failure, not the absence of a further defect. Table 1 gives the observed distribution; 7 of the classifier's eleven categories occur, and cross_field_ref, missing_field, range_bound and the catch-all category do not.
Validation
We checked the classifier against human labels twice. During development we hand-labelled 144 failing attempts stratified by predicted category, drawn from the full corpus of 1,326 failures so that rare categories had support. The labelling screen displayed the classifier's label, and the author consulted an LLM assistant when interpreting outputs; every label was assigned by the author. This labelling surfaced a detection-order defect in an earlier classifier, in which Pydantic mapping preceded the behavioural predicates; we corrected the order and reclassified the corpus. Against the corrected classifier, unadjudicated agreement is 140 of 144 (97.2%, Wilson 95% CI [93.1, 98.9]), and on adjudication all four disagreements were labelling errors.
Table 1 Primary categories on the reporting basis.
| Category | n | Share |
|---|---|---|
| markdown_wrap | 681 | 60.5% |
| length_bound | 263 | 23.4% |
| regex_pattern | 126 | 11.2% |
| schema_mirroring | 38 | 3.4% |
| prose_preamble | 9 | 0.8% |
| enum_violation | 8 | 0.7% |
| parse_error | 1 | 0.1% |
| Total | 1,126 |
Because the classifier's label was visible and these samples shaped the classifier, this is a development-time consistency check, not independent validation.
After freezing the classifier we ran a pre-registered held-out check: 100 further failures from the reported basis, excluding every development item and stratified over the three categories with attempts remaining, labelled by hand by the author with the classifier's label hidden and without AI assistance on any item. Agreement is 69 of 100 (69.0%, Wilson 95% CI [59.4, 77.2]; 73.4% weighted by category frequency). Checked post hoc against the validator's error record and the raw completion, none of the 31 disagreements showed the classifier misapplying the category definitions or the precedence rule. In 18 the annotator could not confirm from the displayed output a length overflow the validator reported; 4 fenced outputs were labelled by the violation beneath the fence and 2 more were marked ambiguous; and 7 identifier pattern mismatches were labelled otherwise, 2 of them as enum_violation, the confusion behind three of the four development disagreements. Stage-2 labels are a fixed map from validator errors, so human labels chiefly test the category definitions and the Stage-1 predicates, and unaided reading cannot verify a length label. The gap between the two figures is consistent with anchoring on the displayed label in the development round. Appendix C gives per-category results and corpus screens for the Stage-1 categories.
4 Results
4.1 Failure rates and run completion
Table 2 gives per-model results. The attempt-weighted failure rate over the reporting basis is (95% CI [26.3, 30.1]), but Haiku 4.5 contributes 878 of the 1,126 failures. Excluding it gives , and the unweighted mean of the nine medium-tier rates is . Attempt-weighted aggregates over this corpus are therefore largely statements about one model, and we report per-model figures. No conclusion below depends on ordering models whose intervals overlap.
Attempt failure and pipeline completion are different quantities. Under the repair loop, 948 of 973 runs complete all three nodes. Every run completes for seven of the nine models; gpt-4o-mini completes 69 of 70 (its only incomplete run exhausted its retries on the supporting-identifier check, the one enforced constraint not stated in the prompt; Appendix F), and Haiku 4.5, whose attempt failure rate is , completes
Table 2 Per-model results at the medium tier, baseline prompt, task domains pooled (gpt-4o, gpt-4o-mini and Sonnet 4.6 are HotpotQA only on the reporting basis). Intervals are question-clustered bootstrap 95% intervals (Section 3.2). Rows are ordered by failure rate for readability; configurations with overlapping intervals are not ranked.
| Model | Runs | Att. | Fail. | Rate % | 95% CI | Dominant | Share % | 95% CI |
|---|---|---|---|---|---|---|---|---|
| claude-haiku-4-5 | 166 | 1329 | 878 | 66.1 | [64.9, 67.3] | markdown_wrap | 72.9 | [70.4, 75.3] |
| claude-sonnet-5 | 82 | 313 | 67 | 21.4 | [17.2, 25.2] | markdown_wrap | 61.2 | [49.3, 71.4] |
| gpt-4o | 70 | 250 | 40 | 16.0 | [11.9, 20.0] | schema_mirroring | 72.5 | [58.8, 87.2] |
| claude-sonnet-4-6 | 50 | 178 | 28 | 15.7 | [10.2, 21.5] | length_bound | 64.3 | [48.1, 80.8] |
| gpt-4o-mini | 70 | 242 | 33 | 13.6 | [8.0, 19.7] | regex_pattern | 66.7 | [45.7, 83.3] |
| gpt-5.6-terra | 84 | 266 | 14 | 5.3 | [3.1, 7.7] | regex_pattern | 85.7 | [64.3, 100.0] |
| claude-opus-4-8 | 84 | 265 | 13 | 4.9 | [2.7, 7.4] | length_bound | 76.9 | [53.8, 100.0] |
| gpt-5.6-luna | 85 | 266 | 11 | 4.1 | [2.2, 6.3] | regex_pattern | 72.7 | [44.4, 100.0] |
| gpt-5.6-sol | 82 | 255 | 9 | 3.5 | [1.6, 5.7] | regex_pattern | 88.9 | [62.5, 100.0] |
142 of 166 at a cost of 9.36 attempts per completed run, counting the attempts of its incomplete runs as well (Appendix E).
First attempts, before any feedback, give a stricter view. Of the 2,896 first attempts on the reporting basis, 2,192 validated (75.7%); counting pure-formatting failures as recovered raises this to 85.8%. None of Haiku 4.5's 475 first attempts validated; per-model first-attempt breakdowns are in Appendix E.
4.2 Dominant-category profiles

Fig. 2 Composition of failures by model and schema tier, reporting basis, ordered by failure rate. Per-model failure counts and rates are in Table 2; counts for every cell, including the schema variants, are in Table A1.
Grouping models by dominant category gives four observed profiles (Figure 2): markdown_wrap for Haiku 4.5 and Sonnet 5; regex_pattern for the three GPT-5.6 models and gpt-4o-mini; length_bound for Opus 4.8 and Sonnet 4.6; and schema_mirroring for gpt-4o. These are profiles read off the dominant category, not clusters from any statistical procedure. They are not determined solely by vendor, model tier, or failure rate: gpt-4o and gpt-4o-mini share a generation but not a profile, and gpt-4o-mini,
Sonnet 4.6 and gpt-4o fail at 13.6%, 15.7% and 16.0%, with overlapping intervals, under three different dominant categories. Dominant shares for low-rate models rest on few failures; Opus 4.8's 76.9% share, for example, rests on 13 failures (95% CI [53.8, 100.0]).
Some categories are confined to particular models in our data. schema_mirroring accounts for 72.5% of gpt-4o failures and was not observed in any GPT-5.6 configuration we tested. markdown_wrap was not observed for Sonnet 4.6 across 502 attempts or Opus 4.8 across 265, yet it accounts for 61.2% of Sonnet 5 failures and 72.9% of Haiku 4.5 failures. Haiku 4.5 and gpt-4o are each dominant in a category the other did not produce in our observations. Among the 6 model-tier groups with at least 20 failures, the largest difference between two groups in the share of a single category is 72.9 percentage points, attained by 4 pairs, each setting Haiku 4.5 against a group with no markdown_wrap failures (Appendix G).
Profiles also vary with the task distribution. Sonnet 5 fails at nearly the same rate on both domains (21.1% on FinanceBench, 21.6% on HotpotQA), but on HotpotQA markdown_wrap accounts for 81.4% of its 43 failures, while on FinanceBench no category clearly dominates its 24: length_bound 41.7% (95% CI [25.0, 61.1]), regex_pattern 33.3% and markdown_wrap 25.0%. The observed profile is thus a property of model, constraints, prompt and task distribution together. Opus 4.8 also changes dominant category across domains, but its HotpotQA profile rests on 2 failures and we do not interpret it (Appendix E).
Answer to RQ1: No. Configurations with overlapping failure rates fall into four profiles with different dominant categories, and some categories occur only in particular configurations. A validity rate therefore does not identify which failure an engineer must fix.
4.3 Profiles depend on the constraint surface
Table 3 Sonnet 4.6, HotpotQA. Top: composition at the medium and medium_v2 tiers. Bottom: the stored medium outputs revalidated against the medium_v2 schema, beside the fresh medium_v2 generations. The fresh cell differs in size and retry structure and is not paired by question.
| Category | medium (178 att.) | medium_v2 (324 att.) | ||
|---|---|---|---|---|
| n | rate | n | rate | |
| length_bound | 18 | 10.1% | 0 | 0.0% |
| regex_pattern | 7 | 3.9% | 14 | 4.3% |
| prose_preamble | 1 | 0.6% | 8 | 2.5% |
| enum_violation | 2 | 1.1% | 2 | 0.6% |
| All failures | 28 | 15.7% | 24 | 7.4% |
| Analysis | Attempts | Failures | Rate % |
|---|---|---|---|
| Original medium outputs, medium schema | 178 | 28 | 15.7 |
| Same outputs, medium_v2 schema | 178 | 10 | 5.6 |
| Fresh medium_v2 generations | 324 | 24 | 7.4 |
A profile is not a property of the model alone. Sonnet 4.6 is length_bound-dominant at the medium tier (18 of 28 failures). With the caps raised in medium_v2, length_bound falls to 0, regex_pattern becomes dominant (14 of 24), and the failure rate moves from 15.7% to 7.4% (Table 3).
The error locations identify which caps were binding: 8 coverage_notes values of 251–315 characters against the 250 cap (mean overrun 9.0%, maximum 26.0%), 9 answer values of 417–500 against 400 (mean overrun 15.2%), and 1 fact value of 480 characters against 400. These caps sat below the lengths the model produced, not far below them. Because medium_v2 is a fresh generation, its result could in principle reflect changed output rather than changed caps. We therefore revalidated all 178 stored medium outputs, valid and failed, against the medium_v2 schema. All 18 length_bound failures pass, no valid output becomes invalid, and the remaining 10 failures are the original regex_pattern, enum_violation and prose_preamble cases. Relaxing the caps is sufficient to eliminate the observed length violations. This is an offline revalidation, not a simulated medium_v2 run: under the relaxed schema the retries that followed those failures would not have occurred.
Loosening the identifier character class is the contrasting case. On HotpotQA, gpt-5.6-sol and gpt-5.6-terra produced 8 violating identifiers under the baseline pattern and 11 under the loosened pattern. Leading-digit violations such as the example in Section 1 went from 4 to 0, as the loosened class permits them. Length overflows against the retained 31-character ceiling occurred under both patterns (4 and 10); with a handful of failures per cell we do not interpret that change or the cell rates (Appendix D). No leading-digit violations were observed under the loosened pattern, while length overflow, which the loosened class does not address, still occurred. Because these runs are fresh generations rather than a revalidation of fixed outputs, and the counts are small, we read this as consistent with a sub-cause-specific effect, not as an estimate of one. The regex_pattern label conceals the overflow because the ceiling is written into the pattern's quantifier.
Answer to RQ2: No. Raising length caps changes the dominant category for the same model, and revalidating the same stored outputs attributes the removed length violations to the caps alone. Under a loosened identifier character class, no leading-digit violations were observed (4 to 0) while length overflows remained; with counts this small and unmatched runs, this is an observation, not a measured effect. The same model also shows different profiles on the two task domains (Section 4.2).
4.4 Formatting failures conceal underlying schema violations
Because markdown_wrap takes precedence, it says nothing about what lies inside the fence. We stripped the fence from every wrapped failure and revalidated the payload (Table 4). 48.0% validate; the rest raise a further error, overwhelmingly on length: 327 length_bound, 26 regex_pattern and 1 missing_field. The two wrapping models share a dominant category but not what the wrapper hides: 4 of Sonnet 5's 41 wrapped failures are compound (95% CI [2.1, 19.4]), against 54.7% of Haiku 4.5's 640 (95% CI [49.9, 59.9]). The contrast is not a domain-mix artefact: on HotpotQA alone the compound shares are 8.6% and 51.0%, and Haiku's rises to 71.2% on FinanceBench.
Table 4 Fence-strip revalidation of markdown_wrap failures, reporting basis. Pure formatting validates once the fence is removed; compound raises a further error. Percentages are rounded independently and may not sum exactly.
| Model | Wrapped | Pure formatting | Compound |
|---|---|---|---|
| claude-haiku-4-5 | 640 | 290 (45.3%) | 350 (54.7%) |
| claude-sonnet-5 | 41 | 37 (90.2%) | 4 (9.8%) |
| All wrapped | 681 | 327 (48.0%) | 354 (52.0%) |
Counting co-occurrence, length_bound reaches 590 instances against a primary count of 263, so single-primary-label counts omit some detected co-occurring violations.
What the repair loop repairs.
Concealment is visible in what retries left unrepaired. All 475 of Haiku 4.5's first attempts failed strict validation, every one of them fenced; we audited the extraction (one first attempt per run-node, contiguous attempt numbers, no attempts after a valid one, and fences confirmed on the raw text; Appendix E). On the second attempt, after the validation error was returned, 240 of 475 validated and fences persisted in 165; no later attempt was fenced. What remained was length: length_bound accounts for every failure from the third attempt onward, and all 24 run-nodes that exhausted their retries ended on length_bound, 23 of them in gather. These are exactly the runs that did not complete. Within the loop, nearly all of this model's failures were repaired (451 of 475 failed first attempts eventually validated), and its residual failures were the violations the fence had concealed. In 24 of the 24 exhausted run-nodes, the fence-stripped first attempt already violated the cap of the same field as the final attempt, and in 24 that field exceeded its cap on every attempt. The error returned for each of their 47 fenced attempts was a JSON parse error that did not mention the cap, so 23 of these run-nodes received the length error once before exhausting their retries and 1 received it twice. Offline on the stored attempts, counting pure-formatting failures as recovered leaves of attempts invalid (95% CI [17.6, 22.5]) against strict, for Haiku 4.5 and for Sonnet 5. These are not outcomes of rerunning the pipeline with fence removal enabled, which would change retries and downstream exposure.
Table 5 Exploratory prompt ablation on Haiku 4.5, HotpotQA, rates over attempts. The last row counts length violations that are primary or concealed beneath a fence. Design limits are given in Section 4.4.
| Baseline | Aggressive | Few-shot | |
|---|---|---|---|
| Attempts | 1,066 | 189 | 176 |
| markdown_wrap | 49.0% | 33.9% | 25.0% |
| length_bound (primary) | 14.4% | 16.4% | 22.7% |
| regex_pattern | 1.5% | 2.1% | 2.3% |
| Failure rate | 64.9% | 52.4% | 50.0% |
| Length violations, primary + concealed | 37.8% | 30.2% | 36.9% |
Concealment also changes how a prompt ablation reads. We use an exploratory ablation to show this, not to compare prompts: three system-prompt variants on Haiku 4.5 on HotpotQA, namely the baseline, an aggressive format instruction, and a few-shot prompt (Table 5). The variant cells are much smaller than the baseline cell, were run immediately after the final baseline batch rather than interleaved with it, and are not paired by question, so differences between conditions may reflect question composition or collection time as well as prompt wording. The wrapping rate is of attempts under the baseline and under the few-shot prompt, and the failure rate and . The primary length_bound rate is and , which read alone suggests failures migrating from wrapping to length. But a suppressed fence can expose a length violation that was already present. Counting primary and concealed length violations together gives , and : the combined rate does not rise as wrapping falls, so the rise in the primary rate requires no increase in over-long output. This is an accounting argument within the observed attempts, and it does not depend on the prompts having caused the differences between conditions. We do not interpret the differences among the combined rates, including the lower aggressive figure, and we draw no conclusion about which prompt is more effective.
Answer to RQ3: Only of fenced failures validate once the fence is removed; the rest conceal a length or pattern violation that the returned parse error never mentions. Counting concealed violations changes the reading of the repair loop, whose residual failures were the violations the fence had concealed, and of the exploratory prompt ablation, whose apparent shift towards length violations requires no increase in over-long output.
5 Implications for Practice
Each practice below follows from a specific finding and targets one component of a prompt-and-validate pipeline: the validator, the schema, the retry loop, or the way the pipeline is evaluated (Table 6). The first, second and fourth are supported at the scale of this corpus; the third is a design implication of our findings that we did not test.
Table 6 Engineering practices, the pipeline component each targets, and the finding that supports it.
| Component | Finding | Practice | Evidence |
|---|---|---|---|
| Validator | Only 48.0% of fenced failures validate once the fence is removed | Strip fences, revalidate, and record the residual violation | Section 4.4 |
| Schema | A length ceiling written into a pattern is reported as a pattern violation; caps below observed lengths drive the dominant category | Express length limits separately from patterns; measure output lengths before fixing caps | Section 4.3 |
| Retry loop | The parse error for a fenced output never names the violation beneath it | Build retry feedback from the fence-stripped validation (untested) | Section 4.4 |
| Evaluation | Aggregate rates are dominated by one configuration; primary labels misread a prompt ablation | Report failure composition per configuration, counting concealed violations | Sections 4.1 and 4.4 |
Validator: strip fences, then revalidate and record what remains.
Fence removal is a partial repair: it recovers the pure-formatting share of wrapped failures, which ranged from most of Sonnet 5's to under half of Haiku 4.5's (Section 4.4). A pipeline that counts fence removal as a fix would report the compound remainder as solved.
Schema: separate conflated causes and set caps from data.
A quantifier turns an over-long identifier into a pattern violation, and the natural remedy for a pattern violation, loosening the character class, leaves it untouched (Section 4.3). A separate max_length separates the causes at validation time. Caps should likewise be set from a field's observed length distribution. Sonnet 4.6's dominant mode came from caps sitting modestly below its output lengths, and Haiku 4.5's incomplete runs all ended on length. Such a cap may still be a real downstream requirement; the measurement identifies the mismatch the application must resolve, not that the cap is wrong.
Retry loop: give the model the violation it must fix
The error returned for a fenced output is a JSON parse error, so the repair loop learns of a concealed violation only on a later attempt. Across the reported basis, 354 of the 1,101 retry messages sent (32.2%) named only a parse error while the fence-stripped payload already violated the schema, almost all of them Haiku 4.5's (350) and 328 of them concealing a length violation; they span 218 run-nodes, including all 24 that exhausted their retries (Section 4.4). Validating the fence-stripped payload before composing the retry message would name the underlying violation in each of these messages. This count bounds how often the change would alter the feedback, not its effect: we did not run this variant, and whether a model repairs a violation once it is named is untested, so we do not claim it would reduce retries or exhaustion.
Evaluation: report composition, not only a rate
Over this corpus the attempt-weighted failure rate is largely a statement about one configuration (Section 4.1), and reading primary labels alone makes a prompt ablation appear to move failures from wrapping to length (Section 4.4). Evaluating a pipeline change should therefore report the failure composition per configuration, including violations concealed beneath fences, before concluding that the change removed a failure.
Will these modes persist?
A reasonable objection is that providers are engineering these modes away. Our cross-generation data are descriptive and do not isolate model generation from other configuration differences, including collection date, sampling parameters and endpoint. With that caveat, they point in both directions: schema_mirroring dominates gpt-4o and was not observed in the GPT-5.6 configurations we tested, while markdown_wrap was not observed in Sonnet 4.6 and dominates Sonnet 5 and Haiku 4.5. What differs across these models is which category dominates. A vocabulary for the categories remains useful as the distribution moves, which is a weaker claim than predicting that any particular mode persists.
6 Threats to Validity
We organise threats by the construct, internal, external and conclusion validity classification of Wohlin et al. (2012).
Construct validity
The taxonomy is an operational diagnostic for the prompt-and-validate paradigm, not a complete account of structured-output failure. Primary categories are single-valued, labels follow how a constraint is encoded rather than what it intends (Section 3.3), and we quantify co-occurrence only beneath fences. Human checks of the classifier come from a single labeller who also wrote it. The development check displayed the classifier's label and is not independent; the pre-registered held-out check was blind and gives 69.0% agreement, but covers only the three categories with attempts left after development, and no second annotator labelled either sample, so we report no inter-annotator agreement. Three properties limit what this can affect. Stage-1 categories are syntactic predicates on the raw completion, and corpus-wide screens that do not depend on any human label find no missed case among the failures they match (Appendix C). Stage-2 categories are a fixed map from the Pydantic error types stored with each attempt, and rerunning the released classifier over the database reproduces every stored label. Disagreements in both checks were resolved against the stored error record or the raw completion, not the labeller's judgement. The residual risk lies in the category definitions and the precedence rule rather than in label noise; we release the annotations and stored completions so that an independent labeller can test both. We evaluate conformance only, not whether extracted content is correct. Among attempts whose model-level validators ran, no cross-field violation occurred (Appendix F), but attempts rejected earlier, including during JSON parsing, never reached those checks, so the zero describes a filtered subset of the node-level validators we implemented. Cross-node referential integrity, whether a later node's identifiers appear in an earlier node's entities, is not implemented in our schemas; it is expressible in Pydantic by passing the earlier output as validation context (model_validate_json(data, context=...)) and is the natural next measurement.
Internal validity
Repair attempts, which are conditioned on a prior failure, make up a model-dependent share of each attempt rate; first-attempt rates and run completion are reported separately for that reason (Appendix E). Every retry carries the validation error and no condition retries without it, so the design does not separate the effect of the feedback from that of a further attempt. Five models reject an explicit temperature, and the Anthropic and OpenAI branches use different token ceilings. Some questions were run more than once; keeping only the earliest run per question changes any cell's failure rate by at most 1.3 percentage points (Appendix A). The prompt ablation is exploratory: the variant cells (189 and 176 attempts against 1,066; Table 5) were run after the final baseline batch rather than interleaved with it and are not paired by question, so differences between conditions may reflect question composition or collection time as well as prompt wording. We use it only to show how concealment changes the reading of failure labels, and draw no conclusion about prompt effectiveness; a matched, interleaved rerun would be needed for that.
Which comparisons are matched
Across all nine configurations, the HotpotQA cells at the medium tier share the schema, the baseline system prompt, the retry budget of three further attempts, and the same 50-question prefix (Table A1); these cells are the matched basis for cross-model comparison. The pooled per-model figures in Table 2 and Figure 2 also include FinanceBench for six models; per-cell results are in Table E5. They are not matched in sampling or collection: four configurations run at temperature=0 and five at provider defaults, the Anthropic branch sets an output-token ceiling that the OpenAI branch does not, collection dates range over three weeks (Table A2), and the number of runs per question varies by cell, most for Haiku 4.5 (Table A1). FinanceBench was run for six of the nine models, so domain comparisons are within-model only, and each schema variant was run on one or two models, so constraint-surface comparisons are within those models. We therefore describe differences between configurations and do not attribute them to model capability alone.
External validity
The schemas are ours, and one ablation showed that a cap we set was binding below the output lengths of one model; a different author would produce a different distribution over categories, and the domain comparison shows that a different task would too. We cover two vendors by design, trading breadth for several generations and capability tiers per vendor, which the within-family comparisons require; a third vendor or an open-weights model may exhibit modes our taxonomy lacks. We do not compare against constrained decoding or vendor structured-output modes (Section 2), so we make no claim about how often those configurations would prevent the failures we report. Questions are fixed dataset prefixes, the design is not fully crossed, and most failures in this corpus come from a single model. Most endpoints returned an alias rather than a pinned version, so later calls to the same identifier may not reproduce these distributions.
Conclusion validity
Attempts are not independent, so all intervals are question-clustered bootstrap intervals (Section 3.2) that describe variability over the observed question set, not over the benchmarks. We do not interpret cells with a handful of failures, and we treat maximum-gap divergence statistics as secondary because they are selected to be extreme (Appendix G).
7 Conclusion
A validity rate for prompt-enforced structured output does not tell a practitioner what failed or what a fix will change. Diagnosing a failure requires keeping both the visible formatting failure and the schema violation it may conceal; in this corpus, dropping either layer changes the conclusion an engineer would draw about a repair, a schema change, or a prompt change. Across nine model configurations, those with similar rates fail in different ways (RQ1); the dominant category moves when the binding constraints change and differs between task domains for the same model (RQ2); and the most common failure, markdown wrapping, conceals a length or pattern violation often enough that reading primary labels alone misreads a prompt ablation and misattributes what a repair loop leaves unrepaired (RQ3). In both schema interventions we ran, whether a relaxation removed a failure tracked the sub-cause beneath the label rather than the label itself. Of the four practices we derive, three are supported by these data; the fourth, building retry feedback from the fence-stripped validation, follows from them but is untested. We release the classifier, raw completions and annotation record so the corpus can be relabelled under other definitions; the distribution over categories will move as models change, and the vocabulary is meant to outlast it.
Statements and Declarations
Funding. No funding was received for this work. API usage was paid for by the author.
Competing interests. The author declares no competing interests. The author has no financial ties to OpenAI or Anthropic, whose models are evaluated in this study. The author works as an on-site contractor at American Express through Data Systems Integration Group; this work was carried out independently and is unrelated to that role.
Ethics approval. Not applicable. The study involves no human participants; the datasets used are public.
Consent to participate and consent for publication. Not applicable.
Data availability. The results database, raw completions, the development and held-out annotations, and the question manifest are available at https://github.com/amitvermaknw/schema-enforcement and archived at https://doi.org/10.5281/zenodo.23586834. FinanceBench text is redistributed under CC BY-NC 4.0 and HotpotQA questions under CC BY-SA 4.0 (see DATA_LICENSES.md).
Code availability. The harness, classifier and analysis scripts are available in the same repository.
Use of AI tools. The author used large language model assistants (Claude) for writing, editing and coding assistance, and, during classifier development, as an advisor when interpreting model outputs for the development labels; every label was assigned by the author. The held-out labels were assigned by the author without AI assistance.
on any item; an assistant was consulted only on the wording of the category definitions. All experiments were designed, run and verified by the author; every number reported is generated by scripts from the released results database.
Author contributions. Sole author: conceptualisation, methodology, software, analysis and writing.
Appendix A Cell Manifest, Versions and Sampling
Table A1 Run manifest, one row per model, tier, domain and prompt variant. Runs, attempts and failures use the same prompt-variant filter. Qs is the number of distinct questions; Collected is the range of run timestamps (UTC). Pilot cells (fewer than 30 baseline runs) and prompt-variant rows are outside the reporting basis.
| Model | Tier | Domain | Prompt | Runs | Qs | Att. | Fail. | Collected | Excluded |
|---|---|---|---|---|---|---|---|---|---|
| claude-haiku-4-5 | medium | financebench | baseline | 32 | 18 | 263 | 186 | 2026-08-23-2026-08-26 | - |
| claude-haiku-4-5 | medium | hotpotqa | aggressive | 30 | 30 | 189 | 99 | 2026-08-28-2026-08-28 | prompt_variant |
| claude-haiku-4-5 | medium | hotpotqa | baseline | 134 | 50 | 1066 | 692 | 2026-08-09-2026-08-28 | - |
| claude-haiku-4-5 | medium | hotpotqa | few_shot | 30 | 30 | 176 | 88 | 2026-08-28-2026-08-28 | prompt_variant |
| claude-opus-4-8 | medium | financebench | baseline | 30 | 30 | 101 | 11 | 2026-08-26-2026-08-26 | - |
| claude-opus-4-8 | medium | hotpotqa | baseline | 54 | 50 | 164 | 2 | 2026-08-22-2026-08-23 | - |
| claude-sonnet-4-6 | medium | hotpotqa | baseline | 50 | 50 | 178 | 28 | 2026-08-09-2026-08-09 | - |
| claude-sonnet-4-6 | medium_v2 | hotpotqa | baseline | 100 | 50 | 324 | 24 | 2026-08-10-2026-08-11 | - |
| claude-sonnet-5 | medium | financebench | baseline | 30 | 30 | 114 | 24 | 2026-08-26-2026-08-26 | - |
| claude-sonnet-5 | medium | hotpotqa | baseline | 52 | 50 | 199 | 43 | 2026-08-22-2026-08-23 | - |
| gpt-4o | medium | hotpotqa | baseline | 70 | 50 | 250 | 40 | 2026-08-09-2026-08-09 | - |
| gpt-4o-mini | medium | financebench | baseline | 5 | 5 | 28 | 13 | 2026-08-22-2026-08-22 | pilot |
| gpt-4o-mini | medium | hotpotqa | baseline | 70 | 50 | 242 | 33 | 2026-08-09-2026-08-09 | - |
| gpt-5.6-luna | medium | financebench | baseline | 30 | 30 | 97 | 7 | 2026-08-23-2026-08-23 | - |
| gpt-5.6-luna | medium | hotpotqa | baseline | 55 | 50 | 169 | 4 | 2026-08-22-2026-08-22 | - |
| gpt-5.6-luna | medium_v3_loose_regex | hotpotqa | baseline | 2 | 2 | 6 | 0 | 2026-08-27-2026-08-27 | pilot |
| gpt-5.6-sol | medium | financebench | baseline | 30 | 30 | 96 | 6 | 2026-08-23-2026-08-23 | - |
| gpt-5.6-sol | medium | hotpotqa | baseline | 52 | 50 | 159 | 3 | 2026-08-22-2026-08-22 | - |
| gpt-5.6-sol | medium_v3_loose_regex | hotpotqa | baseline | 50 | 50 | 155 | 5 | 2026-08-27-2026-08-27 | - |
| gpt-5.6-terra | medium | financebench | baseline | 30 | 30 | 98 | 8 | 2026-08-23-2026-08-23 | - |
| gpt-5.6-terra | medium | hotpotqa | baseline | 54 | 50 | 168 | 6 | 2026-08-22-2026-08-22 | - |
| gpt-5.6-terra | medium_v3_loose_regex | hotpotqa | baseline | 50 | 50 | 154 | 4 | 2026-08-27-2026-08-27 | - |
The full corpus of 4,396 attempts decomposes into the 3,997 on the reporting basis, 34 in pilot cells below the 30-run threshold, which was fixed before any results were examined, and 365 from the 60 prompt-variant runs of Table 5. Runs, attempts and failures are counted under one filter, so variant runs appear in their own rows rather than inflating the baseline cell whose configuration they share.
Sampling.
HotpotQA questions are the first records of the validation split in the distractor configuration, in dataset order; FinanceBench questions are the first records, in dataset order, of the public sample released as PatronusAI/financebench on HuggingFace: a subset of the full FinanceBench question set, distributed as a single train split. Evidence is truncated to 2,000 characters with a truncation marker inserted. The datasets are redistributed in the artifact under their licences: FinanceBench under CC BY-NC 4.0 and HotpotQA under CC BY-SA 4.0. There is no shuffle and no seed. Collection ran from 2026-08-09 to 2026-08-28; per-cell date ranges and distinct-question counts are in Table A1. The Haiku 4.5 FinanceBench cell covers 18 distinct questions, fewer than the other FinanceBench cells. Exact question identities, as dataset record hashes, are in the released question_manifest.csv.
Resolved versions and request parameters.
Only the Haiku request names a dated snapshot, which was returned unchanged. gpt-4o resolves to gpt-4o-2024-08-06 and gpt-4o-mini to gpt-4o-mini-2024-07-18; the Anthropic models and the GPT-5.6 family return the requested alias, which identifies the endpoint but not an immutable model version, so later calls to the same identifier may not reproduce these distributions. Version capture was added after the first sweeps: 72 of 250 gpt-4o attempts and 69 of 242 gpt-4o-mini attempts on the reporting basis predate it. Table A2 gives the requested and returned identifiers, the API route, the collection window and the sampling parameters sent by the client for each model.
Validator and client versions.
The Pydantic version used during collection was not recorded; the harness then required version 2.7 or later within major version 2. Analysis used pydantic 2.13.4 with pydantic-core 2.46.4, which the released requirements pin. Revalidating every stored completion against its node schema under these versions reproduces the stored validation outcome of all 4,396 attempts (scripts/revalidate_all.py), so every validity judgement in the corpus is reproducible under the released environment. The client SDK versions used during collection were likewise not recorded; the harness required openai , anthropic and langgraph . The SDKs affect only how requests are sent: the request parameters sent by the client are given per model in Table A2, and no validity judgement depends on an SDK, since validation and classification run on the stored completions.
Table A2 Model provenance. Returned ID is the model identifier in the API response, with attempt counts; not captured marks attempts logged before the response identifier was recorded. Temperature and max_tokens are the values sent by the client.
| Requested ID | Returned ID (attempts) | API | Collected | Temp. | max_tokens |
|---|---|---|---|---|---|
| claude-haiku-4-5-20251001 | as requested (1694) | Anthropic | 2026-08-09-08-28 | 0 | 4096 |
| claude-opus-4-8 | as requested (265) | Anthropic | 2026-08-22-08-26 | omitted | 4096 |
| claude-sonnet-4-6 | as requested (502) | Anthropic | 2026-08-09-08-11 | 0 | 4096 |
| claude-sonnet-5 | as requested (313) | Anthropic | 2026-08-22-08-26 | omitted | 4096 |
| gpt-4o | gpt-4o-2024-08-06 (178)not captured (72) | OpenAI | 2026-08-09 | 0 | not set |
| gpt-4o-mini | gpt-4o-mini-2024-07-18 (201)not captured (69) | OpenAI | 2026-08-09-08-22 | 0 | not set |
| gpt-5.6-luna | as requested (272) | OpenAI | 2026-08-22-08-27 | omitted | not set |
| gpt-5.6-sol | as requested (410) | OpenAI | 2026-08-22-08-27 | omitted | not set |
| gpt-5.6-terra | as requested (420) | OpenAI | 2026-08-22-08-27 | omitted | not set |
Analysis provenance.
The reported numbers were produced by the analysis scripts at commit 31f41e168b from the results database whose content hash begins d0f406f00882. Intervals are question-clustered bootstrap intervals with 2,000 replicates (Section 3.2).
Repeated questions.
The Haiku 4.5 HotpotQA baseline cell contains 134 runs over 50 distinct questions. Restricting it to the earliest run of each question by timestamp, ties broken by run identifier, gives a failure rate of 64.4% (260 of 404) against 64.9% (692 of 1,066) for the full cell. Applied to every cell, the rule changes no cell's failure rate by more than 1.3 percentage points. We do not report a pooled rate under deduplication: it removes mostly Haiku 4.5 attempts, so the pooled change reflects reweighting between models rather than sensitivity to repetition.
Zero-length completion
One attempt (claude-sonnet-5, gather node) returned an empty completion with 4,096 output tokens, equal to the configured ceiling. It is classified parse_error. The stop reason was not logged; the record is consistent with the output budget being exhausted before any text block was emitted.
Appendix B Schemas and Prompts
The baseline schema, its two variants, the system-prompt variants, the per-node user prompts, the validation and retry loop (including the retry message) and the Stage-1 predicates are reproduced below from the released code by scripts/make_app_code.sh. Listings omit comments and module and function docstrings; class docstrings are kept because Pydantic emits them as schema descriptions in the prompt. The listings are generated from the repository at the commit recorded in Appendix A, so they cannot drift from the code that produced the results.
Baseline schema
(src/schemaeval/schemas/medium.py)
import re from typing import List, Literal
from pydantic import BaseModel, Field, model_validator
CANONICAL_ID_PATTERN = r"[a-z][a-z0-9]{2,30}$" _ID_RE = re.compile(CANONICAL_ID_PATTERN)
class Entity(BaseModel): name: str = Field(min_length=1, max_length=100) entity_type: Literal["person", "place", "organization", "concept", "other"] canonical_id: str = Field( pattern=CANONICAL_ID_PATTERN, description="lowercase_snake_case identifier, e.g. 'manchester_united', )
class IdentifyOutput(BaseModel): ""Node 1: entities in the question, with a designated primary."" entities: List[Entity] = Field(min_length=2, max_length=5) question_type: Literal[ "who", "what", "when", "where", "why", "how", "comparison" ] primary_entity_id: str = Field( description="Must match one of entities[].canonical_id exactly" )
) entity_count: int = Field( ge=2, le=5, description="Must equal len(entities)" )
@model_validator(mode="after") def _consistency(self): ids = {e.canonical_id for e in self.entities} if self.primary_entity_id not in ids: raise ValueError( f"primary_entity_id ' {self.primary_entity_id}' not in " f"entities canonical_ids {sorted(ids)}" ) if self.entity_count != len(self.entities): raise ValueError( f"entity_count={self.entity_count} != " f"len(entities)={len(self.entities)}" ) return self
class Fact(BaseModel): entity_id: str = Field( pattern=CANONICAL_ID_PATTERN, description="Reference to a canonical_id from the identify step", ) fact: str = Field(min_length=10, max_length=400) relevance: float = Field(ge=0.0, le=1.0)
class GatherOutput(BaseModel): ""Node 2: facts about entities, with consistency count."" facts: List[Fact] = Field(min_length=2, max_length=8) fact_count: int = Field( ge=2, le=8, description="Must equal len(facts)" ) coverage_notes: str = Field(min_length=20, max_length=250)
@model_validator(mode="after") def _consistency(self): if self.fact_count != len(self.facts): raise ValueError( f"fact_count={self.fact_count} != len(facts)={len(self.facts)}" ) return self
class AnswerOutput(BaseModel): ""Node 3: final answer with confidence and its categorical bucket."" answer: str = Field(min_length=20, max_length=400) supporting_entity_ids: List[str] = Field(min_length=1, max_length=5) confidence: float = Field(ge=0.0, le=1.0) confidence_bucket: Literal["low", "medium", "high"] = Field( description=( "Must match confidence numerically: " "confidence < 0.5 => 'low'; " "0.5 <= confidence <= 0.8 => 'medium'; " "confidence > 0.8 => 'high'" ) )
@model_validator(mode="after") def _consistency(self): expected = ( "low" if self.confidence < 0.5 else "high" if self.confidence > 0.8 else "medium" ) if self.confidence_bucket != expected: raise ValueError( f"confidence={self.confidence} implies bucket={expected}', " f"got ' {self.confidence_bucket}'" ) for eid in self.supporting_entity_ids: if not _ID_RE.match(eid): raise ValueError( f"supporting_entity_id ' {eid}' fails canonical_id pattern " f"{'{CANONICAL_ID_PATTERN}'" ) return self
System-prompt variants
(src/schemaeval/prompts.py)
import json
_BACKTICK_FENCE = " " * 3
def _baseline(schema_json_str: str) -> str: return ( "You must respond with a single JSON object matching this schema.\n" "Return ONLY the JSON — no markdown code fences, no prose, no explanation.\n\n" f"Schema:\n{schema_json_str}" )
def _aggressive(schema_json_str: str) -> str: return ( "CRITICAL: You MUST respond with a single JSON object matching the " "schema below.\n" "Do NOT use markdown formatting.\n" f"Do NOT wrap your response in code fences ({_BACKTICK_FENCE}json " f"or {_BACKTICK_FENCE}).\n" "Do NOT include any prose, explanation, or commentary.\n" "Your response MUST begin with { as the very first character.\n" "Any response starting with backticks or prose will be rejected.\n\n" f"Schema:\n{schema_json_str}" )
def _few_shot(schema_json_str: str) -> str: return ( "You must respond with a single JSON object matching this schema.\n" "Return ONLY the JSON — no markdown code fences, no prose, no explanation.\n\n" "Example of a CORRECT response format:\n" '{"example_field": "example_value", "count": 3}\n\n' "Example of an INCORRECT response format (do not do this):\n" f"{_BACKTICK_FENCE}json\n" '{"example_field": "example_value", "count": 3}\n' ) f"{BACKTICK_FENCE}\n\n" "The second example is wrong because it uses markdown code fences. " "Do not wrap JSON in backticks or code blocks.\n\n" f"Schema:\n{schema_json_str}" )
_PROMPT_BUILDERS = { "baseline": _baseline, "aggressive": _aggressive, "few_shot": _few_shot, }
def build_system_prompt(schema: type, variant: str = "baseline") -> str: if variant not in _PROMPT_BUILDERS: raise ValueError( f"Unknown prompt variant ' {variant}'." f"Available: {sorted(_PROMPT_BUILDERS.keys())}" ) schema_json_str = json.dumps(schema.model_json_schema(), indent=2) return _PROMPT_BUILDERSvariant
def available_variants() -> list[str]: return sorted(_PROMPT_BUILDERS.keys())
Per-node user prompts
(src/schemaeval/topologies/sequential.py)
def run_sequential_graph( question: str, paradigm_fn: ParadigmFn, model: str = "gpt-4o-mini", max_retries: int = 3, schemas: Optional[tuple] = None, ) -> dict: if schemas is None: schemas = get_schemas("medium") IdentifyOutput, GatherOutput, AnswerOutput = schemas
run_id = str(uuid.uuid4()) per_node: dict[str, dict] = {}
prompt1 = ( f"Identify the key entities and question type in this question:\n" f"{question}\n\n" "For each entity, provide a canonical_id in lowercase snake_case " "(e.g. 'manchester_united', 'kansas_university')." ) identify_out, m1 = paradigm_fn( prompt1, IdentifyOutput, model=model, max_retries=max_retries ) per_node["identify"] = m1 if identify_out is None: return _package(run_id, question, per_node, final_answer=None)
entities_str = "\n".join( f"- name='{e.name}' type={e.entity_type} canonical_id={e.canonical_id} ) for e in identify_out.entities ) prompt2 = ( f"Question: {question}\n\n" f"Entities to research:\n{entities_str}\n\n" "For each entity, provide 1-3 facts relevant to answering the question." "Use the exact canonical_id values shown above when referencing entities." )
gather_out, m2 = paradigm_fn( prompt2, GatherOutput, model=model, max_retries=max_retries )
per_node["gather"] = m2 if gather_out is None: return _package(run_id, question, per_node, final_answer=None)
facts_str = "\n".join( f"- entity_id={f.entity_id}: {f.fact}" for f in gather_out.facts )
prompt3 = ( f"Question: {question}\n\n" f"Known facts:\n{facts_str}\n\n" "Synthesize a final answer. In supporting_entity_ids, list the " "canonical_id values (snake_case) of the entities that support your answer." )
answer_out, m3 = paradigm_fn( prompt3, AnswerOutput, model=model, max_retries=max_retries )
per_node["answer"] = m3 final_answer = answer_out.answer if answer_out else None
return _package(run_id, question, per_node, final_answer)
Validation and retry loop
(src/schemaeval/paradigms/strict_repair.py)
def call_llm_strict_repair( prompt: str, schema: type[BaseModel], model: str = "gpt-4o-mini", max_retries: int = 3, temperature: float = 0.0, prompt_variant: str = "baseline", ) -> tuple[Optional[BaseModel], dict]: system_msg = build_system_prompt(schema, variant=prompt_variant) messages = [ {"role": "system", "content": system_msg}, {"role": "user", "content": prompt}, ]
total_in = 0 total_out = 0 num_repairs = 0 last_error: Optional[str] = None attempts: list[dict] = [] start = time.time()
for attempt_num in range(max_retries + 1): try:
call = _dispatch(messages, model=model, temperature=temperature) except Exception as e: last_error = f"api_error: {e}" attempts.append({ "attempt_num": attempt_num, "raw_output": None, "input_tokens": 0, "output_tokens": 0, "validation_ok": False, "resolved_model_version": None, "error_summary": { "categories": ["api_error"], "primary_category": "api_error", "errors": [ { "category": "api_error", "loc": "", "type": type(e).name, "msg": str(e), }], }, }) break
total_in += call["input_tokens"] total_out += call["output_tokens"] raw = call["raw"]
error_summary = None validated = None try: validated = schema.model_validate_json(raw) except ValidationError as ve: error_summary = summarize_validation_error(ve, raw_output=raw) last_error = str(ve) except (ValueError, json.JSONDecodeError) as pe: error_summary = summarize_parse_error(pe, raw_output=raw) last_error = str(pe)
attempts.append({ "attempt_num": attempt_num, "raw_output": raw, "input_tokens": call["input_tokens"], "output_tokens": call["output_tokens"], "validation_ok": validated is not None, "resolved_model_version": call.get("resolved_model"), "error_summary": error_summary, })
if validated is not None: return validated, _metrics(total_in, total_out, num_repairs, start, success=True, error=None, attempts=attempts)
num_repairs += 1 if attempt_num < max_retries: messages.append({ "role": "assistant", "content": raw}) messages.append({ "role": "user", "content": ( "Your JSON failed validation with these errors:\n" f"{last_error}\n\n" ) ) }
"Return corrected JSON matching the schema. " "ONLY JSON, no prose." ), })
return None, _metrics(total_in, total_out, num_repairs, start, success=False, error=last_error, attempts=attempts)
Stage-1 predicates
(src/schemaeval/errors.py)
_SCHEMA_META_KEYS = { "description", "properties", "required", "title", "type", "additionalProperties", "schema", "$ref", "definitions", "items", "anyOf", "allOf", "oneOf", }
_SCHEMA_META_KEY_THRESHOLD = 2
_EMBEDDED_JSON_RE = re.compile(r"{.*}", re.DOTALL)
def _looks_like_schema_mirroring(raw_output: str) -> bool: if not raw_output: return False try: parsed = json.loads(raw_output) except (json.JSONDecodeError, ValueError): stripped = _strip_code_fences(raw_output) if stripped == raw_output: return False try: parsed = json.loads(stripped) except (json.JSONDecodeError, ValueError): return False if not isinstance(parsed, dict): return False root_keys = set(parsed.keys()) return len(root_keys & _SCHEMA_META_KEYS) >= _SCHEMA_META_KEY_THRESHOLD
def _looks_like_markdown_wrap(raw_output: str) -> bool: if not raw_output: return False stripped_start = raw_output.lstrip() return stripped_start.startswith("~~")
def _looks_like_prose_preamble(raw_output: str) -> bool: if not raw_output: return False stripped_start = raw_output.lstrip() if not stripped_start: return False first_char = stripped_start[0] if first_char in ("{", "[]: return False if stripped_start.startswith("~~"): return False match = _EMBEDDED_JSON_RE.search(raw_output) if not match: return False prose_prefix_len = match.start() return prose_prefix_len >= 20
def _strip_code_fences(raw_output: str) -> str: stripped = raw_output.strip() if stripped.startswith("----"): stripped = re.sub(r"----[a-zA-Z]\n?", "", stripped, count=1) stripped = re.sub(r"\n?----\s$", "", stripped, count=1) return stripped
def _heuristic_category(raw_output: Optional[str]) -> Optional[str]: if not raw_output: return None if _looks_like_markdown_wrap(raw_output): return "markdown_wrap" if _looks_like_prose_preamble(raw_output): return "prose_preamble" if _looks_like_schema_mirroring(raw_output): return "schema_mirroring" return None
medium_v2 changes
--- src/schemaeval/schemas/medium.py +++ src/schemaeval/schemas/medium_v2.py @0 -16,6 +16,4 @0
class IdentifyOutput(BaseModel): - ""Node 1: entities in the question, with a designated primary."" - entities: List[Entity] = Field(min_length=2, max_length=5) question_type: Literal[ @0 -49,15 +47,13 @0 description="Reference to a canonical_id from the identify step", ) - fact: str = Field(min_length=10, max_length=400) + fact: str = Field(min_length=10, max_length=800) # was 400 relevance: float = Field(ge=0.0, le=1.0)
class GatherOutput(BaseModel): - ""Node 2: facts about entities, with consistency count."" - facts: List[Fact] = Field(min_length=2, max_length=8) fact_count: int = Field( ge=2, le=8, description="Must equal len(facts)" ) - coverage_notes: str = Field(min_length=20, max_length=250) + coverage_notes: str = Field(min_length=20, max_length=1000) # was 250 @model_validator(mode="after") @0 -70,7 +66,5 @0
class AnswerOutput(BaseModel): - ""Node 3: final answer with confidence and its categorical bucket."" - answer: str = Field(min_length=20, max_length=400) + answer: str = Field(min_length=20, max_length=1200) # was 400 supporting_entity_ids: List[str] = Field(min_length=1, max_length=5) confidence: float = Field(ge=0.0, le=1.0) medium_v3 changes
--- src/schemaeval/schemas/medium.py +++ src/schemaeval/schemas/medium_v3_loose_regex.py @@ -4,5 +4,5 @@ from pydantic import BaseModel, Field, model_validator
-CANONICAL_ID_PATTERN = r"[a-z][a-z0-9_]{2,30}" _ID_RE = re.compile(CANONICAL_ID_PATTERN)
@@ -12,5 +12,5 @@ canonical_id: str = Field( pattern=CANONICAL_ID_PATTERN, description="lowercase_snake_case identifier, e.g. 'manchester_united', + description="alphanumeric identifier, may include hyphens/underscores", )
The medium_v2 variant changes the three character caps and omits the three class docstrings; the medium_v3_loose_regex variant changes CANONICAL_ID_PATTERN and the canonical_id description. The diffs above show every change, including those to prompt-visible text.
Appendix C Classifier Validation
Provenance
Development labelling was performed against an earlier classifier in which Pydantic error-type mapping preceded the behavioural predicates. Schema-mirrored outputs were consequently labelled missing_field and prose-preamble outputs parse_error. We corrected the order and reclassified the full corpus from stored completions and error details, without new model calls. Running the released reclassify_all.py, which applies both stages of errors.py, in dry-run mode over the released database reproduces the stored primary label of all 1,326 failed attempts (zero changes).
Agreement
The sample was drawn from all 1,326 failures in the corpus, including pilot cells and prompt variants. Table C3 reports precision and recall of the corrected classifier against the author's unadjudicated development labels, assigned with the classifier's label displayed. The four disagreements were adjudicated as labelling errors: three outputs labelled enum_violation carried a string_pattern_mismatch on an identifier, and one labelled markdown_wrap contained no fence. The first three are checkable against the stored error record and the fourth against the raw completion, without reference to the labeller. We headline unadjudicated agreement because adjudication uses evidence the labeller did not consult. The sample contains every enum_violation, prose_preamble and schema_mirroring failure in the corpus, so a held-out check with a frozen classifier can test only the remaining categories.
Held-out check
The protocol, sample and seed were committed to the repository before labelling, in PReregistration.md under results/heldout/. The labelling screen showed model, dataset, tier, node and the raw output, truncated in the middle for long outputs as in the development round, but not the classifier's label, and offered no default answer. Labelling was restarted once, after the precedence rule was reread and before any score was computed; the restarted pass is the one reported. Agreement was 34 of 40 for markdown_wrap, 23 of 30 for regex_pattern, and 12 of 30 for length_bound. The annotator marked 20 items ambiguous; excluding them, agreement is 86.2% (post hoc). The per-item disagreement record is released as results/heldout/adjudication.md.
Table C3 Corrected classifier against unadjudicated development labels (), full corpus frame. Recall is computed within the label-stratified sample, not over the corpus.
| Category | Predicted | Precision | Recall |
|---|---|---|---|
| markdown_wrap | 25 | 25/25 | 25/26 |
| length_bound | 30 | 30/30 | 30/30 |
| regex_pattern | 30 | 27/30 | 27/27 |
| schema_mirroring | 42 | 42/42 | 42/42 |
| prose_preamble | 9 | 8/9 | 8/8 |
| enum_violation | 8 | 8/8 | 8/11 |
Corpus screens.
Because the sample is stratified by predicted label, it cannot establish corpus recall. For the Stage-1 categories we screened every failure in the full corpus with relaxed screens for wrapping and preambles, and a keyword-restricted screen for mirroring. A fence at any position matches 790 failures, of which 789 are classified markdown_wrap and 1 prose_preamble (prose before a later fence). A "properties" key matches 42 failures, of which 42 are classified schema_mirroring; this screen tests one meta-keyword where the detector requires two, so it checks for missed mirroring cases only among failures containing that key. An opening character other than a brace, bracket or fence matches 9 non-empty failures, of which 9 are prose_preamble.
Appendix D Identifier Perturbation
Table D4 Sub-causes of violating identifiers in regex_pattern failures, gpt-5.6-sol and gpt-5.6-terra, HotpotQA. Counts are identifiers, not attempts.
| Sub-cause | Baseline pattern | Loosened pattern |
|---|---|---|
| Leading digit | 4 | 0 |
| Length overflow | 4 | 10 |
| Unicode contamination | 0 | 1 |
| Other character | 0 | 0 |
| Violating identifiers | 8 | 11 |
The baseline tier uses ^[a-z][a-z0-9_] {2,30}; both retain the 31-character ceiling, and the loosened pattern also governs the supporting-identifier check inside the answer validator. Sub-causes are assigned mechanically per identifier: non-ASCII characters, a leading digit not admitted by the first-character class, other characters outside the class, and length outside 3–31. The cells hold 3 and 6 failures under the baseline pattern and 5 and 4 under the loosened pattern, too few failures for precise comparative inference. Pooled over the four cells, 17 of 18 failing attempts were assigned regex_pattern, and these contained 19 violating identifiers. Sub-causes are annotated as multilabel rather than by precedence, and no identifier carried more than one; non-ASCII characters are counted as unicode and excluded from the invalid-character check. The single Unicode case under the loosened pattern is an otherwise lowercase band name with a non-Latin combining mark inserted.
Appendix E Per-Domain and First-Attempt Breakdowns
Table E5 Per-cell results, reporting basis.
| Model | Tier | Domain | Att. | Rate | Att./run | Dominant |
|---|---|---|---|---|---|---|
| claude-haiku-4-5 | medium | financebench | 263 | 70.7% | 8.22 | markdown_wrap |
| claude-haiku-4-5 | medium | hotpotqa | 1,066 | 64.9% | 7.96 | markdown_wrap |
| claude-opus-4-8 | medium | financebench | 101 | 10.9% | 3.37 | length_bound |
| claude-opus-4-8 | medium | hotpotqa | 164 | 1.2% | 3.04 | regex_pattern |
| claude-sonnet-4-6 | medium | hotpotqa | 178 | 15.7% | 3.56 | length_bound |
| claude-sonnet-4-6 | medium_v2 | hotpotqa | 324 | 7.4% | 3.24 | regex_pattern |
| claude-sonnet-5 | medium | financebench | 114 | 21.1% | 3.80 | length_bound |
| claude-sonnet-5 | medium | hotpotqa | 199 | 21.6% | 3.83 | markdown_wrap |
| gpt-4o | medium | hotpotqa | 250 | 16.0% | 3.57 | schema_mirroring |
| gpt-4o-mini | medium | hotpotqa | 242 | 13.6% | 3.46 | regex_pattern |
| gpt-5.6-luna | medium | financebench | 97 | 7.2% | 3.23 | regex_pattern |
| gpt-5.6-luna | medium | hotpotqa | 169 | 2.4% | 3.07 | regex_pattern |
| gpt-5.6-sol | medium | financebench | 96 | 6.2% | 3.20 | regex_pattern |
| gpt-5.6-sol | medium | hotpotqa | 159 | 1.9% | 3.06 | regex_pattern |
| gpt-5.6-sol | medium_v3_loose_regex | hotpotqa | 155 | 3.2% | 3.10 | regex_pattern |
| gpt-5.6-terra | medium | financebench | 98 | 8.2% | 3.27 | regex_pattern |
| gpt-5.6-terra | medium | hotpotqa | 168 | 3.6% | 3.11 | regex_pattern |
| gpt-5.6-terra | medium_v3_loose_regex | hotpotqa | 154 | 2.6% | 3.08 | regex_pattern |
Run completion and attempt failure diverge most where the repair loop does the most work: Haiku 4.5 fails of attempts yet completes of runs, at a cost of 9.36 attempts per completed run against 4.22 pooled, where the cost counts every attempt in the cell, including those of incomplete runs.
Pooled over the reporting basis, 2,192 of 2,896 first attempts validated (75.7%), rising to 85.8% if pure-formatting wrapped failures are counted as valid, and 679 of the 704 failed first attempts were repaired by a later attempt.
Audit of first-attempt extraction.
Because every Haiku 4.5 first attempt failed, we checked the extraction directly against the database. Every run-node has exactly one attempt numbered zero; attempt numbers are contiguous from zero; no attempt is logged after a valid attempt in the same
Table E6 Run completion and offline residual invalidity, reporting basis. Att./compl. is the total number of attempts in the cell, including those of incomplete runs, divided by the number of completed runs: the attempt cost per completed run, not the mean number of attempts a completed run used. Residual counts pure-formatting markdown_wrap failures as recovered; it is computed on stored attempts and is not the outcome of rerunning the pipeline with fence removal enabled.
| Model | Tier | Runs | Compl. | Compl. % | Att./compl. | Strict fail % | Residual % | 95% CI |
|---|---|---|---|---|---|---|---|---|
| claude-haiku-4-5 | medium | 166 | 142 | 85.5 | 9.36 | 66.1 | 44.2 | [40.6, 48.0] |
| claude-sonnet-5 | medium | 82 | 82 | 100.0 | 3.82 | 21.4 | 9.6 | [6.3, 13.0] |
| gpt-4o | medium | 70 | 70 | 100.0 | 3.57 | 16.0 | 16.0 | [11.9, 20.0] |
| claude-sonnet-4-6 | medium | 50 | 50 | 100.0 | 3.56 | 15.7 | 15.7 | [10.2, 21.5] |
| gpt-4o-mini | medium | 70 | 69 | 98.6 | 3.51 | 13.6 | 13.6 | [8.0, 19.7] |
| claude-sonnet-4-6 | medium_v2 | 100 | 100 | 100.0 | 3.24 | 7.4 | 7.4 | [3.8, 10.7] |
| gpt-5.6-terra | medium | 84 | 84 | 100.0 | 3.17 | 5.3 | 5.3 | [3.1, 7.7] |
| claude-opus-4-8 | medium | 84 | 84 | 100.0 | 3.15 | 4.9 | 4.9 | [2.7, 7.4] |
| gpt-5.6-luna | medium | 85 | 85 | 100.0 | 3.13 | 4.1 | 4.1 | [2.2, 6.3] |
| gpt-5.6-sol | medium | 82 | 82 | 100.0 | 3.11 | 3.5 | 3.5 | [1.6, 5.7] |
| gpt-5.6-sol | medium_v3_loose_regex | 50 | 50 | 100.0 | 3.10 | 3.2 | 3.2 | [0.7, 6.2] |
| gpt-5.6-terra | medium_v3_loose_regex | 50 | 50 | 100.0 | 3.08 | 2.6 | 2.6 | [0.7, 5.1] |
| Pooled | 973 | 948 | 97.4 | 4.22 | 28.2 | 20.0 | [17.6, 22.5] |
run-node; and the validation flag agrees with the stored category and error record for every attempt in the corpus. First-attempt validity is non-zero for every other model under the same query. All 475 Haiku first attempts begin with a code fence in the raw completion, a check independent of the classifier, and this holds in each collection batch and in both domains. After the first validation error is returned, fences persist in 165 of 475 second attempts and in none thereafter, while length_bound accounts for every failure from the third attempt onward.
Appendix F Model-Level Constraints
Model validators run only after every field-level constraint passes. On the reporting basis, 2,875 attempts reached them: 2,871 that validated and 4 that passed field validation and failed the per-item supporting-identifier check in the answer validator. That check follows the confidence-bucket check in the same method, so those attempts also passed it. No attempt matched any of the four cross-field messages (0 violations). The remaining 1,122 failures did not reach the validators; many failed during JSON parsing. Each node tests only its own checks: two cross-field checks in identify, one in gather, and one cross-field plus one per-item pattern check in answer. 3 of the 4 are the final attempts of one gpt-4o-mini answer node, which exhausted its retries although each returned error named the required pattern; it is that model's only incomplete run. Excluding all 4 changes no cell's or group's dominant category; gpt-4o-mini's regex_pattern share moves from to .
Prompt visibility.
The system prompt embeds each node's model_json_schema() (Appendix B), so a constraint is visible on the first attempt if it is a JSON Schema keyword or is stated in a field or model description. Table F9 lists every constraint the medium tier enforces. The only enforced constraint absent from the prompt is the per-item identifier pattern on supporting_entity_ids, the check behind the 4 model-level failures above; the four cross-field checks, each stated in a description, produced 0 violations. Conversely, the description of Fact.entity_id asks for a reference to an identify-step identifier, but only its pattern is enforced.
Table E7 First attempts by node: valid first attempts over run-nodes reaching the node, the same after fence removal, and the composition of failed first attempts. The denominator depends on upstream success, so the identify node is the only unconditioned comparison. Retry rows give failed first attempts that a later attempt repaired.
| Model | Tier | Node | Valid/reached | After fence | First-attempt failure composition |
|---|---|---|---|---|---|
| claude-haiku-4-5 | medium | identify | 0/166 | 144/166 | markdown_wrap 166 |
| claude-haiku-4-5 | medium | gather | 0/166 | 21/166 | markdown_wrap 166 |
| claude-haiku-4-5 | medium | answer | 0/143 | 96/143 | markdown_wrap 143 |
| claude-haiku-4-5 | medium | retry | 451/475 | failed first attempts later valid | |
| claude-opus-4-8 | medium | identify | 81/84 | 81/84 | regex_pattern 3 |
| claude-opus-4-8 | medium | gather | 84/84 | 84/84 | - |
| claude-opus-4-8 | medium | answer | 75/84 | 75/84 | length_bound 9 |
| claude-opus-4-8 | medium | retry | 12/12 | failed first attempts later valid | |
| claude-sonnet-4-6 | medium | identify | 41/50 | 41/50 | regex_pattern 7, enum_violation 2 |
| claude-sonnet-4-6 | medium | gather | 41/50 | 41/50 | length_bound 9 |
| claude-sonnet-4-6 | medium | answer | 42/50 | 42/50 | length_bound 7, prose_preamble 1 |
| claude-sonnet-4-6 | medium | retry | 26/26 | failed first attempts later valid | |
| claude-sonnet-4-6 | medium_v2 | identify | 84/100 | 84/100 | regex_pattern 14, enum_violation 2 |
| claude-sonnet-4-6 | medium_v2 | gather | 96/100 | 96/100 | prose_preamble 4 |
| claude-sonnet-4-6 | medium_v2 | answer | 96/100 | 96/100 | prose_preamble 4 |
| claude-sonnet-4-6 | medium_v2 | retry | 24/24 | failed first attempts later valid | |
| claude-sonnet-5 | medium | identify | 53/82 | 69/82 | markdown_wrap 20, regex_pattern 9 |
| claude-sonnet-5 | medium | gather | 63/82 | 80/82 | markdown_wrap 17, length_bound 1, parse_error 1 |
| claude-sonnet-5 | medium | answer | 71/82 | 71/82 | length_bound 11 |
| claude-sonnet-5 | medium | retry | 59/59 | failed first attempts later valid | |
| gpt-4o | medium | identify | 59/70 | 59/70 | regex_pattern 8, enum_violation 3 |
| gpt-4o | medium | gather | 70/70 | 70/70 | - |
| gpt-4o | medium | answer | 41/70 | 41/70 | schema_mirroring 29 |
| gpt-4o | medium | retry | 40/40 | failed first attempts later valid | |
| gpt-4o-mini | medium | identify | 55/70 | 55/70 | regex_pattern 15 |
| gpt-4o-mini | medium | gather | 70/70 | 70/70 | - |
| gpt-4o-mini | medium | answer | 60/70 | 60/70 | schema_mirroring 8, length_bound 2 |
| gpt-4o-mini | medium | retry | 24/25 | failed first attempts later valid | |
| gpt-5.6-luna | medium | identify | 77/85 | 77/85 | regex_pattern 8 |
| gpt-5.6-luna | medium | gather | 85/85 | 85/85 | - |
| gpt-5.6-luna | medium | answer | 82/85 | 82/85 | length_bound 3 |
| gpt-5.6-luna | medium | retry | 11/11 | failed first attempts later valid | |
| gpt-5.6-sol | medium | identify | 74/82 | 74/82 | regex_pattern 8 |
| gpt-5.6-sol | medium | gather | 82/82 | 82/82 | - |
| gpt-5.6-sol | medium | answer | 81/82 | 81/82 | length_bound 1 |
| gpt-5.6-sol | medium | retry | 9/9 | failed first attempts later valid | |
| gpt-5.6-sol | medium_v3_loose_regex | identify | 46/50 | 46/50 | regex_pattern 4 |
| gpt-5.6-sol | medium_v3_loose_regex | gather | 50/50 | 50/50 | - |
| gpt-5.6-sol | medium_v3_loose_regex | answer | 49/50 | 49/50 | regex_pattern 1 |
| gpt-5.6-sol | medium_v3_loose_regex | retry | 5/5 | failed first attempts later valid | |
| gpt-5.6-terra | medium | identify | 71/84 | 71/84 | regex_pattern 12, enum_violation 1 |
| gpt-5.6-terra | medium | gather | 84/84 | 84/84 | - |
| gpt-5.6-terra | medium | answer | 83/84 | 83/84 | length_bound 1 |
| gpt-5.6-terra | medium | retry | 14/14 | failed first attempts later valid | |
| gpt-5.6-terra | medium_v3_loose_regex | identify | 46/50 | 46/50 | regex_pattern 4 |
| gpt-5.6-terra | medium_v3_loose_regex | gather | 50/50 | 50/50 | - |
| gpt-5.6-terra | medium_v3_loose_regex | answer | 50/50 | 50/50 | - |
| gpt-5.6-terra | medium_v3_loose_regex | retry | 4/4 | failed first attempts later valid |
Appendix G Divergence Metric
For each pair of model-tier groups and each category we take the absolute difference in the share of the group's failures held by that category. Groups pool task domains and use the reporting basis; of 12 groups with any failure, 6 have at least 20 failures, giving 15 pairs. The two largest values arise on different categories from opposite vendors, 72.9 and 72.5 points, and differ by 0.4 points, so we attach no significance to their order. The maximum of 72.9 points is itself attained by 4 pairs, each setting Haiku 4.5 against a group with no markdown_wrap failures. Without the threshold the maximum is 97.5 points in regex_pattern, attained by 2 pairs, Haiku 4.5 at medium against each of gpt-5.6-sol and gpt-5.6-terra at medium_v3, whose failures are all regex_pattern;
Table E8 Dominant category and fence-strip outcome by cell. Pure/wrapped is pure-formatting wrapped failures over all wrapped failures. Dominant shares for cells with few failures are descriptive only.
| Model | Tier | Domain | Rate % | Dominant | Share % | Pure/wrapped | Compound |
|---|---|---|---|---|---|---|---|
| claude-haiku-4-5 | medium | financebench | 70.7 | markdown_wrap | 63.4 | 34/118 | 84 |
| claude-haiku-4-5 | medium | hotpotqa | 64.9 | markdown_wrap | 75.4 | 256/522 | 266 |
| claude-opus-4-8 | medium | financebench | 10.9 | length_bound | 90.9 | – | – |
| claude-opus-4-8 | medium | hotpotqa | 1.2 | regex_pattern | 100.0 | – | – |
| claude-sonnet-4-6 | medium | hotpotqa | 15.7 | length_bound | 64.3 | – | – |
| claude-sonnet-4-6 | medium_v2 | hotpotqa | 7.4 | regex_pattern | 58.3 | – | – |
| claude-sonnet-5 | medium | financebench | 21.1 | length_bound | 41.7 | 5/6 | 1 |
| claude-sonnet-5 | medium | hotpotqa | 21.6 | markdown_wrap | 81.4 | 32/35 | 3 |
| gpt-4o | medium | hotpotqa | 16.0 | schema_mirroring | 72.5 | – | – |
| gpt-4o-mini | medium | hotpotqa | 13.6 | regex_pattern | 66.7 | – | – |
| gpt-5.6-luna | medium | financebench | 7.2 | regex_pattern | 57.1 | – | – |
| gpt-5.6-luna | medium | hotpotqa | 2.4 | regex_pattern | 100.0 | – | – |
| gpt-5.6-sol | medium | financebench | 6.2 | regex_pattern | 83.3 | – | – |
| gpt-5.6-sol | medium | hotpotqa | 1.9 | regex_pattern | 100.0 | – | – |
| gpt-5.6-sol | medium_v3_loose_regex | hotpotqa | 3.2 | regex_pattern | 100.0 | – | – |
| gpt-5.6-terra | medium | financebench | 8.2 | regex_pattern | 87.5 | – | – |
| gpt-5.6-terra | medium | hotpotqa | 3.6 | regex_pattern | 83.3 | – | – |
| gpt-5.6-terra | medium_v3_loose_regex | hotpotqa | 2.6 | regex_pattern | 100.0 | – | – |
Table F9 Prompt visibility of the constraints enforced by the medium tier. The prompt carries each node's JSON Schema, including field and model descriptions.
| Constraint | Enforced by | Visible in prompt as |
|---|---|---|
| Character caps, list-length bounds, numeric ranges | field | schema keyword |
| Enumerations (entity type, question type, bucket) | field | schema keyword |
| Identifier pattern on canonical_id, entity_id | field | keyword and description |
| primary_entity_id among entity identifiers | validator | description |
| entity_count, fact_count equal list lengths | validator | description |
| Bucket coherent with confidence | validator | description with thresholds |
| Identifier pattern on each supporting_entity_ids item | validator | not visible |
those groups have very few failures. Maximum-gap statistics are selected to be extreme and do not summarise the distributions; we report them as secondary.
Table G10 Largest category-share differences among qualifying groups.
| Category | Group A | Group B | pp |
|---|---|---|---|
| markdown_wrap | claude-haiku-4-5@medium | claude-sonnet-4-6@medium | 72.9 |
| markdown_wrap | claude-haiku-4-5@medium | claude-sonnet-4-6@medium_v2 | 72.9 |
| markdown_wrap | claude-haiku-4-5@medium | gpt-4o@medium | 72.9 |
| markdown_wrap | claude-haiku-4-5@medium | gpt-4o-mini@medium | 72.9 |
| schema_mirroring | claude-haiku-4-5@medium | gpt-4o@medium | 72.5 |
| schema_mirroring | claude-sonnet-4-6@medium | gpt-4o@medium | 72.5 |
| schema_mirroring | claude-sonnet-4-6@medium_v2 | gpt-4o@medium | 72.5 |
| schema_mirroring | claude-sonnet-5@medium | gpt-4o@medium | 72.5 |
References
Cemri M, Pan MZ, Yang S, et al (2025) Why do multi-agent LLM systems fail? In: Advances in Neural Information Processing Systems (NeurIPS), Datasets and Benchmarks Track, URL https://proceedings.neurips.cc/paper_files/paper/2025/ hash/b1041e52d3be19f0a9bc491657488e4a-Abstract-Datasets_and_Benchmarks_Track.html
Dong Y, Ruan CF, Cai Y, et al (2025) XGrammar: Flexible and efficient structured generation engine for large language models. In: Proceedings of Machine Learning and Systems (MLSys), URL https://arxiv.org/abs/2411.15100
Ferguson N, Pennington J, Beghian N, et al (2026) ExtractBench: A benchmark and evaluation methodology for complex structured extraction. arXiv preprint URL https://arxiv.org/abs/2602.12247, arXiv:2602.12247. Preprint, not peer reviewed
Geng S, Cooper H, Moskal M, et al (2025) JSONSchemaBench: A rigorous benchmark of structured outputs for language models. arXiv preprint URL https://arxiv.org/abs/2501.10868, arXiv:2501.10868
Hou X, Zhao Y, Liu Y, et al (2024) Large language models for software engineering: A systematic literature review. ACM Transactions on Software Engineering and Methodology URL https://arxiv.org/abs/2308.10620, arXiv:2308.10620
Huang J, Chen X, Mishra S, et al (2024) Large language models cannot self-correct reasoning yet. In: International Conference on Learning Representations (ICLR), URL https://arxiv.org/abs/2310.01798
Humbatova N, Jahangirova G, Bavota G, et al (2020) Taxonomy of real faults in deep learning systems. In: Proceedings of the 42nd ACM/IEEE International Conference on Software Engineering (ICSE), pp 1110–1121, https://doi.org/10.1145/3377811.3380395
Islam P, Kannappan A, Kiela D, et al (2023) FinanceBench: A new benchmark for financial question answering. arXiv preprint URL https://arxiv.org/abs/2311.11944, arXiv:2311.11944
Liang JT, Lin M, Rao N, et al (2025) Prompts are programs too! Understanding how developers build software containing prompts. Proceedings of the ACM on Software Engineering (FSE) https://doi.org/10.1145/3729342
Liu A, Meng J (2026) Paraphrase-induced output-mode collapse: When LLMs break character under semantically equivalent inputs. arXiv preprint URL https://arxiv.org/abs/2605.04665, arXiv:2605.04665. Preprint, not peer reviewed
Meyer B (1992) Applying “design by contract”. Computer 25(10). https://doi.org/10.1109/2.161279
Shankar S, Li H, Asawa P, et al (2024) SPADE: Synthesizing data quality assertions for large language model pipelines. Proceedings of the VLDB Endowment 17(12). URL https://arxiv.org/abs/2401.03038
Singh AK, Khurdula HV, Khemlani YD, et al (2026) The structured output benchmark: A multi-source benchmark for evaluating structured output quality in large language models. arXiv preprint URL https://arxiv.org/abs/2604.25359, arXiv:2604.25359. Preprint, not peer reviewed
Tam ZR, Wu CK, Tsai YL, et al (2024) Let me speak freely? a study on the impact of format restrictions on performance of large language models. In: Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing: Industry Track. Association for Computational Linguistics, Miami, Florida, pp 1218–1236, URL https://aclanthology.org/2024.emnlp-industry.91/, arXiv:2408.02442
Tenckhoff S, Koddenbrock M, Rodner E (2026) LLMStructBench: Benchmarking large language model structured data extraction. arXiv preprint URL https://arxiv.org/abs/2602.14743, arXiv:2602.14743. Preprint, not peer reviewed
Willard BT, Louf R (2023) Efficient guided generation for large language models. arXiv preprint URL https://arxiv.org/abs/2307.09702, arXiv:2307.09702
Wohlin C, Runeson P, Höst M, et al (2012) Experimentation in Software Engineering. Springer, Berlin, Heidelberg, https://doi.org/10.1007/978-3-642-29044-2
Xia C, Xing C, Du J, et al (2024) FOFO: A benchmark to evaluate LLMs' format-following capability. In: Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). Association for Computational Linguistics, Bangkok, Thailand, pp 680–699, https://doi.org/10.18653/v1/2024.acl-long.40, URL https://aclanthology.org/2024.acl-long.40/
Yang Z, Qi P, Zhang S, et al (2018) HotpotQA: A dataset for diverse, explainable multi-hop question answering. In: Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing. Association for Computational Linguistics, Brussels, Belgium, pp 2369–2380, https://doi.org/10.18653/v1/D18-1259, URL https://aclanthology.org/D18-1259/
Yuan D, Park S, Zhou Y (2012) Characterizing logging practices in open-source software. In: Proceedings of the 34th International Conference on Software Engineering (ICSE). IEEE, Zurich, Switzerland
Zhou J, Lu T, Mishra S, et al (2023) Instruction-following evaluation for large language models. arXiv preprint URL https://arxiv.org/abs/2311.07911, arXiv:2311.07911