Constrained Generation
Techniques that force LLM output to conform to specific formats, schemas, or grammars. This ensures outputs are always valid JSON, SQL, or match a defined structure.
Why It Matters
Constrained generation eliminates parsing failures in production. Instead of hoping the model outputs valid JSON, you guarantee it.
Example
Forcing an LLM to output only valid JSON matching a specific schema — the generation process itself is constrained so invalid output is impossible.
Think of it like...
Like bowling with bumpers — the ball (output) is physically prevented from going into the gutter (invalid format), guaranteeing it stays in the lane.
Related Terms
Structured Output
The ability of an LLM to generate responses in a specific format like JSON, XML, or a defined schema. Structured output makes AI responses parseable by other software systems.
Function Calling
A capability where an LLM can generate structured output to invoke specific functions or APIs. The model decides which function to call and what parameters to pass based on the user's request.