# Constrained Decoding

> Restricting token generation so output follows a grammar, schema, or allowed set of values.

- Category: Reasoning & Inference
- Stage: Rising
- Also called: Grammar decoding, Schema decoding
- Canonical: https://www.joelcsaji.com/ai-dictionary/constrained-decoding

## Plain English

The model can only write answers in shapes your software accepts.

## Example

A generation must produce valid JSON that conforms to a strict schema.

## Why it matters

Constrained decoding makes AI output more dependable for automation and data pipelines.

## Related

- [Structured Outputs](https://www.joelcsaji.com/ai-dictionary/structured-outputs)
- [Function Calling](https://www.joelcsaji.com/ai-dictionary/function-calling)

## Sources

- [OpenAI: Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
- [OpenAI: Function Calling](https://developers.openai.com/api/docs/guides/function-calling)
