Skip to content
03 Determinism From Ambiguity

Shape, not semantics

Constrained decoding guarantees membership in a language. It guarantees nothing about truth.

Lesson 03 of 06 · 7 min

Constrained decoding compiles your target language into an automaton and masks the vocabulary at each step to tokens that keep you inside it. Understanding exactly where the guarantee ends prevents a whole class of design error.

Membership, not truth. A schema-valid JSON object asserting a fabricated invoice total is a complete success by the constrained-decoding contract.

Providers are unusually precise about this. Structured output "ensures the model will always generate responses that adhere to your supplied JSON Schema," preventing omitted keys and invalid enum values. That is a statement about syntax and membership. It says nothing about whether the enum value chosen is the right one.

Predict

You add minimum: 0 to a numeric field in your schema. What enforces it?

The rest of this lesson unlocks when you commit above.