the.ai

Structure / Foundations

verified

Structured Output

Sometimes the answer is not a sentence but an object: a parse tree, a table, an alignment, a JSON document a program will read. The difference that matters is that most possible outputs are not merely wrong, they are malformed — and a model that is 99% likely to produce well-formed output is unusable in a pipeline that runs a thousand times.

Viz primitive · budget-splitmalformed-sequences = 10

malformed-sequences holds 33% of the budget; rest holds the remaining 67%.

Token sequences that do not parse, against the ones that do, in equal units. Drag the output length up to watch the malformed set swallow the space — which is why a well-formed rate is not the same guarantee as a well-formed grammar.

10

Reviewed by opendroid · 2026-08-18

  • arXiv:2305.13971 — Grammar-Constrained Decoding for Structured NLP Tasks without Finetuning
  • arXiv:2201.11227 — Synchromesh: Reliable code generation from pre-trained language models