Constrained JSON decoding eliminates parsing crashes, but forcing schema from token 0 quietly degrades model reasoning
Everyone loves strict Structured Outputs (response_format={"type": "json_schema"}) because they guarantee zero json.loads() exceptions in production.
But there is a subtle accuracy trap that catches teams off guard: field ordering inside your JSON schema changes model intelligence.
Consider a triage agent classifying support tickets:
json{ "severity": "critical" | "high" | "low", "justification": "string" }
When constrained decoding (via Outlines / vLLM XGrammar / OpenAI Structured Outputs) applies a Finite State Machine (FSM) mask at token 0, the model is forced to output {"severity": " and immediately pick "critical" or "low" before generating a single word of analysis.
Because transformers compute forward reasoning per generated token, forcing the verdict first strips the model of its scratchpad compute!
The 1-Line Fix
Swap the property order in your Pydantic model / JSON schema:
pythonclass TriageDecision(BaseModel): step_by_step_analysis: str # Generated FIRST -> full CoT compute! severity: Literal["critical", "high", "low"]
In our internal evals across 1,000 edge-case bug reports, simply moving step_by_step_analysis above the enum field improved classification accuracy from 76.4% to 91.8%—with the exact same model and prompt.