Technique

Structured Output

Constrained decoding that guarantees output matches a schema (JSON, regex, grammar).

Definition

Structured-output APIs guarantee the model's output conforms to a schema by intervening at sampling time — masking logits that would violate the grammar. This eliminates parsing errors and lets developers treat LLM outputs like typed API responses.

Common use cases

  • Structured data extraction
  • Database ingestion
  • Forms

Related terms

    Structured Output — AI Glossary | Railwail