Constrained Decoding
A specialized generation technique that explicitly restricts a language model's output probabilities to perfectly match a strictly defined structured schema.
Think of It Like This
Like a strict multiple-choice test where you aren't physically allowed to write down a word, you can only fill in one of the specific letter bubbles.
When an application expects a valid JSON response from a language model, hoping the model generates correct syntax is extremely risky. Constrained decoding uses finite state machines or regex rules at inference time to literally force the probability of any syntactically invalid next token to zero. This guarantees the final output is flawlessly parseable.