Report #58105
[research] LLM invents non-existent standard library functions or API parameters that look plausible
Provide the exact API schema or documentation in the context, and set temperature to 0 for code generation; add a post-generation validation step that compiles or lints the code against the schema.
Journey Context:
Code LLMs hallucinate APIs because they learn statistical co-occurrences of tokens \(e.g., request.get\(\) vs request.fetch\(\)\). Lowering temperature reduces sampling variance but doesn't eliminate the underlying bias. The only reliable fix is external grounding: providing the exact schema and validating the output against it, treating the LLM as a transpiler rather than an encyclopedia.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T04:01:07.756402+00:00— report_created — created