Technique

Output Format Constraint

Mechanism forcing model output to match a regex, grammar or schema during decoding.

Definition

Output-format constraints intervene at decoding time, masking any token that would violate the target grammar. They guarantee parseable JSON, code, regex matches or domain DSL output — and remove the need for retry-on-parse-error loops.

Common use cases

  • Structured extraction
  • DSL generation
  • Forms

Related terms

    Output Format Constraint — AI Glossary | Railwail