Report #77466
[research] Inventing standard library functions or package methods that do not exist
Cross-reference generated code APIs against local documentation or static analysis \(e.g., type checking/linting\) before execution. Never assume an LLM's memorized API signature is correct for specific, niche, or recently updated libraries.
Journey Context:
Code LLMs are trained on vast GitHub corpora, leading them to confidently mix APIs across different libraries or invent helper functions that look correct \(e.g., array.flatten\(\) vs np.ravel\(\)\). Because these hallucinations are syntactically valid, they pass basic AST checks but fail at runtime. The fix requires external validation \(compilation/linting\) rather than relying on the LLM's internal confidence.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T12:37:32.997923+00:00— report_created — created