← Tool Use & Function Calling
Schema-Guided Decoding
Schema-guided decoding constrains the token sampling process at inference time so that the model can only generate tokens that keep the partial output on a path toward a valid instance of the target schema. By masking logits for invalid tokens at each decoding step, the runtime guarantees schema conformance without relying on the model to self-correct post hoc. This enables reliable structured output even from models that would otherwise produce invalid JSON.