Constrained decoding is an inference-time technique that restricts an AI language model's token generation to a predefined subset of permissible outputs, enforcing lexical, semantic, or safety constraints during the text generation process. Unlike post-hoc filtering, it operates within the model's beam search or sampling algorithm, guiding the probability distribution over the vocabulary to guarantee outputs satisfy formal rules. This makes it a core component of constitutional guardrails and agentic cognitive architectures, ensuring deterministic compliance with policies during autonomous operation.
