RETROSPECTIVE RECORD · PREPARED 16 SEPTEMBER 2026The record · 100 retrospective records ↗

The record / Practice

Practice / From the record · 6 August 2024 event · prepared 16 September 2026

Constrained decoding made JSON output reliable, not correct

OpenAI's Structured Outputs guarantees schema-valid JSON through constrained decoding, but a valid schema does not check whether the values inside are right.

Visual for this record: Constrained decoding made JSON output reliable, not correct
Visual published by canada1.discourse-cdn.com, shown for identification of the record. Credit: canada1.discourse-cdn.com · source page ↗ Rights: owner-review-pending.

A schema the model cannot miss

On 6 August 2024, OpenAI announced Structured Outputs, a mode in which, according to the announcement, a model's response will reliably produce valid JSON matching a supplied schema once a developer sets strict mode on. The company reported that on an internal evaluation of complex schema-following, the gpt-4o-2024-08-06 model reached 100% reliability with the feature enabled, against under 40% for gpt-4-0613 without it. That is a comparison between one model with the feature and an older model without it, run on OpenAI's own evaluation, not a general claim about every schema or every model.

How the guarantee is enforced

The mechanism behind this kind of guarantee is constrained decoding: at each generation step, the set of tokens the model is allowed to produce next is restricted to those consistent with the target grammar, so the output cannot leave the shape of the schema. Willard and Louf's paper on efficient guided generation describes a version of this approach that reformulates a schema or regular expression as a finite-state machine and builds an index over the model's vocabulary so that only valid next tokens are considered, adding little overhead to generation. OpenAI's own guide confirms the practical effect: once the constraint is active, a developer does not need to worry about the model omitting a required key or producing an invalid enum value, because the decoder will not produce a token that breaks either rule.

Valid JSON is not correct JSON

A schema constrains shape, not content. The same guide lists what the guarantee does not cover: a refusal for safety reasons, a response cut off by a token limit, or an incompatibility with parallel function calls will all still occur, and none of OpenAI's documented conditions catch an arithmetic mistake or a wrong value placed correctly inside a valid field. A response can satisfy every type and enum constraint in a schema while still containing a wrong total, a fabricated identifier, or a mismatched unit, because the schema was never designed to check any of those things. Structured Outputs solves a parsing problem, not a correctness problem, and the two are easy to conflate once a pipeline stops throwing exceptions on malformed JSON.

Questions to carry into your own evaluation

  • Does the schema cover every field your downstream code assumes is present, or only some of them?
  • What happens to a request when a refusal or a token limit prevents a schema-conforming response?
  • Is anything checking the values inside a valid response, not just their shape?

A parser that stops throwing exceptions is a real improvement. It is not the same achievement as a model that stops being wrong.

Sources & reading trail

Introducing Structured Outputs in the API ↗

Announces Structured Outputs, the 100%-versus-under-40% reliability comparison, and stated limitations such as refusals and incompatibility with parallel function calls.

Source published: 6 August 2024 · Retrieved: 16 September 2026

Structured Outputs guide ↗

Documents the schema-adherence guarantee, the refusal and max-token exceptions, and the unsupported subset of JSON Schema, as retrieved 16 September 2026.

Source published: Not established · Retrieved: 16 September 2026

Efficient Guided Generation for Large Language Models ↗

Describes finite-state, grammar-constrained decoding as a general mechanism for enforcing output structure during generation.

Source published: 19 July 2023 · Retrieved: 16 September 2026

Papers and official documents establish the record; the reading and the questions are Model Field Guide editorial analysis. This retrospective draft does not imply the site published on the event date.