AI Glossary Term
What does “Guarded Decoding” mean?
Definition
A generation strategy that constrains output tokens to valid structures or policy-compliant choices.
How Guarded Decoding works
Example
To get valid JSON, the decoder blocks any token that would break the required structure at each step. The model can only choose among tokens that keep the output well formed.
Why it matters
It guarantees output formats or policies without relying on the model to behave. It can limit expression if the rules are too tight.
Common questions
Is it the same as a safety filter?
Related. A filter checks text after it is written; guarded decoding limits choices while writing.
Does it slow generation?
A little, since constraints are checked at each step.
What else can it enforce?
Grammars, lists of allowed words, or blocked terms.