MMOOZZGG.com

Glossary

What is structured output in an LLM?

In short

Structured output in an LLM is a mode in which a language model answers with data in a set format instead of free text, usually JSON that follows a schema a program can read.

Prompts · structured output

MMOOZZGG.com editorsChecked: 1 min read

For a child

Imagine a sign-up form for an after-school club: your name in one box, your age in another, your favorite hobby in a third. If everyone writes however they like, the teacher gets confused. With boxes, everything is clear and quick. You can ask a neural network to fill in boxes like these too, and then other programs understand its answer easily and without mistakes.

In plain words

People like to read paragraphs, but a program needs fields: “name”, “phone”, “amount”. If you just ask a model to “return the data as a table”, it sometimes adds an extra phrase or forgets a field, and the program breaks. In this mode the developer describes the shape of the answer in advance: which fields, of which type, which are required. The model cannot leave this shape, because unsuitable characters are blocked during generation. This is how a customer’s email becomes a ready record for the CRM.

For business

Structured output is the bridge between a neural network and your record systems: the AI reads emails, scans and calls, and clean fields reach the CRM, 1C or a spreadsheet with no manual copying. Without this mode, integrations break on rare answers in the wrong format, and developers write retries and checks. The cost barely changes because you pay for the same tokens, and the saving comes from cheaper support of the integration. Know the limit: the form of the answer will be correct, but the content of the fields can still be wrong, so amounts and company details are checked against the source. A refusal by the model also needs its own handling. Test the process on a sample of real documents before you connect it to the live database.

For a specialist

Structured outputs are generation limited by a formal schema, most often JSON Schema (the current version of the specification is 2020–12). The difference from a plain JSON mode: that mode gives only syntactically valid JSON and does not ensure the answer matches the schema. The method rests on constrained decoding: the schema is compiled into a grammar, and at each step the tokens that would break it are masked. Willard and Louf (2023) described an efficient way to do this: reduce regular expressions and context-free grammars to a finite automaton and build an index over the model’s vocabulary in advance. Providers support a subset of JSON Schema; for example, Anthropic’s documentation does not support recursive schemas or the numeric limits minimum and maximum. A refusal by the model or a cut-off at the token limit can produce output outside the schema. Strict tool use applies the same check to tool arguments.

Example

A logistics company gets hundreds of free-form requests. For each one, the model returns an object with the fields “from”, “to”, “weight” and “date”, and the requests go straight into the accounting system with no operator.

Related terms

Questions and answers

How is structured output different from asking for an answer in JSON? A request in the prompt usually works, but the model can get a bracket wrong or skip a field. In this mode a schema sets the shape of the answer, and unsuitable output is cut off during generation.
Why does a business need neural network answers in JSON? So the result goes straight into the CRM, 1C or a spreadsheet with no manual copying. Programs read fields, not paragraphs, so the integration stays stable.

Sources

Where companies use it

Not sure whether your company needs this?

AI solutions map
Contact us