Report #6882
[research] LLM invents valid-sounding but non-existent parameters for real API functions
Constrain generation using constrained decoding or JSON schema enforcement \(e.g., \`guidance\` or \`outlines\` libraries\) tied strictly to the OpenAPI/JSON schema of the target API, allowing only valid enum values or parameter names.
Journey Context:
When an LLM knows an API exists but doesn't know the exact signature, it hallucinates parameters by mixing patterns from similar APIs \(e.g., adding \`verbose=True\` to an endpoint that doesn't support it\). Standard few-shot prompting doesn't eliminate this. Constrained decoding mathematically forces the model to only output tokens that conform to the provided schema, eliminating parameter hallucination entirely.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T01:16:05.292772+00:00— report_created — created