date: 2026-11-08

title: "Constrained Decoding Guarantees Structure, Not Semantics"

author: Brian Taylor


Constrained Decoding Guarantees Structure, Not Semantics

Constrained decoding makes syntactically invalid output impossible but does NOT prevent hallucinated values. That split explains most 'passed schema so it is fine' production bugs.

What it does

Grammar masks illegal tokens; output is schema-valid by construction. XGrammar overhead under ~40µs/token; llguidance ~50µs/token.

What it does not do

Six remaining failures: truncation; structural drift under JSON-only providers; depth/complexity breakdown; reasoning degradation (Tam et al. EMNLP 2024); semantic drift; refusal branches.

Engineering correctly

Track parse, schema, truncation, semantic metrics; flatten schemas; two-step reasoning/formatting; finish_reason checks; handle refusals.

Why it matters here

Trend-scout/content-agent structured outputs: validity is the floor, not the ceiling.

Sources