liveBook · Manning

Constrained decoding

As explained in Reinforcement Learning from Human Feedback

Constrained decoding is a generation technique that restricts the tokens or structures a model may produce to satisfy specified validity constraints.

Constrained decoding restricts the tokens or structures a model may produce so generated tool calls satisfy schemas, valid JSON requirements, and argument-type constraints. section 13.5

In production function calling, these restrictions reduce retries caused by malformed outputs. Providers may expose strict modes, while open-model serving systems can apply constrained decoding through inference configuration. section 13.5 section 13.6

Implementation decisions include:

  • Enforcing valid JSON and correct argument types before tool execution. section 13.5
  • Selecting provider-specific strict modes or inference flags for open models. section 13.5
  • Balancing structured-output reliability against context consumption from tool results. section 13.6

How Reinforcement Learning from Human Feedback covers it

How deep it goes
Explains schema conformance and inference-time enforcement, but does not detail the decoding algorithm.
Examples
Uses function signatures, typed parameters, and function-call messages to illustrate structured tool interactions.
What you can do after
Operate/configure constrained generation to enforce schemas and correct argument types in tool-calling pipelines.
How it connects
Connects tool use, function calling, JSON schemas, inference flags, and context-window management.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Reinforcement Learning from Human Feedback. The section links point to the parts of the book it draws on.