Skip to main content

COMPEL Glossary / constrained-decoding

Constrained decoding

A decoding-time technique forcing model outputs to conform to a grammar, JSON Schema, or regular language by masking invalid next-token probabilities.

What this means in practice

Stronger guarantee than prompting alone: structure is enforced deterministically rather than requested. Implementations include Outlines, Guidance, and llama.cpp GBNF.

Synonyms

grammar-constrained decoding , token-level constraint , schema-enforced decoding

See also

  • Structured output — Output formatted to match a declared schema — JSON with a JSON Schema, function-call arguments, or grammar-constrained text — rather than free text.
  • Tool use / function calling — A prompt pattern authorizing the model to request named functions with structured arguments — searching the web, reading a database, calling a calculator, triggering an API — rather than generating all answers from its weights.

Related articles in the Body of Knowledge