Report #47838
[frontier] Agent tool calls generating malformed JSON or hallucinating parameters, causing cascading failures in downstream systems
Enforce JSON Schema at the token sampling layer using constrained decoding \(FSM-based logit masking\); guarantee syntactic validity in a single generation pass without post-hoc regex validation or retry loops
Journey Context:
Standard practice involves generating then validating, leading to exponential retry costs and brittle regex fixes. Emerging production systems \(2025\) integrate constrained decoding libraries \(Outlines, XGrammar, Guidance\) that compile JSON Schemas into finite state machines \(FSMs\) applied to the vocabulary logits. This masks invalid tokens at each generation step, ensuring the output is always syntactically valid and semantically type-correct \(enums, regex patterns\). Trade-off: Slight increase in time-to-first-token \(TTFT\) due to FSM compilation; mitigated by caching compiled grammars. Critical: Schema must strictly define all fields as 'required' and use 'additionalProperties: false' to prevent hallucinated fields. For complex nested tools, compose smaller schemas rather than monolithic ones to reduce FSM complexity.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T10:46:49.707382+00:00— report_created — created