Rendered Source Note

Efficient Guided Generation for Large Language Models

Generated HTML view. Markdown remains canonical.

Efficient Guided Generation for Large Language Models

Type: paper Tier: 2 (Foundational Paper) Authors: Brandon T. Willard, Rémi Louf (Normal Computing; the Outlines library) Year: 2023 arXiv: 2307.09702 — https://arxiv.org/abs/2307.09702 URL: https://arxiv.org/abs/2307.09702 Accessed: 2026-06-09

Primary source for Elective 06 — Structured Output & Reliability (the constrained-decoding extension, §8). Faithful summary; arXiv PDF is canonical.


Why This Source Matters

The reliability core of Elective 06 makes structured output trustworthy after generation — extract, validate, and repair what the model produced. This paper is the other half: prevent invalid output at generation. It grounds the claim that the most robust fix is constrained decoding — making schema-violating output impossible by construction rather than catching it afterward — and is the basis for the elective's "forced structure" extension.

Key Claims

a regular expression (and, by extension, a context-free grammar or JSON schema): each FSM state defines which next tokens keep the output valid.

step the logits of disallowed tokens are masked — the model can only sample tokens that keep the output schema-valid. Output therefore matches the schema by construction.

vocabulary each step), making guaranteed-valid generation practical, not just theoretically possible.

JSON-schema-shaped output.

Relevant To

validate-and-repair loop, §8 / the extension).

the shape" idea via the API), mcp-tools.md (outputSchema / structured results). Elective 03 (no repair generations means lower cost).

Known issues / cautions

it's most directly available on local/open models or providers that implement it server-side.

semantically wrong. Constrained decoding does not replace evaluation.

emit something schema-shaped); the schema must leave room for "unknown"/"needs human".