Structured Output
Constraining a model to emit data conforming to a declared schema rather than free text.
Structured output is the practice of requiring a model's response to conform to a declared schema — typically expressed as JSON Schema — so the result can be consumed by code without parsing prose. It underlies both Tool Use and any pipeline that needs machine-readable results.
The important subtlety is that not every part of a schema is enforced the same way. Providers commonly compile the schema into a grammar that constrains generation, but only for the parts a grammar can express: object shape, property names, types, enumerations, required-versus-optional. Constraints like minimum length, maximum length, item counts, and regular-expression patterns are typically stripped out of the grammar and appended to the field's description as prose. The model is then merely asked to respect them, while the client library still validates the reply against the full schema — so a bound set close to the length actually wanted produces intermittent hard failures.
Two consequences follow. Put the intended target in the description and keep any hard limit far away as a runaway backstop, per Anchoring Effect. And treat anything the grammar cannot express — custom refinements, cross-field rules — as runtime validation only, invisible to the model, which means the failure message is the only channel that teaches it what is legal.
See also5
Hand-picked in the note itself — the neighbours worth reading next.
Constrained Decoding
Restricting a model's next-token choices to those a formal grammar permits.
Agents & Language Models9 connections
Schema Validation
Checking data against a declared shape at runtime, and using the result as the typed value.
Agents & Language Models11 connections
Prompt Engineering
Shaping a model's input to make the desired behaviour reliable rather than occasional.
Agents & Language Models18 connections
Nondeterminism
The property that identical inputs may produce different outputs, and what it costs to test around.
Agents & Language Models17 connections
Large Language Model
A neural network trained to predict text, used as a general-purpose instruction-following system.
Agents & Language Models22 connections
Related2
Nearby in the graph rather than deliberately chosen. Looser, sometimes surprising.
Linked from10
Notes elsewhere in the wiki that reach for this one.
- Anchoring EffectMethod
A stated number pulls subsequent estimates toward it, regardless of relevance.
- Constrained DecodingAgents & Language Models
Restricting a model's next-token choices to those a formal grammar permits.
- Goodhart's LawMethod
When a measure becomes a target, it stops being a good measure.
- JSON SchemaAgents & Language Models
A vocabulary for describing the shape of JSON data, and the lingua franca of model tool interfaces.
- Large Language ModelAgents & Language Models
A neural network trained to predict text, used as a general-purpose instruction-following system.
- Model RoutingAgents & Language Models
Choosing which model handles which step, trading capability against cost and latency.
- Prompt EngineeringAgents & Language Models
Shaping a model's input to make the desired behaviour reliable rather than occasional.
- Schema ValidationAgents & Language Models
Checking data against a declared shape at runtime, and using the result as the typed value.
- TokenAgents & Language Models
The sub-word unit a language model actually reads and writes; the unit of cost and of context.
- Tool UseAgents & Language Models
Giving a model a set of callable functions so it can act on the world rather than only describe it.