JSON mode

Also: constrained decoding, grammar-constrained sampling

A serving-side feature that masks out any token which would break the required grammar, so the output is valid JSON by construction rather than by request.

What people get wrong

Valid is not the same as correct. Constrained decoding guarantees the shape parses and matches the schema; whether the fields are filled with the right values is still an accuracy question.

A definition is not an understanding. This is taught properly in Asking for JSON versus guaranteeing it, part of Structured output.

Learn this properly

Terms from the same topic