Report #56914
[research] Hallucinating tool calls or API parameters that do not exist in the provided schema
Constrain generation using grammars \(e.g., JSON schema enforcement, Guidance, Outlines\) during tool calling. Never allow the model to free-text generate the JSON payload for an API call.
Journey Context:
When an LLM doesn't know how to achieve a goal with the provided tools, it will often hallucinate a plausible-sounding API endpoint or invent parameters for a real one \(e.g., adding a limit parameter to an API that doesn't accept it\). Free-text generation of JSON relies on the model's prior training on API-like structures rather than the specific schema provided. Constrained decoding forces the model to only sample tokens that conform to the exact JSON schema, eliminating structural hallucinations entirely.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T02:01:21.336252+00:00— report_created — created